tencent cloud

Data Lake Compute

ドキュメントData Lake ComputeSQL構文SuperSQL構文「Iceberg テーブル構文」Iceberg外部テーブルとネイティブテーブルの構文の違い

Iceberg外部テーブルとネイティブテーブルの構文の違い

PDF
フォーカスモード
フォントサイズ
最終更新日: 2025-12-25 12:00:06
データレイクコンピューティング DLC で使用される Iceberg の構文バージョンは0.13.1です。詳細な構文説明については、Iceberg 公式ドキュメントを参照してください。
Iceberg外部テーブルを使用する場合、SQL構文はIcebergネイティブテーブルと以下の違いがあります。

CREATE TABLE

ネイティブテーブル

構文
CREATE TABLE [ IF NOT EXISTS ] table_identifier
( col_name[:] col_type [ COMMENT col_comment ], ... )
[ COMMENT table_comment ]
[ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ]
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
( col_name[:] col_type [ COMMENT col_comment ], ... )
USING iceberg
[ COMMENT table_comment ]
[ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ]
[ LOCATION path ]
[ TBLPROPERTIES ( property_name=property_value, ... ) ]
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>>
)
USING iceberg
COMMENT 'table documentation'
PARTITIONED BY (bucket(16,id), years(ts_year), months(date_month), identity(bno), bucket(3,num), truncate(10,data))
LOCATION 'cosn://rickytest-1305424723/channing-test/loc'
TBLPROPERTIES ('write.format.default'='orc');

CREATE TABLE AS SELECT

ネイティブテーブル

構文
CREATE TABLE [ IF NOT EXISTS ] table_identifier
[ COMMENT table_comment ]
[ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ]
AS select_statement
CREATE TABLE IF NOT EXISTS dempts_copy
COMMENT 'table create as select'
PARTITIONED BY (eno, dno)
AS SELECT * from dempts;

外部テーブル

構文
CREATE TABLE [ IF NOT EXISTS ] table_identifier
USING iceberg
[ COMMENT table_comment ]
[ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ]
[ LOCATION path ]
[ TBLPROPERTIES ( property_name=property_value, ... ) ]
AS select_statement
CREATE TABLE dempts_copy
USING iceberg
COMMENT 'table create as select'
PARTITIONED BY (eno, dno)
LOCATION 'cosn://rickytest-1305424723/channing-test/loc'
TBLPROPERTIES ('write.format.default'='avro')
AS SELECT * from dempts;


REPLACE TABLE AS SELECT

ネイティブテーブル

構文
CREATE OR REPLACE TABLE table_identifier
[ COMMENT table_comment ]
[ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ]
AS select_statement
CREATE OR REPLACE TABLE dempts_replace
COMMENT 'table create as replace'
PARTITIONED BY (eno, bucket(10, num))
AS SELECT * from dempts;

外部テーブル

構文
CREATE [OR REPLACE] TABLE table_identifier
USING iceberg
[ COMMENT table_comment ]
[ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ]
[ LOCATION path ]
[ TBLPROPERTIES ( property_name=property_value, ... ) ]
AS select_statement
CREATE OR REPLACE TABLE dempts_replace
USING iceberg
COMMENT 'table create as replace'
PARTITIONED BY (eno, dno)
LOCATION 'cosn://rickytest-1305424723/channing-test/loc'
TBLPROPERTIES ('write.format.default'='avro')
AS SELECT * from dempts;

Procedure

注意
移行元テーブルはHiveテーブルまたはSparkテーブルである必要があります。

ネイティブテーブル

サポートしていません。

外部テーブル

スナップショット 元のテーブルに基づいて軽量な一時テーブルを作成し、一時テーブルは直接元のテーブルのスナップショットを再利用します。 構文
CALL `Catalog`.`system`.snapshot(source_table, table, [location], [properties]);
CALL `DataLakeCatalog`.`system`.snapshot('validation.table_01', 'validation.snap');
CALL `DataLakeCatalog`.`system`.snapshot('validation.table_01', 'validation.snap2', 'cosn://channingdata-1305424723/example3/');
call テーブル属性を更新して置き換えます。 構文
CALL `Catalog`.`system`.migrate(table, [properties]);
CALL `DataLakeCatalog`.`system`.migrate('validation.table_01');
CALL `DataLakeCatalog`.`system`.migrate('validation.table_01', map('data', 'name'));

add_files hiveから直接データファイルをロードし、データファイルを指定したパーティションに割り当てることができます。 構文
CALL `Catalog`.`system`.add_files(table, source_table, [partition_filter]);
CALL `DataLakeCatalog`.`system`.add_files(`table`=>'validation.table_02', `source_table`=>'validation.table_01');
CALL `DataLakeCatalog`.`system`.add_files(`table`=>'validation.table_02', `source_table`=>'validation.table_01', `partition_filter`=>map('part_col', 'A'));


ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック