njriasan commented on a change in pull request #2435:
URL: https://github.com/apache/calcite/pull/2435#discussion_r665995049
##########
File path: core/src/test/java/org/apache/calcite/tools/PlannerTest.java
##########
@@ -1525,4 +1527,67 @@ private void checkView(String sql, Matcher<String>
matcher)
final RelRoot root = planner.rel(validate);
assertThat(toString(root.rel), matcher);
}
+
+ /** Test case for <a
href="https://issues.apache.org/jira/browse/CALCITE-4642">[CALCITE-4642]
+ * Checks that custom type systems can be registered in a planner by
+ * comparing options for converting unions of chars.</a>.
+ */
+ @Test void testCustomTypeSystem() throws Exception {
+ final String sql = "select Case when DEPTNO <> 30 then 'hi' else 'world'
end from dept";
+ final String expectedVarying = "LogicalProject("
+ + "EXPR$0=["
+ + "CASE(<>($0, 30),"
+ + " 'hi':VARCHAR(5), "
+ + "'world':VARCHAR(5))])\n"
+ + " LogicalValues("
+ + "tuples=[[{ 10, 'Sales' },"
+ + " { 20, 'Marketing' },"
+ + " { 30, 'Engineering' },"
+ + " { 40, 'Empty' }]])\n";
+ final String expectedDefault = "LogicalProject("
+ + "EXPR$0=["
+ + "CASE(<>($0, 30),"
+ + " 'hi ', "
+ + "'world')])\n"
+ + " LogicalValues("
+ + "tuples=[[{ 10, 'Sales ' },"
+ + " { 20, 'Marketing ' },"
+ + " { 30, 'Engineering' },"
+ + " { 40, 'Empty ' }]])\n";
Review comment:
Thanks for the suggestion. I'll merge this change to make it more
readable.
--
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]