-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-43742][SQL][FOLLOWUP] Do not use null literal as default value for non-nullable columns #41656
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
Conversation
| val sql5 = s"UPDATE $tblName SET name=DEFAULT, age=DEFAULT" | ||
| // Note: 'i' and 's' are the names of the columns in 'tblName'. | ||
| val sql6 = s"UPDATE $tblName SET i=DEFAULT, s=DEFAULT" | ||
| val sql7 = s"UPDATE testcat.defaultvalues SET i=DEFAULT, s=DEFAULT" |
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.
move the tests out of the loop as the table name does not change.
| start = 62, | ||
| stop = 68)) | ||
|
|
||
| val sql7 = "UPDATE testcat.tab2 SET x=DEFAULT" |
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.
this is the new test
| // DEFAULT column reference in the merge condition: | ||
| // This MERGE INTO command includes an ON clause with a DEFAULT column reference. This | ||
| // DEFAULT column won't be resolved. | ||
| val mergeWithDefaultReferenceInMergeCondition = |
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.
ditto, move tests out of the loop
| errorClass = "_LEGACY_ERROR_TEMP_1343", | ||
| parameters = Map.empty) | ||
|
|
||
| val mergeWithDefaultReferenceForNonNullableCol = |
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.
this is the new test
Co-authored-by: Gengliang Wang <[email protected]>
|
Could you re-trigger the failed SQL pipeline? |
|
Merged to master. Thank you, @cloud-fan and @gengliangwang . |
What changes were proposed in this pull request?
A followup of #41262 to fix a mistake. If a column has no default value and is not nullable, we should fail if people want to use its default value via the explicit
DEFAULTname, and do not fill missing columns in INSERT.Why are the changes needed?
fix a wrong behavior
Does this PR introduce any user-facing change?
yes, otherwise the DML command will fail later at runtime.
How was this patch tested?
new tests