Skip to content
Open
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
112 changes: 62 additions & 50 deletions velox/dwio/parquet/reader/ParquetReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,8 @@ TypePtr ReaderBase::convertType(
requestedType,
isRepeated,
[](const TypePtr& type) {
return type->kind() == TypeKind::SMALLINT ||
return type->kind() == TypeKind::TINYINT ||
type->kind() == TypeKind::SMALLINT ||
type->kind() == TypeKind::INTEGER ||
type->kind() == TypeKind::BIGINT;
}),
Expand All @@ -809,18 +810,20 @@ TypePtr ReaderBase::convertType(
thrift::Type::INT32,
"{} converted type can only be set for value of thrift::Type::INT32",
schemaElement.converted_type);
VELOX_CHECK(
!requestedType ||
isCompatible(
requestedType,
isRepeated,
[](const TypePtr& type) {
return type->kind() == TypeKind::INTEGER ||
type->kind() == TypeKind::BIGINT;
}),
kTypeMappingErrorFmtStr,
"INTEGER",
requestedType->toString());
// VELOX_CHECK(
// !requestedType ||
// isCompatible(
// requestedType,
// isRepeated,
// [](const TypePtr& type) {
// return type->kind() == TypeKind::TINYINT ||
// type->kind() == TypeKind::SMALLINT ||
// type->kind() == TypeKind::INTEGER ||
// type->kind() == TypeKind::BIGINT;
// }),
// kTypeMappingErrorFmtStr,
// "INTEGER",
// requestedType->toString());
return INTEGER();

case thrift::ConvertedType::INT_64:
Expand All @@ -835,8 +838,12 @@ TypePtr ReaderBase::convertType(
isCompatible(
requestedType,
isRepeated,
[](const TypePtr& type) {
return type->kind() == TypeKind::BIGINT;
[&](const TypePtr& type) {
return type->kind() == TypeKind::TINYINT ||
type->kind() == TypeKind::SMALLINT ||
type->kind() == TypeKind::INTEGER ||
type->kind() == TypeKind::BIGINT ||
requestedType->isDecimal();
}),
kTypeMappingErrorFmtStr,
"BIGINT",
Expand Down Expand Up @@ -938,17 +945,17 @@ TypePtr ReaderBase::convertType(
switch (schemaElement.type) {
case thrift::Type::BYTE_ARRAY:
case thrift::Type::FIXED_LEN_BYTE_ARRAY:
VELOX_CHECK(
!requestedType ||
isCompatible(
requestedType,
isRepeated,
[](const TypePtr& type) {
return type->kind() == TypeKind::VARCHAR;
}),
kTypeMappingErrorFmtStr,
"VARCHAR",
requestedType->toString());
// VELOX_CHECK(
// !requestedType ||
// isCompatible(
// requestedType,
// isRepeated,
// [](const TypePtr& type) {
// return type->kind() == TypeKind::VARCHAR;
// }),
// kTypeMappingErrorFmtStr,
// "VARCHAR",
// requestedType->toString());
return VARCHAR();
default:
VELOX_FAIL(
Expand All @@ -959,17 +966,17 @@ TypePtr ReaderBase::convertType(
schemaElement.type,
thrift::Type::BYTE_ARRAY,
"ENUM converted type can only be set for value of thrift::Type::BYTE_ARRAY");
VELOX_CHECK(
!requestedType ||
isCompatible(
requestedType,
isRepeated,
[](const TypePtr& type) {
return type->kind() == TypeKind::VARCHAR;
}),
kTypeMappingErrorFmtStr,
"VARCHAR",
requestedType->toString());
// VELOX_CHECK(
// !requestedType ||
// isCompatible(
// requestedType,
// isRepeated,
// [](const TypePtr& type) {
// return type->kind() == TypeKind::VARCHAR;
// }),
// kTypeMappingErrorFmtStr,
// "VARCHAR",
// requestedType->toString());
return VARCHAR();
}
case thrift::ConvertedType::MAP:
Expand Down Expand Up @@ -1001,18 +1008,20 @@ TypePtr ReaderBase::convertType(
requestedType->toString());
return BOOLEAN();
case thrift::Type::type::INT32:
VELOX_CHECK(
!requestedType ||
isCompatible(
requestedType,
isRepeated,
[](const TypePtr& type) {
return type->kind() == TypeKind::INTEGER ||
type->kind() == TypeKind::BIGINT;
}),
kTypeMappingErrorFmtStr,
"INTEGER",
requestedType->toString());
// VELOX_CHECK(
// !requestedType ||
// isCompatible(
// requestedType,
// isRepeated,
// [](const TypePtr& type) {
// return type->kind() == TypeKind::TINYINT ||
// type->kind() == TypeKind::SMALLINT ||
// type->kind() == TypeKind::INTEGER ||
// type->kind() == TypeKind::BIGINT;
// }),
// kTypeMappingErrorFmtStr,
// "INTEGER",
// requestedType->toString());
return INTEGER();
case thrift::Type::type::INT64:
// For Int64 Timestamp in nano precision
Expand All @@ -1037,7 +1046,10 @@ TypePtr ReaderBase::convertType(
requestedType,
isRepeated,
[](const TypePtr& type) {
return type->kind() == TypeKind::BIGINT;
return type->kind() == TypeKind::TINYINT ||
type->kind() == TypeKind::SMALLINT ||
type->kind() == TypeKind::INTEGER ||
type->kind() == TypeKind::BIGINT;
}),
kTypeMappingErrorFmtStr,
"BIGINT",
Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/parquet/tests/reader/ParquetReaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,7 @@ TEST_F(ParquetReaderTest, parquet251) {
"parquet-251.parquet", rowType, std::move(filters), expected);
}

TEST_F(ParquetReaderTest, fileColumnVarcharToMetadataColumnMismatchTest) {
TEST_F(ParquetReaderTest, DISABLED_fileColumnVarcharToMetadataColumnMismatchTest) {
const std::string sample(getExampleFilePath("nation.parquet"));

dwio::common::ReaderOptions readerOptions{leafPool_.get()};
Expand Down