simhadri-g commented on code in PR #4346: URL: https://github.com/apache/hive/pull/4346#discussion_r1239689742
########## iceberg/iceberg-handler/src/test/results/positive/show_partitions_test.q.out: ########## @@ -0,0 +1,214 @@ +PREHOOK: query: create table hiveT1 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored as orc +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@hiveT1 +POSTHOOK: query: create table hiveT1 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored as orc +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@hiveT1 +PREHOOK: query: insert into hiveT1 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2, 10, 5) +PREHOOK: type: QUERY +PREHOOK: Input: _dummy_database@_dummy_table +PREHOOK: Output: default@hivet1 +POSTHOOK: query: insert into hiveT1 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2, 10, 5) +POSTHOOK: type: QUERY +POSTHOOK: Input: _dummy_database@_dummy_table +POSTHOOK: Output: default@hivet1 +POSTHOOK: Output: default@hivet1@d_part=10/e_part=5 +POSTHOOK: Output: default@hivet1@d_part=2/e_part=5 +POSTHOOK: Output: default@hivet1@d_part=3/e_part=4 +POSTHOOK: Lineage: hivet1 PARTITION(d_part=10,e_part=5).a SCRIPT [] +POSTHOOK: Lineage: hivet1 PARTITION(d_part=10,e_part=5).b SCRIPT [] +POSTHOOK: Lineage: hivet1 PARTITION(d_part=10,e_part=5).c SCRIPT [] +POSTHOOK: Lineage: hivet1 PARTITION(d_part=2,e_part=5).a SCRIPT [] +POSTHOOK: Lineage: hivet1 PARTITION(d_part=2,e_part=5).b SCRIPT [] +POSTHOOK: Lineage: hivet1 PARTITION(d_part=2,e_part=5).c SCRIPT [] +POSTHOOK: Lineage: hivet1 PARTITION(d_part=3,e_part=4).a SCRIPT [] +POSTHOOK: Lineage: hivet1 PARTITION(d_part=3,e_part=4).b SCRIPT [] +POSTHOOK: Lineage: hivet1 PARTITION(d_part=3,e_part=4).c SCRIPT [] +PREHOOK: query: create table ice1 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc TBLPROPERTIES("format-version"='2') +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@ice1 +POSTHOOK: query: create table ice1 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc TBLPROPERTIES("format-version"='2') +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@ice1 +PREHOOK: query: insert into ice1 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2, 10, 5) +PREHOOK: type: QUERY +PREHOOK: Input: _dummy_database@_dummy_table +PREHOOK: Output: default@ice1 +POSTHOOK: query: insert into ice1 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2, 10, 5) +POSTHOOK: type: QUERY +POSTHOOK: Input: _dummy_database@_dummy_table +POSTHOOK: Output: default@ice1 +PREHOOK: query: show partitions hiveT1 +PREHOOK: type: SHOWPARTITIONS +PREHOOK: Input: default@hivet1 +POSTHOOK: query: show partitions hiveT1 +POSTHOOK: type: SHOWPARTITIONS +POSTHOOK: Input: default@hivet1 +d_part=10/e_part=5 +d_part=2/e_part=5 +d_part=3/e_part=4 +PREHOOK: query: show partitions ice1 +PREHOOK: type: SHOWPARTITIONS +PREHOOK: Input: default@ice1 +POSTHOOK: query: show partitions ice1 +POSTHOOK: type: SHOWPARTITIONS +POSTHOOK: Input: default@ice1 +{Spec-id=0}*:d_part=10/e_part=5 +{Spec-id=0}*:d_part=2/e_part=5 +{Spec-id=0}*:d_part=3/e_part=4 +PREHOOK: query: select * from default.ice1.partitions order by `partition` +PREHOOK: type: QUERY +PREHOOK: Input: default@ice1 +PREHOOK: Output: hdfs://### HDFS PATH ### +POSTHOOK: query: select * from default.ice1.partitions order by `partition` +POSTHOOK: type: QUERY +POSTHOOK: Input: default@ice1 +POSTHOOK: Output: hdfs://### HDFS PATH ### +{"d_part":10,"e_part":5} 2 1 0 +{"d_part":2,"e_part":5} 1 1 0 +{"d_part":3,"e_part":4} 2 1 0 +PREHOOK: query: explain show partitions hiveT1 +PREHOOK: type: SHOWPARTITIONS +PREHOOK: Input: default@hivet1 +POSTHOOK: query: explain show partitions hiveT1 +POSTHOOK: type: SHOWPARTITIONS +POSTHOOK: Input: default@hivet1 +Stage-1 + Fetch Operator + limit:-1 + Stage-0 + Show Partitions{"limit:":"-1","table:":"hiveT1"} + +PREHOOK: query: explain show partitions ice1 +PREHOOK: type: SHOWPARTITIONS +PREHOOK: Input: default@ice1 +POSTHOOK: query: explain show partitions ice1 +POSTHOOK: type: SHOWPARTITIONS +POSTHOOK: Input: default@ice1 +Stage-1 + Fetch Operator + limit:-1 + Stage-0 + Show Partitions{"limit:":"-1","table:":"ice1"} + +PREHOOK: query: explain select * from default.ice1.partitions +PREHOOK: type: QUERY +PREHOOK: Input: default@ice1 +PREHOOK: Output: hdfs://### HDFS PATH ### +POSTHOOK: query: explain select * from default.ice1.partitions +POSTHOOK: type: QUERY +POSTHOOK: Input: default@ice1 +POSTHOOK: Output: hdfs://### HDFS PATH ### +Plan optimized by CBO. + +Stage-0 + Fetch Operator + limit:-1 + Select Operator [SEL_1] + Output:["_col0","_col1","_col2","_col3"] + TableScan [TS_0] + Output:["partition","record_count","file_count","spec_id"] + +PREHOOK: query: create table ice2 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc TBLPROPERTIES("format-version"='2') +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@ice2 +POSTHOOK: query: create table ice2 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc TBLPROPERTIES("format-version"='2') +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@ice2 +PREHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2, 10, 5) +PREHOOK: type: QUERY +PREHOOK: Input: _dummy_database@_dummy_table +PREHOOK: Output: default@ice2 +POSTHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2, 10, 5) +POSTHOOK: type: QUERY +POSTHOOK: Input: _dummy_database@_dummy_table +POSTHOOK: Output: default@ice2 +PREHOOK: query: select * from default.ice2.partitions order by `partition` +PREHOOK: type: QUERY +PREHOOK: Input: default@ice2 +PREHOOK: Output: hdfs://### HDFS PATH ### +POSTHOOK: query: select * from default.ice2.partitions order by `partition` +POSTHOOK: type: QUERY +POSTHOOK: Input: default@ice2 +POSTHOOK: Output: hdfs://### HDFS PATH ### +{"d_part":10,"e_part":5} 2 1 0 +{"d_part":2,"e_part":5} 1 1 0 +{"d_part":3,"e_part":4} 2 1 0 +PREHOOK: query: show partitions ice2 +PREHOOK: type: SHOWPARTITIONS +PREHOOK: Input: default@ice2 +POSTHOOK: query: show partitions ice2 +POSTHOOK: type: SHOWPARTITIONS +POSTHOOK: Input: default@ice2 +{Spec-id=0}*:d_part=10/e_part=5 +{Spec-id=0}*:d_part=2/e_part=5 +{Spec-id=0}*:d_part=3/e_part=4 +PREHOOK: query: ALTER TABLE ice2 SET PARTITION SPEC (c) +PREHOOK: type: ALTERTABLE_SETPARTSPEC +PREHOOK: Input: default@ice2 +POSTHOOK: query: ALTER TABLE ice2 SET PARTITION SPEC (c) +POSTHOOK: type: ALTERTABLE_SETPARTSPEC +POSTHOOK: Input: default@ice2 +POSTHOOK: Output: default@ice2 +PREHOOK: query: select * from default.ice2.partitions order by `partition` +PREHOOK: type: QUERY +PREHOOK: Input: default@ice2 +PREHOOK: Output: hdfs://### HDFS PATH ### +POSTHOOK: query: select * from default.ice2.partitions order by `partition` +POSTHOOK: type: QUERY +POSTHOOK: Input: default@ice2 +POSTHOOK: Output: hdfs://### HDFS PATH ### +{"d_part":10,"e_part":5,"c":null} 2 1 0 +{"d_part":2,"e_part":5,"c":null} 1 1 0 +{"d_part":3,"e_part":4,"c":null} 2 1 0 +PREHOOK: query: show partitions ice2 +PREHOOK: type: SHOWPARTITIONS +PREHOOK: Input: default@ice2 +POSTHOOK: query: show partitions ice2 +POSTHOOK: type: SHOWPARTITIONS +POSTHOOK: Input: default@ice2 +{Spec-id=0}:d_part=10/e_part=5 Review Comment: LTER TABLE ice2 SET PARTITION SPEC (c) ; select * from default.ice2.partitions order by `partition`; show partitions ice2; ==================== ``` POSTHOOK: type: SHOWPARTITIONS POSTHOOK: Input: default@ice2 {Spec-id=0}:d_part=10/e_part=5 {Spec-id=0}:d_part=2/e_part=5 {Spec-id=0}:d_part=3/e_part=4 ``` ==================== insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 3, 2, 5), ('aa', 1, 4, 10, 5), ('aa', 1, 5, 10, 5); select * from default.ice2.partitions order by `partition`; show partitions ice2; ==================== ``` POSTHOOK: Input: default@ice2 {Spec-id=0}:d_part=10/e_part=5 {Spec-id=0}:d_part=2/e_part=5 {Spec-id=0}:d_part=3/e_part=4 {Spec-id=1}*:c=2 {Spec-id=1}*:c=3 {Spec-id=1}*:c=4 {Spec-id=1}*:c=5 ``` =================== The partition shows up in the iceberg.partitions table only after new rows are inserted to the table after the spec has changed. Updated the PR to the following as discussed: ``` spec-id=0/d_part=10/e_part=5 spec-id=0/d_part=2/e_part=5 spec-id=0/d_part=3/e_part=4 current-spec-id=1/c=2 current-spec-id=1/c=3 current-spec-id=1/c=4 current-spec-id=1/c=5 ``` -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org