julianhyde commented on a change in pull request #2435:
URL: https://github.com/apache/calcite/pull/2435#discussion_r662560116



##########
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";

Review comment:
       Yeah, that's valid. It's difficult to see the  relational operators 
'LogicalProject' and 'LogicalValues'. Sometimes I ensure that continuation 
lines have no preceding spaces at, which visually distinguishes them from the 
indented relational operators. Like this:
   
   ```
   "LogicalProject(EXPR$0=[CASE(<>($0, 30), "
           + "'hi   ', "
           + "'world')])\n"
           + "  LogicalValues("
           + "tuples=[[{ 10, 'Sales      ' }, "
           + "{ 20, 'Marketing  ' }, "
           + "{ 30, 'Engineering' }, "
           + "{ 40, 'Empty      ' }]])\n";
   ```
   
   It works well in large, very-indented plans.




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