2 个回答
创建永久表
-- 示例1:创建Hive永久表(批流一体)
CREATE TABLE hive_orders (
order_id STRING,
amount DOUBLE,
event_time TIMESTAMP(3),
WATERMARK FOR event_time AS event_time - INTERVAL '5' SECOND
) PARTITIONED BY (dt STRING)
WITH (
'connector' = 'hive',
'uri' = 'thrift://hive-metastore:9083',
'table-name' = 'orders'
);
删除永久表DROP TABLE IF EXISTS hive_orders;
发布于:1周前 (05-28) IP属地:
创建临时表
-- 示例1:从Kafka创建临时表(含事件时间与水印)
CREATE TEMPORARY TABLE kafka_orders (
order_id STRING,
amount DOUBLE,
event_time TIMESTAMP(3),
WATERMARK FOR event_time AS event_time - INTERVAL '5' SECOND
) WITH (
'connector' = 'kafka',
'topic' = 'orders_topic',
'properties.bootstrap.servers' = 'localhost:9092',
'format' = 'json'
);
删除临时表DROP TEMPORARY TABLE IF EXISTS kafka_orders;
发布于:1周前 (05-28) IP属地:
我来回答
您需要 登录 后回答此问题!