Skip to content

[SPARK-39666][SQL] Use UnsafeProjection.create to respect spark.sql.codegen.factoryMode in ExpressionEncoder#37067

Closed
HyukjinKwon wants to merge 1 commit intoapache:masterfrom
HyukjinKwon:SPARK-39666
Closed

[SPARK-39666][SQL] Use UnsafeProjection.create to respect spark.sql.codegen.factoryMode in ExpressionEncoder#37067
HyukjinKwon wants to merge 1 commit intoapache:masterfrom
HyukjinKwon:SPARK-39666

Conversation

@HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Jul 4, 2022

What changes were proposed in this pull request?

This PR is sort of a followup of 88d8de9 to respect interpreted projections in ExpressionEncoder. Similar fix was made before in deserialization side at 2612848, and this PR completes it in serialization side too.

Why are the changes needed?

This is a symmetry with 2612848. We should make the configurations respected consistently.

Does this PR introduce any user-facing change?

No, by default.
Yes, when users set spark.sql.codegen.factoryMode to other values. The operations such as DSv1, DSv2, or object conversions such as MapObjects will respect the value.

How was this patch tested?

Existing test cases at RowEncoderSuite extends CodegenInterpretedPlanTest and ExpressionEncoderSuite extends CodegenInterpretedPlanTest should cover this.

@HyukjinKwon HyukjinKwon marked this pull request as draft July 4, 2022 03:01
@github-actions github-actions bot added the SQL label Jul 4, 2022
@@ -555,8 +555,27 @@ case class NewInstance(
}

override def eval(input: InternalRow): Any = {
Copy link
Member Author

Choose a reason for hiding this comment

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

I believe this is now matched with codegen part.

Copy link
Member Author

Choose a reason for hiding this comment

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

I borrowed some codes from InvokeLike. It's a bit complicated to share the same codebase.

val result = child.eval(input)
if (checkType(result)) {
result
override def nullSafeEval(input: Any): Any = {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is also matched with the codegen side if I am not mistaken.

@HyukjinKwon HyukjinKwon changed the title [WIP][SPARK-39666][SQL] Use UnsafeProjection.create to respect spark.sql.codegen.factoryMode in RowEncoder [WIP][SPARK-39666][SQL] Use UnsafeProjection.create to respect spark.sql.codegen.factoryMode in ExpressionEncoder Jul 4, 2022
@HyukjinKwon HyukjinKwon marked this pull request as ready for review July 4, 2022 06:22
@HyukjinKwon HyukjinKwon changed the title [WIP][SPARK-39666][SQL] Use UnsafeProjection.create to respect spark.sql.codegen.factoryMode in ExpressionEncoder [SPARK-39666][SQL] Use UnsafeProjection.create to respect spark.sql.codegen.factoryMode in ExpressionEncoder Jul 4, 2022
@HyukjinKwon
Copy link
Member Author

cc @cloud-fan

@HyukjinKwon
Copy link
Member Author

Merged to master.

@HyukjinKwon HyukjinKwon deleted the SPARK-39666 branch January 15, 2024 00:53
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