diff --git a/velox/dwio/common/ScanSpec.cpp b/velox/dwio/common/ScanSpec.cpp index 005c6eaa47ae9..100e9b79b0c69 100644 --- a/velox/dwio/common/ScanSpec.cpp +++ b/velox/dwio/common/ScanSpec.cpp @@ -277,15 +277,7 @@ bool testFilter( const TypePtr& type) { bool mayHaveNull = true; - // Has-null statistics is often not set. Hence, we supplement it with - // number-of-values statistic to detect no-null columns more often. - // Number-of-values is the number of non-null values. When it is equal to - // total number of values, we know there are no nulls. if (stats->getNumberOfValues().has_value()) { - if (stats->getNumberOfValues().value() == 0) { - // Column is all null. - return filter->testNull(); - } mayHaveNull = stats->getNumberOfValues().value() < totalRows; } diff --git a/velox/dwio/parquet/tests/examples/null_map.parquet b/velox/dwio/parquet/tests/examples/null_map.parquet new file mode 100644 index 0000000000000..64dbe3e87a43c Binary files /dev/null and b/velox/dwio/parquet/tests/examples/null_map.parquet differ diff --git a/velox/dwio/parquet/tests/reader/ParquetTableScanTest.cpp b/velox/dwio/parquet/tests/reader/ParquetTableScanTest.cpp index f7a66ae039524..3da6984d3135d 100644 --- a/velox/dwio/parquet/tests/reader/ParquetTableScanTest.cpp +++ b/velox/dwio/parquet/tests/reader/ParquetTableScanTest.cpp @@ -354,6 +354,19 @@ TEST_F(ParquetTableScanTest, map) { assertSelectWithFilter({"map"}, {}, "", "SELECT map FROM tmp"); } +TEST_F(ParquetTableScanTest, nullMap) { + auto path = getExampleFilePath("null_map.parquet"); + loadData( + path, + ROW({"i", "c"}, {VARCHAR(), MAP(VARCHAR(), VARCHAR())}), + makeRowVector( + {"i", "c"}, + {makeConstant("1", 1), + makeNullableMapVector({std::nullopt})})); + + assertSelectWithFilter({"i", "c"}, {}, "", "SELECT i, c FROM tmp"); +} + // Core dump is fixed. TEST_F(ParquetTableScanTest, singleRowStruct) { auto vector = makeArrayVector({{}});