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

   `IcebergSparkSqlExtensionsParser` does not forward two `ParserInterface` 
methods to the parser it wraps. 
   1. `parseRoutineParam` throws `UnsupportedOperationException`, so function 
creation with parameters fails whenever the extension is registered. 
   2. `parseQuery` calls `parsePlan`, so text that is not a query is accepted.
   
   From my investigation,  both lines were stubs added to satisfy the 
interface, in [#5094](https://github.com/apache/iceberg/pull/5094) for Spark 
3.3 and [#13022](https://github.com/apache/iceberg/pull/13022) for Spark 4.0. 
These workarounds are not be necessary anymore.
   
   Repro on Spark 4.2  with the Iceberg runtime jar built from `main`:
   
   ```sql
   spark-sql (default)> CREATE FUNCTION f(a INT) RETURNS INT RETURN a;
   26/10/28 23:34:27 ERROR SparkSQLDriver: Failed in [CREATE FUNCTION f(a INT) 
RETURNS INT RETURN a]
   java.lang.UnsupportedOperationException
           at 
org.apache.spark.sql.catalyst.parser.extensions.IcebergSparkSqlExtensionsParser.parseRoutineParam(IcebergSparkSqlExtensionsParser.scala:114)
           at 
org.apache.spark.sql.catalyst.catalog.UserDefinedFunction$.parseRoutineParam(UserDefinedFunction.scala:92)
           at 
org.apache.spark.sql.execution.command.CreateSQLFunctionCommand.$anonfun$run$1(CreateSQLFunctionCommand.scala:77)
           at scala.Option.map(Option.scala:242)
           at 
org.apache.spark.sql.execution.command.CreateSQLFunctionCommand.run(CreateSQLFunctionCommand.scala:77)
           at 
org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:79)
           at 
org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:77)
           at 
org.apache.spark.sql.execution.command.ExecutedCommandExec.executeCollect(commands.scala:88)
           at 
org.apache.spark.sql.execution.QueryExecution$.$anonfun$runCommand$2(QueryExecution.scala:973)
           at 
org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId0$8(SQLExecution.scala:228
   ```
   
   
   Test plan: Make `parseQueryRejectsNonQuery` and 
`createSqlFunctionWithParameters` in `TestExtendedParser` fail before fixing 
this delegation change.
   
   ---
   **AI Disclosure**
   - Model: Claude Sonnet 5.5
   - Platform/Tool: Claude Code
   - Human Oversight: fully reviewed by me
   - Prompt Summary: Investigate and fix the extension parser not forwarding 
`parseRoutineParam` and `parseQuery`.
   


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