j1wonpark opened a new pull request, #16626:
URL: https://github.com/apache/iceberg/pull/16626

   Closes #16625.
   
   ## Root cause
   
   Spark 4.1 routes parameterized queries through 
`ParserInterface.parsePlanWithParameters(sqlText, parameterContext)` 
(SPARK-53573). The trait's default implementation ignores the 
`ParameterContext` and falls back to `parsePlan`. 
`IcebergSparkSqlExtensionsParser` overrides `parsePlan` but not 
`parsePlanWithParameters`, so with the extensions installed the context is 
dropped and parameter markers are never bound. Only 4.1 is affected — the 
method and `ParameterContext` are new in 4.1; 3.5 and 4.0 bind parameters 
post-parse.
   
   ## Fix
   
   Override `parsePlanWithParameters` to mirror `parsePlan`: Iceberg commands 
keep the existing path, everything else delegates to the wrapped Spark parser 
with the `ParameterContext` intact.
   
   ## Testing
   
   Added regression tests in `TestExtendedParser` (all fail without the fix, 
pass with it):
   - `testParsePlanWithParametersDelegatesForNonIcebergSql` — non-Iceberg SQL 
delegates with the context preserved.
   - `testParsePlanWithParametersBindsPositionalParameter` — `SELECT ? AS id` 
binds end-to-end.
   - `testParsePlanWithParametersBindsNamedParameter` — `SELECT :id AS id` 
binds end-to-end.
   
   `spotlessCheck`, `scalastyle*Check`, and `checkstyle*` all pass.
   


-- 
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]

Reply via email to