-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-50226][SQL] Correct MakeDTInterval and MakeYMInterval to catch Java exceptions #48773
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-50226][SQL] Correct MakeDTInterval and MakeYMInterval to catch Java exceptions #48773
Conversation
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala
Outdated
Show resolved
Hide resolved
|
Had a conversation with @mihailom-db. |
|
Update title please. No spaces between tags and the name of the PR should be the same as the ticket on jira. |
Done. |
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala
Outdated
Show resolved
Hide resolved
…_OVERFLOW, it suggests disabling ANSI
...lyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
Outdated
Show resolved
Hide resolved
|
CI fails, but UPD Found that |
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala
Outdated
Show resolved
Hide resolved
sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
Outdated
Show resolved
Hide resolved
|
@srielau Does this look good to you? |
|
You can remove [WIP] and Draft as well. |
98c4d11 to
d7352a4
Compare
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalMathUtils.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalMathUtils.scala
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
Outdated
Show resolved
Hide resolved
mihailomilosevic2001
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for few comments
|
+1, LGTM. Merging to master. |
|
@gotocoding-DB Congratulations with your first contribution to Apache Spark! |
| Math.toIntExact( | ||
| Math.addExact(month.asInstanceOf[Int], | ||
| Math.multiplyExact(year.asInstanceOf[Int], MONTHS_PER_YEAR))) | ||
| } catch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we add IntervalUtils.makeYearMonthInterval so that we duplicate less code between interpreted and codegen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off course we should deduplicate it, but I didn't succeed with it: #48773 (comment).
Max suggested to use StaticInvoke, I'll try it in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already makeDayTimeInterval and we can just follow it. Can you try it again and create a PR? We can help to check the code together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll do it a bit later.
UPD: #48848
What changes were proposed in this pull request?
MakeDTIntervalandMakeYMIntervaldo not catch Java exceptions in nullSafeEval like it doesMakeInterval. So we making behavior similar.Why are the changes needed?
To show to users readable nice error message.
Does this PR introduce any user-facing change?
Yes, I changed error message type in error-conditions.json => it's a behavioral change for clients who parse error message type or error message text.
How was this patch tested?
There already were few tests to check behavior, I just changed expected error type.
Was this patch authored or co-authored using generative AI tooling?
Yes, Copilot used.