asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjaco...@apache.org
Subject asterixdb git commit: ASTERIXDB-1327, ASTERIXDB-1362 Fixed circle-point intersect function
Date Wed, 08 Mar 2017 06:25:32 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master ce39cc777 -> 31d8102aa


ASTERIXDB-1327, ASTERIXDB-1362 Fixed circle-point intersect function

Change-Id: I2512c73c9dcd593dc7e6690435da67f8086ff0db
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1558
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Jianfeng Jia <jianfeng.jia@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/31d8102a
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/31d8102a
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/31d8102a

Branch: refs/heads/master
Commit: 31d8102aa05259d01012f648e503b849ff913f34
Parents: ce39cc7
Author: Steven Glenn Jacobs <sjaco002@ucr.edu>
Authored: Tue Mar 7 16:26:06 2017 -0800
Committer: Steven Jacobs <sjaco002@ucr.edu>
Committed: Tue Mar 7 22:24:34 2017 -0800

----------------------------------------------------------------------
 .../queries/comparison/ComparisonQueries.xml    |  5 +++
 .../circle-point/circle-point.1.ddl.aql         | 44 ++++++++++++++++++++
 .../circle-point/circle-point.2.update.aql      | 28 +++++++++++++
 .../circle-point/circle-point.3.query.aql       | 27 ++++++++++++
 .../circle-point/circle-point.4.query.aql       | 27 ++++++++++++
 .../circle-point/circle-point.5.query.aql       | 28 +++++++++++++
 .../circle-point/circle-point.6.query.aql       | 25 +++++++++++
 .../comparison/circle-point/circle-point.1.adm  |  1 +
 .../comparison/circle-point/circle-point.2.adm  |  1 +
 .../comparison/circle-point/circle-point.3.adm  |  1 +
 .../comparison/circle-point/circle-point.4.adm  |  1 +
 .../functions/SpatialIntersectDescriptor.java   |  2 +-
 12 files changed, 189 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
index e549a92..58fd49d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
@@ -28,6 +28,11 @@
     </compilation-unit>
   </test-case>
   <test-case FilePath="comparison">
+    <compilation-unit name="circle-point">
+      <output-dir compare="Text">circle-point</output-dir>
+    </compilation-unit>
+  </test-case>
+  <test-case FilePath="comparison">
     <compilation-unit name="datetime_range">
       <output-dir compare="Text">datetime_range</output-dir>
     </compilation-unit>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.1.ddl.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.1.ddl.aql
new file mode 100644
index 0000000..05747bb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.1.ddl.aql
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.2.update.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.2.update.aql
new file mode 100644
index 0000000..832940d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.2.update.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse channels;
+
+insert into dataset EmergencyReports(
+[{"severity": 1, "impactZone": circle("2500.23697136,1633.68172386 1000.0"), "timeoffset":
544.7287792315149, "duration": 900.0, "message": "earthquake alert!", "emergencyType": "earthquake"},
+{"severity": 1, "impactZone": circle("2501.23697136,1633.68172386 1000.0"), "timeoffset":
552.2465166866674, "duration": 900.0, "message": "earthquake alert!", "emergencyType": "earthquake"}]
+);
+
+insert into dataset UserLocations(
+{"location":point("2500.23697136,1633.68172386"),"user-id":"t124","timeoffset":60.0}
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.3.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.3.query.aql
new file mode 100644
index 0000000..d289d7a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.3.query.aql
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse channels;
+
+count(for $report in dataset EmergencyReports
+for $location in dataset UserLocations
+where spatial-intersect($report.impactZone, $location.location)
+return {
+  "user at":$location.location,
+  "report at":$report.impactZone
+});

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.4.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.4.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.4.query.aql
new file mode 100644
index 0000000..fc1f55b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.4.query.aql
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse channels;
+
+count(for $report in dataset EmergencyReports
+for $location in dataset UserLocations
+where spatial-intersect($location.location,$report.impactZone )
+return {
+  "user at":$location.location,
+  "report at":$report.impactZone
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.5.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.5.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.5.query.aql
new file mode 100644
index 0000000..baca958
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.5.query.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse channels;
+
+count(for $report in dataset EmergencyReports
+for $location in dataset UserLocations
+let $circle := create-circle($location.location,.1)
+where spatial-intersect($circle,$report.impactZone)
+return {
+  "user at":$location.location,
+  "report at":$report.impactZone
+});

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.6.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.6.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.6.query.aql
new file mode 100644
index 0000000..47fc080
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/circle-point/circle-point.6.query.aql
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse channels;
+
+let $check1 := spatial-intersect(circle("3107.06794511,1079.71664882 1000.0"),point("3513.27543563,978.772476107"))
+
+let $check2 := spatial-intersect(point("3513.27543563,978.772476107"),circle("3107.06794511,1079.71664882
1000.0"))
+
+return [ $check1, $check2 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.1.adm
new file mode 100644
index 0000000..d8263ee
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.1.adm
@@ -0,0 +1 @@
+2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.2.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.2.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.2.adm
new file mode 100644
index 0000000..d8263ee
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.2.adm
@@ -0,0 +1 @@
+2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.3.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.3.adm
new file mode 100644
index 0000000..d8263ee
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.3.adm
@@ -0,0 +1 @@
+2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.4.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.4.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.4.adm
new file mode 100644
index 0000000..8a1d020
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/circle-point/circle-point.4.adm
@@ -0,0 +1 @@
+[ true, true ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/31d8102a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
index 98b0f91..6edbf6f 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
@@ -997,7 +997,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                             case CIRCLE:
                                 switch (tag1) {
                                     case POINT:
-                                        res = pointInCircle(bytes0, offset0, bytes1, offset1);
+                                        res = pointInCircle(bytes1, offset1, bytes0, offset0);
                                         break;
                                     case LINE:
                                         res = lineCircleIntersection(bytes1, offset1, bytes0,
offset0);


Mime
View raw message