You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "jobit mathew (Jira)" <ji...@apache.org> on 2019/11/06 12:38:00 UTC

[jira] [Commented] (SPARK-28296) Improved VALUES support

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

jobit mathew commented on SPARK-28296:
--------------------------------------

[~petertoth] there are some more valid commands supporting in postgresql, but which are not supporting in spark sql.

 

VALUES (1, 'one'), (2, 'two'), (3, 'three') FETCH FIRST 3 rows only;

VALUES (1, 'one'), (2, 'two'), (3, 'three') OFFSET 1 row;
 
||  ||column1||column2||
|1|1|one|
|2|2|two|
|3|3|three|
 
||  ||column1||column2||
|1|2|two|
|2|3|three|

but same in spark-sql

 

spark-sql> VALUES (1, 'one'), (2, 'two'), (3, 'three') FETCH FIRST 3 rows only;
Error in query:
mismatched input 'FIRST' expecting <EOF>(line 1, pos 50)

== SQL ==
VALUES (1, 'one'), (2, 'two'), (3, 'three') FETCH FIRST 3 rows only
--------------------------------------------------^^^

spark-sql> VALUES (1, 'one'), (2, 'two'), (3, 'three') OFFSET 1 row;
Error in query:
mismatched input '1' expecting <EOF>(line 1, pos 51)

== SQL ==
VALUES (1, 'one'), (2, 'two'), (3, 'three') OFFSET 1 row
---------------------------------------------------^^^

spark-sql>

 

> Improved VALUES support
> -----------------------
>
>                 Key: SPARK-28296
>                 URL: https://issues.apache.org/jira/browse/SPARK-28296
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Peter Toth
>            Priority: Major
>
> These are valid queries in PostgreSQL, but they don't work in Spark SQL:
> {noformat}
> values ((select 1));
> values ((select c from test1));
> select (values(c)) from test10;
> with cte(foo) as ( values(42) ) values((select foo from cte));
> {noformat}
> where test1 and test10:
> {noformat}
> CREATE TABLE test1 (c INTEGER);
> INSERT INTO test1 VALUES(1);
> CREATE TABLE test10 (c INTEGER);
> INSERT INTO test10 SELECT generate_sequence(1, 10);
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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