Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,12 @@ private static Schema readSchema(Configuration conf, Table table, boolean caseSe
}

String[] selectedColumns = InputFormatConfig.selectedColumns(conf);
if (selectedColumns == null) {
return table.schema();
}
readSchema = table.schema();

readSchema = caseSensitive ? table.schema().select(selectedColumns) :
table.schema().caseInsensitiveSelect(selectedColumns);
if (selectedColumns != null) {
readSchema =
caseSensitive ? readSchema.select(selectedColumns) : readSchema.caseInsensitiveSelect(selectedColumns);
}

if (InputFormatConfig.fetchVirtualColumns(conf)) {
return IcebergAcidUtil.createFileReadSchemaWithVirtualColums(readSchema.columns(), table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ drop table if exists tbl_ice;
create external table tbl_ice(a int, b string) partitioned by (c int) stored by iceberg stored as orc tblproperties ('format-version'='2');
insert into tbl_ice values (1, 'one', 50), (2, 'two', 50), (3, 'three', 50), (4, 'four', 52), (5, 'five', 54), (111, 'one', 52), (333, 'two', 56);

select tbl_ice.ROW__POSITION from tbl_ice;

select a, c, tbl_ice.PARTITION__SPEC__ID, tbl_ice.PARTITION__HASH, tbl_ice.ROW__POSITION from tbl_ice
order by tbl_ice.PARTITION__HASH, tbl_ice.ROW__POSITION desc;

select a, c, tbl_ice.PARTITION__SPEC__ID, tbl_ice.PARTITION__HASH, tbl_ice.ROW__POSITION from tbl_ice
sort by tbl_ice.PARTITION__HASH, tbl_ice.ROW__POSITION desc;


-- create a table with more than 4 columns
create table ice01 (a int, b int, c int, d int, e int) stored by iceberg tblproperties ('format-version'='2');
insert into ice01 values (1,2,3,4,5), (6,7,8,9,10);

select ice01.ROW__POSITION from ice01;
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ POSTHOOK: query: insert into tbl_ice values (1, 'one', 50), (2, 'two', 50), (3,
POSTHOOK: type: QUERY
POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@tbl_ice
PREHOOK: query: select tbl_ice.ROW__POSITION from tbl_ice
PREHOOK: type: QUERY
PREHOOK: Input: default@tbl_ice
PREHOOK: Output: hdfs://### HDFS PATH ###
POSTHOOK: query: select tbl_ice.ROW__POSITION from tbl_ice
POSTHOOK: type: QUERY
POSTHOOK: Input: default@tbl_ice
POSTHOOK: Output: hdfs://### HDFS PATH ###
0
1
2
0
1
0
0
PREHOOK: query: select a, c, tbl_ice.PARTITION__SPEC__ID, tbl_ice.PARTITION__HASH, tbl_ice.ROW__POSITION from tbl_ice
order by tbl_ice.PARTITION__HASH, tbl_ice.ROW__POSITION desc
PREHOOK: type: QUERY
Expand Down Expand Up @@ -54,3 +69,29 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
4 52 0 83 0
5 54 0 85 0
333 56 0 87 0
PREHOOK: query: create table ice01 (a int, b int, c int, d int, e int) stored by iceberg tblproperties ('format-version'='2')
PREHOOK: type: CREATETABLE
PREHOOK: Output: database:default
PREHOOK: Output: default@ice01
POSTHOOK: query: create table ice01 (a int, b int, c int, d int, e int) stored by iceberg tblproperties ('format-version'='2')
POSTHOOK: type: CREATETABLE
POSTHOOK: Output: database:default
POSTHOOK: Output: default@ice01
PREHOOK: query: insert into ice01 values (1,2,3,4,5), (6,7,8,9,10)
PREHOOK: type: QUERY
PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@ice01
POSTHOOK: query: insert into ice01 values (1,2,3,4,5), (6,7,8,9,10)
POSTHOOK: type: QUERY
POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@ice01
PREHOOK: query: select ice01.ROW__POSITION from ice01
PREHOOK: type: QUERY
PREHOOK: Input: default@ice01
PREHOOK: Output: hdfs://### HDFS PATH ###
POSTHOOK: query: select ice01.ROW__POSITION from ice01
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice01
POSTHOOK: Output: hdfs://### HDFS PATH ###
0
1