Skip to content

Commit 9f490a6

Browse files
authored
fix(avro): format avro types in decoder errors (alibaba#343)
1 parent 62e3794 commit 9f490a6

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/paimon/format/avro/avro_direct_decoder.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ Status DecodeAvroValueToBuilder(const ::avro::NodePtr& avro_node,
289289
case arrow::Type::DATE32: {
290290
if (logical_type.type() != ::avro::LogicalType::Type::DATE) {
291291
return Status::TypeError(
292-
fmt::format("Unexpected avro type [{}] with arrow type [{}].", type,
293-
arrow_type->ToString()));
292+
fmt::format("Unexpected avro type [{}] with arrow type [{}].",
293+
::avro::toString(type), arrow_type->ToString()));
294294
}
295295
auto* builder =
296296
arrow::internal::checked_cast<arrow::Date32Builder*>(array_builder);
@@ -299,8 +299,8 @@ Status DecodeAvroValueToBuilder(const ::avro::NodePtr& avro_node,
299299
}
300300
default:
301301
return Status::TypeError(
302-
fmt::format("Unexpected avro type [{}] with arrow type [{}].", type,
303-
arrow_type->ToString()));
302+
fmt::format("Unexpected avro type [{}] with arrow type [{}].",
303+
::avro::toString(type), arrow_type->ToString()));
304304
}
305305
}
306306

@@ -332,8 +332,8 @@ Status DecodeAvroValueToBuilder(const ::avro::NodePtr& avro_node,
332332
}
333333
default:
334334
return Status::TypeError(
335-
fmt::format("Unexpected avro type [{}] with arrow type [{}].", type,
336-
array_builder->type()->ToString()));
335+
fmt::format("Unexpected avro type [{}] with arrow type [{}].",
336+
::avro::toString(type), array_builder->type()->ToString()));
337337
}
338338
}
339339

@@ -379,8 +379,8 @@ Status DecodeAvroValueToBuilder(const ::avro::NodePtr& avro_node,
379379
}
380380
default:
381381
return Status::TypeError(
382-
fmt::format("Unexpected avro type [{}] with arrow type [{}].", type,
383-
array_builder->type()->ToString()));
382+
fmt::format("Unexpected avro type [{}] with arrow type [{}].",
383+
::avro::toString(type), array_builder->type()->ToString()));
384384
}
385385
}
386386

@@ -398,7 +398,8 @@ Status DecodeAvroValueToBuilder(const ::avro::NodePtr& avro_node,
398398
return DecodeMapToBuilder(avro_node, decoder, array_builder, ctx);
399399
}
400400
default:
401-
return Status::Invalid(fmt::format("Unsupported avro type: {}", type));
401+
return Status::Invalid(
402+
fmt::format("Unsupported avro type: {}", ::avro::toString(type)));
402403
}
403404
}
404405

0 commit comments

Comments
 (0)