You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (JIRA)" <ji...@apache.org> on 2019/08/12 07:24:00 UTC

[jira] [Resolved] (SPARK-28674) Spark should support select into from
where as PostgreSQL supports
     [ https://issues.apache.org/jira/browse/SPARK-28674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hyukjin Kwon resolved SPARK-28674.
----------------------------------
    Resolution: Duplicate

> Spark should support select <columnname> into <table> from <table> where <condition> as PostgreSQL supports 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-28674
>                 URL: https://issues.apache.org/jira/browse/SPARK-28674
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 2.4.0
>            Reporter: ABHISHEK KUMAR GUPTA
>            Priority: Major
>
> Spark should support {{select <columnname> into <table> from <table> where <condition>}} as PostgreSQL supports 
> {code}
> create table dup(id int);
> insert into dup values(1);
> insert into dup values(2);
> select id into test_dup from dup where id=1;
> select * from test_dup;
> {code}
> *Result: Success in PostgreSQL*
> But select id into test_dup from dup where id=1; in Spark gives ParseException
> {code}
> scala> sql("show tables").show();
> +--------+---------+-----------+
> |database|tableName|isTemporary|
> +--------+---------+-----------+
> |    func|      dup|      false|
> +--------+---------+-----------+
> {code}
> {code}
> scala> sql("select id into test_dup from dup where id=1").show()
> org.apache.spark.sql.catalyst.parser.ParseException:
> mismatched input 'test_dup' expecting <EOF>(line 1, pos 15)
> == SQL ==
> select id into test_dup from dup where id=1
> ---------------^^^
>   at org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:241)
>   at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:117)
>   at org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:48)
>   at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:69)
>   at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:642)
>   ... 49 elided
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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