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 08:03:00 UTC
[jira] [Commented] (SPARK-58931) Reject negative randstr length during analysis
[ 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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org