[jira] [Commented] (SPARK-29650) Discard a NULL constant in LIMIT
[ https://issues.apache.org/jira/browse/SPARK-29650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16985701#comment-16985701 ] Xiao Li commented on SPARK-29650: - Let us first close this JIRA. If needed, we can open a separate Jira for supporting expressions in the LIMIT clause. > Discard a NULL constant in LIMIT > > > Key: SPARK-29650 > URL: https://issues.apache.org/jira/browse/SPARK-29650 > Project: Spark > Issue Type: Sub-task > Components: SQL >Affects Versions: 3.0.0 >Reporter: Takeshi Yamamuro >Priority: Major > > In PostgreSQL, a NULL constant is accepted in LIMIT and its just ignored. > But, in spark, it throws an exception below; > {code:java} > select * from int8_tbl limit (case when random() < 0.5 then bigint(null) end); > org.apache.spark.sql.AnalysisException > The limit expression must evaluate to a constant value, but got CASE WHEN > (`_nondeterministic` < CAST(0.5BD AS DOUBLE)) THEN CAST(NULL AS BIGINT) END; > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-29650) Discard a NULL constant in LIMIT
[ https://issues.apache.org/jira/browse/SPARK-29650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16967486#comment-16967486 ] Takeshi Yamamuro commented on SPARK-29650: -- I think we need to study the behaviour of LIMIT in the other DBMSs like mysql and oracle first. I'm not sure that they have the same behaviour. > Discard a NULL constant in LIMIT > > > Key: SPARK-29650 > URL: https://issues.apache.org/jira/browse/SPARK-29650 > Project: Spark > Issue Type: Sub-task > Components: SQL >Affects Versions: 3.0.0 >Reporter: Takeshi Yamamuro >Priority: Major > > In PostgreSQL, a NULL constant is accepted in LIMIT and its just ignored. > But, in spark, it throws an exception below; > {code:java} > select * from int8_tbl limit (case when random() < 0.5 then bigint(null) end); > org.apache.spark.sql.AnalysisException > The limit expression must evaluate to a constant value, but got CASE WHEN > (`_nondeterministic` < CAST(0.5BD AS DOUBLE)) THEN CAST(NULL AS BIGINT) END; > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-29650) Discard a NULL constant in LIMIT
[ https://issues.apache.org/jira/browse/SPARK-29650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16967254#comment-16967254 ] Aman Omer commented on SPARK-29650: --- cc [~maropu] > Discard a NULL constant in LIMIT > > > Key: SPARK-29650 > URL: https://issues.apache.org/jira/browse/SPARK-29650 > Project: Spark > Issue Type: Sub-task > Components: SQL >Affects Versions: 3.0.0 >Reporter: Takeshi Yamamuro >Priority: Major > > In PostgreSQL, a NULL constant is accepted in LIMIT and its just ignored. > But, in spark, it throws an exception below; > {code:java} > select * from int8_tbl limit (case when random() < 0.5 then bigint(null) end); > org.apache.spark.sql.AnalysisException > The limit expression must evaluate to a constant value, but got CASE WHEN > (`_nondeterministic` < CAST(0.5BD AS DOUBLE)) THEN CAST(NULL AS BIGINT) END; > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-29650) Discard a NULL constant in LIMIT
[ https://issues.apache.org/jira/browse/SPARK-29650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16963686#comment-16963686 ] Aman Omer commented on SPARK-29650: --- {code:java} select * from TName limit(int(1));{code} Successful. {code:java} select * from str limit(int(null));{code} Failed with error "_The evaluated limit expression must not be null, but got CAST(NULL AS INT)";_ > Discard a NULL constant in LIMIT > > > Key: SPARK-29650 > URL: https://issues.apache.org/jira/browse/SPARK-29650 > Project: Spark > Issue Type: Sub-task > Components: SQL >Affects Versions: 3.0.0 >Reporter: Takeshi Yamamuro >Priority: Major > > In PostgreSQL, a NULL constant is accepted in LIMIT and its just ignored. > But, in spark, it throws an exception below; > {code:java} > select * from int8_tbl limit (case when random() < 0.5 then bigint(null) end); > org.apache.spark.sql.AnalysisException > The limit expression must evaluate to a constant value, but got CASE WHEN > (`_nondeterministic` < CAST(0.5BD AS DOUBLE)) THEN CAST(NULL AS BIGINT) END; > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-29650) Discard a NULL constant in LIMIT
[ https://issues.apache.org/jira/browse/SPARK-29650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16963683#comment-16963683 ] Aman Omer commented on SPARK-29650: --- {code:java} select * from TName limit (case when random() < 0.5 then 1 else 2 end); select * from TName limit (case when 1 < 0 then 1 else 2 end){code} Even above queries are throwing same error. I think limit function does not support _case..when..then_ expression. In following case, _null_ is ignored and output is all rows of table. {code:java} select * from TName limit (null);{code} > Discard a NULL constant in LIMIT > > > Key: SPARK-29650 > URL: https://issues.apache.org/jira/browse/SPARK-29650 > Project: Spark > Issue Type: Sub-task > Components: SQL >Affects Versions: 3.0.0 >Reporter: Takeshi Yamamuro >Priority: Major > > In PostgreSQL, a NULL constant is accepted in LIMIT and its just ignored. > But, in spark, it throws an exception below; > {code:java} > select * from int8_tbl limit (case when random() < 0.5 then bigint(null) end); > org.apache.spark.sql.AnalysisException > The limit expression must evaluate to a constant value, but got CASE WHEN > (`_nondeterministic` < CAST(0.5BD AS DOUBLE)) THEN CAST(NULL AS BIGINT) END; > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-29650) Discard a NULL constant in LIMIT
[ https://issues.apache.org/jira/browse/SPARK-29650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16963677#comment-16963677 ] Aman Omer commented on SPARK-29650: --- Analyzing this one. > Discard a NULL constant in LIMIT > > > Key: SPARK-29650 > URL: https://issues.apache.org/jira/browse/SPARK-29650 > Project: Spark > Issue Type: Sub-task > Components: SQL >Affects Versions: 3.0.0 >Reporter: Takeshi Yamamuro >Priority: Major > > In PostgreSQL, a NULL constant is accepted in LIMIT and its just ignored. > But, in spark, it throws an exception below; > {code:java} > select * from int8_tbl limit (case when random() < 0.5 then bigint(null) end); > org.apache.spark.sql.AnalysisException > The limit expression must evaluate to a constant value, but got CASE WHEN > (`_nondeterministic` < CAST(0.5BD AS DOUBLE)) THEN CAST(NULL AS BIGINT) END; > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org