[
https://issues.apache.org/jira/browse/ASTERIXDB-1327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15203161#comment-15203161
]
Jianfeng Jia commented on ASTERIXDB-1327:
-----------------------------------------
[~lwhay] I'm not very familiar with the internal spatial-intersect
implementation. Yet, I think the problem is easy to verify by this query
{code}
spatial-intersect(circle("3107.06794511,1079.71664882
1000.0"),point("3513.27543563,978.772476107"))
{code}
However, it gave me the following exception:
{code}
java.lang.ArrayIndexOutOfBoundsException: 17
at
org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer.getLong(AInt64SerializerDeserializer.java:58)
at
org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer.getLongBits(ADoubleSerializerDeserializer.java:61)
at
org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer.getDouble(ADoubleSerializerDeserializer.java:57)
at
org.apache.asterix.runtime.evaluators.functions.SpatialIntersectDescriptor$2$1.pointInCircle(SpatialIntersectDescriptor.java:186)
at
org.apache.asterix.runtime.evaluators.functions.SpatialIntersectDescriptor$2$1.evaluate(SpatialIntersectDescriptor.java:1008)
at
org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:221)
at
org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:153)
at
org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55)
at
org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.transform(ConstantFoldingRule.java:163)
at
org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractAssignOperator.acceptExpressionTransform(AbstractAssignOperator.java:67)
at
org.apache.asterix.optimizer.rules.ConstantFoldingRule.rewritePost(ConstantFoldingRule.java:150)
at
org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:125)
at
org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:99)
at
org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:99)
at
org.apache.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialFixpointRuleController.rewriteWithRuleCollection(SequentialFixpointRuleController.java:53)
at
org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.runOptimizationSets(HeuristicOptimizer.java:95)
at
org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.optimize(HeuristicOptimizer.java:82)
at
org.apache.hyracks.algebricks.compiler.api.HeuristicCompilerFactoryBuilder$1$1.optimize(HeuristicCompilerFactoryBuilder.java:87)
at
org.apache.asterix.api.common.APIFramework.compileQuery(APIFramework.java:289)
{code}
On the other hand, it returned a valid result if I changed the order of two
variables as following:
{code}
spatial-intersect(point("3513.27543563,978.772476107"),circle("3107.06794511,1079.71664882
1000.0"))
{code}
{code}
true
{code}
I thinks [~kisskys] may know better about this issue.
> Spatial-intersect between point and circle not working correctly
> ----------------------------------------------------------------
>
> Key: ASTERIXDB-1327
> URL: https://issues.apache.org/jira/browse/ASTERIXDB-1327
> Project: Apache AsterixDB
> Issue Type: Bug
> Reporter: Steven Jacobs
> Attachments: EmergencyReports.adm, UserLocationsShort.adm
>
>
> The first query returns a large set of results. The second returns nothing
> {noformat}
> for $report in dataset EmergencyReports
> for $location in dataset UserLocations
> where $report.emergencyType = "earthquake"
> let $circle := create-circle($location.location,.1)
> where spatial-intersect($report.impactZone, $circle)
> return {
> "user at":$location.location,
> "report at":$report.impactZone
> }
> {noformat}
> {noformat}
> for $report in dataset EmergencyReports
> for $location in dataset UserLocations
> where $report.emergencyType = "earthquake"
> where spatial-intersect($report.impactZone, $location.location)
> return {
> "user at":$location.location,
> "report at":$report.impactZone
> }
> {noformat}
> Here are the DDL statements. I will attach the two datasets:
> {noformat}
> drop dataverse channels if exists;
> create dataverse channels;
> use dataverse channels;
> create type UserLocation as closed {
> recordId: uuid,
> location: point,
> user-id: string,
> timeoffset: float
> }
> create type EmergencyReport as closed {
> reportId: uuid,
> severity: int,
> impactZone: circle,
> timeoffset: float,
> duration: float,
> message: string,
> emergencyType: string
> }
> create dataset UserLocations(UserLocation)
> primary key recordId autogenerated;
> create dataset EmergencyReports(EmergencyReport)
> primary key reportId autogenerated;
> load dataset UserLocations using localfs
> (("path"="asterix_nc1:///Users/stevenjacobs/Desktop/EmergencyDataset/UserLocationsShort.adm"),("format"="adm"));
> load dataset EmergencyReports using
> localfs(("path"="asterix_nc1:///Users/stevenjacobs/Desktop/EmergencyDataset/EmergencyReports.adm"),("format"="adm"));
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)