dtenedor commented on code in PR #36445:
URL: https://github.com/apache/spark/pull/36445#discussion_r870626313
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveDefaultColumns.scala:
##########
@@ -164,13 +166,74 @@ case class ResolveDefaultColumns(
// For each assignment in the UPDATE command's SET clause with a DEFAULT
column reference on
// the right-hand side, look up the corresponding expression from the
above map.
val newAssignments: Option[Seq[Assignment]] =
- replaceExplicitDefaultValuesForUpdateAssignments(u.assignments,
columnNamesToExpressions)
+ replaceExplicitDefaultValuesForUpdateAssignments(
+ u.assignments, CommandType.Update, columnNamesToExpressions)
newAssignments.map { n =>
u.copy(assignments = n)
}.getOrElse(u)
}.getOrElse(u)
}
+ /**
+ * Resolves DEFAULT column references for a MERGE INTO command.
+ */
+ private def resolveDefaultColumnsForMerge(m: MergeIntoTable): LogicalPlan = {
+ val schema: StructType =
getSchemaForTargetTable(m.targetTable).getOrElse(return m)
+ // Return a more descriptive error message if the user tries to use a
DEFAULT column reference
+ // inside an UPDATE command's WHERE clause; this is not allowed.
+ m.mergeCondition.map { c: Expression =>
Review Comment:
Thanks, that's clearer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]