如题:
我向kafka中输出了json格式的数据
{"id":5,"price":40,"timestamp":1584942626828,"type":"math"}
{"id":2,"price":70,"timestamp":1584942629638,"type":"math"}
{"id":2,"price":70,"timestamp":1584942634951,"type":"math"}
....
其中timestamp字段是13位时间戳,对应的SQL表中应该怎么处理成时间格式呢?
- name: bookpojo
type: source-table
connector:
property-version: 1
type: kafka
version: "universal"
topic: pojosource
startup-mode: earliest-offset
properties:
zookeeper.connect: localhost:2181
bootstrap.servers: localhost:9092
group.id: testGroup
format:
property-version: 1
type: json
schema: "ROW<id INT, type STRING, price INT, timestamp TIMESTAMP>"
schema:
- name: id
data-type: INT
- name: type
data-type: STRING
- name: price
data-type: INT
- name: timestamp
data-type: TIMESTAMP(3)
上述配置,好像有问题。
我在官网中找到这样一句说明:
字符串和时间类型:时间类型必须根据Java SQL时间格式进行格式化,并以毫秒为单位。例如: 2018-01-01
日期,20:43:59
时间和2018-01-01 20:43:59.999
时间戳。
时间一定得是字符串类型且带毫秒吗?
谢谢。