mihaibudiu commented on code in PR #3785:
URL: https://github.com/apache/calcite/pull/3785#discussion_r1591363888


##########
core/src/main/java/org/apache/calcite/sql/type/OperandTypes.java:
##########
@@ -986,6 +986,14 @@ public static SqlSingleOperandTypeChecker same(int 
operandCount,
 
   public static final SqlSingleOperandTypeChecker ANY_ANY =
       family(SqlTypeFamily.ANY, SqlTypeFamily.ANY);
+
+  public static final SqlSingleOperandTypeChecker SECOND_THIRD_SAME =
+      new SameOperandTypeChecker(3) {

Review Comment:
   If you happened to see https://issues.apache.org/jira/browse/CALCITE-6383 
you may have noticed that the SameOperatndTypeChecker does not enforce that the 
operands have the same type, but only that they are comparable. Perhaps if this 
is what you want you should document this fact here.



##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -10036,6 +10036,34 @@ void assertSubFunReturns(boolean binary, String s, int 
start,
     checkNvl(f, FunctionAlias.of(SqlLibraryOperators.NVL));
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-6397";>[CALCITE-6397]
+   * Add NVL2 function (enabled in Spark library). </a>.
+   */
+  @Test void testNvl2Func() {
+    final SqlOperatorFixture f = fixture();
+    f.setFor(SqlLibraryOperators.NVL2, VmName.EXPAND);
+    f.checkFails("^nvl2(NULL, 2, 1)^",
+        "No match found for function signature "
+            + "NVL2\\(<NULL>, <NUMERIC>, <NUMERIC>\\)", false);
+
+    final SqlOperatorFixture f12 = f

Review Comment:
   the SameOperandTypeChecker allows different types for the operands 1 & 2, 
including numeric and string. Perhaps you should have some tests for these 
cases.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to