Skip to content

Commit d6a2351

Browse files
njaremkoalamb
andauthored
Fix record API support for reading INT32 encoded TIME_MILLIS (#7511)
* Add support for records with int32 encoding of TIME_MILLIS * Add test --------- Co-authored-by: Andrew Lamb <[email protected]>
1 parent 0b75873 commit d6a2351

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

parquet/src/record/api.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ impl Field {
671671
ConvertedType::UINT_16 => Field::UShort(value as u16),
672672
ConvertedType::UINT_32 => Field::UInt(value as u32),
673673
ConvertedType::DATE => Field::Date(value),
674+
ConvertedType::TIME_MILLIS => Field::TimestampMillis(value as i64),
674675
ConvertedType::DECIMAL => Field::Decimal(Decimal::from_i32(
675676
value,
676677
descr.type_precision(),
@@ -1054,6 +1055,10 @@ mod tests {
10541055
let row = Field::convert_int32(&descr, 14611);
10551056
assert_eq!(row, Field::Date(14611));
10561057

1058+
let descr = make_column_descr![PhysicalType::INT32, ConvertedType::TIME_MILLIS];
1059+
let row = Field::convert_int32(&descr, 14611);
1060+
assert_eq!(row, Field::TimestampMillis(14611));
1061+
10571062
let descr = make_column_descr![PhysicalType::INT32, ConvertedType::DECIMAL, 0, 8, 2];
10581063
let row = Field::convert_int32(&descr, 444);
10591064
assert_eq!(row, Field::Decimal(Decimal::from_i32(444, 8, 2)));

0 commit comments

Comments
 (0)