Skip to content

Commit d017160

Browse files
committed
Add hive text timezone regression case
1 parent 0bc5924 commit d017160

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

regression-test/suites/external_table_p0/hive/ddl/test_hive_ddl_text_format.groovy

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,45 @@ suite("test_hive_ddl_text_format", "p0,external,hive,external_docker,external_do
122122
order_qt_different_properties """ select * from text_table_different_properties """
123123
order_qt_hive_docker_different_properties """ select * from text_table_different_properties order by id; """
124124

125+
// timezone in text data should not cause core, expect parse failure
126+
String tz_raw_tbl = "text_tz_raw"
127+
String tz_typed_tbl = "text_tz_typed"
128+
String tz_tbl_loc = "hdfs://${externalEnvIp}:${hdfs_port}/tmp/hive/text_tz_case_${hivePrefix}"
129+
130+
sql """ drop table if exists ${tz_raw_tbl} """
131+
sql """
132+
create table ${tz_raw_tbl} (
133+
id string,
134+
ts string
135+
) ENGINE=hive
136+
PROPERTIES (
137+
'file_format'='text',
138+
'location'='${tz_tbl_loc}'
139+
);
140+
"""
141+
sql """
142+
insert overwrite table ${tz_raw_tbl} values
143+
('1', '2025-11-21 00:02:48+08:00'),
144+
('2', '2025-11-21 00:02:48');
145+
"""
146+
order_qt_tz_raw """ select * from ${tz_raw_tbl} order by id; """
147+
148+
sql """ drop table if exists ${tz_typed_tbl} """
149+
sql """
150+
create table ${tz_typed_tbl} (
151+
id string,
152+
ts timestamp
153+
) ENGINE=hive
154+
PROPERTIES (
155+
'file_format'='text',
156+
'location'='${tz_tbl_loc}'
157+
);
158+
"""
159+
test {
160+
sql """ select * from ${tz_typed_tbl} """
161+
exception "parse date fail"
162+
}
163+
125164
String serde = "'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'"
126165
String input_format = "'org.apache.hadoop.mapred.TextInputFormat'"
127166
String output_format = "'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'"

0 commit comments

Comments
 (0)