[Spark load][Fe 4/6] Add hive external table and update hive table syntax in loadstmt (#3819)

* Add hive external table and update hive table syntax in loadstmt

* Move check hive table from SelectStmt to FromClause and update doc

* Update hive external table en sql reference
This commit is contained in:
Mingyu Chen
2020-06-13 16:28:24 +08:00
committed by GitHub
15 changed files with 561 additions and 62 deletions

View File

@ -35,7 +35,7 @@ Syntax:
CREATE [EXTERNAL] TABLE [IF NOT EXISTS] [database.]table_name
(column_definition1[, column_definition2, ...]
[, index_definition1[, ndex_definition12,]])
[ENGINE = [olap|mysql|broker]]
[ENGINE = [olap|mysql|broker|hive]]
[key_desc]
[COMMENT "table comment"]
[partition_desc]
@ -104,7 +104,7 @@ Syntax:
Notice:
Only support BITMAP index in current version, BITMAP can only apply to single column
3. ENGINE type
Default is olap. Options are: olap, mysql, broker
Default is olap. Options are: olap, mysql, broker, hive
1) For mysql, properties should include:
```
@ -123,7 +123,7 @@ Syntax:
table_name in CREATE TABLE stmt is table is Doris. They can be different or same.
MySQL table created in Doris is for accessing data in MySQL database.
Doris does not maintain and store any data from MySQL table.
1) For broker, properties should include:
2) For broker, properties should include:
```
PROPERTIES (
@ -145,6 +145,16 @@ Syntax:
Notice:
Files name in "path" is separated by ",". If file name includes ",", use "%2c" instead. If file name includes "%", use "%25" instead.
Support CSV and Parquet. Support GZ, BZ2, LZ4, LZO(LZOP)
3) For hive, properties should include:
```
PROPERTIES (
"database" = "hive_db_name",
"table" = "hive_table_name",
"hive.metastore.uris" = "thrift://127.0.0.1:9083"
)
```
"database" is the name of the database corresponding to the hive table, "table" is the name of the hive table, and "hive.metastore.uris" is the hive metastore service address.
Notice: At present, hive external tables are only used for Spark Load and query is not supported.
4. key_desc
Syntax:
key_type(k1[,k2 ...])
@ -577,6 +587,23 @@ Syntax:
PROPERTIES ("in_memory"="true");
```
13. Create a hive external table
```
CREATE TABLE example_db.table_hive
(
k1 TINYINT,
k2 VARCHAR(50),
v INT
)
ENGINE=hive
PROPERTIES
(
"database" = "hive_db_name",
"table" = "hive_table_name",
"hive.metastore.uris" = "thrift://127.0.0.1:9083"
);
```
## keyword
CREATE,TABLE