You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Steven Jacobs (Code Review)" <do...@asterixdb.incubator.apache.org> on 2017/12/27 21:26:41 UTC

Change in asterixdb-bad[master]: Coordinated change for ASTERIXDB-2214

Steven Jacobs has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2250

Change subject: Coordinated change for ASTERIXDB-2214
......................................................................

Coordinated change for ASTERIXDB-2214

Added dependency check tests

Change-Id: I2348838149b73800e2322d020acb6e91f4008a46
---
M asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java
M asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java
M asterix-bad/src/main/java/org/apache/asterix/bad/metadata/DeployedJobSpecEventListener.java
A asterix-bad/src/test/resources/runtimets/queries/channel/drop-dataset-used-by-channel/drop-dataset-used-by-channel.1.ddl.sqlpp
A asterix-bad/src/test/resources/runtimets/queries/channel/drop-function-used-by-channel/drop-function-used-by-channel.1.ddl.sqlpp
M asterix-bad/src/test/resources/runtimets/testsuite.xml
6 files changed, 134 insertions(+), 5 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb-bad refs/changes/50/2250/1

diff --git a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java
index 3864248..f16d2e0 100644
--- a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java
+++ b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java
@@ -336,10 +336,12 @@
             // Now we subscribe
             if (listener == null) {
                 List<IDataset> datasets = new ArrayList<>();
+                List<FunctionSignature> functions = new ArrayList<>();
                 datasets.add(MetadataManager.INSTANCE.getDataset(mdTxnCtx, dataverse, subscriptionsName.getValue()));
                 datasets.add(MetadataManager.INSTANCE.getDataset(mdTxnCtx, dataverse, resultsName.getValue()));
-                //TODO: Add datasets used by channel function
-                listener = new DeployedJobSpecEventListener(appCtx, entityId, PrecompiledType.CHANNEL, datasets, null,
+                functions.add(function);
+                listener = new DeployedJobSpecEventListener(appCtx, entityId, PrecompiledType.CHANNEL, datasets,
+                        functions, null,
                         "BadListener");
                 activeEventHandler.registerListener(listener);
             }
diff --git a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java
index adfa485..ce35096 100644
--- a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java
+++ b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java
@@ -279,9 +279,9 @@
 
             // Now we subscribe
             if (listener == null) {
-                //TODO: Add datasets used by channel function
+                //TODO: Add datasets and functions used by procedure
                 listener = new DeployedJobSpecEventListener(appCtx, entityId, procedureJobSpec.second,
-                        new ArrayList<>(),
+                        new ArrayList<>(), new ArrayList<>(),
                         null, "BadListener");
                 activeEventHandler.registerListener(listener);
             }
diff --git a/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/DeployedJobSpecEventListener.java b/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/DeployedJobSpecEventListener.java
index 950612c..bf2284c 100644
--- a/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/DeployedJobSpecEventListener.java
+++ b/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/DeployedJobSpecEventListener.java
@@ -32,6 +32,7 @@
 import org.apache.asterix.active.message.ActivePartitionMessage;
 import org.apache.asterix.app.result.ResultReader;
 import org.apache.asterix.common.dataflow.ICcApplicationContext;
+import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.common.metadata.IDataset;
 import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
 import org.apache.hyracks.api.dataset.IHyracksDataset;
@@ -74,6 +75,7 @@
     protected final ICcApplicationContext appCtx;
     protected final EntityId entityId;
     protected final List<IDataset> datasets;
+    private final List<FunctionSignature> functions;
     protected final ActiveEvent statsUpdatedEvent;
     protected long statsTimestamp;
     protected String stats;
@@ -83,10 +85,12 @@
     protected int numRegistered;
 
     public DeployedJobSpecEventListener(ICcApplicationContext appCtx, EntityId entityId, PrecompiledType type,
-            List<IDataset> datasets, AlgebricksAbsolutePartitionConstraint locations, String runtimeName) {
+            List<IDataset> datasets, List<FunctionSignature> functions, AlgebricksAbsolutePartitionConstraint locations,
+            String runtimeName) {
         this.appCtx = appCtx;
         this.entityId = entityId;
         this.datasets = datasets;
+        this.functions = functions;
         this.state = ActivityState.STOPPED;
         this.statsTimestamp = -1;
         this.statsRequestState = RequestState.INIT;
@@ -136,6 +140,11 @@
         return datasets.contains(dataset);
     }
 
+    @Override
+    public synchronized boolean dependsOnFunction(FunctionSignature function) {
+        return functions.contains(function);
+    }
+
     public JobId getJobId() {
         return jobId;
     }
diff --git a/asterix-bad/src/test/resources/runtimets/queries/channel/drop-dataset-used-by-channel/drop-dataset-used-by-channel.1.ddl.sqlpp b/asterix-bad/src/test/resources/runtimets/queries/channel/drop-dataset-used-by-channel/drop-dataset-used-by-channel.1.ddl.sqlpp
new file mode 100644
index 0000000..f001e6e
--- /dev/null
+++ b/asterix-bad/src/test/resources/runtimets/queries/channel/drop-dataset-used-by-channel/drop-dataset-used-by-channel.1.ddl.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+/*
+* Description  : Try to drop a dataset used by a channel
+* Expected Res : Error
+* Date         : Dec 2017
+* Author       : Steven Jacobs
+*/
+
+drop dataverse channels if exists;
+create dataverse channels;
+use channels;
+
+create type TweetMessageTypeuuid as closed {
+  tweetid: uuid,
+  sender_location: point,
+  send_time: datetime,
+  referred_topics: {{ string }},
+  message_text: string,
+  countA: int32,
+  countB: int32
+};
+
+
+create dataset TweetMessageuuids(TweetMessageTypeuuid)
+primary key tweetid autogenerated;
+
+create function NearbyTweetsContainingText(place, text) {
+  (select m.message_text
+  from TweetMessageuuids m
+  where contains(m.message_text,text)
+  and spatial_intersect(m.sender_location, place))
+};
+
+create repetitive channel nearbyTweetChannel using NearbyTweetsContainingText@2 period duration("PT10M");
+
+drop dataset nearbyTweetChannelResults;
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/runtimets/queries/channel/drop-function-used-by-channel/drop-function-used-by-channel.1.ddl.sqlpp b/asterix-bad/src/test/resources/runtimets/queries/channel/drop-function-used-by-channel/drop-function-used-by-channel.1.ddl.sqlpp
new file mode 100644
index 0000000..09024ed
--- /dev/null
+++ b/asterix-bad/src/test/resources/runtimets/queries/channel/drop-function-used-by-channel/drop-function-used-by-channel.1.ddl.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+/*
+* Description  : Try to drop a function used by a channel
+* Expected Res : Error
+* Date         : Dec 2017
+* Author       : Steven Jacobs
+*/
+
+drop dataverse channels if exists;
+create dataverse channels;
+use channels;
+
+create type TweetMessageTypeuuid as closed {
+  tweetid: uuid,
+  sender_location: point,
+  send_time: datetime,
+  referred_topics: {{ string }},
+  message_text: string,
+  countA: int32,
+  countB: int32
+};
+
+
+create dataset TweetMessageuuids(TweetMessageTypeuuid)
+primary key tweetid autogenerated;
+
+create function NearbyTweetsContainingText(place, text) {
+  (select m.message_text
+  from TweetMessageuuids m
+  where contains(m.message_text,text)
+  and spatial_intersect(m.sender_location, place))
+};
+
+create repetitive channel nearbyTweetChannel using NearbyTweetsContainingText@2 period duration("PT10M");
+
+drop function NearbyTweetsContainingText@2;
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/runtimets/testsuite.xml b/asterix-bad/src/test/resources/runtimets/testsuite.xml
index 1b2844b..29a56e3 100644
--- a/asterix-bad/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-bad/src/test/resources/runtimets/testsuite.xml
@@ -82,6 +82,18 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="channel">
+      <compilation-unit name="drop-dataset-used-by-channel">
+        <output-dir compare="Text">drop-dataset-used-by-channel</output-dir>
+        <expected-error>ASX1023: Cannot drop dataset channels.nearbyTweetChannelResults since it is connected to active entity: channels.nearbyTweetChannel(Channel)</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="channel">
+      <compilation-unit name="drop-function-used-by-channel">
+        <output-dir compare="Text">drop-function-used-by-channel</output-dir>
+        <expected-error>ASX3109: Function channels.NearbyTweetsContainingText@2 is being used. It cannot be dropped</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="channel">
       <compilation-unit name="subscribe_channel_check_subscriptions">
         <output-dir compare="Text">subscribe_channel_check_subscriptions</output-dir>
       </compilation-unit>

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2250
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2348838149b73800e2322d020acb6e91f4008a46
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: Steven Jacobs <sj...@ucr.edu>

Change in asterixdb-bad[master]: Coordinated change for ASTERIXDB-2214

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: Coordinated change for ASTERIXDB-2214
......................................................................


Patch Set 1:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterixbad-gerrit/225/

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2250
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2348838149b73800e2322d020acb6e91f4008a46
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: Steven Jacobs <sj...@ucr.edu>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb-bad[master]: Coordinated change for ASTERIXDB-2214

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: Coordinated change for ASTERIXDB-2214
......................................................................


Patch Set 1:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterixbad-gerrit/227/

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2250
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2348838149b73800e2322d020acb6e91f4008a46
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: Steven Jacobs <sj...@ucr.edu>
Gerrit-Reviewer: Ildar Absalyamov <il...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Xikui Wang <xk...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb-bad[master]: Coordinated change for ASTERIXDB-2214

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: Coordinated change for ASTERIXDB-2214
......................................................................


Patch Set 1:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterixbad-gerrit/228/

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2250
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2348838149b73800e2322d020acb6e91f4008a46
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: Steven Jacobs <sj...@ucr.edu>
Gerrit-Reviewer: Ildar Absalyamov <il...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Xikui Wang <xk...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb-bad[master]: Coordinated change for ASTERIXDB-2214

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: Coordinated change for ASTERIXDB-2214
......................................................................


Patch Set 1:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterixbad-gerrit/224/

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2250
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2348838149b73800e2322d020acb6e91f4008a46
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: Steven Jacobs <sj...@ucr.edu>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb-bad[master]: Coordinated change for ASTERIXDB-2214

Posted by "Steven Jacobs (Code Review)" <do...@asterixdb.incubator.apache.org>.
Steven Jacobs has abandoned this change.

Change subject: Coordinated change for ASTERIXDB-2214
......................................................................


Abandoned

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2250
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: I2348838149b73800e2322d020acb6e91f4008a46
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: Steven Jacobs <sj...@ucr.edu>
Gerrit-Reviewer: Ildar Absalyamov <il...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Xikui Wang <xk...@gmail.com>

Change in asterixdb-bad[master]: Coordinated change for ASTERIXDB-2214

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: Coordinated change for ASTERIXDB-2214
......................................................................


Patch Set 1:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterixbad-gerrit/226/

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2250
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2348838149b73800e2322d020acb6e91f4008a46
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: Steven Jacobs <sj...@ucr.edu>
Gerrit-Reviewer: Ildar Absalyamov <il...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Xikui Wang <xk...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb-bad[master]: Coordinated change for ASTERIXDB-2214

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: Coordinated change for ASTERIXDB-2214
......................................................................


Patch Set 1:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterixbad-gerrit/223/

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2250
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2348838149b73800e2322d020acb6e91f4008a46
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: Steven Jacobs <sj...@ucr.edu>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No