产品概述
产品优势
应用场景
CREATE TABLE [ IF NOT EXISTS ] table_identifier( col_name[:] col_type [ COMMENT col_comment ], ... )[ COMMENT table_comment ][ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ]
table_identifier 支持三段式:catalog.db.name。col_type: primitive_type| nested_typeprimitive_type: boolean| int/integer| long/bigint| float| double| decimal(p,s),p=最大位数,s=最大小数点位数, s<=p<=38| date| timestamp,timestamp with timezone,不支持time和without timezone| string,也可对应Iceberg uuid类型| binary,也可对应Iceberg fixed类型nested_type: struct| list| map
transform: identity,支持任意类型, DLC不支持该转换| bucket[N],hash mod N分桶,支持col_type: int,long, decimal, date, timestamp, string, binary| truncate[L],L截取分桶,支持col_type: int,long,decimal,string| years,年份,支持col_type: date,timestamp| months,月份,支持col_type: date,timestamp| days/date,日期,支持col_type: date,timestamp| hours/date_hour,小时,支持col_type: timestamp
CREATE TABLE dempts(id bigint COMMENT 'id number',num int,eno float,dno double,cno decimal(9,3),flag boolean,data string,ts_year timestamp,date_month date,bno binary,point struct<x: double, y: double>,points array<struct<x: double, y: double>>,pointmaps map<struct<x: int>, struct<a: int>>)COMMENT 'table documentation'PARTITIONED BY (bucket(16,id), years(ts_year), months(date_month), identity(bno), bucket(3,num),truncate(10,data));
CREATE TABLE [ IF NOT EXISTS ] table_identifier[ COMMENT table_comment ][ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ][ TBLPROPERTIES ( property_name=property_value, ... ) ]AS select_statement
CREATE TABLE dempts_copyCOMMENT 'table create as select'PARTITIONED BY (eno, dno)AS SELECT * from dempts;
CREATE [OR REPLACE] TABLE table_identifier[ COMMENT table_comment ][ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ]AS select_statement
CREATE OR REPLACE TABLE dempts_replaceCOMMENT 'table create as replace'PARTITIONED BY (eno, dno)AS SELECT * from dempts;
DROP TABLE [ IF EXISTS ] table_identifier
ALTER TABLE table_identifier RENAME TO new_table_identifier
-- SET 更新属性配置ALTER TABLE table_identifierSET TBLPROPERTIES (property_name=property_value, ...)-- UNSET 删除属性配置ALTER TABLE table_identifierUNSET TBLPROPERTIES (property_name, ...)
-- SET 更新属性配置ALTER TABLE dempts SET TBLPROPERTIES ('read.split.target-size'='268435456');-- UNSET 删除属性配置ALTER TABLE dempts UNSET TBLPROPERTIES ('read.split.target-size'='268435456');
ALTER TABLE table_identifierWRITE [LOCALLY] ORDERED BY{col_name [ASC|DESC] [NULLS FIRST|LAST]}[, ...]
ALTER TABLE dempts WRITE ORDERED BY category, id;-- use optional ASC/DEC keyword to specify sort order of each field (default ASC)ALTER TABLE dempts WRITE ORDERED BY category ASC, id DESC;-- use optional NULLS FIRST/NULLS LAST keyword to specify null order of each field (default FIRST)ALTER TABLE dempts WRITE ORDERED BY category ASC NULLS LAST, id DESC NULLS FIRST;-- To order within each task, not across tasksALTER TABLE dempts WRITE LOCALLY ORDERED BY category, id;
ALTER TABLE table_identifierWRITE DISTRIBUTED BY PARTITION[ LOCALLY ORDERED BY{col_name [ASC|DESC] [NULLS FIRST|LAST]}[, ...]]
ALTER TABLE dempts WRITE DISTRIBUTED BY PARTITION;ALTER TABLE dempts WRITE DISTRIBUTED BY PARTITION LOCALLY ORDERED BY id;
-- 新增多个字段ALTER TABLE table_identifierADD COLUMNS (col_name col_type [COMMENT col_comment], ...)-- 新增单个字段ALTER TABLE table_identifierADD COLUMN col_name col_type [COMMENT col_comment][FIRST | AFTER target_col_name]
-- 新增多个字段ALTER TABLE demptsADD COLUMNS (new_column_1 string comment 'new_column_1 docs',new_column_2 int comment 'new_column_2 docs');-- 新增单个字段ALTER TABLE demptsADD COLUMN new_column_3 string comment 'new_column docs';
ALTER TABLE table_identifierRENAME COLUMN old_column_name TO new_column_name
ALTER TABLE table_identifierALTER COLUMN col_name{TYPE new_col_type | COMMENT col_comment}
ALTER TABLE dempts ALTER COLUMN new_column_2 TYPE bigint;ALTER TABLE dempts ALTER COLUMN new_column_2 comment 'alter docs';
ALTER TABLE table_identifier DROP COLUMN column_name
ALTER TABLE table_identifierADD PARTITION FIELD col_name|transform (col_name) [AS alias]
ALTER TABLE dempts ADD PARTITION FIELD new_column_1;ALTER TABLE dempts ADD PARTITION FIELD bucket(3,new_column_2);
ALTER TABLE table_identifier REPLACE PARTITION FIELD col_name|transform (col_name) [AS alias]
ALTER TABLE table_identifierDROP PARTITION FIELD col_name|transform (col_name);
ALTER TABLE dempts DROP PARTITION FIELD new_column_1;ALTER TABLE dempts DROP PARTITION FIELD bucket(3,new_column_2);
ALTER TABLE dempts SET IDENTIFIER FIELDS empno, name
ALTER TABLE dempts DROP IDENTIFIER FIELDS empno, name
文档反馈