dtenedor commented on code in PR #47428:
URL: https://github.com/apache/spark/pull/47428#discussion_r1714112687
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -436,14 +436,19 @@ class AstBuilder extends DataTypeAstBuilder
val (relationCtx, options, cols, partition, ifPartitionNotExists,
byName)
= visitInsertIntoTable(table)
withIdentClause(relationCtx, ident => {
- InsertIntoStatement(
+ val insertIntoStatement = InsertIntoStatement(
createUnresolvedRelation(relationCtx, ident, options),
partition,
cols,
query,
overwrite = false,
ifPartitionNotExists,
byName)
+ if (conf.getConf(SQLConf.OPTIMIZE_INSERT_INTO_VALUES_PARSER)) {
+ EvaluateUnresolvedInlineTable.evaluate(insertIntoStatement)
Review Comment:
We brainstormed about this earlier, but realized that doing so would be
invoking an analyzer rule (starting with `Resolve`, and inheriting from the
Catalyst rule classes) directly from the parser. With database management
system implementation, it's a best practice to separate concerns between the
different distinct phases of SQL compilation, including parsing, analysis,
logical optimization, logical to physical planning, and execution binding.
Thus the refactor to call `EvaluateUnresolvedInlineTable.evaluate` instead.
The code does the same steps, it's just now a helper function instead of
calling a Catalyst rule directly from the parser. This is mostly a style thing.
--
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]