Skip to content

Conversation

@cloud-fan
Copy link
Contributor

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 DEFAULT name, 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

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"
Copy link
Contributor Author

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"
Copy link
Contributor Author

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 =
Copy link
Contributor Author

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 =
Copy link
Contributor Author

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

@dongjoon-hyun
Copy link
Member

Could you re-trigger the failed SQL pipeline?

@dongjoon-hyun
Copy link
Member

Merged to master. Thank you, @cloud-fan and @gengliangwang .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants