Skip to content
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

Fix bug with decoding timestamp as decimal #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jefffrey
Copy link
Contributor

Closes #14

Copy link
Contributor Author

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

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

Thanks @progval for identifying this bug

@@ -103,7 +103,7 @@ fn decimal128_decoder(
let data = get_rle_reader(column, data)?;

let secondary = stripe.stream_map().get(column, Kind::Secondary);
let secondary = get_rle_reader(column, secondary)?;
let secondary = get_unsigned_rle_reader(column, secondary);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bug was here. Secondary is unsigned stream. It's retrieved correctly for timestamp, but was mistakenly taken as signed here. See line 62 for correct behaviour.

fn get_inner_timestamp_decoder<T: ArrowTimestampType + Send>(
column: &Column,
stripe: &Stripe,
seconds_since_unix_epoch: i64,
) -> Result<PrimitiveArrayDecoder<T>> {
let data = stripe.stream_map().get(column, Kind::Data);
let data = get_rle_reader(column, data)?;
let secondary = stripe.stream_map().get(column, Kind::Secondary);
let secondary = get_unsigned_rle_reader(column, secondary);
let present = PresentDecoder::from_stripe(stripe, column);
let iter = Box::new(TimestampDecoder::<T>::new(
seconds_since_unix_epoch,
data,
secondary,
));
Ok(PrimitiveArrayDecoder::<T>::new(iter, present))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Timestamp decoding into Decimal128 since v0.4.0
1 participant