Sorry i sent the Chinese written email to user@ Let me translate it to English. I create a table using sql-client from kafka topic: CREATE TABLE order_status ( out_order_code VARCHAR, intput_date TIMESTAMP(3), owner_code VARCHAR, status INT ) WITH ( 'connector.type' = 'kafka',......... 'format.type' = 'json', 'format.derive-schema' = 'true' ) Then I send message to the topic: {"out_order_code":"MAMICK2020031048","input_date":"2020-03-11T13:00:00.123Z","owner_code":"WDTLEN04","status":90} But the input_date is not recognized on the sql-client and is null, even i tried 1583828700240 "2020-03-11 13:00:00" "2020-03-11 13:00:00.000" How should the timestamp(3) look like in the json message? Thanks, Lei [hidden email] 发件人: [hidden email] 发送时间: 2020-03-11 17:41 收件人: user 主题: json 中 timestamp 类型在json中怎样写才能被 flink sql 识别 用 sql-client create 了一个 kafka table: CREATE TABLE order_status ( out_order_code VARCHAR, intput_date TIMESTAMP(3), owner_code VARCHAR, status INT ) WITH ( 'connector.type' = 'kafka',......... 'format.type' = 'json', 'format.derive-schema' = 'true' ) 然后往 kafka 这个 topic 发送消息:{"out_order_code":"MAMICK2020031048","input_date":"2020-03-11T13:00:00.123Z","owner_code":"WDTLEN04","status":90} input_date 在 sql-clinet 端始终是 NULL. 我把 发送的 input_date 改成 1583828700240 "2020-03-11 13:00:00" "2020-03-11 13:00:00.000" 也都不行。 这个 TIMESTAMP(3)在JSON 中应该写成什么样子呢? 谢谢, 王磊 [hidden email] |
Administrator
|
Hi Lei,
The "2020-03-11T13:00:00.123Z" format is correct, but you defined the wrong field name in the DDL. It should be "input_date", not "intput_date". Best, Jark On Wed, 11 Mar 2020 at 17:52, [hidden email] < [hidden email]> wrote: > > Sorry i sent the Chinese written email to user@ > Let me translate it to English. > > I create a table using sql-client from kafka topic: > > CREATE TABLE order_status ( > out_order_code VARCHAR, > intput_date TIMESTAMP(3), > owner_code VARCHAR, > status INT > ) WITH ( > 'connector.type' = 'kafka', > > ......... > 'format.type' = 'json', > > 'format.derive-schema' = 'true' > > ) > > Then I send message to the topic: > {"out_order_code":"MAMICK2020031048","input_date":"2020-03-11T13:00:00.123Z","owner_code":"WDTLEN04","status":90} > But the input_date is not recognized on the sql-client and is null, even i > tried 1583828700240 "2020-03-11 13:00:00" "2020-03-11 13:00:00.000" > > How should the timestamp(3) look like in the json message? > > Thanks, > Lei > > > ------------------------------ > > [hidden email] > > > *发件人:* [hidden email] > *发送时间:* 2020-03-11 17:41 > *收件人:* user <[hidden email]> > *主题:* json 中 timestamp 类型在json中怎样写才能被 flink sql 识别 > > 用 sql-client create 了一个 kafka table: > > CREATE TABLE order_status ( > out_order_code VARCHAR, > intput_date TIMESTAMP(3), > owner_code VARCHAR, > status INT > ) WITH ( > 'connector.type' = 'kafka', > > ......... > 'format.type' = 'json', > > 'format.derive-schema' = 'true' > > ) > > 然后往 kafka 这个 topic > 发送消息:{"out_order_code":"MAMICK2020031048","input_date":"2020-03-11T13:00:00.123Z","owner_code":"WDTLEN04","status":90} > input_date 在 sql-clinet 端始终是 NULL. > 我把 发送的 input_date 改成 1583828700240 "2020-03-11 13:00:00" "2020-03-11 > 13:00:00.000" 也都不行。 > 这个 TIMESTAMP(3)在JSON 中应该写成什么样子呢? > > 谢谢, > 王磊 > > ------------------------------ > [hidden email] > > |
Thanks Jark, No word to express my '囧'. [hidden email] Sender: Jark Wu Send Time: 2020-03-11 18:32 Receiver: [hidden email] cc: user; user-zh Subject: Re: json 中 timestamp 类型在json中怎样写才能被 flink sql 识别 Hi Lei, The "2020-03-11T13:00:00.123Z" format is correct, but you defined the wrong field name in the DDL. It should be "input_date", not "intput_date". Best, Jark On Wed, 11 Mar 2020 at 17:52, [hidden email] <[hidden email]> wrote: Sorry i sent the Chinese written email to user@ Let me translate it to English. I create a table using sql-client from kafka topic: CREATE TABLE order_status ( out_order_code VARCHAR, intput_date TIMESTAMP(3), owner_code VARCHAR, status INT ) WITH ( 'connector.type' = 'kafka',......... 'format.type' = 'json', 'format.derive-schema' = 'true' ) Then I send message to the topic: {"out_order_code":"MAMICK2020031048","input_date":"2020-03-11T13:00:00.123Z","owner_code":"WDTLEN04","status":90} But the input_date is not recognized on the sql-client and is null, even i tried 1583828700240 "2020-03-11 13:00:00" "2020-03-11 13:00:00.000" How should the timestamp(3) look like in the json message? Thanks, Lei [hidden email] 发件人: [hidden email] 发送时间: 2020-03-11 17:41 收件人: user 主题: json 中 timestamp 类型在json中怎样写才能被 flink sql 识别 用 sql-client create 了一个 kafka table: CREATE TABLE order_status ( out_order_code VARCHAR, intput_date TIMESTAMP(3), owner_code VARCHAR, status INT ) WITH ( 'connector.type' = 'kafka',......... 'format.type' = 'json', 'format.derive-schema' = 'true' ) 然后往 kafka 这个 topic 发送消息:{"out_order_code":"MAMICK2020031048","input_date":"2020-03-11T13:00:00.123Z","owner_code":"WDTLEN04","status":90} input_date 在 sql-clinet 端始终是 NULL. 我把 发送的 input_date 改成 1583828700240 "2020-03-11 13:00:00" "2020-03-11 13:00:00.000" 也都不行。 这个 TIMESTAMP(3)在JSON 中应该写成什么样子呢? 谢谢, 王磊 [hidden email] |
Free forum by Nabble | Edit this page |