[
https://issues.apache.org/jira/browse/SPARK-58931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18106524#comment-18106524
]
Uroš Bojanić commented on SPARK-58931:
--------------------------------------
In progress: https://github.com/apache/spark/pull/58200.
> 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: 4.4.0
> Reporter: Uroš Bojanić
> Priority: Major
> Labels: pull-request-available
>
> `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]