Anurag Mantripragada created SPARK-59977:
--------------------------------------------

             Summary: Raise a parse error for a parameter marker in a partition 
or ordering transform
                 Key: SPARK-59977
                 URL: https://issues.apache.org/jira/browse/SPARK-59977
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Anurag Mantripragada


In AstBuilder, the `constant` alternative of `transformArgument` also matches a 
parameter marker, but visitTransformArgument assumes a Literal and calls 
`lit.value`. Without parameter args, `spark.sql("CREATE TABLE cat.t (id INT) 
USING foo PARTITIONED BY (bucket(?, id))")` skips parameter substitution, 
visitPosParameterLiteral returns a PosParameter, and parsing fails with a raw 
ClassCastException (PosParameter cannot be cast to Literal) instead of 
UNBOUND_SQL_PARAMETER or a parse error. Since SPARK-34586 
(https://github.com/apache/spark/pull/58153) the same happens for ORDERED BY 
bucket(?, id) in CREATE/REPLACE TABLE.

visitTransformArgument should raise a proper parse error when the visited 
constant is not a Literal.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to