HuaHuaY commented on code in PR #47427:
URL: https://github.com/apache/arrow/pull/47427#discussion_r2307200254
##########
cpp/src/parquet/arrow/schema.cc:
##########
@@ -1076,10 +1078,16 @@ Result<bool> ApplyOriginalStorageMetadata(const Field&
origin_field,
modified = true;
}
- if (origin_type->id() == ::arrow::Type::DECIMAL256 &&
- inferred_type->id() == ::arrow::Type::DECIMAL128) {
- inferred->field = inferred->field->WithType(origin_type);
- modified = true;
+ if (::arrow::is_decimal(origin_type->id()) &&
+ ::arrow::is_decimal(inferred_type->id())) {
+ auto& origin_decimal = checked_cast<const
::arrow::DecimalType&>(*origin_type);
+ auto& inferred_decimal = checked_cast<const
::arrow::DecimalType&>(*inferred_type);
+ ARROW_DCHECK_EQ(origin_decimal.scale(), inferred_decimal.scale());
+ ARROW_DCHECK_LE(origin_decimal.precision(), inferred_decimal.precision());
Review Comment:
> I'd rather we error out cleanly (or simply do not apply the original type)
I prefer not to apply origin type.
> I'm also not sure why `ARROW_DCHECK_LE` on the precision. Why not check
it's equal instead?
I was wrong. It should be `EQ`. Either precision or scale mismatch should be
consided as an error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]