danny0405 commented on a change in pull request #2382:
URL: https://github.com/apache/calcite/pull/2382#discussion_r612921434



##########
File path: core/src/test/java/org/apache/calcite/test/SqlToRelTestBase.java
##########
@@ -592,26 +617,11 @@ public RelRoot convertSqlToRel(String sql) {
       }
       final RelDataTypeFactory typeFactory = getTypeFactory();
       final Prepare.CatalogReader catalogReader =
-          createCatalogReader(typeFactory);
+              createCatalogReader(typeFactory);

Review comment:
       Fix the indentation.

##########
File path: core/src/test/java/org/apache/calcite/test/SqlToRelTestBase.java
##########
@@ -770,7 +795,32 @@ public void assertConvertsTo(
       assertConvertsTo(sql, plan, false);
     }
 
+    public void assertConvertsTo(String sql,
+                                 String plan,

Review comment:
       Fix the indentation.

##########
File path: core/src/test/java/org/apache/calcite/test/SqlToRelTestBase.java
##########
@@ -215,10 +223,25 @@ void assertConvertsTo(
      * @param plan Expected plan
      * @param trim Whether to trim columns that are not needed
      */
+    void assertConvertsTo(
+            String sql,

Review comment:
       Fix the indentation.

##########
File path: core/src/test/java/org/apache/calcite/test/SqlToRelTestBase.java
##########
@@ -636,27 +646,35 @@ public RelNode trimRelNode(RelNode relNode) {
       final SqlValidator validator =
           createValidator(
               catalogReader, typeFactory);
-      final Context context = getContext();
-      final CalciteConnectionConfig calciteConfig =
-          context.unwrap(CalciteConnectionConfig.class);
-      if (calciteConfig != null) {
-        validator.transform(config ->
-            
config.withDefaultNullCollation(calciteConfig.defaultNullCollation()));
-      }
-      final SqlToRelConverter.Config config =
-          configTransform.apply(SqlToRelConverter.config());
 
       final SqlToRelConverter converter =
           createSqlToRelConverter(
               validator,
-              catalogReader,
-              typeFactory,
-              config);
+              catalogReader);
       relNode = converter.flattenTypes(relNode, true);
       relNode = converter.trimUnusedFields(true, relNode);
       return relNode;
     }
 
+    private SqlToRelConverter createSqlToRelConverter(SqlValidator validator,
+                                                      Prepare.CatalogReader 
catalogReader) {

Review comment:
       Fix the indentation.

##########
File path: core/src/test/java/org/apache/calcite/test/SqlToRelTestBase.java
##########
@@ -770,7 +795,32 @@ public void assertConvertsTo(
       assertConvertsTo(sql, plan, false);
     }
 
+    public void assertConvertsTo(String sql,
+                                 String plan,
+                                 boolean trim) {
+      assertConvertsTo(sql, plan, false, true);
+    }
+
     public void assertConvertsTo(
+            String sql,
+            String plan,
+            boolean trim,
+            boolean query) {
+      if (query) {
+        assertSqlConvertsTo(sql, plan, trim);
+      } else {
+        assertExprConvertsTo(sql);
+      }
+    }
+
+    private void assertExprConvertsTo(
+        String expr) {

Review comment:
       ```java
   private void assertExprConvertsTo(
           String expr,
           String plan) {
         String expr2 = getDiffRepos().expand("sql", expr);
         RexNode rex = convertExprToRex(expr2);
         assertNotNull(rex);
         // NOTE jvs 28-Mar-2006:  insert leading newline so
         // that plans come out nicely stacked instead of first
         // line immediately after CDATA start
         String actual = NL + rex.toString();
         diffRepos.assertEquals("plan", plan, actual);
       }
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to