Skip to content

Commit c336990

Browse files
committed
fix
1 parent 8c93f60 commit c336990

2 files changed

Lines changed: 8 additions & 22 deletions

File tree

src/paimon/format/avro/avro_direct_decoder.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ Status SkipAvroValue(const ::avro::NodePtr& avro_node, ::avro::Decoder* decoder)
7676
decoder->skipBytes();
7777
return Status::OK();
7878

79-
case ::avro::AVRO_FIXED:
80-
decoder->skipFixed(avro_node->fixedSize());
81-
return Status::OK();
82-
8379
case ::avro::AVRO_RECORD: {
8480
// Skip all fields in order
8581
for (size_t i = 0; i < avro_node->leaves(); ++i) {
@@ -88,10 +84,6 @@ Status SkipAvroValue(const ::avro::NodePtr& avro_node, ::avro::Decoder* decoder)
8884
return Status::OK();
8985
}
9086

91-
case ::avro::AVRO_ENUM:
92-
decoder->decodeEnum();
93-
return Status::OK();
94-
9587
case ::avro::AVRO_ARRAY: {
9688
const auto& element_node = avro_node->leafAt(0);
9789
// skipArray() returns count like arrayStart(), must handle all blocks

src/paimon/format/avro/avro_direct_encoder.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Status AvroDirectEncoder::EncodeArrowToAvro(const ::avro::NodePtr& avro_node,
139139
}
140140

141141
case ::avro::AVRO_LONG: {
142-
// AVRO_LONG can represent: int64, time (microseconds), timestamp (microseconds)
142+
// AVRO_LONG can represent: int64, timestamp
143143
switch (array.type()->id()) {
144144
case arrow::Type::INT64: {
145145
const auto& int64_array =
@@ -286,10 +286,9 @@ Status AvroDirectEncoder::EncodeArrowToAvro(const ::avro::NodePtr& avro_node,
286286
}
287287
encoder.arrayEnd();
288288
return Status::OK();
289-
}
290-
291-
// Handle MapArray (for Avro maps with non-string keys)
292-
if (array.type()->id() == arrow::Type::MAP) {
289+
} else if (array.type()->id() == arrow::Type::MAP &&
290+
AvroUtils::HasMapLogicalType(avro_node)) {
291+
// Handle MapArray (for Avro maps with non-string keys)
293292
if (PAIMON_UNLIKELY(element_node->type() != ::avro::AVRO_RECORD ||
294293
element_node->leaves() != 2)) {
295294
return Status::Invalid(
@@ -354,23 +353,18 @@ Status AvroDirectEncoder::EncodeArrowToAvro(const ::avro::NodePtr& avro_node,
354353

355354
for (int64_t i = start; i < end; ++i) {
356355
encoder.startItem();
356+
const auto& string_array =
357+
arrow::internal::checked_cast<const arrow::StringArray&>(*keys);
358+
std::string_view key_value = string_array.GetView(i);
359+
encoder.encodeString(std::string(key_value));
357360

358-
if (keys->type()->id() == arrow::Type::STRING) {
359-
const auto& string_array =
360-
arrow::internal::checked_cast<const arrow::StringArray&>(*keys);
361-
std::string_view key_value = string_array.GetView(i);
362-
encoder.encodeString(std::string(key_value));
363-
}
364361
PAIMON_RETURN_NOT_OK(EncodeArrowToAvro(value_node, encoder, *values, i, ctx));
365362
}
366363
}
367364
encoder.mapEnd();
368365
return Status::OK();
369366
}
370367

371-
case ::avro::AVRO_ENUM:
372-
return Status::NotImplemented("ENUM type encoding not yet implemented");
373-
374368
case ::avro::AVRO_UNION:
375369
// Already handled above
376370
return Status::Invalid("Unexpected union handling");

0 commit comments

Comments
 (0)