From 1434e662b7f8197bd65fee3636deaf939f54e740 Mon Sep 17 00:00:00 2001 From: Jimmy Lu Date: Mon, 23 Sep 2024 06:58:36 -0700 Subject: [PATCH] Enable reading explicit row number column from Prism connector Summary: Also add the missing implementation for `FlatMapAsStructColumnReader::estimateMaterializedSize`. Differential Revision: D63151114 --- velox/dwio/common/ColumnSelector.cpp | 2 +- velox/exec/tests/TableScanTest.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/velox/dwio/common/ColumnSelector.cpp b/velox/dwio/common/ColumnSelector.cpp index ef57fff7ab0f6..228da970af4ca 100644 --- a/velox/dwio/common/ColumnSelector.cpp +++ b/velox/dwio/common/ColumnSelector.cpp @@ -344,7 +344,7 @@ std::shared_ptr ColumnSelector::fromScanSpec( const RowTypePtr& rowType) { std::vector columnNames; for (auto& child : spec.children()) { - if (child->isConstant()) { + if (child->isConstant() || child->isExplicitRowNumber()) { continue; } std::string name = child->fieldName(); diff --git a/velox/exec/tests/TableScanTest.cpp b/velox/exec/tests/TableScanTest.cpp index fbf5723be09d7..f8ad084362092 100644 --- a/velox/exec/tests/TableScanTest.cpp +++ b/velox/exec/tests/TableScanTest.cpp @@ -5090,6 +5090,10 @@ TEST_F(TableScanTest, rowNumberInRemainingFilter) { auto file = TempFilePath::create(); writeToFile(file->getPath(), {vector}); auto outputType = ROW({"c1"}, {BIGINT()}); + // We should not need r1 in table schema for production code; this is just to + // infer type of r1 in remaining filter expression parser. We probably need + // to find a way to specify the type of r1 without adding it to table schema + // to test this case. For now it's essentially untested. auto schema = ROW({"c1", "r1"}, {BIGINT(), BIGINT()}); auto plan = PlanBuilder() .startTableScan()