From 110e3e36682207a86eaab5b04324188ae941de85 Mon Sep 17 00:00:00 2001 From: Colin Dellow Date: Mon, 12 Mar 2018 21:09:00 -0400 Subject: [PATCH] row group skipping for is [not] null queries --- parquet/parquet_cursor.cc | 9 +++++++-- tests/test-queries | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/parquet/parquet_cursor.cc b/parquet/parquet_cursor.cc index e355298..2dd512d 100644 --- a/parquet/parquet_cursor.cc +++ b/parquet/parquet_cursor.cc @@ -44,11 +44,16 @@ bool ParquetCursor::currentRowGroupSatisfiesFilter() { if(column == -1) { rv = currentRowGroupSatisfiesRowIdFilter(constraints[i]); } else { - // printf("column = %d\n", column); - // std::unique_ptr md = rowGroupMetadata->ColumnChunk(column); + std::unique_ptr md = rowGroupMetadata->ColumnChunk(column); + if(!md->is_stats_set()) { + continue; + } + std::shared_ptr stats = md->statistics(); if(op == IsNull) { + rv = stats->null_count() > 0; } else if(op == IsNotNull) { + rv = stats->num_values() > 0; } } diff --git a/tests/test-queries b/tests/test-queries index 5d93030..33f63aa 100755 --- a/tests/test-queries +++ b/tests/test-queries @@ -39,7 +39,7 @@ main() { exit 1 fi - if [ "$(cat testcases.txt | wc -l)" == "1" ]; then + if [ ! -v NO_DEBUG ] && [ "$(cat testcases.txt | wc -l)" == "1" ]; then set -x gdb -ex run --args "$root"/sqlite/sqlite3 -init testcase-cmds.txt else