Uroš Bojanić created SPARK-58931:
------------------------------------

             Summary: Reject negative randstr length during analysis
                 Key: SPARK-58931
                 URL: https://issues.apache.org/jira/browse/SPARK-58931
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Uroš Bojanić


`randstr(length[, seed])` requires a non-negative `length`, but that guard 
currently lives only on the execution paths (`RandStr.lengthInteger()`, called 
from interpreted eval and codegen), so a negative constant `length` is not 
rejected until the query executes.

This moves the check into `RandStr.checkInputDataTypes()` so it is enforced 
during Catalyst analysis, reusing the existing `INVALID_PARAMETER_VALUE.LENGTH` 
error. As a result, `randstr` with a negative constant `length` now fails 
during analysis instead of at execution. The error itself is unchanged (same 
`SparkRuntimeException` and error class); only the phase at which it is raised 
changes. Queries with a valid (non-negative) `length` are unaffected.




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