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

Jiajun Xie commented on CALCITE-4455:
-------------------------------------

Would anyone review it?

https://github.com/apache/calcite/pull/2949/files

> Babel parser support Spark INSERT OVERWRITE TABLE/DIRECTORY statement
> ---------------------------------------------------------------------
>
>                 Key: CALCITE-4455
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4455
>             Project: Calcite
>          Issue Type: Sub-task
>          Components: spark
>            Reporter: shradha
>            Assignee: Jiajun Xie
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Spark has [INSERT OVERWRITE TABLE 
> statement|https://spark.apache.org/docs/3.1.2/sql-ref-syntax-dml-insert-overwrite-table.html]
>  and [INSERT OVERWRITE DIRECTORY 
> statement|https://spark.apache.org/docs/3.1.2/sql-ref-syntax-dml-insert-overwrite-directory.html].
>  
> We can support part of their grammar, here is syntax that babel parser used:
>  - INSERT OVERWRITE TABLE
>  -- Syntax
> {code:java}
> INSERT OVERWRITE TABLE table_identifier [ partition_spec [ IF NOT EXISTS ] ] 
> [ ( column_list ) ]
> { VALUES ( { value | NULL } [ , ... ] ) [ , ( ... ) ] | query }  {code}
> -- Example
> {code:java}
> -- Insert Using a SELECT Statement
> INSERT OVERWRITE TABLE students PARTITION (student_id = 222222)
> SELECT name, address FROM persons WHERE name = "Dora Williams";
> -- Insert Using a SELECT Statement with column list and omit partition
> INSERT OVERWRITE TABLE target (c1) SELECT * FROM source 
> -- Insert Using a VALUES Clause
> INSERT OVERWRITE TABLE students
> VALUES ('Ashua Hill', '456 Erica Ct, Cupertino', 111111),
>        ('Brian Reed', '723 Kern Ave, Palo Alto', 222222);  {code}
>  - INSERT OVERWRITE DIRECTORY
>  -- Syntax
> {code:java}
> INSERT OVERWRITE [ LOCAL ] DIRECTORY directory_path
> USING file_format [ OPTIONS ( key = val [ , ... ] ) ]
> { VALUES ( { value | NULL } [ , ... ] ) [ , ( ... ) ] | query }{code}
> -- Example
> {code:java}
> INSERT OVERWRITE DIRECTORY '/tmp/destination'
> USING parquet
> OPTIONS (col1=1, col2=2, col3='test')
> SELECT * FROM test_table;
> -- omit options
> INSERT OVERWRITE DIRECTORY '/tmp/destination' 
> USING parquet 
> SELECT * FROM test_table;{code}



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

Reply via email to