You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by lu...@apache.org on 2018/08/09 21:27:01 UTC

asterixdb git commit: [ASTERIXDB-2125] Fix RTree Bulkload Exception

Repository: asterixdb
Updated Branches:
  refs/heads/master dee3f9269 -> 468b9beea


[ASTERIXDB-2125] Fix RTree Bulkload Exception

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- When bulkloading a rtree, it's possible that we saw the
NotImplementedException. It turns out this bug is caused by that we
forgot to reset the previous MBR when calculating the MBR for missing
fields.

Change-Id: I4267a7ce0b8621471e7a8504c448ba1f500e92db
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2864
Reviewed-by: abdullah alamoudi <ba...@gmail.com>
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>


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

Branch: refs/heads/master
Commit: 468b9beea987901f8ecde1b072254ea900e32734
Parents: dee3f92
Author: luochen01 <cl...@uci.edu>
Authored: Thu Aug 9 09:09:45 2018 -0700
Committer: Luo Chen <cl...@uci.edu>
Committed: Thu Aug 9 14:26:42 2018 -0700

----------------------------------------------------------------------
 .../spatial-large-data.1.ddl.sqlpp              | 92 ++++++++++++++++++++
 .../spatial-large-data.2.update.sqlpp           | 24 +++++
 .../spatial-large-data.3.ddl.sqlpp              | 22 +++++
 .../spatial-large-data.4.query.sqlpp            | 24 +++++
 .../spatial-large-data/spatial-large-data.1.adm |  1 +
 .../resources/runtimets/testsuite_sqlpp.xml     |  5 ++
 .../evaluators/common/CreateMBREvalFactory.java |  2 +-
 7 files changed, 169 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/468b9bee/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.1.ddl.sqlpp
new file mode 100644
index 0000000..a8dd17b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.1.ddl.sqlpp
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+/*
+ * Test case Name  : spatial-large-data.sqlpp
+ * Description     : This test is intended to test creating an rtree index on cloudberry sample tweets with a nullable field
+ * Expected Result : Success
+ * Date            : Aug 9 2018
+ */
+
+drop dataverse twitter if exists;
+create dataverse twitter if not exists;
+use twitter;
+create type typeUser if not exists as open {
+    id: int64,
+    name: string,
+    screen_name : string,
+    lang : string,
+    location: string,
+    create_at: date,
+    description: string,
+    followers_count: int32,
+    friends_count: int32,
+    statues_count: int64
+};
+create type typePlace if not exists as open{
+    country : string,
+    country_code : string,
+    full_name : string,
+    id : string,
+    name : string,
+    place_type : string,
+    bounding_box : rectangle
+};
+create type typeGeoTag if not exists as open {
+    stateID: int32,
+    stateName: string,
+    countyID: int32,
+    countyName: string,
+    cityID: int32?,
+    cityName: string?
+};
+create type typeTweet if not exists as open{
+    create_at : datetime,
+    id: int64,
+    `text`: string,
+    in_reply_to_status : int64,
+    in_reply_to_user : int64,
+    favorite_count : int64,
+    coordinate: point?,
+    retweet_count : int64,
+    lang : string,
+    is_retweet: boolean,
+    hashtags : {{ string }} ?,
+    user_mentions : {{ int64 }} ? ,
+    user : typeUser,
+    place : typePlace?,
+    geo_tag: typeGeoTag
+};
+create dataset ds_tweet(typeTweet) if not exists primary key id
+with filter on create_at
+with {
+  "merge-policy": {
+    "name": "prefix",
+    "parameters": { "max-mergable-component-size": 1073741824, "max-tolerance-component-count": 5 }
+  }
+};
+
+create feed TweetFeed with {
+  "adapter-name" : "localfs",
+  "path" : "asterix_nc1://data/fulltext/cloudberry_sample_tweet.adm",
+  "address-type" : "nc",
+  "type-name" : "typeTweet",
+  "format" : "adm",
+  "insert-feed" : "true"
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/468b9bee/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.2.update.sqlpp
new file mode 100644
index 0000000..5006988
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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 twitter;
+
+set `wait-for-completion-feed` "true";
+connect feed TweetFeed to dataset ds_tweet;
+start feed TweetFeed;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/468b9bee/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.3.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.3.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.3.ddl.sqlpp
new file mode 100644
index 0000000..1a76cae
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.3.ddl.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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 twitter;
+
+create index location_idx if not exists on ds_tweet(coordinate) type rtree;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/468b9bee/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.4.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.4.query.sqlpp
new file mode 100644
index 0000000..5f0f66d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/spatial-large-data/spatial-large-data.4.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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 twitter;
+
+select count(*)
+from ds_tweet
+where `spatial-intersect`(coordinate,`create-rectangle`(`create-point`(-100.0, -100.0), `create-point`(100.0, 100.0)))

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/468b9bee/asterixdb/asterix-app/src/test/resources/runtimets/results/spatial/spatial-large-data/spatial-large-data.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/spatial/spatial-large-data/spatial-large-data.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/spatial/spatial-large-data/spatial-large-data.1.adm
new file mode 100644
index 0000000..0645f4c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/spatial/spatial-large-data/spatial-large-data.1.adm
@@ -0,0 +1 @@
+{ "$1": 2691 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/468b9bee/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index dedabbe..81b53bd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -6218,6 +6218,11 @@
         <output-dir compare="Text">spatial-area</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="spatial">
+      <compilation-unit name="spatial-large-data">
+        <output-dir compare="Text">spatial-large-data</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="statement-params">
     <test-case FilePath="statement-params">

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/468b9bee/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
index c763d3c..03ddd73 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
@@ -85,6 +85,7 @@ public class CreateMBREvalFactory implements IScalarEvaluatorFactory {
                 int startOffset2 = inputArg2.getStartOffset();
 
                 try {
+                    resultStorage.reset();
                     if (data0[startOffset0] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG
                             || data1[startOffset1] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG
                             || data2[startOffset2] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
@@ -99,7 +100,6 @@ public class CreateMBREvalFactory implements IScalarEvaluatorFactory {
                         result.set(resultStorage);
                         return;
                     }
-                    resultStorage.reset();
                     if (data1[startOffset1] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
                         throw new TypeMismatchException(BuiltinFunctions.CREATE_MBR, 1, data1[startOffset1],
                                 ATypeTag.SERIALIZED_INT32_TYPE_TAG);