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

 ##########
 File path: core/src/test/java/org/apache/calcite/test/catalog/Fixture.java
 ##########
 @@ -109,16 +109,23 @@
             .build();
     empListType =
         typeFactory.createArrayType(empRecordType, -1);
+
+    // Subclass ObjectSqlType to make nested field queryable.
     addressType =
-        new ObjectSqlType(SqlTypeName.STRUCTURED,
+        new ObjectSqlType(
+            SqlTypeName.STRUCTURED,
 
 Review comment:
   Hey @zabetak, I tried this Bookstore schema in SqlToRelConverterTest. The 
change is much bigger than the original one because to add Bookstore schema in 
SqlToRelTestBase takes:
   1. Change TesterImpl type factory to JavaTypeFactoryImpl -> add 
withTypeFactory method in both Tester interface and impl.
   2. Do the same thing for RelOptPlanner in TesterImpl and replace it with a 
subclass of MockRelOptPlanner with traitset related method overrided. 
   3. To support the Bookstore schema, we need make the CalciteSchema to be 
cached instead of existing simple, and make it case insensitive -> change 
MockCatalogReader constructor signature and subclass it to register bookstore 
schema.
   
   I think there is no need that we stick to Bookstore because there is already 
existing nested fields in MockCatalogReaderSimple. Another approach is to adapt 
the existing changes on Bookstore schema to MockCatalogReaderSimple (basically 
add one more layer deeper in a nested schema). And migrate existing changes in 
PlannerTest to SqlToRelConverterTest. IMO this approach is cleanest and also 
aligned with the existing tests.
   
   What do you think?

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