-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-58966][SQL] Resolve SQL variables in UPDATE and MERGE INTO conditions #58244
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,7 +67,8 @@ class ResolveReferencesInUpdate(val catalogManager: CatalogManager) | |
|
|
||
| val newUpdate = u.copy( | ||
| assignments = newAssignments, | ||
| condition = u.condition.map(resolveExpressionByPlanChildren(_, u))) | ||
| condition = u.condition.map( | ||
| resolveExpressionByPlanChildren(_, u, includeLastResort = true))) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-blocking: Update the class Scaladoc with this condition path. It currently presents a complete three-step |
||
| newUpdate.copyTagsFrom(u) | ||
| newUpdate | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,6 +127,15 @@ abstract class RowLevelOperationSuiteBase | |
| catalog.createTable(ident, tableInfo) | ||
| } | ||
|
|
||
| /** Declares a session variable for the duration of `f`, dropping it afterwards. */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-blocking: Make this helper reject or preserve an existing same-named variable. |
||
| protected def withSessionVariable( | ||
| name: String, | ||
| dataType: String, | ||
| default: String)(f: => Unit): Unit = { | ||
| sql(s"DECLARE OR REPLACE VARIABLE $name $dataType DEFAULT $default") | ||
| try f finally sql(s"DROP TEMPORARY VARIABLE IF EXISTS $name") | ||
| } | ||
|
|
||
| protected def createAndInitTable(schemaString: String, jsonData: String): Unit = { | ||
| createTable(schemaString) | ||
| append(schemaString, jsonData) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.