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-45569][SQL] Assign name to the error _LEGACY_ERROR_TEMP_2152 #43396

Closed
wants to merge 4 commits into from

Conversation

dengziming
Copy link
Member

What changes were proposed in this pull request?

Assign the name EXPRESSION_ENCODING_FAILED to the legacy error class _LEGACY_ERROR_TEMP_2152.

Why are the changes needed?

To assign proper name as a part of activity in SPARK-37935.

Does this PR introduce any user-facing change?

Yes, the error message will include the error class name

How was this patch tested?

Add a unit test to produce the error from user code.

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

No.

@@ -191,7 +191,7 @@ object ExpressionEncoder {
* thread-safe. Note that multiple calls to `apply(..)` return the same actual [[InternalRow]]
* object. Thus, the caller should copy the result before making another call if required.
*/
class Serializer[T](private val expressions: Seq[Expression])
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid this change.
You can use ExpressionEncoder.createDeserializer

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for reminding this @beliefer , it was modified by accident and I have reverted it, PTAL again.

@@ -652,7 +652,7 @@ class ExpressionEncoderSuite extends CodegenInterpretedPlanTest with AnalysisTes
val e = intercept[RuntimeException] {
toRow(bigNumeric)
}
assert(e.getMessage.contains("Error while encoding"))
assert(e.getMessage.contains("Failed to encode a value of the expressions:"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is a chance to use checkError with errorClass. cc @MaxGekk

Copy link
Member

Choose a reason for hiding this comment

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

Yep, if it is possible let's use checkError but this one is from a nested non-Spark exception, isn't.

@@ -276,8 +276,8 @@ class RowEncoderSuite extends CodegenInterpretedPlanTest {
val schema = new StructType().add("int", IntegerType)
val encoder = ExpressionEncoder(schema)
val e = intercept[RuntimeException](toRow(encoder, null))
assert(e.getMessage.contains("Null value appeared in non-nullable field"))
assert(e.getMessage.contains("top level Product or row object"))
assert(e.getCause.getMessage.contains("Null value appeared in non-nullable field"))
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@MaxGekk
Copy link
Member

MaxGekk commented Oct 19, 2023

@dengziming Please, resolve conflicts.

Copy link
Member

@MaxGekk MaxGekk left a comment

Choose a reason for hiding this comment

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

Waiting for CI.

Copy link
Contributor

@beliefer beliefer left a comment

Choose a reason for hiding this comment

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

LGTM.

@MaxGekk
Copy link
Member

MaxGekk commented Oct 19, 2023

All GAs passed: https://github.com/dengziming/spark/actions/runs/6570868445/job/17859440831
Merging to master.
Thank you, @dengziming and @beliefer for review.

@MaxGekk MaxGekk closed this in 69fa51c Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants