[ 
https://issues.apache.org/jira/browse/SPARK-40208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17584351#comment-17584351
 ] 

Serge Rielau commented on SPARK-40208:
--------------------------------------

[~maxgekk] (FYI)
Also (I'm sure LIMIT is the same, maybe fix in one fell swoop?)

spark-sql> SELECT name, age FROM person ORDER BY name OFFSET -1;

Error in query: The offset expression must be equal to or greater than 0, but 
got -1;

Offset -1

+- Sort [name#185 ASC NULLS FIRST], true

   +- Project [name#185, age#186]

      +- SubqueryAlias person

         +- View (`person`, [name#185,age#186])

            +- Project [cast(col1#187 as string) AS name#185, cast(col2#188 as 
int) AS age#186]

               +- LocalRelation [col1#187, col2#188]

> New OFFSET clause does not use new error framework 
> ---------------------------------------------------
>
>                 Key: SPARK-40208
>                 URL: https://issues.apache.org/jira/browse/SPARK-40208
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 3.4.0
>            Reporter: Serge Rielau
>            Priority: Minor
>
> CREATE TEMP VIEW person (name, age)
> AS VALUES ('Zen Hui', 25),
> ('Anil B' , 18),
> ('Shone S', 16),
> ('Mike A' , 25),
> ('John A' , 18),
> ('Jack N' , 16);
> SELECT name, age FROM person ORDER BY name OFFSET length(name);
> Error in query: The offset expression must evaluate to a constant value, but 
> got length(person.name);
> Offset length(name#181)
> +- Sort [name#181 ASC NULLS FIRST], true
>    +- Project [name#181, age#182]
>       +- SubqueryAlias person
>          +- View (`person`, [name#181,age#182])
>             +- Project [cast(col1#183 as string) AS name#181, cast(col2#184 
> as int) AS age#182]
>                +- LocalRelation [col1#183, col2#184|#183, col2#184]
>  
> Returning the plan here is quite pointless as well. The context would be more 
> interesting.
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to