seatunnel消费kafka(json字符串),json体里空值的字段缺失,导致解析后字段值错位,这种情况如何解决?
env {
execution.mode = "cluster"
parallelism = 3
job.name = "j1"
job.mode = "STREAMING"
}
source {
Kafka {
topic = "tt"
bootstrap.servers = "172.1.2.3:9092"
consumer.group = "g1"
format = "json"
schema = {
fields = {
a = "string"
b = "string"
c = "string"
timestamp = "long"
# 根据你的实际数据定义更多字段
}
}
result_table_name = "t1"
}
}
transform {
SQL {
query = """
SELECT
a,
b,
c
FROM_UNIXTIME(CAST(timestamp/1000 AS bigint), 'yyyyMMdd') AS dayid
FROM
t1
"""
}
}
sink {
HdfsFile {
fs.defaultFS = "hdfs://ns1"
path = "/user/hive/warehouse/db1/ods/t_1"
hdfs_site_path = "hdfs-site.xml"
file_format_type = "orc"
sink_columns = ["a","b","c","dayid"]
is_enable_transaction = true
have_partition = true
partition_by = ["dayid"]
remote_user = "u1"
partition_date_format = "yyyyMMdd"
}
}