[Only Test] Make HiveGenericUDF's DeferredObject lazy#47193
Closed
panbingkun wants to merge 2 commits into
Closed
Conversation
LuciferYang
reviewed
Jul 3, 2024
|
|
||
| def setArg(index: Int, arg: Any): Unit = | ||
| deferredObjects(index).asInstanceOf[DeferredObjectAdapter].set(arg) | ||
| deferredObjects(index).asInstanceOf[DeferredObjectAdapter].set(() => arg) |
Contributor
There was a problem hiding this comment.
cc @jackylee-ch Can you test this fix?
I have some change in my local. Like @cloud-fan said, we should pass function to setArg to make it lazy. I have passed the failed case with none codegen case, and I'm still trying to fix it with codegen.
Contributor
Author
There was a problem hiding this comment.
@jackylee-ch Can you help test the updated version again?
Thanks.
cloud-fan
reviewed
Jul 3, 2024
| @@ -129,7 +129,7 @@ class HiveGenericUDFEvaluator( | |||
| override def returnType: DataType = inspectorToDataType(returnInspector) | |||
|
|
|||
| def setArg(index: Int, arg: Any): Unit = | |||
Contributor
There was a problem hiding this comment.
I think we should make it lazy at the very beginning, arg here is already materialized.
jackylee-ch
reviewed
Jul 3, 2024
| | return $finalEval; | ||
| | } | ||
| | }; | ||
| |$refEvaluator.setFuncArg($i, $funcArg); |
Contributor
There was a problem hiding this comment.
This won't work as we should mv the eval.code in apply, so that we can lazy run child functions. Just like the following code.
|$refEvaluator.setArg($i, new scala.runtime.AbstractFunction0<Object>() {
| public Object apply() {
| ${eval.code}
| return ${eval.value};
| }
|});
""".stripMargin
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?
Why are the changes needed?
Does this PR introduce any user-facing change?
How was this patch tested?
Was this patch authored or co-authored using generative AI tooling?