Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions velox/dwio/parquet/reader/ParquetReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ std::shared_ptr<const ParquetTypeWithId> ReaderBase::getParquetColumnInfo(
schemaElement.name,
std::nullopt,
maxRepeat,
maxDefine);
maxDefine - 1);
}
return leafTypePtr;
}
Expand Down Expand Up @@ -381,6 +381,9 @@ TypePtr ReaderBase::convertType(
}

case thrift::ConvertedType::UTF8:
// Thrift ENUM values are converted to Parquet binaries containing UTF-8
// strings.
case thrift::ConvertedType::ENUM:
switch (schemaElement.type) {
case thrift::Type::BYTE_ARRAY:
case thrift::Type::FIXED_LEN_BYTE_ARRAY:
Expand All @@ -392,7 +395,6 @@ TypePtr ReaderBase::convertType(
case thrift::ConvertedType::MAP:
case thrift::ConvertedType::MAP_KEY_VALUE:
case thrift::ConvertedType::LIST:
case thrift::ConvertedType::ENUM:
case thrift::ConvertedType::TIME_MILLIS:
case thrift::ConvertedType::TIME_MICROS:
case thrift::ConvertedType::JSON:
Expand Down
Binary file added velox/dwio/parquet/tests/examples/part-r-0.parquet
Binary file not shown.
36 changes: 29 additions & 7 deletions velox/dwio/parquet/tests/reader/ParquetTableScanTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,42 @@ TEST_F(ParquetTableScanTest, map) {
}

// Array reader result has missing result.
// TEST_F(ParquetTableScanTest, array) {
// auto vector = makeArrayVector<int32_t>({{1, 2, 3}});
TEST_F(ParquetTableScanTest, array) {
auto vector = makeArrayVector<int32_t>({{1, 2, 3}});

loadData(
getExampleFilePath("old-repeated-int.parquet"),
ROW({"repeatedInt"}, {ARRAY(INTEGER())}),
makeRowVector(
{"repeatedInt"},
{
vector,
}));

assertSelectWithFilter(
{"repeatedInt"}, {}, "", "SELECT repeatedInt FROM tmp");
}

// Failed unit test on Velox array reader.
// Optional array with required elements.
// TEST_F(ParquetTableScanTest, optionalArray) {
// auto vector = makeArrayVector<StringView>({
// {"a", "b"},
// {"c", "d"},
// {"e", "f"},
// });

// loadData(
// getExampleFilePath("old-repeated-int.parquet"),
// ROW({"repeatedInt"}, {ARRAY(INTEGER())}),
// getExampleFilePath("part-r-0.parquet"),
// ROW({"_1"}, {ARRAY(VARCHAR())}),
// makeRowVector(
// {"repeatedInt"},
// {"_1"},
// {
// vector,
// }));

// assertSelectWithFilter({"repeatedInt"}, {}, "", "SELECT repeatedInt FROM
// tmp");
// assertSelectWithFilter(
// {"_1"}, {}, "", "SELECT _1 FROM tmp");
// }

// Failed unit test on Velox map reader.
Expand Down