[ https://issues.apache.org/jira/browse/CALCITE-4455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17632672#comment-17632672 ]
Jiajun Xie commented on CALCITE-4455: ------------------------------------- I used `SqlKind.OTHER_DML` to validate INSERT OVERWRITE and renamed "SqlInsertOverwriteTable" to "SqlInsertOverwriteTbl". Notes: `SqlKind.OTHER_DML` is as useful as `SqlKind.OTHER_DDL`. Here is some DML statements that calcite not support. * TRUNCATE TABLE([BigQuery DML|https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax]) * SELECT … INTO …([SqlServer DML|https://learn.microsoft.com/en-us/sql/t-sql/queries/select-into-clause-transact-sql?view=sql-server-ver16]) TRUNCATE TABLE statement is not difficult to implement, I plan to implement it when I am free. > 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)