-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
St_* function error messages + support literal transform functions #8001
St_* function error messages + support literal transform functions #8001
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8001 +/- ##
=========================================
Coverage ? 71.40%
Complexity ? 4303
=========================================
Files ? 1624
Lines ? 84152
Branches ? 12597
=========================================
Hits ? 60092
Misses ? 19955
Partials ? 4105
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
...e/src/main/java/org/apache/pinot/core/operator/transform/function/BaseTransformFunction.java
Outdated
Show resolved
Hide resolved
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not sure this logic is correct. this means if transformFunction is Literal, you don't check for the DataType of the result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@walterddr yeh this is a good question! But all the existing ST_* functions do it like this and it seems to work alright.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh. this is the reason. nvm then.
Line 39 in ca08968
* TODO: Preserve the type of the literal instead of inferring the type from the string |
...core/src/main/java/org/apache/pinot/core/geospatial/transform/function/StEqualsFunction.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/apache/pinot/core/operator/transform/function/BaseTransformFunction.java
Outdated
Show resolved
Hide resolved
88a2f5b
to
60aa2d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType() == FieldSpec.DataType.BYTES | ||
|| transformFunction instanceof LiteralTransformFunction, | ||
String.format("The %s argument must be of type %s , but was %s", | ||
"first", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, you can inline first
in the msg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is worthwhile because it avoids the varargs overload too
…sform functions in StContainsFunction
c077ad5
to
07b9492
Compare
@Jackie-Jiang @yupeng9 any objections to merging this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
St_Contains
,St_Area
,St_Distance
, andSt_Equals
to indicate to the user what argument type they actually passed to the function.St_Equals
andSt_Area
accept literal transform functions (the same as the otherSt_
functions)The change to
St_Equals
lets us compare the location in a column against a literal location:And the change to
St_Area
does the same thing:Upgrade Notes
Does this PR prevent a zero down-time upgrade? (Assume upgrade order: Controller, Broker, Server, Minion)
backward-incompat
, and complete the section below on Release Notes)Does this PR fix a zero-downtime upgrade introduced earlier?
backward-incompat
, and complete the section below on Release Notes)Does this PR otherwise need attention when creating release notes? Things to consider:
release-notes
and complete the section on Release Notes)Release Notes
Documentation