-
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
Fix StPoint scalar function usage in multi-stage engine intermediate stage #11731
Fix StPoint scalar function usage in multi-stage engine intermediate stage #11731
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11731 +/- ##
============================================
- Coverage 63.12% 63.10% -0.02%
Complexity 1118 1118
============================================
Files 2342 2342
Lines 125889 125924 +35
Branches 19360 19364 +4
============================================
+ Hits 79462 79469 +7
- Misses 40783 40799 +16
- Partials 5644 5656 +12
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 18 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
...-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/ScalarFunctions.java
Outdated
Show resolved
Hide resolved
db36255
to
35d3db4
Compare
...ntegration-tests/src/test/java/org/apache/pinot/integration/tests/custom/GeoSpatialTest.java
Outdated
Show resolved
Hide resolved
3bb7b74
to
ad55f9f
Compare
...-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/StPointFunction.java
Outdated
Show resolved
Hide resolved
...-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/StPointFunction.java
Outdated
Show resolved
Hide resolved
@@ -213,7 +213,7 @@ public enum TransformFunctionType { | |||
ST_GEOG_FROM_WKB("ST_GeogFromWKB", ReturnTypes.explicit(SqlTypeName.VARBINARY), OperandTypes.BINARY), | |||
ST_GEOM_FROM_WKB("ST_GeomFromWKB", ReturnTypes.explicit(SqlTypeName.VARBINARY), OperandTypes.BINARY), | |||
ST_POINT("ST_Point", ReturnTypes.explicit(SqlTypeName.VARBINARY), | |||
OperandTypes.family(ImmutableList.of(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC), | |||
OperandTypes.family(ImmutableList.of(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC, SqlTypeFamily.ANY), |
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.
OperandTypes.family(ImmutableList.of(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC, SqlTypeFamily.ANY), | |
OperandTypes.or( | |
OperandTypes.family(ImmutableList.of(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC)), | |
OperandTypes.family(ImmutableList.of(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC, SqlTypeFamily.BOOLEAN)) | |
), |
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.
somehow this doesn't honor ordinal -> ordinal > 1 && ordinal < 4
to handle variable number of parameters.
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.
When I try to define this as:
ST_POINT("ST_Point", ReturnTypes.explicit(SqlTypeName.VARBINARY),
OperandTypes.or(
OperandTypes.family(ImmutableList.of(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC),
ordinal -> ordinal > 1 && ordinal < 4),
OperandTypes.family(ImmutableList.of(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC, SqlTypeFamily.BOOLEAN),
ordinal -> ordinal > 1 && ordinal < 4)),
"stPoint"),
The StPoint(1,2) will fail.
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.
ah. i see. that's fine for now
702a0a5
to
8b03ee5
Compare
8b03ee5
to
e7481da
Compare
Point point = GeometryUtils.GEOMETRY_FACTORY.createPoint(new Coordinate(x, y)); | ||
if (isGeography) { | ||
if (BooleanUtils.toBoolean(isGeography)) { |
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.
what if isGeography is not given boolean up?
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.
BooleanUtils.toBoolean
actually works for number/string/boolean type.
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 see. for non-boolean value, will it handle exception?
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 our internal boolean util, it can handle number/string/boolean
public static boolean toBoolean(Object booleanObject) {
if (booleanObject == null) {
return false;
} else if (booleanObject instanceof String) {
return BooleanUtils.toBoolean((String) booleanObject);
} else if (booleanObject instanceof Number) {
return ((Number) booleanObject).intValue() == INTERNAL_TRUE;
} else if (booleanObject instanceof Boolean) {
return (boolean) booleanObject;
} else {
throw new IllegalArgumentException("Illegal type for boolean conversion: " + booleanObject.getClass());
}
}
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 we should add more tests for other ST later
Current
stPoint
only supports boolean as 3rd argument, this is not aligned with Transformer function which can be eitherINT
orBOOLEAN
.stPoint
to useObject
as 3rd argumentBYTES
andSTRING
in H3IndexFilterOperator to handle binary literal values.org.apache.pinot.integration.tests.custom.GeoSpatialTest