gengliangwang commented on code in PR #36398:
URL: https://github.com/apache/spark/pull/36398#discussion_r861555510
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveDefaultColumns.scala:
##########
@@ -183,25 +192,24 @@ case class ResolveDefaultColumns(
// If necessary, return a more descriptive error message if the user tries
to nest the DEFAULT
// column reference inside some other expression, such as DEFAULT + 1
(this is not allowed).
//
- // Note that we don't need to check if
"SQLConf.get.useNullsForMissingDefaultColumnValues"
- // after this point because this method only takes responsibility to
replace *existing*
- // DEFAULT references. In contrast, the "getDefaultExpressions" method
will check that config
+ // Note that we don't need to check if
"SQLConf.get.useNullsForMissingDefaultColumnValues" after
+ // this point because this method only takes responsibility to replace
*existing* DEFAULT
+ // references. In contrast, the "getDefaultExpressionsForInsert" method
will check that config
// and add new NULLs if needed.
input match {
case table: UnresolvedInlineTable =>
- replaceExplicitDefaultColumnValues(defaultExpressions, table)
+ replaceExplicitDefaultValuesForInlineTable(defaultExpressions, table)
case project: Project =>
- replaceExplicitDefaultColumnValues(defaultExpressions, columnNames,
project)
+ replaceExplicitDefaultValuesForProject(defaultExpressions,
columnNames, project)
}
}
/**
* Replaces unresolved DEFAULT column references with corresponding values
in an inline table.
*/
- private def replaceExplicitDefaultColumnValues(
- defaultExpressions: Seq[Expression],
- table: UnresolvedInlineTable): Option[LogicalPlan] = {
- var replaced = false
Review Comment:
I prefer the local variable approach in the current code. Sharing a global
variable doesn't seem to be a good idea.
--
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]