@@ -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