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

Make the error message of changing decimal type the same as Spark's [databricks] #5915

Merged

Conversation

HaoYang670
Copy link
Collaborator

@HaoYang670 HaoYang670 commented Jun 27, 2022

Signed-off-by: remzi 13716567376yh@gmail.com
Related to #5196.

Rationale for this change

We want to throw the same error message as Spark.

Changes in this PR.

  1. Make the error message of changing decimal type be consistent with Spark's.
  • I add some extra compution in cannotChangeDecimalPrecisionError to find which value causes the error, so that we could throw the same error message as Spark.
  1. Update update_test_floor_ceil_overflow to check the error message more precisely.
  • So far I only check the exception type (java.lang.ArithmeticException before Spark 3.3.0 and SparkArithmeticException after 330). The content of error message is not checked because I don't find a good way to get the value of data_gen

Signed-off-by: remzi <13716567376yh@gmail.com>
@HaoYang670
Copy link
Collaborator Author

build

@HaoYang670
Copy link
Collaborator Author

CI error: https://github.com/NVIDIA/spark-rapids/runs/7067135922?check_suite_focus=true#step:2:5245,
which seems not related to this PR/

@HaoYang670
Copy link
Collaborator Author

build

revans2
revans2 previously approved these changes Jun 27, 2022
fromType: DecimalType,
toType: DecimalType,
context: String = ""): ArithmeticException = {
val row_id = withResource(outOfBounds.copyToHost()) {hcv =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

My only real nit is that there is a lot of copy and paste between the 4 implementations of this code. Is there a ways we can make this more common?

Copy link
Collaborator Author

@HaoYang670 HaoYang670 Jun 28, 2022

Choose a reason for hiding this comment

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

Yes, I can extra some common expressions to be a new helper function. But I am not sure where to put the helper.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Only GpuCeil and GpuFloor do this. I would create a trait or an object in mathExpressions.scala and name it something like FloorCeilErrorUtil or RoundingErrorUtil and add it there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated!

@sameerz sameerz added the task Work required that improves the product but is not user facing label Jun 27, 2022
@sameerz sameerz added this to the Jun 20 - Jul 8 milestone Jun 27, 2022
Signed-off-by: remzi <13716567376yh@gmail.com>
@HaoYang670
Copy link
Collaborator Author

build

Signed-off-by: remzi <13716567376yh@gmail.com>
@HaoYang670
Copy link
Collaborator Author

build

@HaoYang670
Copy link
Collaborator Author

@HaoYang670 HaoYang670 requested a review from revans2 June 30, 2022 08:55
@HaoYang670
Copy link
Collaborator Author

@revans2 Please have a look. Thank you!

revans2
revans2 previously approved these changes Jun 30, 2022
Copy link
Collaborator

@revans2 revans2 left a comment

Choose a reason for hiding this comment

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

Looks like there is a type in one of the files.


object RapidsErrorUtils {
object RapidsErrorUtils extends {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is there an "extends" here that is not used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated!

@HaoYang670
Copy link
Collaborator Author

build

1 similar comment
@HaoYang670
Copy link
Collaborator Author

build

@HaoYang670
Copy link
Collaborator Author

HaoYang670 commented Jul 4, 2022

@revans2
Copy link
Collaborator

revans2 commented Jul 5, 2022

The failure test is not related to this PR. https://github.com/NVIDIA/spark-rapids/runs/7159690760?check_suite_focus=true#step:2:34528

Looks like the issue for this failure is #5937

I am inclined to let this PR wait until the issue is resolved, but if others have a different option I can admin merge it.

@sameerz
Copy link
Collaborator

sameerz commented Jul 6, 2022

build

1 similar comment
@HaoYang670
Copy link
Collaborator Author

build

@pxLi pxLi changed the title Make the error message of changing decimal type the same as Spark's Make the error message of changing decimal type the same as Spark's [databricks] Jul 8, 2022
@HaoYang670 HaoYang670 merged commit 5015754 into NVIDIA:branch-22.08 Jul 8, 2022
@HaoYang670 HaoYang670 deleted the update_test_floor_ceil_overflow branch July 8, 2022 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Work required that improves the product but is not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants