j1wonpark commented on code in PR #16626:
URL: https://github.com/apache/iceberg/pull/16626#discussion_r3359898485
##########
spark/v4.1/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/parser/extensions/IcebergSparkSqlExtensionsParser.scala:
##########
@@ -125,6 +126,24 @@ class IcebergSparkSqlExtensionsParser(delegate:
ParserInterface)
}
}
+ /**
+ * Parse a string to a LogicalPlan, binding the given parameters.
+ */
+ override def parsePlanWithParameters(
Review Comment:
Good call — extracted the shared skeleton into a private
`parsePlanWithDelegate(sqlText)(delegateParse)` helper in 74675ed89, so
`parsePlan` and `parsePlanWithParameters` now only supply their delegate call
and can no longer drift. spotless/scalastyle and all `TestExtendedParser` cases
still pass.
##########
spark/v4.1/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/parser/extensions/IcebergSparkSqlExtensionsParser.scala:
##########
@@ -125,6 +126,24 @@ class IcebergSparkSqlExtensionsParser(delegate:
ParserInterface)
}
}
+ /**
+ * Parse a string to a LogicalPlan, binding the given parameters.
+ */
+ override def parsePlanWithParameters(
+ sqlText: String,
+ parameterContext: ParameterContext): LogicalPlan = {
+ val sqlTextAfterSubstitution = substitutor.substitute(sqlText)
+ if (isIcebergCommand(sqlTextAfterSubstitution)) {
+ // Iceberg DDL grammars do not accept parameter markers (`?` / `:name`),
so the
Review Comment:
Agreed this is a nice hardening. Since the Iceberg grammar has no parameter
markers, a non-empty `parameterContext` reaching this path would indicate a
caller bug, so failing fast beats silently dropping it. To keep this PR scoped
to the binding fix I've split it out into a follow-up: #16683.
--
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]