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 2023/01/11 21:28:01 UTC

[GitHub] [calcite] olivrlee commented on a diff in pull request #3003: 5430/Add IFNULL() function for BIG_QUERY dialect

olivrlee commented on code in PR #3003:
URL: https://github.com/apache/calcite/pull/3003#discussion_r1067473329


##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -6315,6 +6315,30 @@ void assertSubFunReturns(boolean binary, String s, int start,
     f12.checkNull("nvl(CAST(NULL AS VARCHAR(6)), cast(NULL AS VARCHAR(4)))");
   }
 
+
+  @Test void testIfNullCoalesceFunc() {
+    final SqlOperatorFixture f = fixture()
+        .withLibrary(SqlLibrary.BIG_QUERY)
+        .setFor(SqlLibraryOperators.IFNULL, VM_EXPAND);
+
+    f.checkString("ifnull('a','b')", "a", "CHAR(1) NOT NULL");
+    f.checkString("ifnull(null,'b')", "b", "CHAR(1)");

Review Comment:
   Updated to follow NVL pattern and the result is CHAR(1) NOT NULL, so fixed!



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