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
6 changes: 4 additions & 2 deletions src/iceberg/parquet/parquet_schema_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,14 @@ Status ValidateParquetTypeCompatibility(
}
break;
case TypeId::kString:
if (arrow_type->id() == ::arrow::Type::STRING) {
if (arrow_type->id() == ::arrow::Type::STRING ||
arrow_type->id() == ::arrow::Type::LARGE_STRING) {
return {};
}
break;
case TypeId::kBinary:
if (arrow_type->id() == ::arrow::Type::BINARY) {
if (arrow_type->id() == ::arrow::Type::BINARY ||
arrow_type->id() == ::arrow::Type::LARGE_BINARY) {
return {};
}
break;
Expand Down
30 changes: 30 additions & 0 deletions src/iceberg/test/parquet_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,36 @@ TEST_F(ParquetReaderTest, ReadSmallDecimalsWithStoredArrowSchema) {
}
}

TEST_F(ParquetReaderTest, ReadLargeStringAndBinaryWithStoredArrowSchema) {
const std::string kParquetFieldIdKey = "PARQUET:field_id";
auto type = ::arrow::struct_(
{::arrow::field("name", ::arrow::large_utf8(), /*nullable=*/true,
::arrow::KeyValueMetadata::Make({kParquetFieldIdKey}, {"1"})),
::arrow::field("payload", ::arrow::large_binary(), /*nullable=*/true,
::arrow::KeyValueMetadata::Make({kParquetFieldIdKey}, {"2"})),
::arrow::field(
"tags",
::arrow::list(::arrow::field(
"element", ::arrow::large_utf8(), /*nullable=*/true,
::arrow::KeyValueMetadata::Make({kParquetFieldIdKey}, {"101"}))),
/*nullable=*/true,
::arrow::KeyValueMetadata::Make({kParquetFieldIdKey}, {"3"}))});
constexpr std::string_view kJson = R"([["Foo", "abc", ["a", "b"]], [null, "", []]])";
ASSERT_NO_FATAL_FAILURE(CreateParquetFileWithArrowSchema(type, kJson));

auto schema = std::make_shared<Schema>(std::vector<SchemaField>{
SchemaField::MakeOptional(1, "name", string()),
SchemaField::MakeOptional(2, "payload", binary()),
SchemaField::MakeOptional(
3, "tags", list(SchemaField::MakeOptional(101, "element", string())))});
auto reader = ReaderFactoryRegistry::Open(
FileFormatType::kParquet,
{.path = temp_parquet_file_, .io = file_io_, .projection = schema});
ASSERT_THAT(reader, IsOk());
ASSERT_NO_FATAL_FAILURE(VerifyNextBatch(**reader, kJson));
ASSERT_NO_FATAL_FAILURE(VerifyExhausted(**reader));
}

TEST_F(ParquetReaderTest, ReadReorderedFieldsWithNulls) {
CreateSimpleParquetFile();

Expand Down
Loading