mirror of
https://github.com/apache/impala.git
synced 2025-12-25 02:03:09 -05:00
IMPALA-14290: Make Iceberg partitioning column names case insensitive
When creating or altering partitions of Iceberg tables, Impala only accepts column names if they are in lowercase and throws ImpalaRuntimeException otherwise. This patch allows the usage of other cases as well in PARTITION SPEC clauses. IcebergPartitionField converts field names to lower case in its constructor, similar to ColumnDef and PartitionKeyValue. Testing: * ran existing tests * add new test with mixed letter case columns Change-Id: I4080a6b7468fff940435e2e780322d4ba1f0de49 Reviewed-on: http://gerrit.cloudera.org:8080/23334 Reviewed-by: Daniel Becker <daniel.becker@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
committed by
Daniel Becker
parent
db92c88a4c
commit
edd5ff6e2a
@@ -54,8 +54,8 @@ public class IcebergPartitionField extends StmtNode {
|
||||
Preconditions.checkState(type.isScalarType());
|
||||
sourceId_ = sourceId;
|
||||
fieldId_ = fieldId;
|
||||
origFieldName_ = origFieldName;
|
||||
fieldName_ = fieldName;
|
||||
origFieldName_ = origFieldName.toLowerCase();
|
||||
fieldName_ = fieldName.toLowerCase();
|
||||
transform_ = transform;
|
||||
type_ = (ScalarType)type;
|
||||
}
|
||||
|
||||
@@ -18,3 +18,37 @@ STRING, STRING
|
||||
---- RUNTIME_PROFILE
|
||||
aggregation(SUM, NumRowGroups): 1
|
||||
====
|
||||
---- QUERY
|
||||
# IMPALA-14290: check partition columns case insensitivity
|
||||
CREATE TABLE partition_case_insensitive ( START_TIME TIMESTAMP, End_Time TIMESTAMP )
|
||||
PARTITIONED BY SPEC (DAY(START_TIME), MONTH(enD_tIMe))
|
||||
STORED AS ICEBERG;
|
||||
---- RESULTS
|
||||
'Table has been created.'
|
||||
====
|
||||
---- QUERY
|
||||
ALTER TABLE partition_case_insensitive SET PARTITION SPEC (MONTH(start_TIME), DAY(end_time));
|
||||
---- RESULTS
|
||||
'Updated partition spec.'
|
||||
====
|
||||
---- QUERY
|
||||
INSERT INTO partition_case_insensitive VALUES ("2023-11-27 00:00:00", "2024-08-12 00:00:00");
|
||||
ALTER TABLE partition_case_insensitive DROP PARTITION (MONTH(sTARt_timE) = "2023-11");
|
||||
---- RESULTS
|
||||
'Dropped 1 partition(s)'
|
||||
====
|
||||
---- QUERY
|
||||
INSERT INTO partition_case_insensitive VALUES ("2023-12-27 00:00:00", "2024-08-12 00:00:00");
|
||||
INSERT INTO partition_case_insensitive VALUES ("2023-12-25 00:00:00", "2024-08-12 00:00:00");
|
||||
INSERT INTO partition_case_insensitive VALUES ("2023-12-25 00:00:00", "2024-07-12 00:00:00");
|
||||
INSERT INTO partition_case_insensitive VALUES ("2023-11-27 00:00:00", "2024-07-12 00:00:00");
|
||||
SHOW PARTITIONS partition_case_insensitive;
|
||||
---- LABELS
|
||||
Partition, Number Of Rows, Number Of Files
|
||||
---- RESULTS
|
||||
'{"start_time_day":null,"end_time_month":null,"start_time_month":"646","end_time_day":"19916"}',1,1
|
||||
'{"start_time_day":null,"end_time_month":null,"start_time_month":"647","end_time_day":"19916"}',1,1
|
||||
'{"start_time_day":null,"end_time_month":null,"start_time_month":"647","end_time_day":"19947"}',2,2
|
||||
---- TYPES
|
||||
STRING, BIGINT, BIGINT
|
||||
====
|
||||
|
||||
Reference in New Issue
Block a user