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

Remove unnecessary Option from Int96 #2471

Merged
merged 2 commits into from Aug 17, 2022

Conversation

tustvold
Copy link
Contributor

Which issue does this PR close?

Part of #1661

Rationale for this change

I can't see an obvious reason for this Option existing, as nothing seems to be exploiting it. Removing it will allow reading Int96 as a regular "primitive" type

What changes are included in this PR?

Are there any user-facing changes?

Theoretically now you can call Int96::data before calling set_data and it won't panic, not sure this counts...

@@ -843,7 +843,7 @@ mod tests {
run_test::<Int96Type>(
-1,
&[Int96::from(vec![1, 2, 3]), Int96::from(vec![2, 3, 4])],
32,
24,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This changes as there is no longer 8 bytes taken up by the Option

@github-actions github-actions bot added the parquet Changes to the parquet crate label Aug 16, 2022
@@ -36,29 +36,27 @@ use crate::util::{

/// Rust representation for logical type INT96, value is backed by an array of `u32`.
/// The type only takes 12 bytes, without extra padding.
#[derive(Clone, Debug, PartialOrd, Default)]
#[derive(Clone, Debug, PartialOrd, Default, PartialEq, Eq)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a question about this issue.
How to compare the INT96 in parquet? How to ensure the order of two INT64?
From the parquet spec https://github.com/apache/parquet-format/blob/54e53e5d7794d383529dd30746378f19a12afd58/src/main/thrift/parquet.thrift#L36, the type of INT96 has be deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be signed little endian comparison, not sure this is what is actually implemented though

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be signed little endian comparison, not sure this is what is actually implemented though

Maybe I can read the codebase of the parquet-mr of java-version, and answer this.

Copy link
Contributor Author

@tustvold tustvold Aug 17, 2022

Choose a reason for hiding this comment

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

https://github.com/apache/arrow-rs/blob/master/parquet/src/column/writer/mod.rs#L1036 doesn't appear to special case this type, so this crate is currently performing unsigned little endian comparison. I don't think this is correct

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/apache/arrow-rs/blob/master/parquet/src/column/writer/mod.rs#L1036 doesn't appear to special case this type

Do you think the logic of compare_greater_byte_array_decimals is wrong? From the current implementation and test, it use the signed comparator with little endian byte order.

Copy link
Contributor Author

@tustvold tustvold Aug 17, 2022

Choose a reason for hiding this comment

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

Int96 is not a decimal type, but used for timestamps by some older systems such as Spark. 64-bit nanoseconds since midnight, followed by 32-bit Julian day.

}

/// Returns underlying data as slice of [`u32`].
#[inline]
pub fn data(&self) -> &[u32] {
self.value
.as_ref()
.expect("set_data should have been called")
Copy link
Member

@viirya viirya Aug 17, 2022

Choose a reason for hiding this comment

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

I guess that it originally wants to make sure data always returns something set instead of an initial value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't follow why we would care about this for Int96 and not for all the other types. This feels like an unnecessary quirk?

@tustvold tustvold merged commit 5e8586a into apache:master Aug 17, 2022
@ursabot
Copy link

ursabot commented Aug 17, 2022

Benchmark runs are scheduled for baseline = 4e4902f and contender = 5e8586a. 5e8586a is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

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

Successfully merging this pull request may close these issues.

None yet

4 participants