-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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-42307][SQL] Assign name for error _LEGACY_ERROR_TEMP_2232 #47354
Conversation
Hi @MaxGekk , I propose a PR to update the name for legacy errors. Do you mind taking a look? Thanks. |
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.
cc @cloud-fan
@@ -123,4 +123,17 @@ class RowSuite extends SparkFunSuite with SharedSparkSession { | |||
parameters = Map("methodName" -> "fieldIndex", "className" -> "Row", "fieldName" -> "`foo`") | |||
) | |||
} | |||
|
|||
test("SPARK-42307 - Trying to get the value from a null column should result in error") { |
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.
nit:
test("SPARK-42307 - Trying to get the value from a null column should result in error") { | |
test("SPARK-42307: get the value from a null column should result in error") { |
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.
Thanks for the comment @allisonwang-db. I updated the test description.
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.
My bad I clicked the revoke review by mistake...
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.
cc @allisonwang-db @cloud-fan @MaxGekk. Not sure if you got a chance to review this small PR? Thanks!
@@ -123,4 +123,17 @@ class RowSuite extends SparkFunSuite with SharedSparkSession { | |||
parameters = Map("methodName" -> "fieldIndex", "className" -> "Row", "fieldName" -> "`foo`") | |||
) | |||
} | |||
|
|||
test("SPARK-42307 - get the value from a null column should result in error") { |
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.
test("SPARK-42307 - get the value from a null column should result in error") { | |
test("SPARK-42307: get a value from a null column should result in error") { |
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.
Thanks @allisonwang-db! Updated.
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.
Is it correct? If not, please, fix it.
* @throws NullPointerException when value is null. |
@@ -572,6 +572,12 @@ | |||
], | |||
"sqlState" : "42703" | |||
}, | |||
"COLUMN_VALUE_IS_NULL" : { |
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.
Let's name in more precise way:
"COLUMN_VALUE_IS_NULL" : { | |
"ROW_VALUE_IS_NULL" : { |
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.
Updated.
@@ -572,6 +572,12 @@ | |||
], | |||
"sqlState" : "42703" | |||
}, | |||
"COLUMN_VALUE_IS_NULL" : { | |||
"message" : [ | |||
"Value at index <index> is null." |
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.
"Value at index <index> is null." | |
Found NULL in a row at the index <index>, expected a non-NULL value. |
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.
Done
"message" : [ | ||
"Value at index <index> is null." | ||
], | ||
"sqlState" : "22000" |
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.
How about this number "22023"
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.
Done
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.
... name _LEGACY_ERROR_TEMP_2232 with COLUMN_VALUE_IS_NULL
Could you update PR's description according to your changes, please.
@@ -219,39 +219,34 @@ trait Row extends Serializable { | |||
* Returns the value at position i as a primitive boolean. | |||
* | |||
* @throws ClassCastException when data type does not match. | |||
* @throws NullPointerException when value is null. |
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.
Could you clarify why did you remove it instead of replacing NullPointerException
by SparkException
, just wonder.
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.
Oops I misunderstood your previous comment. Replaced NPE with SparkException
.
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.
And one more thing is need to update the SQL migration guide because this might impact user apps and potentially break them. Please, add an item to sql-migration-guide.md
.
Hi @MaxGekk , looks like the current implementation is causing an error when generating docs (job link), because SparkException is declared in the comment but it is not thrown from the codes.
I found two options to fix this:
I kind of lean towards option #1 as it could provide users with better context about the exception type being thrown, although they would have to handle this exception explicitly in their codes. Let me know your thought on this or if you have other ideas. Thanks :)! |
@junyuc25 I guess a runtime exception might not force catching the exception. How about to replace |
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 waiting for CI.
+1, LGTM. Merging to master. |
@junyuc25 Do you have an account at the OSS JIRA? If so, leave a comment in SPARK-42307. I will assign the ticket to you. |
Yes I posted a comment in the Jira ticket. Thanks for reviewing!
Sent from Gmail Mobile
Maxim Gekk ***@***.***>于2024年8月14日 周三01:18写道:
… @junyuc25 <https://github.com/junyuc25> Do you have an account at the OSS
JIRA? If so, leave a comment in SPARK-42307
<https://issues.apache.org/jira/browse/SPARK-42307>. I will assign the
ticket to you.
—
Reply to this email directly, view it on GitHub
<#47354 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACS35K5D7DRJXJYHMO7KYV3ZRI5U3AVCNFSM6AAAAABK4I2EH2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBWG42DEMJQGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
### What changes were proposed in this pull request? In this PR, I propose to replace the legacy error name `_LEGACY_ERROR_TEMP_2232` with `ROW_VALUE_IS_NULL `, and add a test case for it. ### Why are the changes needed? Proper name improves user experience with Spark SQL. ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? Ran all the tests in the suite: ``` build/sbt "testOnly *org.apache.spark.sql.RowSuite" ``` ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#47354 from junyuc25/SPARK-42307. Lead-authored-by: junyuc25 <10862251+junyuc25@users.noreply.github.com> Co-authored-by: junyuc25 <=> Signed-off-by: Max Gekk <max.gekk@gmail.com>
### What changes were proposed in this pull request? In this PR, I propose to replace the legacy error name `_LEGACY_ERROR_TEMP_2232` with `ROW_VALUE_IS_NULL `, and add a test case for it. ### Why are the changes needed? Proper name improves user experience with Spark SQL. ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? Ran all the tests in the suite: ``` build/sbt "testOnly *org.apache.spark.sql.RowSuite" ``` ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#47354 from junyuc25/SPARK-42307. Lead-authored-by: junyuc25 <10862251+junyuc25@users.noreply.github.com> Co-authored-by: junyuc25 <=> Signed-off-by: Max Gekk <max.gekk@gmail.com>
### What changes were proposed in this pull request? In this PR, I propose to replace the legacy error name `_LEGACY_ERROR_TEMP_2232` with `ROW_VALUE_IS_NULL `, and add a test case for it. ### Why are the changes needed? Proper name improves user experience with Spark SQL. ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? Ran all the tests in the suite: ``` build/sbt "testOnly *org.apache.spark.sql.RowSuite" ``` ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#47354 from junyuc25/SPARK-42307. Lead-authored-by: junyuc25 <10862251+junyuc25@users.noreply.github.com> Co-authored-by: junyuc25 <=> Signed-off-by: Max Gekk <max.gekk@gmail.com>
What changes were proposed in this pull request?
In this PR, I propose to replace the legacy error name
_LEGACY_ERROR_TEMP_2232
withROW_VALUE_IS_NULL
, and add a test case for it.Why are the changes needed?
Proper name improves user experience with Spark SQL.
Does this PR introduce any user-facing change?
Yes.
How was this patch tested?
Ran all the tests in the suite:
Was this patch authored or co-authored using generative AI tooling?
No