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/01/14 19:30:22 UTC

[GitHub] [pinot] richardstartin commented on a change in pull request #8001: St_* function error messages + support literal transform functions

richardstartin commented on a change in pull request #8001:
URL: https://github.com/apache/pinot/pull/8001#discussion_r785104120



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/StEqualsFunction.java
##########
@@ -53,14 +54,16 @@ public void init(List<TransformFunction> arguments, Map<String, DataSource> data
     TransformFunction transformFunction = arguments.get(0);
     Preconditions.checkArgument(transformFunction.getResultMetadata().isSingleValue(),
         "First argument must be single-valued for transform function: %s", getName());
-    Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType() == FieldSpec.DataType.BYTES,
-        "The first argument must be of bytes type");
+    Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType() == FieldSpec.DataType.BYTES
+            || transformFunction instanceof LiteralTransformFunction,
+        notBytesErrorMessage(transformFunction, "first"));
     _firstArgument = transformFunction;
     transformFunction = arguments.get(1);
     Preconditions.checkArgument(transformFunction.getResultMetadata().isSingleValue(),
         "Second argument must be single-valued for transform function: %s", getName());
-    Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType() == FieldSpec.DataType.BYTES,
-        "The second argument must be of bytes type");
+    Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType() == FieldSpec.DataType.BYTES
+            || transformFunction instanceof LiteralTransformFunction,
+        notBytesErrorMessage(transformFunction, "second"));

Review comment:
       Let's not eagerly create strings in checks like this - instead use the template overload and provide parameters, or don't use `Preconditions` and move the construction of the error message within the conditions so that it is only constructed in exceptional 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: 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