赞
踩
-- flink v2
CREATE TABLE `sample_uniq_test01` (
CREATE
TABLE
`sample_uniq_test01` (
`id` BIGINT NOT NULL,
`id`
BIGINT
NOT
NULL
,
`data` VARCHAR(2147483647),
`data`
VARCHAR
(2147483647),
PRIMARY KEY (`id`) NOT ENFORCED
PRIMARY
KEY
(`id`)
ENFORCED
) PARTITIONED BY (`id`)
) PARTITIONED
BY
WITH (
WITH
(
'format-version'='2',
'format-version'
=
'2'
'catalog-database' = 'test001',
'catalog-database'
'test001'
'write.upsert.enabled' = 'true',
'write.upsert.enabled'
'true'
'write.metadata.delete-after-commit.enabled' = 'true',
'write.metadata.delete-after-commit.enabled'
'warehouse' = 'hdfs://nameservice2/user/hive/warehouse/',
'warehouse'
'hdfs://nameservice2/user/hive/warehouse/'
'uri' = 'thrift://10.8.49.114:9083,thrift://10.8.49.115:9083',
'uri'
'thrift://10.8.49.114:9083,thrift://10.8.49.115:9083'
'write.metadata.previous-versions-max' = '2',
'write.metadata.previous-versions-max'
'catalog-table' = 'sample_uniq_test01',
'catalog-table'
'sample_uniq_test01'
'catalog-type' = 'hive',
'catalog-type'
'hive'
'write.distribution-mode' = 'hash'
'write.distribution-mode'
'hash'
);
// 一定要有主键,且为主键在分区上,才可以的
insert into sample_uniq_test01 values (1,'1');
insert
into
sample_uniq_test01
values
(1,
'1'
后面可以接入 flink kafka 表即可