You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/11/02 18:15:52 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #9707: initial commit to support all scalar/transform/filter match

Jackie-Jiang commented on code in PR #9707:
URL: https://github.com/apache/pinot/pull/9707#discussion_r1012139262


##########
pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java:
##########
@@ -147,4 +157,48 @@ public static FunctionInfo getFunctionInfo(String functionName, int numParameter
   private static String canonicalize(String functionName) {
     return StringUtils.remove(functionName, '_').toLowerCase();
   }
+
+  /**
+   * Placeholders for scalar function, they register and represents the signature for transform and filter predicate
+   * so that v2 engine can understand and plan them correctly.
+   */
+  private static class PlaceholderScalarFunctions {
+
+    public static Object jsonExtractScalar(String jsonFieldName, String jsonPath, String resultsType) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    public static Object jsonExtractScalar(String jsonFieldName, String jsonPath, String resultsType,
+        Object defaultValue) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    public static String jsonExtractKey(String jsonFieldName, String jsonPath) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    public static long timeConvert(String timeConvertInput, String fromFormat, String toFormat) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    public static long extract(String extractFormat, long timestamp) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    // CHECKSTYLE:OFF
+    // @formatter:off
+    public static boolean text_contains(String text, String pattern) {

Review Comment:
   Will calcite match the underscore? If so, other things can also break such as `json_extract_scalar`



##########
pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java:
##########
@@ -25,7 +25,7 @@
 
 
 public enum TransformFunctionType {
-  // Aggregation functions for single-valued columns
+  // arithmetic functions for single-valued columns

Review Comment:
   (format) Keep the comment capitalized to be consistent



##########
pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java:
##########
@@ -147,4 +157,48 @@ public static FunctionInfo getFunctionInfo(String functionName, int numParameter
   private static String canonicalize(String functionName) {
     return StringUtils.remove(functionName, '_').toLowerCase();
   }
+
+  /**
+   * Placeholders for scalar function, they register and represents the signature for transform and filter predicate
+   * so that v2 engine can understand and plan them correctly.
+   */
+  private static class PlaceholderScalarFunctions {
+
+    public static Object jsonExtractScalar(String jsonFieldName, String jsonPath, String resultsType) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    public static Object jsonExtractScalar(String jsonFieldName, String jsonPath, String resultsType,
+        Object defaultValue) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    public static String jsonExtractKey(String jsonFieldName, String jsonPath) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    public static long timeConvert(String timeConvertInput, String fromFormat, String toFormat) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    public static long extract(String extractFormat, long timestamp) {
+      throw new UnsupportedOperationException("Placeholder scalar function, should not reach here");
+    }
+
+    // CHECKSTYLE:OFF
+    // @formatter:off

Review Comment:
   Why do we need to turn them on?



-- 
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@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org