luoyuxia commented on code in PR #21927:
URL: https://github.com/apache/flink/pull/21927#discussion_r1199884283
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/IfCallGen.scala:
##########
@@ -52,19 +52,19 @@ class IfCallGen() extends CallGenerator {
val resultCode =
s"""
|// --- Start code generated by ${className[IfCallGen]}
- |${castedResultTerm1.getCode}
- |${castedResultTerm2.getCode}
|${operands.head.code}
|$resultTerm = $resultDefault;
|if (${operands.head.resultTerm}) {
| ${operands(1).code}
| if (!${operands(1).nullTerm}) {
+ | ${castedResultTerm1.getCode}
Review Comment:
Since we have changed the type inference in
[here](https://github.com/apache/flink/pull/21927/files#diff-2c7dc9ff08ba0e7271dd3f739dcd9ccce11f0d074054074f488e6d1f27df7bf3R59),
we don't need to modify int here, right?
##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/CalcITCase.scala:
##########
@@ -366,6 +366,59 @@ class CalcITCase extends StreamingTestBase {
sink.getAppendResults.foreach(result => assertEquals(expected, result))
}
+ @Test
+ def testIfFunctionWithNestedInput(): Unit = {
+ val data = List(
+ Row.of(Row.of("Hello", "Worlds"), Int.box(1)),
+ Row.of(Row.of("Hello", "Hidden"), Int.box(5)),
+ Row.of(Row.of("Hello again", null), Int.box(2)),
+ Row.of(Row.of(null, "World"), Int.box(0)),
+ Row.of(Row.of("Hello again", "Hide"), Int.box(6))
+ )
+ val dataId = TestValuesTableFactory.registerData(data)
+ val ddl =
Review Comment:
Following the style of this test, use the way like
` val t = env
.fromCollection(TestData.tupleData3)
.toTable(tEnv, 'a, 'b, 'c)
tEnv.createTemporaryView("MyTable", t)
`
to create a table ? Then the code will look much clear.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]