diff --git a/src/paimon/common/data/binary_row_writer.cpp b/src/paimon/common/data/binary_row_writer.cpp index 23e93882a..7e0c3b50d 100644 --- a/src/paimon/common/data/binary_row_writer.cpp +++ b/src/paimon/common/data/binary_row_writer.cpp @@ -140,7 +140,7 @@ Result BinaryRowWriter::CreateFieldSetter( }; return field_setter; } - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { auto* decimal_type = arrow::internal::checked_cast(field_type.get()); assert(decimal_type); diff --git a/src/paimon/common/data/internal_row.cpp b/src/paimon/common/data/internal_row.cpp index a600ac32a..b6b7eb632 100644 --- a/src/paimon/common/data/internal_row.cpp +++ b/src/paimon/common/data/internal_row.cpp @@ -110,7 +110,7 @@ Result InternalRow::CreateFieldGetter( }; break; } - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { auto* decimal_type = arrow::internal::checked_cast(field_type.get()); assert(decimal_type); diff --git a/src/paimon/common/data/serializer/binary_serializer_utils.cpp b/src/paimon/common/data/serializer/binary_serializer_utils.cpp index 602efafac..57b1c6709 100644 --- a/src/paimon/common/data/serializer/binary_serializer_utils.cpp +++ b/src/paimon/common/data/serializer/binary_serializer_utils.cpp @@ -103,7 +103,7 @@ Status BinarySerializerUtils::WriteBinaryData(const std::shared_ptrSetNullAt(pos, type_id); return Status::OK(); - } else if (type_id != arrow::Type::type::DECIMAL && + } else if (type_id != arrow::Type::type::DECIMAL128 && type_id != arrow::Type::type::TIMESTAMP) { // if row writer, exclude decimal and timestamp when set null writer->SetNullAt(pos); @@ -167,7 +167,7 @@ Status BinarySerializerUtils::WriteBinaryData(const std::shared_ptr(type.get()); assert(decimal_type); auto precision = decimal_type->precision(); diff --git a/src/paimon/common/data/serializer/row_compacted_serializer.cpp b/src/paimon/common/data/serializer/row_compacted_serializer.cpp index 547d1211e..75e8c06e5 100644 --- a/src/paimon/common/data/serializer/row_compacted_serializer.cpp +++ b/src/paimon/common/data/serializer/row_compacted_serializer.cpp @@ -94,7 +94,7 @@ Result RowCompactedSerializer::CompareField(const FieldInfo& field_info PAIMON_ASSIGN_OR_RAISE(Timestamp val2, reader2->ReadTimestamp(field_info.precision)); return val1 == val2 ? 0 : (val1 < val2 ? -1 : 1); } - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { PAIMON_ASSIGN_OR_RAISE(Decimal val1, reader1->ReadDecimal(field_info.precision, field_info.scale)); PAIMON_ASSIGN_OR_RAISE(Decimal val2, @@ -124,7 +124,7 @@ Result RowCompactedSerializer::CreateSliceComparat arrow::internal::checked_pointer_cast(field_type); assert(timestamp_type); field_infos[i].precision = DateTimeUtils::GetPrecisionFromType(timestamp_type); - } else if (field_type->id() == arrow::Type::type::DECIMAL) { + } else if (field_type->id() == arrow::Type::type::DECIMAL128) { auto decimal_type = arrow::internal::checked_pointer_cast(field_type); assert(decimal_type); @@ -275,7 +275,7 @@ Result RowCompactedSerializer::CreateFieldR }; break; } - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { auto* decimal_type = arrow::internal::checked_cast(field_type.get()); assert(decimal_type); @@ -410,7 +410,7 @@ Result RowCompactedSerializer::CreateFieldW }; break; } - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { auto* decimal_type = arrow::internal::checked_cast(field_type.get()); assert(decimal_type); diff --git a/src/paimon/common/utils/fields_comparator.cpp b/src/paimon/common/utils/fields_comparator.cpp index 63f240a4f..26f1cb443 100644 --- a/src/paimon/common/utils/fields_comparator.cpp +++ b/src/paimon/common/utils/fields_comparator.cpp @@ -163,7 +163,7 @@ Result FieldsComparator::CompareField( return lvalue == rvalue ? 0 : (lvalue < rvalue ? -1 : 1); }); } - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { auto* decimal_type = arrow::internal::checked_cast(input_type.get()); assert(decimal_type); diff --git a/src/paimon/core/bucket/bucket_id_calculator.cpp b/src/paimon/core/bucket/bucket_id_calculator.cpp index 5b86194d7..9ae665a64 100644 --- a/src/paimon/core/bucket/bucket_id_calculator.cpp +++ b/src/paimon/core/bucket/bucket_id_calculator.cpp @@ -206,7 +206,7 @@ static Result WriteBucketRow(int32_t col_id, }; return writer_func; } - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { const auto* decimal_type = arrow::internal::checked_cast(field->type().get()); assert(decimal_type); diff --git a/src/paimon/core/io/row_to_arrow_array_converter.h b/src/paimon/core/io/row_to_arrow_array_converter.h index 2a0764af0..8f6007d8f 100644 --- a/src/paimon/core/io/row_to_arrow_array_converter.h +++ b/src/paimon/core/io/row_to_arrow_array_converter.h @@ -129,7 +129,7 @@ Status RowToArrowArrayConverter::Reserve(arrow::ArrayBuilder* array_builde case arrow::Type::type::FLOAT: case arrow::Type::type::DOUBLE: case arrow::Type::type::TIMESTAMP: - case arrow::Type::type::DECIMAL: + case arrow::Type::type::DECIMAL128: break; case arrow::Type::type::STRING: { // reserve string data buffer @@ -201,7 +201,7 @@ Status RowToArrowArrayConverter::Accumulate(const arrow::Array* array, int case arrow::Type::type::FLOAT: case arrow::Type::type::DOUBLE: case arrow::Type::type::TIMESTAMP: - case arrow::Type::type::DECIMAL: + case arrow::Type::type::DECIMAL128: break; case arrow::Type::type::STRING: { auto string_array = arrow::internal::checked_cast(array); @@ -403,7 +403,7 @@ RowToArrowArrayConverter::AppendField(bool use_view, arrow::ArrayBuilder* DateTimeUtils::TimestampToInteger(timestamp, time_type)); }); } - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { PAIMON_ASSIGN_OR_RAISE(auto* field_builder, CastToTypedBuilder(array_builder)); auto decimal_type = diff --git a/src/paimon/core/mergetree/compact/aggregate/field_max_agg.h b/src/paimon/core/mergetree/compact/aggregate/field_max_agg.h index 9a7f1a13f..65ae34448 100644 --- a/src/paimon/core/mergetree/compact/aggregate/field_max_agg.h +++ b/src/paimon/core/mergetree/compact/aggregate/field_max_agg.h @@ -61,7 +61,7 @@ class FieldMaxAgg : public FieldAggregator { case arrow::Type::type::FLOAT: case arrow::Type::type::DOUBLE: case arrow::Type::type::TIMESTAMP: - case arrow::Type::type::DECIMAL: + case arrow::Type::type::DECIMAL128: case arrow::Type::type::STRING: case arrow::Type::type::BINARY: return FieldMaxFunc([](const VariantType& accumulator, diff --git a/src/paimon/core/mergetree/compact/aggregate/field_min_agg.h b/src/paimon/core/mergetree/compact/aggregate/field_min_agg.h index 818dd53f6..9d42d6b32 100644 --- a/src/paimon/core/mergetree/compact/aggregate/field_min_agg.h +++ b/src/paimon/core/mergetree/compact/aggregate/field_min_agg.h @@ -61,7 +61,7 @@ class FieldMinAgg : public FieldAggregator { case arrow::Type::type::FLOAT: case arrow::Type::type::DOUBLE: case arrow::Type::type::TIMESTAMP: - case arrow::Type::type::DECIMAL: + case arrow::Type::type::DECIMAL128: case arrow::Type::type::STRING: case arrow::Type::type::BINARY: return FieldMinFunc([](const VariantType& accumulator, diff --git a/src/paimon/core/mergetree/compact/aggregate/field_sum_agg.cpp b/src/paimon/core/mergetree/compact/aggregate/field_sum_agg.cpp index 6f8960b4c..746ee456e 100644 --- a/src/paimon/core/mergetree/compact/aggregate/field_sum_agg.cpp +++ b/src/paimon/core/mergetree/compact/aggregate/field_sum_agg.cpp @@ -71,7 +71,7 @@ Result FieldSumAgg::CreateSumFunc( DataDefine::GetVariantValue(input_field); return sum; }); - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { return FieldSumFunc( [](const VariantType& accumulator, const VariantType& input_field) -> VariantType { auto v1 = DataDefine::GetVariantValue(accumulator); @@ -120,7 +120,7 @@ Result FieldSumAgg::CreateNegFunc( auto value = DataDefine::GetVariantValue(input_field); return (-value); }); - case arrow::Type::type::DECIMAL: { + case arrow::Type::type::DECIMAL128: { return FieldNegFunc([](const VariantType& input_field) -> VariantType { auto value = DataDefine::GetVariantValue(input_field); return Decimal(value.Precision(), value.Scale(), -value.Value()); diff --git a/src/paimon/core/mergetree/in_memory_sort_buffer.cpp b/src/paimon/core/mergetree/in_memory_sort_buffer.cpp index b428ef282..db010b883 100644 --- a/src/paimon/core/mergetree/in_memory_sort_buffer.cpp +++ b/src/paimon/core/mergetree/in_memory_sort_buffer.cpp @@ -140,7 +140,7 @@ Result InMemorySortBuffer::EstimateMemoryUse(const std::shared_ptrlength() * sizeof(double); case arrow::Type::type::TIMESTAMP: return null_bits_size_in_bytes + array->length() * sizeof(int64_t); - case arrow::Type::type::DECIMAL: + case arrow::Type::type::DECIMAL128: return null_bits_size_in_bytes + array->length() * sizeof(Decimal::int128_t); case arrow::Type::type::STRING: case arrow::Type::type::BINARY: { diff --git a/src/paimon/core/schema/schema_validation.cpp b/src/paimon/core/schema/schema_validation.cpp index 4af714124..65e09aaf5 100644 --- a/src/paimon/core/schema/schema_validation.cpp +++ b/src/paimon/core/schema/schema_validation.cpp @@ -48,8 +48,9 @@ namespace paimon { bool SchemaValidation::IsComplexType(const std::shared_ptr& field) { - return (field->type()->id() == arrow::Type::TIMESTAMP || - field->type()->id() == arrow::Type::DECIMAL || BlobUtils::IsBlobField(field)); + arrow::Type::type arrow_type_id = field->type()->id(); + return (arrow_type_id == arrow::Type::TIMESTAMP || arrow_type_id == arrow::Type::DECIMAL128 || + BlobUtils::IsBlobField(field)); } Status SchemaValidation::ValidateTableSchema(const TableSchema& schema) {