[SPARK-39666][SQL] Use UnsafeProjection.create to respect spark.sql.codegen.factoryMode in ExpressionEncoder#37067
Closed
HyukjinKwon wants to merge 1 commit intoapache:masterfrom
Closed
[SPARK-39666][SQL] Use UnsafeProjection.create to respect spark.sql.codegen.factoryMode in ExpressionEncoder#37067HyukjinKwon wants to merge 1 commit intoapache:masterfrom
spark.sql.codegen.factoryMode in ExpressionEncoder#37067HyukjinKwon wants to merge 1 commit intoapache:masterfrom
Conversation
HyukjinKwon
commented
Jul 4, 2022
| @@ -555,8 +555,27 @@ case class NewInstance( | |||
| } | |||
|
|
|||
| override def eval(input: InternalRow): Any = { | |||
Member
Author
There was a problem hiding this comment.
I believe this is now matched with codegen part.
Member
Author
There was a problem hiding this comment.
I borrowed some codes from InvokeLike. It's a bit complicated to share the same codebase.
HyukjinKwon
commented
Jul 4, 2022
| val result = child.eval(input) | ||
| if (checkType(result)) { | ||
| result | ||
| override def nullSafeEval(input: Any): Any = { |
Member
Author
There was a problem hiding this comment.
This is also matched with the codegen side if I am not mistaken.
spark.sql.codegen.factoryMode in RowEncoderspark.sql.codegen.factoryMode in ExpressionEncoder
spark.sql.codegen.factoryMode in ExpressionEncoderspark.sql.codegen.factoryMode in ExpressionEncoder
Member
Author
|
cc @cloud-fan |
cloud-fan
approved these changes
Jul 4, 2022
Member
Author
|
Merged to master. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.factoryModeto other values. The operations such as DSv1, DSv2, or object conversions such asMapObjectswill respect the value.How was this patch tested?
Existing test cases at
RowEncoderSuite extends CodegenInterpretedPlanTestandExpressionEncoderSuite extends CodegenInterpretedPlanTestshould cover this.