自定义元数据表Schema

可以在任务中通过SET语法配置元数据表的Schema。特别是元数据中心不能很好支持Flink Table Schema表达的情况下。例如:Hbase表

SET '<table_name>.format.schema'='ROW<user_id VARCHAR, base_info ROW<deviceid VARCHAR, os varchar, logtime bigint>>';

table_name是任务中某表名;schema:

 create table table_name (
     user_id VARCHAR,
    base_info ROW<deviceid VARCHAR, os varchar, logtime bigint>
 )

Demo

set 'music_useraction_queue_3.connections.group.id' = 'test_group_id';
set 'music_useraction_queue_3.connector.startup-mode' = 'latest-offset';

set 'sloth_ua_one.format.schema' ='ROW<user_id VARCHAR, base_info ROW<deviceid VARCHAR, os varchar, logtime bigint>>';
set 'sloth_ua_one.connector.version' = '1.4.3';
set 'sloth_ua_one.connector.table-name' = 'sloth_ua_one';

INSERT INTO sloth_hbase_v_one_test.`default`.sloth_ua_one
    SELECT v.userid as user_id, ROW(deviceid, os, logtime) as base_info  FROM music_useraction_queue_3 as v;