lightzhao commented on PR #5514:
URL: https://github.com/apache/seatunnel/pull/5514#issuecomment-1727543774
### step 1:create hive table
~~~
CREATE TABLE dbtest01.tmp_t_hive_data_type_test_2_day (
id INT,
name STRING,
hobbies ARRAY<STRING>,
address MAP<STRING, STRING>,
details STRUCT<age: INT, email: STRING>
)
PARTITIONED BY (dt STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '#'
COLLECTION ITEMS TERMINATED BY ','
MAP KEYS TERMINATED BY ':';
~~~
### step 2:seatunnel config
~~~
env {
execution.parallelism = 1
job.mode = "STREAMING"
job.name = "test_hive_data_type"
execution.planner = "blink"
execution.checkpoint.interval = 180000
}
source {
Kafka {
result_table_name = "source_table"
format = "text"
field_delimiter = "#"
schema = {
fields{
id = string
name = string
hobbies = "array<string>"
address = "map<string,string>"
details = {
age = int
email = string
}
}
}
topic = "test5"
bootstrap.servers = "broker1:9092,broker2:9092,broker:9092"
}
}
transform {
sql {
sql = "select `id` as id, `name` as name, `hobbies` as hobbies,
`address` as address, `details` as details, CAST(DATE_FORMAT(
CAST(NOW() AS VARCHAR),'yyyyMMdd') as VARCHAR) as dt from source_table "
}
}
sink {
Console{}
Hive {
table_name = "dbtest01.tmp_t_hive_data_type_test_2_day"
metastore_uri = "thrift://localhost:9083"
}
}
~~~
### step 3: kafka produce data
<img width="1375" alt="image"
src="https://github.com/apache/seatunnel/assets/40714172/d47162f4-dfe7-4562-8734-4bd221d18fd8">
### step4: hive query
<img width="1383" alt="image"
src="https://github.com/apache/seatunnel/assets/40714172/ce9cf91c-5ed1-4abd-9285-dcacba8f15f3">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]