[ https://issues.apache.org/jira/browse/CALCITE-5688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17720280#comment-17720280 ]
Jiajun Xie edited comment on CALCITE-5688 at 5/7/23 6:08 AM: ------------------------------------------------------------- >From your PR, core parser support rather than babel parser. We should change JIRA title and commit message. Here is truncate syntax in SQL2011: {code:java} <truncate table statement> ::= TRUNCATE TABLE <target table> [ <identity column restart option> ] <identity column restart option> ::= CONTINUE IDENTITY | RESTART IDENTITY{code} [PostgreSQL|https://www.postgresql.org/docs/current/sql-truncate.html] Similar to it. {code:java} TRUNCATE [ TABLE ] [ ONLY ] name [ * ] [, ... ] [ RESTART IDENTITY | CONTINUE IDENTITY ] [ CASCADE | RESTRICT ] {code} [Oracle|https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/TRUNCATE-TABLE.html#GUID-B76E5846-75B5-4876-98EC-439E15E4D8A4] more complicated. {code:java} TRUNCATE TABLE [schema.] table [ {PRESERVE | PURGE} MATERIALIZED VIEW LOG ] [ {DROP [ ALL ] | REUSE} STORAGE ] [ CASCADE ] ; {code} [SQL Server|https://learn.microsoft.com/en-us/sql/t-sql/statements/truncate-table-transact-sql?view=sql-server-ver16] allow partitions. {code:java} TRUNCATE TABLE { database_name.schema_name.table_name | schema_name.table_name | table_name } [ WITH ( PARTITIONS ( { <partition_number_expression> | <range> } [ , ...n ] ) ) ] [ ; ] <range> ::= <partition_number_expression> TO <partition_number_expression> {code} [Hive|https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-TruncateTable] also allow partitions. {code:java} TRUNCATE [TABLE] table_name [PARTITION partition_spec]; partition_spec: : (partition_column = partition_col_value, partition_column = partition_col_value, ...) {code} I suggest we add ` CONTINUE IDENTITY` and `RESTART IDENTITY`, core parser should follow standard SQL as much as possible. was (Author: jiajunbernoulli): >From your PR, core parser support rather than babel parser. We should change JIRA title and commit message. Here is truncate syntax in SQL2011: {code:java} <truncate table statement> ::= TRUNCATE TABLE <target table> [ <identity column restart option> ] <identity column restart option> ::= CONTINUE IDENTITY | RESTART IDENTITY{code} [PostgreSQL|https://www.postgresql.org/docs/current/sql-truncate.html] Similar to it. {code:java} TRUNCATE [ TABLE ] [ ONLY ] name [ * ] [, ... ] [ RESTART IDENTITY | CONTINUE IDENTITY ] [ CASCADE | RESTRICT ] {code} [Oracle|https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/TRUNCATE-TABLE.html#GUID-B76E5846-75B5-4876-98EC-439E15E4D8A4] more complicated. {code:java} TRUNCATE TABLE [schema.] table [ {PRESERVE | PURGE} MATERIALIZED VIEW LOG ] [ {DROP [ ALL ] | REUSE} STORAGE ] [ CASCADE ] ; {code} [SQL Server|https://learn.microsoft.com/en-us/sql/t-sql/statements/truncate-table-transact-sql?view=sql-server-ver16] allow partitions. {code:java} TRUNCATE TABLE { database_name.schema_name.table_name | schema_name.table_name | table_name } [ WITH ( PARTITIONS ( { <partition_number_expression> | <range> } [ , ...n ] ) ) ] [ ; ] <range> ::= <partition_number_expression> TO <partition_number_expression> {code} [Hive|https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-TruncateTable] also allow partitions. {code:java} TRUNCATE [TABLE] table_name [PARTITION partition_spec]; partition_spec: : (partition_column = partition_col_value, partition_column = partition_col_value, ...) {code} I suggest we add ` CONTINUE IDENTITY` and `RESTART IDENTITY`, core parser should follow standard SQL as much as possible. > Support TRUNCATE TABLE DDL statement in Babel parser > ---------------------------------------------------- > > Key: CALCITE-5688 > URL: https://issues.apache.org/jira/browse/CALCITE-5688 > Project: Calcite > Issue Type: Task > Components: babel, core > Reporter: Sumeet > Priority: Minor > Labels: pull-request-available > -- This message was sent by Atlassian Jira (v8.20.10#820010)