You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/11/04 22:56:03 UTC

[GitHub] [calcite] NobiGo commented on a change in pull request #2598: [CALCITE-4875] Preserve Operand Nullability in NVL rewrite

NobiGo commented on a change in pull request #2598:
URL: https://github.com/apache/calcite/pull/2598#discussion_r743258201



##########
File path: core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
##########
@@ -7202,6 +7218,41 @@ void assertSubFunReturns(boolean binary, String s, int start,
         "nvl(CAST(NULL AS VARCHAR(6)), cast(NULL AS VARCHAR(4)))");
   }
 
+
+  private RelNode transformSqlToRel(String sql) throws Exception {
+    final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
+    final SchemaPlus defSchema = rootSchema.add("hr", new HrClusteredSchema());
+    final FrameworkConfig config = Frameworks.newConfigBuilder()
+        .parserConfig(SqlParser.Config.DEFAULT)
+        .defaultSchema(defSchema)
+        .traitDefs(ConventionTraitDef.INSTANCE, RelCollationTraitDef.INSTANCE)
+        .operatorTable(SqlLibraryOperatorTableFactory.INSTANCE
+            .getOperatorTable(SqlLibrary.STANDARD, SqlLibrary.ORACLE))
+        .build();
+    Planner planner = Frameworks.getPlanner(config);
+    SqlNode parse = planner.parse(sql);
+    SqlNode validate = planner.validate(parse);
+    RelRoot planRoot = planner.rel(validate);
+    return planRoot.rel;
+
+  }
+
+  @Test public void testNvlOperands() throws Exception {

Review comment:
       The testNvlFunc has existed in SqlOperatorTest, If it doesn't have enough tests for you, please perfect it.
   
   If this can't suit your need. You can add a SQL type test in .iq file.




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