You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "snuyanzin (via GitHub)" <gi...@apache.org> on 2023/03/15 06:17:11 UTC

[GitHub] [calcite] snuyanzin commented on a diff in pull request #3111: [CALCITE-5574] Break MockCatalogReaderSimple#init into smaller methods

snuyanzin commented on code in PR #3111:
URL: https://github.com/apache/calcite/pull/3111#discussion_r1136578777


##########
testkit/src/main/java/org/apache/calcite/test/catalog/MockCatalogReaderSimple.java:
##########
@@ -441,8 +437,106 @@ protected MockCatalogReaderSimple(RelDataTypeFactory typeFactory,
       struct10View.addColumn(column.getName(), column.type);
     }
     registerTable(struct10View);
+  }
+
+  @Override public MockCatalogReaderSimple init() {
+    final Fixture fixture = new Fixture(typeFactory);
+
+    // Register "SALES" schema.
+    MockSchema salesSchema = new MockSchema("SALES");
+    registerSchema(salesSchema);
+
+    // Register "EMP" table with customer InitializerExpressionFactory
+    // to check whether newDefaultValue method called or not.
+    final InitializerExpressionFactory countingInitializerExpressionFactory =
+        new CountingFactory(ImmutableList.of("DEPTNO"));
+
+    registerType(
+        ImmutableList.of(salesSchema.getCatalogName(), salesSchema.getName(),
+            "customBigInt"),
+        typeFactory -> typeFactory.createSqlType(SqlTypeName.BIGINT));
+
+    // Register "EMP" table.
+    final MockTable empTable =
+        MockTable.create(this, salesSchema, "EMP", false, 14, null,
+            countingInitializerExpressionFactory, false);
+    registerTableEmp(empTable, fixture);
+
+    // Register "EMPNULLABLES" table with nullable columns.
+    final MockTable empNullablesTable =
+        MockTable.create(this, salesSchema, "EMPNULLABLES", false, 14);
+    registerTableEmpNullables(empNullablesTable, fixture);
+
+    // Register "EMPDEFAULTS" table with default values for some columns.
+    registerTableEmpDefaults(salesSchema, fixture);
+
+    // Register "EMP_B" table. As "EMP", birth with a "BIRTHDATE" column.
+    registerTableEmpB(salesSchema, fixture);
+
+    // Register "DEPT" table.

Review Comment:
   I wonder if we still need such comments since the same is written in method names?



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org