You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Uroš Bojanić (Jira)" <ji...@apache.org> on 2026/08/21 07:42:00 UTC

[jira] [Created] (SPARK-58931) Reject negative randstr length during analysis

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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org