-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-48344][SQL] Prepare SQL Scripting for addition of Execution Framework #48879
[SPARK-48344][SQL] Prepare SQL Scripting for addition of Execution Framework #48879
Conversation
...st/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SqlScriptingLogicalPlans.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/SqlScriptingParserSuite.scala
Show resolved
Hide resolved
I'm not sure at which point, but we should introduce two things missing here:
|
|
||
/** | ||
* Trait for all SQL Scripting logical operators that are product of parsing phase. | ||
* These operators will be used by the SQL Scripting interpreter to generate execution nodes. | ||
*/ | ||
sealed trait CompoundPlanStatement | ||
sealed trait CompoundPlanStatement extends LogicalPlan | ||
|
||
/** | ||
* Logical operator representing result of parsing a single SQL statement | ||
* that is supposed to be executed against Spark. | ||
* @param parsedPlan Result of SQL statement parsing. | ||
*/ | ||
case class SingleStatement(parsedPlan: LogicalPlan) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this abstraction? It's only used as the condition in other statements like IfElseStatement
, but seems we can just use LogicalPlan
now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though we can use LogicalPlan
I would keep this abstraction to differ between SQL Scripts and allowed statements there and "normal" statements outside of script. There will be multiple iterations of refactoring so I would do a follow-up to remove this abstraction if it is really not needed.
One place where it is being used is in AbstractSqlParser
-> parsePlan
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future we will also need some kind of abstraction so we know that we should eagerly execute scripts via Spark Connect. So I would keep this for now and discuss this later.
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/SqlScriptingParserSuite.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/SqlScriptingParserSuite.scala
Show resolved
Hide resolved
sql/core/src/test/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreterSuite.scala
Outdated
Show resolved
Hide resolved
thanks, merging to master! |
…s and Local Variables ### What changes were proposed in this pull request? This PR is **third** in series of refactoring and introducing SQL Scripting Execution Framework: - Introducing `SqlScriptingExecutionContext`, object to keep current state of script execution. - Introducing `Frames` and `Scopes` to support Local Variables and Error Handlers resolution. - Decoupled `SqlScriptingIterator` from `SqlScriptExecution`. - Enabling execution of SQL Scripting using `sql()` API. - Updated `SqlScriptingExecutionNodeSuite` so tests remain independent of concept of Frames and Scopes. First [PR](#48879) Second [PR](#48950) ### Why are the changes needed? This changes are needed to enable introduction of Error Handling mechanism and Local Variables. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing tests that were updated to support new concepts introduced in this PR. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #49006 from miland-db/milan-dankovic_data/refactor-execution-3. Lead-authored-by: Milan Dankovic <[email protected]> Co-authored-by: David Milicevic <[email protected]> Signed-off-by: Max Gekk <[email protected]>
…s and Local Variables ### What changes were proposed in this pull request? This PR is **third** in series of refactoring and introducing SQL Scripting Execution Framework: - Introducing `SqlScriptingExecutionContext`, object to keep current state of script execution. - Introducing `Frames` and `Scopes` to support Local Variables and Error Handlers resolution. - Decoupled `SqlScriptingIterator` from `SqlScriptExecution`. - Enabling execution of SQL Scripting using `sql()` API. - Updated `SqlScriptingExecutionNodeSuite` so tests remain independent of concept of Frames and Scopes. First [PR](apache#48879) Second [PR](apache#48950) ### Why are the changes needed? This changes are needed to enable introduction of Error Handling mechanism and Local Variables. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing tests that were updated to support new concepts introduced in this PR. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#49006 from miland-db/milan-dankovic_data/refactor-execution-3. Lead-authored-by: Milan Dankovic <[email protected]> Co-authored-by: David Milicevic <[email protected]> Signed-off-by: Max Gekk <[email protected]>
What changes were proposed in this pull request?
This PR is Initial refactoring of SQL Scripting to prepare it for addition of Execution Framework:
SqlScriptingLogicalOperators
toSqlScriptingLogicalPlans
.CompoundNestedStatementIteratorExec
because it is unnecessary abstraction.parseScript
because it is no more needed. Parsing is done inparsePlan
method.Why are the changes needed?
This changes are needed so execution of SQL Scripts can be implemented properly.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing tests.
Was this patch authored or co-authored using generative AI tooling?
No.