Skip to content

Conversation

@panbingkun
Copy link
Contributor

@panbingkun panbingkun commented Oct 18, 2024

What changes were proposed in this pull request?

The pr aims to make StaticInvoke compatible with the method that return Any.

Why are the changes needed?

Currently, our StaticInvoke does not support calling the method with a return type signature of Any(actually, the type of return value may be different data type), while Invoke supports it, let's align it.

Does this PR introduce any user-facing change?

No, only for spark developer.

How was this patch tested?

  • Add new UT.
  • Pass GA.

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

No.

@github-actions github-actions bot added the SQL label Oct 18, 2024

test("StaticInvoke call return `any` method") {
val cls = TestStaticInvokeReturnAny.getClass
Seq((0, IntegerType, true), (1, IntegerType, true), (2, IntegerType, false)).foreach {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • case 0 - (0, IntegerType, true) will hit line 325 of objects.scala
  • case 1 - (1, IntegerType, true) will hit line 332 of objects.scala
  • case 2 - (2, IntegerType, true) will hit line 340 of objects.scala

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This UT can hit three points where cast is added.

@panbingkun panbingkun marked this pull request as ready for review October 18, 2024 10:53
@panbingkun
Copy link
Contributor Author

cc @cloud-fan

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in f9a5de4 Oct 21, 2024
ericm-db pushed a commit to ericm-db/spark that referenced this pull request Oct 22, 2024
…t return `Any`

### What changes were proposed in this pull request?
The pr aims to make `StaticInvoke` compatible with the method that return `Any`.

### Why are the changes needed?
Currently, our `StaticInvoke` does not support calling the method with a return type signature of `Any`(actually, the type of return value may be `different data type`), while `Invoke` supports it, let's align it.

### Does this PR introduce _any_ user-facing change?
No, only for spark developer.

### How was this patch tested?
- Add new UT.
- Pass GA.

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

Closes apache#48542 from panbingkun/SPARK-50029.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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