[CALCITE-7690] DELETE on a single-column table fails with "Cannot cast java.lang.Object to int" - #5150
Conversation
|
Sometimes it's useful to have long descriptions of what's going on for short PRs, but I think in this case you are just wasting reviewer bandwidth. Can you please use shorter descriptions? |
| * type is a primitive. The generated sink key extractor must not cast | ||
| * Object to that primitive directly: Java allows such a cast but Janino, | ||
| * which compiles the generated code, does not implement it. */ | ||
| @Test void testDeleteSingleColumn() throws Exception { |
There was a problem hiding this comment.
Can we have tests for columns which already have Object types, e.g., INT ARRAY?
There was a problem hiding this comment.
If this fails, you should figure out whether it's the same bug or another one. If it's another one, please file an issue. If it's the same one, maybe this is the place to fix it.
…t java.lang.Object to int" EnumerableTableModify.deleteFromCollection casts the sink row, declared as Object, to the table's Java row type. For a single-column table that type is a primitive, so the generated code is "(int) sinkRow". javac accepts such a cast; Janino does not. Box the target type. Primitive.box leaves references unchanged, so the multi-column case is unaffected. Adds ServerTest.testDeleteSingleColumn, testDeleteSingleObjectColumn and testDeleteSingleNullableColumn. The tests added by CALCITE-7510 are all two-column, so this shape was never covered.
99503c8 to
c3c254a
Compare
|
Shortened the description here and on the Jira, and cut the code comments down to a line or two. Thanks for the review. |
|
I think, as a rule, you should never submit something you haven't read entirely yourself, or something you would not have written yourself. It's fine to use a tool to write them, but you should treat the production as your own, and it should meet your personal quality standards. |
|
CALCITE-7690 and apache/calcite#5150 carry the one-line fix and two ServerTest cases, verified against Calcite's build. When it reaches a snapshot the two tests here go green untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CALCITE-7690 and apache/calcite#5150 carry the one-line fix and two ServerTest cases, verified against Calcite's build. When it reaches a snapshot the two tests here go green untouched.



https://issues.apache.org/jira/browse/CALCITE-7690
DELETEon a single-column table generates(int) sinkRowfrom asinkRowdeclaredObject, because forone column the table's Java row type is a primitive. javac accepts that cast; Janino does not, so the
generated code fails to compile.
Boxing the target type fixes it.
Primitive.boxleaves references unchanged, so the multi-column case isunaffected.
Tests:
ServerTest.testDeleteSingleColumn,testDeleteSingleObjectColumnandtestDeleteSingleNullableColumn. The tests added by [CALCITE-7510] are all two-column, so this shape wasnever covered.