asdfgh19 commented on code in PR #3518:
URL: https://github.com/apache/calcite/pull/3518#discussion_r1393564621
##########
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);
Review Comment:
Do you mean that assertSame and assertEquals easily make people confused
which is expected and which is actual? So I need to change to assertThat, right?
--
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]