单独查kafka,mysql都有数据,
关联temporal join 维表字段就带不出来

看了下流表的proctime比当前时间早8小时,会不会这个原因?








在 2021-07-06 15:33:08,"guoyb" <[email protected]> 写道:
>select的问题,排查一下,单独查表是否有数据,关联条件。
>
>
>
>---Original---
>From: "赵旭晨"<[email protected]&gt;
>Sent at: 2021年7月6日(Tue) PM3:25
>To: "user-zh"<[email protected]&gt;;
>Subject: flinksql 流维join 问题
>
>
>流表:
>CREATE TABLE flink_doris_source (
>&nbsp; &nbsp; reporttime STRING,
>&nbsp; &nbsp; tenantcode STRING,
>&nbsp; &nbsp; visitid STRING,
>&nbsp; &nbsp; orderid STRING,
>orderdetailid STRING,
>paymentdetailid STRING,
>etltype STRING,
>ptime as proctime()
>) WITH (
>&nbsp;'connector' = 'kafka',&nbsp; 
>&nbsp;'topic' = 'demo', 
>&nbsp;'properties.bootstrap.servers' = '10.26.255.82:9092', 
>&nbsp;'properties.group.id' = 'consumer-55',&nbsp; 
>&nbsp;'format' = 'json',&nbsp; 
>&nbsp;'scan.startup.mode' = 'latest-offset'&nbsp; 
>);
>
>
>维表:
>CREATE TABLE people (
>&nbsp; `Id` int,
>&nbsp; `Name` String,
>&nbsp; `Sex` tinyint,
>&nbsp; `Birth` timestamp,
>&nbsp; `Etltype` String,
>&nbsp; PRIMARY KEY (Id) NOT ENFORCED
>) WITH (
>&nbsp; &nbsp;'connector' = 'jdbc',
>&nbsp; &nbsp;'url' = 'jdbc:mysql://10.26.20.122:3306/test1',
>&nbsp; &nbsp;'table-name' = 'people',
>&nbsp; &nbsp;'username'='root',
>&nbsp; &nbsp;'password'='*******',
>&nbsp; &nbsp;'lookup.cache.ttl'='10s',
>&nbsp; &nbsp;'lookup.cache.max-rows'='20'
>);
>
>
>mysql ddl:
>CREATE TABLE `people` (
>&nbsp; `Id` int(11) NOT NULL AUTO_INCREMENT,
>&nbsp; `Name` varchar(40) NOT NULL,
>&nbsp; `Sex` tinyint(3) unsigned NOT NULL,
>&nbsp; `Birth` datetime DEFAULT NULL,
>&nbsp; `Etltype` varchar(40) NOT NULL,
>&nbsp; PRIMARY KEY (`Id`)
>) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4
>
>
>
>
>
>--流维join
>INSERT INTO flink_doris_sink select 
>a.reporttime,a.tenantcode,a.visitid,a.orderid,a.orderdetailid,a.paymentdetailid,b.Etltype
> from flink_doris_source a left join people FOR SYSTEM_TIME AS OF a.ptime b on 
>a.tenantcode = b.Name;
>
>
>
>
>
>维表数据没有带出来,设置的维表ttl也没效果,是语句问题么?
>flink版本:flink-1.12.0-bin-scala_2.11.tgz&nbsp; &nbsp;mysql:5.7.32&nbsp; 
>&nbsp;mysql驱动:8.0.22
>
>
>
>
>
>
>
>
>
>&nbsp;

回复