diff --git a/docs/en/reference/sql/ddl/CREATE_TABLE_STATEMENT.md b/docs/en/reference/sql/ddl/CREATE_TABLE_STATEMENT.md index 2d41f278c87..7af45229251 100644 --- a/docs/en/reference/sql/ddl/CREATE_TABLE_STATEMENT.md +++ b/docs/en/reference/sql/ddl/CREATE_TABLE_STATEMENT.md @@ -18,18 +18,20 @@ TableElement ::= ColumnDef | ColumnIndex ``` - The `TableElementList` needs to be defined in the `CREATE TABLE` statement. `TableElementList` consists of `ColumnDef` (column definition) and `ColumnIndex`. OpenMLDB requires at least one `ColumnDef` in the `TableElementList`. -Or use Hive tables to create new tables. +Or use Hive tables and Parquet files to create new tables. ```sql CreateTableStmt ::= - 'CREATE' 'TABLE' TableName LIKE 'HIVE' PATH + 'CREATE' 'TABLE' TableName LIKE LikeType PATH TableName ::= Identifier ('.' Identifier)? +LikeType ::= + 'HIVE' | 'PARQUET' + PATH ::= string_literal ``` @@ -201,6 +203,15 @@ CREATE TABLE db1.t1 LIKE HIVE 'hive://hive_db.t1'; Notice that the table name should include database name at present. +**Example 6: Create a Table from the Parquet files** + +```sql +CREATE TABLE db1.t1 LIKE PARQUET 'file://t1.parquet'; +-- SUCCEED +``` + +Notice that the table name should include database name at present. + ### ColumnIndex (optional) ```sql diff --git a/docs/zh/openmldb_sql/ddl/CREATE_TABLE_STATEMENT.md b/docs/zh/openmldb_sql/ddl/CREATE_TABLE_STATEMENT.md index 2c4d9b42abe..daf56a1e911 100644 --- a/docs/zh/openmldb_sql/ddl/CREATE_TABLE_STATEMENT.md +++ b/docs/zh/openmldb_sql/ddl/CREATE_TABLE_STATEMENT.md @@ -22,7 +22,23 @@ TableElement ::= 建表语句中需要定义`TableElementList`,即`TableElement`列表。`TableElement`分为列描述`ColumnDef`和列索引`ColumnIndex`。OpenMLDB要求`TableElement`列表中至少包含一个`ColumnDef`。 -基于 `LIKE` 语法建表目前仅支持基于 Hive 的表格,详情查看文档 [Hive 数据源支持](../../integration/offline_data_sources/hive.md)。 +或者基于 `LIKE` 语法建表,目前支持基于 Hive 和 Parquet 格式。 + +```sql +CreateTableStmt ::= + 'CREATE' 'TABLE' TableName LIKE LikeType PATH + +TableName ::= + Identifier ('.' Identifier)? + +LikeType ::= + 'HIVE' | 'PARQUET' + +PATH ::= + string_literal +``` + +基于 Hive 建表的详情可查看文档 [Hive 数据源支持](../../integration/offline_data_sources/hive.md)。 ### 列描述ColumnDef(必要) @@ -173,7 +189,7 @@ desc t4; -------------- ``` -**示例5:基于Hive表创建新表** +**示例5:基于 Hive 表创建新表** 首先[配置OpenMLDB支持Hive](../../integration/offline_data_sources/hive.md),然后使用以下语句。 @@ -184,6 +200,15 @@ CREATE TABLE db1.t1 LIKE HIVE 'hive://hive_db.t1'; 注意目前创建的表名必须包括DB名。 +**示例6:基于 Parquet 文件创建新表** + +```sql +CREATE TABLE db1.t1 LIKE PARQUET 'file://t1.parquet'; +-- SUCCEED +``` + +注意目前创建的表名必须包括DB名。 + ### 列索引ColumnIndex(可选) ```sql