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 2020/07/02 04:08:49 UTC

[GitHub] [calcite] danny0405 commented on a change in pull request #2049: [CALCITE-4094] Allow SqlOperator of SqlKind#OTHER_FUNCTION to define a Strong.Policy

danny0405 commented on a change in pull request #2049:
URL: https://github.com/apache/calcite/pull/2049#discussion_r448732851



##########
File path: core/src/main/java/org/apache/calcite/plan/Strong.java
##########
@@ -85,8 +86,32 @@ public static boolean isNotTrue(RexNode node, ImmutableBitSet nullColumns) {
   }
 
   /** Returns how to deduce whether a particular kind of expression is null,
-   * given whether its arguments are null. */
+   * given whether its arguments are null.
+   * @deprecated Use {@link Strong#policy(RexNode)} or {@link Strong#policy(SqlOperator)} */
+  @Deprecated // to be removed before 2.0
   public static Policy policy(SqlKind kind) {
+    return getPolicy(kind);

Review comment:
       Is there any strong reason we must deprecate this interface ?
   
   If we add an interface `SqlFunction#getStrongPolicy`, the only exception is the `SqlKind.OTHER_FUNCTION`, when we encounter that, a SqlFunction instance should be passed in.
   
   For the other SqlKind and policy mapping, it is great if we can make the mapping configurable and pluggable, just like what we do to `SqlTypeMappingRule`

##########
File path: core/src/main/java/org/apache/calcite/plan/Strong.java
##########
@@ -294,4 +319,10 @@ private boolean anyNull(List<RexNode> operands) {
     /** This kind of expression may be null. There is no way to rewrite. */
     AS_IS,
   }
+
+  /** Interface to allow {@link SqlOperator} of kind {@link SqlKind#OTHER_FUNCTION}
+   * to define their own {@link Policy}. */
+  public interface PolicySupplier {
+    Policy getPolicy();

Review comment:
       I was thinking of adding an interface in `SqlFunction`, something like `SqlFunction#getStrongPolicy` and give it a default value.




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

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