Skip to content

Commit

Permalink
[BugFix] add null value count to iceberg value count (#50699)
Browse files Browse the repository at this point in the history
Signed-off-by: stephen <[email protected]>
(cherry picked from commit 37ef12f)
  • Loading branch information
stephen-shelby authored and mergify[bot] committed Sep 5, 2024
1 parent b037d88 commit 3b43759
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions be/src/formats/parquet/parquet_file_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ FileWriter::FileStatistics ParquetFileWriter::_statistics(const ::parquet::FileM
if (column_stat->HasNullCount()) {
has_null_count = true;
null_value_counts[field_id] = column_stat->null_count();
value_counts[field_id] += column_stat->null_count();
}
if (column_stat->HasMinMax()) {
has_min_max = true;
Expand Down
26 changes: 26 additions & 0 deletions test/sql/test_iceberg/R/test_write_null
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- name: test_write_null
create external catalog iceberg_sql_test_${uuid0} PROPERTIES ("type"="iceberg", "iceberg.catalog.type"="hive", "iceberg.catalog.hive.metastore.uris"="${iceberg_catalog_hive_metastore_uris}","enable_iceberg_metadata_cache"="true","aws.s3.access_key" = "${oss_ak}","aws.s3.secret_key" = "${oss_sk}","aws.s3.endpoint" = "${oss_endpoint}");
-- result:
-- !result
create database iceberg_sql_test_${uuid0}.iceberg_db_${uuid0};
-- result:
-- !result
create external table iceberg_sql_test_${uuid0}.iceberg_db_${uuid0}.ice_tbl_${uuid0} (k1 int);
-- result:
-- !result
insert into iceberg_sql_test_${uuid0}.iceberg_db_${uuid0}.ice_tbl_${uuid0} select null;
-- result:
-- !result
select element_at(value_counts,1) from iceberg_sql_test_${uuid0}.iceberg_db_${uuid0}.ice_tbl_${uuid0}$files;
-- result:
1
-- !result
drop table iceberg_sql_test_${uuid0}.iceberg_db_${uuid0}.ice_tbl_${uuid0} force;
-- result:
-- !result
drop database iceberg_sql_test_${uuid0}.iceberg_db_${uuid0};
-- result:
-- !result
drop catalog iceberg_sql_test_${uuid0};
-- result:
-- !result
12 changes: 12 additions & 0 deletions test/sql/test_iceberg/T/test_write_null
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- name: test_write_null

create external catalog iceberg_sql_test_${uuid0} PROPERTIES ("type"="iceberg", "iceberg.catalog.type"="hive", "iceberg.catalog.hive.metastore.uris"="${iceberg_catalog_hive_metastore_uris}","enable_iceberg_metadata_cache"="true","aws.s3.access_key" = "${oss_ak}","aws.s3.secret_key" = "${oss_sk}","aws.s3.endpoint" = "${oss_endpoint}");

create database iceberg_sql_test_${uuid0}.iceberg_db_${uuid0};
create external table iceberg_sql_test_${uuid0}.iceberg_db_${uuid0}.ice_tbl_${uuid0} (k1 int);
insert into iceberg_sql_test_${uuid0}.iceberg_db_${uuid0}.ice_tbl_${uuid0} select null;
select element_at(value_counts,1) from iceberg_sql_test_${uuid0}.iceberg_db_${uuid0}.ice_tbl_${uuid0}$files;

drop table iceberg_sql_test_${uuid0}.iceberg_db_${uuid0}.ice_tbl_${uuid0} force;
drop database iceberg_sql_test_${uuid0}.iceberg_db_${uuid0};
drop catalog iceberg_sql_test_${uuid0};

0 comments on commit 3b43759

Please sign in to comment.