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 16:04:49 UTC

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

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



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

Review comment:
       i am not sure this logic is correct. this means if transformFunction is Literal, you don't check for the DataType of the result?

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BaseTransformFunction.java
##########
@@ -79,6 +79,21 @@ public Dictionary getDictionary() {
     throw new UnsupportedOperationException();
   }
 
+  protected String notBytesErrorMessage(TransformFunction transformFunction) {
+    return String.format("The argument must be of type %s , but was %s",
+        DataType.BYTES,
+        transformFunction.getResultMetadata().getDataType()
+    );

Review comment:
       nit
   ```suggestion
       return notBytesErrorMessage(transformFunction, "first");
   ```




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