spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao Li (Jira)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-29591) Support data insertion in a different order if you wish or even omit some columns in spark sql also like postgresql
Date Sun, 01 Dec 2019 22:14:00 GMT

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

Xiao Li commented on SPARK-29591:
---------------------------------

Ignoring the values is hard to support now since we need to define the default values when
creating the schema.

 

However, it is not hard to support different orders. We only need to update the parser like
what we did for MERGE/UPSERT statements. cc [~maropu] [~cloud_fan]

> Support data insertion in a different order if you wish or even omit some columns in
spark sql also like postgresql
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-29591
>                 URL: https://issues.apache.org/jira/browse/SPARK-29591
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 2.4.4
>            Reporter: jobit mathew
>            Priority: Major
>
> Support data insertion in a different order if you wish or even omit some columns in
spark sql also like postgre sql.
> *In postgre sql*
> CREATE TABLE weather (
>  city varchar(80),
>  temp_lo int, – low temperature
>  temp_hi int, – high temperature
>  prcp real, – precipitation
>  date date
>  );
> *You can list the columns in a different order if you wish or even omit some columns,*
> INSERT INTO weather (date, city, temp_hi, temp_lo)
>  VALUES ('1994-11-29', 'Hayward', 54, 37);
> *Spark SQL*
> But in spark sql is not allowing to insert data in different order or omit any column.Better
to support this as it can save time if we can not predict any specific column value or if
some value is fixed always.
> create table jobit(id int,name string);
> > insert into jobit values(1,"Ankit");
>  Time taken: 0.548 seconds
>  spark-sql> *insert into jobit (id) values(1);*
>  *Error in query:*
>  mismatched input 'id' expecting \{'(', 'SELECT', 'FROM', 'VALUES', 'TABLE', 'INSERT',
'MAP', 'REDUCE'}(line 1, pos 19)
> == SQL ==
>  insert into jobit (id) values(1)
>  -------------------^^^
> spark-sql> *insert into jobit (name,id) values("Ankit",1);*
>  *Error in query:*
>  mismatched input 'name' expecting \{'(', 'SELECT', 'FROM', 'VALUES', 'TABLE', 'INSERT',
'MAP', 'REDUCE'}(line 1, pos 19)
> == SQL ==
>  insert into jobit (name,id) values("Ankit",1)
>  -------------------^^^
> spark-sql>
>  



--
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


Mime
View raw message