julianhyde commented on code in PR #3518:
URL: https://github.com/apache/calcite/pull/3518#discussion_r1393251009


##########
linq4j/src/test/java/org/apache/calcite/linq4j/test/InlinerTest.java:
##########
@@ -152,6 +154,31 @@ void checkAssignInConditionOptimizedOut(int modifiers, 
String s) {
     assertThat(Expressions.toString(builder.toBlock()), is(s));
   }
 
+  /**
+   * Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-6109";>[CALCITE-6109]
+   * OptimizeShuttle should not create new instances of TernaryExpression
+   * if it does not do any optimization</a>.
+   */
+  @Test void testInlineTernaryNonOptimized() {
+    Statement originStatement =
+        Expressions.return_(null,
+            Expressions.makeTernary(ExpressionType.Conditional,
+                Expressions.makeBinary(ExpressionType.NotEqual,
+                    Expressions.parameter(int.class, "a"),
+                    Expressions.constant(1)),
+                Expressions.parameter(int.class, "b"),
+                Expressions.parameter(int.class, "c")));
+    b.add(originStatement);
+    BlockStatement block = b.toBlock();
+    assertEquals(block.statements.size(), 1);
+    assertSame(originStatement, block.statements.get(0));

Review Comment:
   why you require `assertSame` is rather subtle. and it's the whole point of 
the test. so, say why.



-- 
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]

Reply via email to