-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23583][SQL] Invoke should support interpreted execution #20797
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
Conversation
|
Test build #88164 has finished for PR 20797 at commit
|
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.
Do we need to do explicitly cast? Doesn't Scala cast it if it's needed?
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.
It would work without this cast in Scala. I tried to do the same check that may throw an exception.
WDYT?
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.
For interpreted execution, I think it is less meaningful to check that. cc @hvanhovell
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.
I think that the point is where we want to cause a cast exception. With this code, an exception will occur at this class. Without this code, an exception will occur anywhere in the code.
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.
We should also check if obj is null too.
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
|
Test build #88181 has finished for PR 20797 at commit
|
|
ping @hvanhovell |
1 similar comment
|
ping @hvanhovell |
|
Test build #88583 has finished for PR 20797 at commit
|
|
Test build #88590 has finished for PR 20797 at commit
|
|
Test build #88591 has finished for PR 20797 at commit
|
|
@hvanhovell sorry for ping again |
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.
I basically have the same comments here as for StaticInvoke: Why do we need to resolve the method at runtime? Why are you using CodeGenerator.defaultValue(dataType) to determine if something is a primitive?
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.
O, btw: We should reuse the method resolution logic in StaticInvoke
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.
Since obj should be evaluated at each call of eval, it is hard to reuse method resolution logic in StaticInvoke. On the other hand, we can reuse logic for casting a return 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.
I refactored the code as possible as the common code is used.
|
Test build #88631 has finished for PR 20797 at commit
|
|
Test build #88649 has finished for PR 20797 at commit
|
|
retest this please |
|
Test build #88655 has finished for PR 20797 at commit
|
|
retest this please |
|
Test build #88686 has finished for PR 20797 at commit
|
|
retest this please |
|
Test build #88821 has finished for PR 20797 at commit
|
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.
Why are we resolving during evaluation time? This seems to be expensive?
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.
Unlike StaticInvoke, this is because obj is dynamically evaluated with a value in InternalRow. We cannot resolve beforehand when the case class is created.
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.
We should know the type before this right? Otherwise whole stage code generation doesn't work either.
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.
We can know the base class beforehand. The obj class may be a subclass. I think this is a kind of virtual table lookup based on the literal name?
Since JVM class resolution converts the literal name to a constant offset, the code generation can perform a fast lookup based on the offset.
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.
Ah, this method may be applied to the base class. let me try this optimization.
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.
Good catch. I also use method that was already defined for interpreted execution.
|
Test build #88847 has finished for PR 20797 at commit
|
|
LGTM @kiszk can you update your branch so we can merge? |
|
Test build #88869 has finished for PR 20797 at commit
|
|
retest this please |
|
Test build #88879 has finished for PR 20797 at commit
|
|
retest this please |
|
Test build #88886 has finished for PR 20797 at commit
|
|
LGTM - merging to master. Thanks! |
| case ObjectType(cls) => cls | ||
| case _ => typeJavaMapping.getOrElse(dt, classOf[java.lang.Object]) | ||
| } | ||
| } |
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 @maropu We can now use this instead of CallMethodViaReflection.typeMapping.
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.
ok
## What changes were proposed in this pull request? This pr added interpreted execution for `Invoke`. ## How was this patch tested? Added tests in `ObjectExpressionsSuite`. Author: Kazuaki Ishizaki <[email protected]> Closes apache#20797 from kiszk/SPARK-28583.
## What changes were proposed in this pull request? This pr added interpreted execution for `Invoke`. ## How was this patch tested? Added tests in `ObjectExpressionsSuite`. Author: Kazuaki Ishizaki <[email protected]> Closes apache#20797 from kiszk/SPARK-28583.
What changes were proposed in this pull request?
This pr added interpreted execution for
Invoke.How was this patch tested?
Added tests in
ObjectExpressionsSuite.