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

Julian Hyde commented on CALCITE-4455:
--------------------------------------

[~jiajunbernoulli], No worries at all about the late reply. Apache's process is 
designed for asynchronous work, and we especially want to encourage people who 
are working on their own time.

The updated description is much better - thank you.

I still think that "SqlInsertOverwriteTable" is a confusing class name. And in 
fact I wonder whether a subclass of SqlInsert is the way to go. How do you feel 
about adding an extra option to SqlInsert, called "overwrite" whose allowable 
values are null, or calls representing "table" or "directory"?

You would need to take some care to preserve compatibility with existing uses 
of the {{SqlInsert}} constructor, but people would be able to treat {{INSERT 
OVERWRITE}} the same way as {{INSERT}} and {{UPSERT}} in the validation and 
translation process.

> 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