Skip to content

Commit

Permalink
HIVE-27073: Apply SerDe properties when creating materialized view (K…
Browse files Browse the repository at this point in the history
…risztian Kasa, reviewed by Laszlo Vegh, Steve Carlin)
  • Loading branch information
kasakrisz committed Feb 15, 2023
1 parent ca9e6c2 commit 6f480cd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
--! qt:replace:/(\s+uuid\s+)\S+(\s*)/$1#Masked#$2/
-- Mask random snapshot id
--! qt:replace:/(\s+current-snapshot-id\s+)\d+(\s*)/$1#SnapshotId#/
-- Mask the totalSize value as it can change at file format library update
--! qt:replace:/(\s+totalSize\s+)\S+(\s+)/$1#Masked#$2/
-- SORT_QUERY_RESULTS

drop materialized view if exists mat1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- MV data is stored by partitioned iceberg with partition spec
--! qt:replace:/(\s+uuid\s+)\S+(\s*)/$1#Masked#$2/
--! qt:replace:/(\s+current-snapshot-id\s+)\d+(\s*)/$1#SnapshotId#/
-- Mask the totalSize value as it can change at file format library update
--! qt:replace:/(\s+totalSize\s+)\S+(\s+)/$1#Masked#$2/
-- SORT_QUERY_RESULTS

drop materialized view if exists mat1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,17 @@ Table Parameters:
current-snapshot-id #SnapshotId#
engine.hive.enabled true
format-version 1
iceberg.orc.files.only false
iceberg.orc.files.only true
metadata_location hdfs://### HDFS PATH ###
numFiles 2
numRows 2
previous_metadata_location hdfs://### HDFS PATH ###
storage_handler org.apache.iceberg.mr.hive.HiveIcebergStorageHandler
table_type ICEBERG
totalSize 1282
totalSize #Masked#
#### A masked pattern was here ####
uuid #Masked#
write.format.default orc

# Storage Information
SerDe Library: org.apache.iceberg.mr.hive.HiveIcebergSerDe
Expand Down Expand Up @@ -143,17 +144,18 @@ Table Parameters:
current-snapshot-id #SnapshotId#
engine.hive.enabled true
format-version 2
iceberg.orc.files.only false
iceberg.orc.files.only true
metadata_location hdfs://### HDFS PATH ###
numFiles 2
numRows 2
previous_metadata_location hdfs://### HDFS PATH ###
storage_handler org.apache.iceberg.mr.hive.HiveIcebergStorageHandler
table_type ICEBERG
totalSize 1282
totalSize #Masked#
#### A masked pattern was here ####
uuid #Masked#
write.delete.mode merge-on-read
write.format.default orc
write.merge.mode merge-on-read
write.update.mode merge-on-read

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,17 @@ Table Parameters:
current-snapshot-id #SnapshotId#
engine.hive.enabled true
format-version 1
iceberg.orc.files.only false
iceberg.orc.files.only true
metadata_location hdfs://### HDFS PATH ###
numFiles 2
numRows 2
previous_metadata_location hdfs://### HDFS PATH ###
storage_handler org.apache.iceberg.mr.hive.HiveIcebergStorageHandler
table_type ICEBERG
totalSize 1282
totalSize #Masked#
#### A masked pattern was here ####
uuid #Masked#
write.format.default orc

# Storage Information
SerDe Library: org.apache.iceberg.mr.hive.HiveIcebergSerDe
Expand Down Expand Up @@ -145,17 +146,18 @@ Table Parameters:
current-snapshot-id #SnapshotId#
engine.hive.enabled true
format-version 2
iceberg.orc.files.only false
iceberg.orc.files.only true
metadata_location hdfs://### HDFS PATH ###
numFiles 2
numRows 2
previous_metadata_location hdfs://### HDFS PATH ###
storage_handler org.apache.iceberg.mr.hive.HiveIcebergStorageHandler
table_type ICEBERG
totalSize 1282
totalSize #Masked#
#### A masked pattern was here ####
uuid #Masked#
write.delete.mode merge-on-read
write.format.default orc
write.merge.mode merge-on-read
write.update.mode merge-on-read

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ public Table toTable(HiveConf conf) throws HiveException {
org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE,
getStorageHandler());
}
if (getSerdeProps() != null) {
for (Map.Entry<String, String> entry : getSerdeProps().entrySet()) {
tbl.setSerdeParam(entry.getKey(), entry.getValue());
}
}

HiveStorageHandler storageHandler = tbl.getStorageHandler();

setColumnsAndStorePartitionTransformSpecOfTable(getSchema(), getPartCols(), conf, tbl);
Expand Down

0 comments on commit 6f480cd

Please sign in to comment.