somu-imply commented on code in PR #14510:
URL: https://github.com/apache/druid/pull/14510#discussion_r1287508462


##########
sql/src/main/java/org/apache/druid/sql/calcite/expression/OperatorConversions.java:
##########
@@ -505,16 +506,13 @@ public OperatorBuilder<T> operandTypes(final 
SqlTypeFamily... operandTypes)
     }
 
     /**
-     * Signifies that the first {@code requiredOperands} operands are 
required, and all later operands are optional.
+     * Equivalent to calling {@link 
BasicOperandTypeChecker.Builder#requiredOperandCount(int)}; leads to using a
+     * {@link BasicOperandTypeChecker} as our operand type checker.
      *
-     * Required operands are not allowed to be null. Optional operands can 
either be skipped or explicitly provided as
-     * literal NULLs. For example, if {@code requiredOperands == 1}, then 
{@code F(x, NULL)} and  {@code F(x)} are both
-     * accepted, and {@code x} must not be null.
-     *
-     * Must be used in conjunction with {@link 
#operandTypes(SqlTypeFamily...)}; this method is not compatible with
-     * {@link #operandTypeChecker(SqlOperandTypeChecker)}.
+     * Not compatible with {@link #operandTypeChecker(SqlOperandTypeChecker)}.
      */
-    public OperatorBuilder<T> requiredOperandCount(final int 
requiredOperandCount)
+    @Deprecated

Review Comment:
   The alternative is to use 
`.operandTypeChecker(BasicOperandTypeChecker.builder().requiredOperandCount(1).build())`
 and remove the deprecated function call as it now happens inside the type 
checker. Something like this
   ```
   private static final SqlAggFunction FUNCTION_INSTANCE =
         OperatorConversions.aggregatorBuilder(NAME)
                           .operandNames("column", "lgK", "tgtHllType")
                           .operandTypes(SqlTypeFamily.ANY, 
SqlTypeFamily.NUMERIC, SqlTypeFamily.STRING)
                           .operandTypeInference(InferTypes.VARCHAR_1024)
                           
.operandTypeChecker(BasicOperandTypeChecker.builder().requiredOperandCount(1).build())
                           .literalOperands(1, 2)
                           .returnTypeNonNull(SqlTypeName.OTHER)
                           
.functionCategory(SqlFunctionCategory.USER_DEFINED_FUNCTION)
                           .build();
                           ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to