Skip to content

Commit

Permalink
Merge pull request #52 from samansmink/fix-count-star-with-partition-…
Browse files Browse the repository at this point in the history
…values

fix bug with count star and partition values
  • Loading branch information
samansmink authored Jul 15, 2024
2 parents b3def68 + e0add7b commit d4965f0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/functions/delta_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,9 @@ void DeltaMultiFileReader::FinalizeBind(const MultiFileReaderOptions &file_optio
if (!file_metadata->partition_map.empty()) {
for (idx_t i = 0; i < global_column_ids.size(); i++) {
column_t col_id = global_column_ids[i];
if (IsRowIdColumnId(col_id)) {
continue;
}
auto col_partition_entry = file_metadata->partition_map.find(global_names[col_id]);
if (col_partition_entry != file_metadata->partition_map.end()) {
// Todo: use https://github.com/delta-io/delta/blob/master/PROTOCOL.md#partition-value-serialization
Expand Down
41 changes: 40 additions & 1 deletion test/sql/dat/all.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ query I rowsort nested_types
SELECT *
FROM delta_scan('${DAT_PATH}/out/reader_tests/generated/nested_types/delta')
----

query I rowsort nested_types
SELECT *
FROM parquet_scan('${DAT_PATH}/out/reader_tests/generated/nested_types/expected/latest/**/*.parquet')
Expand All @@ -43,6 +42,16 @@ SELECT *
FROM parquet_scan('${DAT_PATH}/out/reader_tests/generated/basic_append/expected/latest/**/*.parquet')
----

query I rowsort basic_append_count
SELECT count(*)
FROM delta_scan('${DAT_PATH}/out/reader_tests/generated/basic_append/delta')
----

query I rowsort basic_append_count
SELECT count(*)
FROM parquet_scan('${DAT_PATH}/out/reader_tests/generated/basic_append/expected/latest/**/*.parquet')
----

# with_schema_change
query I rowsort with_checkpoint
SELECT *
Expand All @@ -54,6 +63,16 @@ SELECT *
FROM parquet_scan('${DAT_PATH}/out/reader_tests/generated/with_schema_change/expected/latest/**/*.parquet')
----

query I rowsort with_checkpoint_count
SELECT count(*)
FROM delta_scan('${DAT_PATH}/out/reader_tests/generated/with_schema_change/delta')
----

query I rowsort with_checkpoint_count
SELECT count(*)
FROM parquet_scan('${DAT_PATH}/out/reader_tests/generated/with_schema_change/expected/latest/**/*.parquet')
----

# basic_partitioned
query I rowsort basic_partitioned
SELECT *
Expand All @@ -65,6 +84,16 @@ SELECT *
FROM parquet_scan('${DAT_PATH}/out/reader_tests/generated/basic_partitioned/expected/latest/**/*.parquet')
----

query I rowsort basic_partitioned_count
SELECT count(*)
FROM delta_scan('${DAT_PATH}/out/reader_tests/generated/basic_partitioned/delta')
----

query I rowsort basic_partitioned_count
SELECT count(*)
FROM parquet_scan('${DAT_PATH}/out/reader_tests/generated/basic_partitioned/expected/latest/**/*.parquet')
----

# multi_partitioned
query I rowsort multi_partitioned
SELECT *
Expand All @@ -76,6 +105,16 @@ SELECT letter, date, decode(data) as data, number
FROM parquet_scan('${DAT_PATH}/out/reader_tests/generated/multi_partitioned/expected/latest/**/*.parquet')
----

query I rowsort multi_partitioned_count
SELECT count(*)
FROM delta_scan('${DAT_PATH}/out/reader_tests/generated/multi_partitioned/delta')
----

query I rowsort multi_partitioned_count
SELECT count(*)
FROM parquet_scan('${DAT_PATH}/out/reader_tests/generated/multi_partitioned/expected/latest/**/*.parquet')
----

# TODO: fix this
require notwindows

Expand Down

0 comments on commit d4965f0

Please sign in to comment.