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

[SPARK-48604][SQL] Replace deprecated new ArrowType.Decimal(precision, scale) method call #46961

Closed
wants to merge 1 commit into from

Conversation

wayneguow
Copy link
Contributor

@wayneguow wayneguow commented Jun 12, 2024

What changes were proposed in this pull request?

This pr replaces deprecated classes and methods of arrow-vector called in Spark:

  • Decimal(int precision, int scale) -> Decimal( @JsonProperty("precision") int precision, @JsonProperty("scale") int scale, @JsonProperty("bitWidth") int bitWidth )

All arrow-vector related Spark classes, I made a double check, only in ArrowUtils there is a deprecated method call.

Why are the changes needed?

Clean up deprecated API usage.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Passed GA.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Jun 12, 2024
@wayneguow
Copy link
Contributor Author

cc @LuciferYang

@@ -51,7 +51,7 @@ private[sql] object ArrowUtils {
case BinaryType if !largeVarTypes => ArrowType.Binary.INSTANCE
case _: StringType if largeVarTypes => ArrowType.LargeUtf8.INSTANCE
case BinaryType if largeVarTypes => ArrowType.LargeBinary.INSTANCE
case DecimalType.Fixed(precision, scale) => new ArrowType.Decimal(precision, scale)
case DecimalType.Fixed(precision, scale) => new ArrowType.Decimal(precision, scale, 8 * 16)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use a named val to replace this magic number?

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 refer to the style of lines 44-47

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@LuciferYang
Copy link
Contributor

Only one case?

@wayneguow
Copy link
Contributor Author

wayneguow commented Jun 13, 2024

Only one case?

Yes, I made a check.

@LuciferYang
Copy link
Contributor

LuciferYang commented Jun 13, 2024

+1, LGTM
Merged into master for Spark 4.0. Thanks @wayneguow

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

Successfully merging this pull request may close these issues.

2 participants