zabetak commented on a change in pull request #1104: [CALCITE-2900] 
RewriteRexShuttle generates wrong type during flatten for structured type when 
visitInputRef
URL: https://github.com/apache/calcite/pull/1104#discussion_r265887634
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/tools/PlannerTest.java
 ##########
 @@ -996,6 +997,66 @@ private void checkBushy(String sql, String expected) 
throws Exception {
     assertThat(toString(transform), containsString(expected));
   }
 
+  private void checkFlattenTypesOnNestedColumn(String sql, String expected) 
throws Exception {
+    final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
+    final SqlParser.Config sqlParserConfig = SqlParser.configBuilder()
+        .setCaseSensitive(false)
+        .setUnquotedCasing(Casing.UNCHANGED)
+        .setQuotedCasing(Casing.UNCHANGED)
+        .build();
+    final FrameworkConfig config = Frameworks.newConfigBuilder()
+        .parserConfig(sqlParserConfig)
+        .defaultSchema(
+            CalciteAssert.addSchema(rootSchema,
+                CalciteAssert.SchemaSpec.BOOKSTORE))
+        .traitDefs((List<RelTraitDef>) null)
+        .build();
+    final Planner planner = Frameworks.getPlanner(config);
+    SqlNode parse = planner.parse(sql);
+    SqlNode validate = planner.validate(parse);
+    RelNode convert = planner.rel(validate).rel;
+    assertThat(toString(convert), containsString(expected));
+  }
+
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-2900";>[CALCITE-2900]
+   * RewriteRexShuttle generates wrong type during flatten for structured type 
when
+   * visitInputRef</a>. */
+  @Test
+  public void testFlattenTypesWithFieldAccessOnFirstLevel() throws Exception {
+    String sql = ""
 
 Review comment:
   The current tests are great! I was just wondering if you could add a few 
lower level tests which address directly the problematic part of the flattener 
or even directly the RewriteRexShuttle. 

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


With regards,
Apache Git Services

Reply via email to