Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 6036ca5

Browse files
committed
ARROW-1811
1 parent c5c4294 commit 6036ca5

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

src/parquet/arrow/arrow-reader-writer-test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ static std::shared_ptr<GroupNode> MakeSimpleSchema(const ::arrow::DataType& type
362362
break;
363363
case ::arrow::Type::DECIMAL: {
364364
const auto& decimal_type =
365-
static_cast<const ::arrow::DecimalType&>(values_type);
365+
static_cast<const ::arrow::Decimal128Type&>(values_type);
366366
precision = decimal_type.precision();
367367
scale = decimal_type.scale();
368368
byte_width = DecimalSize(precision);
@@ -375,7 +375,7 @@ static std::shared_ptr<GroupNode> MakeSimpleSchema(const ::arrow::DataType& type
375375
byte_width = static_cast<const ::arrow::FixedSizeBinaryType&>(type).byte_width();
376376
break;
377377
case ::arrow::Type::DECIMAL: {
378-
const auto& decimal_type = static_cast<const ::arrow::DecimalType&>(type);
378+
const auto& decimal_type = static_cast<const ::arrow::Decimal128Type&>(type);
379379
precision = decimal_type.precision();
380380
scale = decimal_type.scale();
381381
byte_width = DecimalSize(precision);

src/parquet/arrow/arrow-schema-test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const auto TIMESTAMP_MS = ::arrow::timestamp(TimeUnit::MILLI);
5151
const auto TIMESTAMP_US = ::arrow::timestamp(TimeUnit::MICRO);
5252
const auto TIMESTAMP_NS = ::arrow::timestamp(TimeUnit::NANO);
5353
const auto BINARY = ::arrow::binary();
54-
const auto DECIMAL_8_4 = std::make_shared<::arrow::DecimalType>(8, 4);
54+
const auto DECIMAL_8_4 = std::make_shared<::arrow::Decimal128Type>(8, 4);
5555

5656
class TestConvertParquetSchema : public ::testing::Test {
5757
public:

src/parquet/arrow/reader.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ static inline void RawBytesToDecimalBytes(const uint8_t* value, int32_t byte_wid
970970
/// 3. Converting the big-endian bytes in the FixedSizeBinaryArray to two integers
971971
/// representing the high and low bits of each decimal value.
972972
template <>
973-
struct TransferFunctor<::arrow::DecimalType, FLBAType> {
973+
struct TransferFunctor<::arrow::Decimal128Type, FLBAType> {
974974
Status operator()(RecordReader* reader, MemoryPool* pool,
975975
const std::shared_ptr<::arrow::DataType>& type,
976976
std::shared_ptr<Array>* out) {
@@ -991,7 +991,7 @@ struct TransferFunctor<::arrow::DecimalType, FLBAType> {
991991

992992
// The byte width of each decimal value
993993
const int32_t type_length =
994-
static_cast<const ::arrow::DecimalType&>(*type).byte_width();
994+
static_cast<const ::arrow::Decimal128Type&>(*type).byte_width();
995995

996996
// number of elements in the entire array
997997
const int64_t length = fixed_size_binary_array.length();
@@ -1046,7 +1046,7 @@ static Status DecimalIntegerTransfer(RecordReader* reader, MemoryPool* pool,
10461046

10471047
const auto values = reinterpret_cast<const ElementType*>(reader->values());
10481048

1049-
const auto& decimal_type = static_cast<const ::arrow::DecimalType&>(*type);
1049+
const auto& decimal_type = static_cast<const ::arrow::Decimal128Type&>(*type);
10501050
const int64_t type_length = decimal_type.byte_width();
10511051

10521052
std::shared_ptr<Buffer> data;
@@ -1079,7 +1079,7 @@ static Status DecimalIntegerTransfer(RecordReader* reader, MemoryPool* pool,
10791079
}
10801080

10811081
template <>
1082-
struct TransferFunctor<::arrow::DecimalType, Int32Type> {
1082+
struct TransferFunctor<::arrow::Decimal128Type, Int32Type> {
10831083
Status operator()(RecordReader* reader, MemoryPool* pool,
10841084
const std::shared_ptr<::arrow::DataType>& type,
10851085
std::shared_ptr<Array>* out) {
@@ -1088,7 +1088,7 @@ struct TransferFunctor<::arrow::DecimalType, Int32Type> {
10881088
};
10891089

10901090
template <>
1091-
struct TransferFunctor<::arrow::DecimalType, Int64Type> {
1091+
struct TransferFunctor<::arrow::Decimal128Type, Int64Type> {
10921092
Status operator()(RecordReader* reader, MemoryPool* pool,
10931093
const std::shared_ptr<::arrow::DataType>& type,
10941094
std::shared_ptr<Array>* out) {
@@ -1157,13 +1157,13 @@ Status PrimitiveImpl::NextBatch(int64_t records_to_read, std::shared_ptr<Array>*
11571157
case ::arrow::Type::DECIMAL: {
11581158
switch (descr_->physical_type()) {
11591159
case ::parquet::Type::INT32: {
1160-
TRANSFER_DATA(::arrow::DecimalType, Int32Type);
1160+
TRANSFER_DATA(::arrow::Decimal128Type, Int32Type);
11611161
} break;
11621162
case ::parquet::Type::INT64: {
1163-
TRANSFER_DATA(::arrow::DecimalType, Int64Type);
1163+
TRANSFER_DATA(::arrow::Decimal128Type, Int64Type);
11641164
} break;
11651165
case ::parquet::Type::FIXED_LEN_BYTE_ARRAY: {
1166-
TRANSFER_DATA(::arrow::DecimalType, FLBAType);
1166+
TRANSFER_DATA(::arrow::Decimal128Type, FLBAType);
11671167
} break;
11681168
default:
11691169
return Status::Invalid(

src/parquet/arrow/schema.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const auto TIMESTAMP_MS = ::arrow::timestamp(::arrow::TimeUnit::MILLI);
5050
const auto TIMESTAMP_US = ::arrow::timestamp(::arrow::TimeUnit::MICRO);
5151
const auto TIMESTAMP_NS = ::arrow::timestamp(::arrow::TimeUnit::NANO);
5252

53-
TypePtr MakeDecimalType(const PrimitiveNode& node) {
53+
TypePtr MakeDecimal128Type(const PrimitiveNode& node) {
5454
const auto& metadata = node.decimal_metadata();
5555
return ::arrow::decimal(metadata.precision, metadata.scale);
5656
}
@@ -61,7 +61,7 @@ static Status FromByteArray(const PrimitiveNode& node, TypePtr* out) {
6161
*out = ::arrow::utf8();
6262
break;
6363
case LogicalType::DECIMAL:
64-
*out = MakeDecimalType(node);
64+
*out = MakeDecimal128Type(node);
6565
break;
6666
default:
6767
// BINARY
@@ -77,7 +77,7 @@ static Status FromFLBA(const PrimitiveNode& node, TypePtr* out) {
7777
*out = ::arrow::fixed_size_binary(node.type_length());
7878
break;
7979
case LogicalType::DECIMAL:
80-
*out = MakeDecimalType(node);
80+
*out = MakeDecimal128Type(node);
8181
break;
8282
default:
8383
std::stringstream ss;
@@ -120,7 +120,7 @@ static Status FromInt32(const PrimitiveNode& node, TypePtr* out) {
120120
*out = ::arrow::time32(::arrow::TimeUnit::MILLI);
121121
break;
122122
case LogicalType::DECIMAL:
123-
*out = MakeDecimalType(node);
123+
*out = MakeDecimal128Type(node);
124124
break;
125125
default:
126126
std::stringstream ss;
@@ -144,7 +144,7 @@ static Status FromInt64(const PrimitiveNode& node, TypePtr* out) {
144144
*out = ::arrow::uint64();
145145
break;
146146
case LogicalType::DECIMAL:
147-
*out = MakeDecimalType(node);
147+
*out = MakeDecimal128Type(node);
148148
break;
149149
case LogicalType::TIMESTAMP_MILLIS:
150150
*out = TIMESTAMP_MS;
@@ -542,7 +542,8 @@ Status FieldToNode(const std::shared_ptr<Field>& field,
542542
case ArrowType::DECIMAL: {
543543
type = ParquetType::FIXED_LEN_BYTE_ARRAY;
544544
logical_type = LogicalType::DECIMAL;
545-
const auto& decimal_type = static_cast<const ::arrow::DecimalType&>(*field->type());
545+
const auto& decimal_type =
546+
static_cast<const ::arrow::Decimal128Type&>(*field->type());
546547
precision = decimal_type.precision();
547548
scale = decimal_type.scale();
548549
length = DecimalSize(precision);

src/parquet/arrow/writer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ Status FileWriter::Impl::TypedWriteBatch<FLBAType, ::arrow::FixedSizeBinaryType>
791791
}
792792

793793
template <>
794-
Status FileWriter::Impl::TypedWriteBatch<FLBAType, ::arrow::DecimalType>(
794+
Status FileWriter::Impl::TypedWriteBatch<FLBAType, ::arrow::Decimal128Type>(
795795
ColumnWriter* column_writer, const std::shared_ptr<Array>& array, int64_t num_levels,
796796
const int16_t* def_levels, const int16_t* rep_levels) {
797797
const auto& data = static_cast<const Decimal128Array&>(*array);
@@ -805,7 +805,7 @@ Status FileWriter::Impl::TypedWriteBatch<FLBAType, ::arrow::DecimalType>(
805805

806806
auto writer = reinterpret_cast<TypedColumnWriter<FLBAType>*>(column_writer);
807807

808-
const auto& decimal_type = static_cast<const ::arrow::DecimalType&>(*data.type());
808+
const auto& decimal_type = static_cast<const ::arrow::Decimal128Type&>(*data.type());
809809
const int32_t offset =
810810
decimal_type.byte_width() - DecimalSize(decimal_type.precision());
811811

@@ -947,7 +947,7 @@ Status FileWriter::Impl::WriteColumnChunk(const Array& data) {
947947
WRITE_BATCH_CASE(BINARY, BinaryType, ByteArrayType)
948948
WRITE_BATCH_CASE(STRING, BinaryType, ByteArrayType)
949949
WRITE_BATCH_CASE(FIXED_SIZE_BINARY, FixedSizeBinaryType, FLBAType)
950-
WRITE_BATCH_CASE(DECIMAL, DecimalType, FLBAType)
950+
WRITE_BATCH_CASE(DECIMAL, Decimal128Type, FLBAType)
951951
WRITE_BATCH_CASE(DATE32, Date32Type, Int32Type)
952952
WRITE_BATCH_CASE(DATE64, Date64Type, Int32Type)
953953
WRITE_BATCH_CASE(TIME32, Time32Type, Int32Type)

0 commit comments

Comments
 (0)