Skip to content

Fix record API support for reading INT32 encoded TIME_MILLIS #7511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions parquet/src/record/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ impl Field {
ConvertedType::UINT_16 => Field::UShort(value as u16),
ConvertedType::UINT_32 => Field::UInt(value as u32),
ConvertedType::DATE => Field::Date(value),
ConvertedType::TIME_MILLIS => Field::TimestampMillis(value as i64),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConvertedType::DECIMAL => Field::Decimal(Decimal::from_i32(
value,
descr.type_precision(),
Expand Down Expand Up @@ -1054,6 +1055,10 @@ mod tests {
let row = Field::convert_int32(&descr, 14611);
assert_eq!(row, Field::Date(14611));

let descr = make_column_descr![PhysicalType::INT32, ConvertedType::TIME_MILLIS];
let row = Field::convert_int32(&descr, 14611);
assert_eq!(row, Field::TimestampMillis(14611));

let descr = make_column_descr![PhysicalType::INT32, ConvertedType::DECIMAL, 0, 8, 2];
let row = Field::convert_int32(&descr, 444);
assert_eq!(row, Field::Decimal(Decimal::from_i32(444, 8, 2)));
Expand Down
Loading