Skip to content

创建 hadoop catalog

sql
CREATE CATALOG hadoop_catalog WITH (
  'type'='iceberg',
  'catalog-type'='hadoop',
  'warehouse'='hdfs:///user/catalog/warehouse',
  'property-version'='1'
);

建表配置:

sql
SET engine.hive.enabled=true; 
SET iceberg.engine.hive.enabled=true;

SET iceberg.mr.catalog=hive;

创建外部表:

CREATE EXTERNAL TABLE table_a(
    id   string,
    name string,
    age int
)
STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler'
LOCATION 'hdfs:///user/catalog/warehouse/table_a'
TBLPROPERTIES ('iceberg.catalog'='hadoop');

创建表:

CREATE TABLE db2.table_a (
  id bigint, name string
) PARTITIONED BY (
  dept string
) STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler';

XXX:

sql
CREATE CATALOG hadoop_catalog WITH (
  'type'='iceberg',
  'catalog-type'='hadoop',
  'warehouse'='hdfs:///user/hive_iceberg/warehouse',
  'property-version'='1'
);

SET engine.hive.enabled=true; 
SET iceberg.engine.hive.enabled=true;
SET iceberg.mr.catalog=hive; 

CREATE EXTERNAL TABLE iceberg_test( 
  id int, 
  name string)
STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler' 
TBLPROPERTIES (
  'iceberg.mr.catalog'='hadoop'
  );