Commit 73e3c36
[SPARK-40385][SQL] Fix interpreted path for companion object constructor
### What changes were proposed in this pull request?
Fixes encoding of classes that uses companion object constructors in the interpreted path. Without this change the that is added in this change would fail with
```
...
Cause: java.lang.RuntimeException: Error while decoding: java.lang.RuntimeException: Couldn't find a valid constructor on interface org.apache.spark.sql.catalyst.ScroogeLikeExample
newInstance(interface org.apache.spark.sql.catalyst.ScroogeLikeExample)
at org.apache.spark.sql.errors.QueryExecutionErrors$.expressionDecodingError(QueryExecutionErrors.scala:1199)
...
```
As far as I can tell this bug has existed since the initial implementation in SPARK-8288 #23062
The existing spec that tested this part of the code incorrectly provided an outerPointer which hid the bug from that test.
### Why are the changes needed?
Fixes a bug, the new spec in the ExpressionsEncoderSuite shows that this is in fact a bug.
### Does this PR introduce _any_ user-facing change?
Yes, it fixes a bug.
### How was this patch tested?
New and existing specs in ExpressionEncoderSuite and ObjectExpressionsSuite.
Closes #37837 from eejbyfeldt/spark-40385.
Authored-by: Emil Ejbyfeldt <eejbyfeldt@liveintent.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>1 parent 969d2d4 commit 73e3c36
3 files changed
Lines changed: 7 additions & 4 deletions
File tree
- sql/catalyst/src
- main/scala/org/apache/spark/sql/catalyst
- test/scala/org/apache/spark/sql/catalyst
- encoders
- expressions
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
850 | 850 | | |
851 | 851 | | |
852 | 852 | | |
853 | | - | |
854 | | - | |
| 853 | + | |
| 854 | + | |
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
480 | 483 | | |
481 | 484 | | |
482 | 485 | | |
| |||
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ObjectExpressionsSuite.scala
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
426 | | - | |
| 426 | + | |
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| |||
0 commit comments