amaliujia commented on a change in pull request #1792: [CALCITE-3775] Implicit 
lookup methods in SimpleCalciteSchema ignore case sensitivity parameter
URL: https://github.com/apache/calcite/pull/1792#discussion_r377250827
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/test/JdbcTest.java
 ##########
 @@ -6616,6 +6617,43 @@ private void checkGetTimestamp(Connection con) throws 
SQLException {
     assertThat(aSchema.getSubSchemaNames().size(), is(2));
   }
 
+  @Test public void testCaseSensitiveConfigurableSimpleCalciteSchema() throws 
Exception {
+    final SchemaPlus rootSchema = CalciteSchema.createRootSchema(false, 
false).plus();
+    // create schema "/a"
+    final Map<String, Schema> dummySubSchemaMap = new HashMap<>();
+    final Map<String, Table> dummyTableMap = new HashMap<>();
+    final Map<String, RelProtoDataType> dummyTypeMap = new HashMap<>();
+    final SchemaPlus dummySchema = rootSchema.add("dummy",
+        new AbstractSchema() {
+          @Override protected Map<String, Schema> getSubSchemaMap() {
+            return dummySubSchemaMap;
+          }
+
+          @Override protected Map<String, Table> getTableMap() {
+            return dummyTableMap;
+          }
+
+          @Override protected Map<String, RelProtoDataType> getTypeMap() {
+            return dummyTypeMap;
+          }
+        });
+    // add implicit schema "/dummy/abc"
+    dummySubSchemaMap.put("abc", new AbstractSchema());
+    // add implicit table "/dummy/xyz"
+    dummyTableMap.put("xyz", new AbstractTable() {
+      @Override public RelDataType getRowType(RelDataTypeFactory typeFactory) {
+        return null;
+      }
+    });
+    // add implicit table "/dummy/myType"
+    dummyTypeMap.put("myType", factory -> factory.builder().build());
+
+    final CalciteSchema dummyCalciteSchema = CalciteSchema.from(dummySchema);
+    assertThat(dummyCalciteSchema.getSubSchema("aBC", false), notNullValue());
+    assertThat(dummyCalciteSchema.getTable("XyZ", false), notNullValue());
+    assertThat(dummyCalciteSchema.getType("MytYpE", false), notNullValue());
 
 Review comment:
   How about also have a test for "TRUE" case sensitive? 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to