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

Add Decimal128 and Decimal256 to downcast_primitive #3056

Merged
merged 5 commits into from Nov 9, 2022

Conversation

viirya
Copy link
Member

@viirya viirya commented Nov 9, 2022

Which issue does this PR close?

Closes #3055.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@viirya viirya changed the title Add decimal to downcast primitive Add Decimal128 and Decimal256 to downcast_primitive Nov 9, 2022
@github-actions github-actions bot added the arrow Changes to the arrow crate label Nov 9, 2022
@viirya
Copy link
Member Author

viirya commented Nov 9, 2022

Interesting, there are a few tests failed due to this change. I will take a deep look.

@@ -726,6 +697,21 @@ unsafe fn decode_column(
)))
}
};
let array: ArrayRef = match &field.data_type {
Copy link
Contributor

@tustvold tustvold Nov 9, 2022

Choose a reason for hiding this comment

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

I think we should probably be passing the data type into decode_primitive so that it can correctly construct the array with the correct data type. I suspect the current logic will lose the timezone for timestamps 🤔

Copy link
Member Author

@viirya viirya Nov 9, 2022

Choose a reason for hiding this comment

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

As the change doesn't touch timestamp array, I think that you didn't mean the issue is caused by this change, but suggested that we should also fix the current logic together, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, they both have the same problem

@@ -326,9 +326,20 @@ fn decode_fixed<T: FixedLengthEncoding + ToByteSlice>(
pub fn decode_primitive<T: ArrowPrimitiveType>(
rows: &mut [&[u8]],
options: SortOptions,
data_type: &DataType,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is technically unsafe as it could allow for transmute from decimal128 to decimal256, etc... I have a PR in the works to fix this

@viirya viirya force-pushed the add_decimal_to_downcast_primitive branch from 74f2552 to 1af7263 Compare November 9, 2022 09:21
Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

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

I'm happy for this to go in, but I think I would prefer #3064 went in first

@tustvold tustvold added the api-change Changes to the arrow API label Nov 9, 2022
@tustvold
Copy link
Contributor

tustvold commented Nov 9, 2022

I've added an API change, as this may lead to downstream breakage (likely a good thing as it will remove unnecessary special-case handling for decimals)

@viirya
Copy link
Member Author

viirya commented Nov 9, 2022

I will rebase once #3064 is merged.

@tustvold tustvold merged commit f596209 into apache:master Nov 9, 2022
@ursabot
Copy link

ursabot commented Nov 9, 2022

Benchmark runs are scheduled for baseline = e4e15f8 and contender = f596209. f596209 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
api-change Changes to the arrow API arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Decimal128 and Decimal256 to downcast_primitive
3 participants