asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xi...@apache.org
Subject asterixdb git commit: ASTERIXDB-1854 Fix Feed with user defined function
Date Fri, 31 Mar 2017 18:06:07 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 1fb232d96 -> 261dc6d08


ASTERIXDB-1854 Fix Feed with user defined function

1. Fix the bug that AQL Function applied to feed can only $x as
parameter.
2. Fix Connect feed statement can only take one user defined function.
3. Fix one metadata bug when store multiple UDF in feed connection.

Change-Id: Ic60582b4198614a1f6a6026fe4c8675c9fec8a97
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1635
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Steven Jacobs <sjaco002@ucr.edu>


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

Branch: refs/heads/master
Commit: 261dc6d0874fcd9985cbf891724ab963228dbfb1
Parents: 1fb232d
Author: Xikui Wang <xkkwww@gmail.com>
Authored: Wed Mar 29 21:23:15 2017 -0700
Committer: Xikui Wang <xkkwww@gmail.com>
Committed: Fri Mar 31 11:05:18 2017 -0700

----------------------------------------------------------------------
 .../connect-feed-with-aql-function.1.ddl.aql    | 57 ++++++++++++++++++++
 .../connect-feed-with-aql-function.2.update.aql | 32 +++++++++++
 .../connect-feed-with-aql-function.3.server.aql | 27 ++++++++++
 .../connect-feed-with-aql-function.4.sleep.aql  | 27 ++++++++++
 .../connect-feed-with-aql-function.5.update.aql | 29 ++++++++++
 .../connect-feed-with-aql-function.6.query.aql  | 31 +++++++++++
 .../connect-feed-with-aql-function.7.server.aql | 28 ++++++++++
 .../connect-feed-with-aql-function.8.ddl.aql    | 28 ++++++++++
 .../connect-feed-with-aql-function.1.adm        |  4 ++
 .../src/test/resources/runtimets/testsuite.xml  |  5 ++
 .../aql/statement/SubscribeFeedStatement.java   |  6 +--
 .../asterix-lang-aql/src/main/javacc/AQL.jj     | 25 ++++++---
 .../common/statement/ConnectFeedStatement.java  |  9 ++--
 .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj | 25 ++++++---
 .../FeedConnectionTupleTranslator.java          |  1 +
 15 files changed, 311 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.1.ddl.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.1.ddl.aql
new file mode 100644
index 0000000..631c3fb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.1.ddl.aql
@@ -0,0 +1,57 @@
+/*
+ * 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  : Create a feed and apply two functions in the
+ * workflow. The output of the first function can be used in
+ * the second function. The function parameter can have any
+ * name.
+ * Expected Res : Success
+ * Date         : 29th Mar 2017
+ */
+drop dataverse experiments if exists;
+create dataverse experiments;
+use dataverse experiments;
+
+create type TwitterUser if not exists as open{
+    screen-name: string,
+    friends_count: int32,
+    name: string,
+    followers_count: int32
+};
+
+create dataset TwitterUsers(TwitterUser) primary key screen-name;
+
+create function test_func0($xyz) {
+    let $tty1 := if ($xyz.followers_count > 25000) then {"popularity":"Good!"} else {"popularity":"Bad!"}
+    return object_merge($tty1, $xyz)
+}
+
+create function test_func1($anyname) {
+    let $tty2 := if ($anyname.popularity = "Good!") then {"true_popularity":"Indeed Good!"}
else {"true_popularity":"Indeed Bad!"}
+    return object_merge($tty2, $anyname)
+}
+
+create feed UserFeed using socket_adapter
+(
+    ("sockets"="127.0.0.1:10001"),
+    ("address-type"="IP"),
+    ("type-name"="TwitterUser"),
+    ("format"="adm"),
+    ("upsert-feed"="true")
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.2.update.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.2.update.aql
new file mode 100644
index 0000000..a5933a5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.2.update.aql
@@ -0,0 +1,32 @@
+/*
+ * 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  : Create a feed and apply two functions in the
+ * workflow. The output of the first function can be used in
+ * the second function. The function parameter can have any
+ * name.
+ * Expected Res : Success
+ * Date         : 29th Mar 2017
+ */
+use dataverse experiments;
+set wait-for-completion-feed "false";
+
+connect feed UserFeed to dataset TwitterUsers apply function test_func0,test_func1;
+
+start feed UserFeed;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.3.server.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.3.server.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.3.server.aql
new file mode 100644
index 0000000..eacf623
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.3.server.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.
+ */
+/*
+ * Description  : Create a feed and apply two functions in the
+ * workflow. The output of the first function can be used in
+ * the second function. The function parameter can have any
+ * name.
+ * Expected Res : Success
+ * Date         : 29th Mar 2017
+ */
+start client 10001 file-client 127.0.0.1 ../asterix-app/data/tinysocial/twu.adm 500 50 1000
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.4.sleep.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.4.sleep.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.4.sleep.aql
new file mode 100644
index 0000000..dc5dae0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.4.sleep.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.
+ */
+/*
+ * Description  : Create a feed and apply two functions in the
+ * workflow. The output of the first function can be used in
+ * the second function. The function parameter can have any
+ * name.
+ * Expected Res : Success
+ * Date         : 29th Mar 2017
+ */
+2000
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.5.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.5.update.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.5.update.aql
new file mode 100644
index 0000000..dcf2278
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.5.update.aql
@@ -0,0 +1,29 @@
+/*
+ * 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  : Create a feed and apply two functions in the
+ * workflow. The output of the first function can be used in
+ * the second function. The function parameter can have any
+ * name.
+ * Expected Res : Success
+ * Date         : 29th Mar 2017
+ */
+use dataverse experiments;
+stop feed UserFeed;
+disconnect feed UserFeed from dataset TwitterUsers;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.6.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.6.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.6.query.aql
new file mode 100644
index 0000000..1a06334
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.6.query.aql
@@ -0,0 +1,31 @@
+/*
+ * 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  : Create a feed and apply two functions in the
+ * workflow. The output of the first function can be used in
+ * the second function. The function parameter can have any
+ * name.
+ * Expected Res : Success
+ * Date         : 29th Mar 2017
+ */
+use dataverse experiments;
+
+for $x in dataset TwitterUsers
+order by $x.screen-name
+return $x.true_popularity;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.7.server.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.7.server.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.7.server.aql
new file mode 100644
index 0000000..4ba1c81
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.7.server.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.
+ */
+/*
+ * Description  : Create a feed and apply two functions in the
+ * workflow. The output of the first function can be used in
+ * the second function. The function parameter can have any
+ * name.
+ * Expected Res : Success
+ * Date         : 29th Mar 2017
+ */
+
+stop 10001
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.8.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.8.ddl.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.8.ddl.aql
new file mode 100644
index 0000000..7722945
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.8.ddl.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.
+ */
+/*
+ * Description  : Create a feed and apply two functions in the
+ * workflow. The output of the first function can be used in
+ * the second function. The function parameter can have any
+ * name.
+ * Expected Res : Success
+ * Date         : 29th Mar 2017
+ */
+use dataverse experiments;
+drop dataverse experiments;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/results/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.1.adm
new file mode 100644
index 0000000..c5a10be
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/feeds/connect-feed-with-aql-function/connect-feed-with-aql-function.1.adm
@@ -0,0 +1,4 @@
+"Indeed Good!"
+"Indeed Bad!"
+"Indeed Good!"
+"Indeed Bad!"

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index ef90175..122a4c6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -249,6 +249,11 @@
         <output-dir compare="Text">push-socket-with-auuid</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="feeds">
+      <compilation-unit name="connect-feed-with-aql-function">
+        <output-dir compare="Text">connect-feed-with-aql-function</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="upsert">
     <test-case FilePath="upsert">

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/statement/SubscribeFeedStatement.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/statement/SubscribeFeedStatement.java
b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/statement/SubscribeFeedStatement.java
index 5150db3..f3bebbe 100644
--- a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/statement/SubscribeFeedStatement.java
+++ b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/statement/SubscribeFeedStatement.java
@@ -104,9 +104,9 @@ public class SubscribeFeedStatement implements Statement {
                 variableIndex++;
                 switch (function.getLanguage().toUpperCase()) {
                     case Function.LANGUAGE_AQL:
-                        builder.append(
-                                " let " + "$" + lValueName + variableIndex + ":=(" + function.getFunctionBody()
+ ")");
-                        builder.append("\n");
+                        builder.append(" let " + "$" + lValueName + variableIndex + ":="
+ function.getName() + "("
+                                + "$" + rValueName + ")");
+                        rValueName = lValueName + variableIndex;
                         break;
                     case Function.LANGUAGE_JAVA:
                         builder.append(" let " + "$" + lValueName + variableIndex + ":="
+ function.getName() + "("

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
index 8d842e3..ba699f0 100644
--- a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
+++ b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
@@ -818,16 +818,27 @@ boolean IfNotExists() throws ParseException:
     }
 }
 
-FunctionSignature ApplyFunction() throws ParseException:
+List<FunctionSignature> ApplyFunction() throws ParseException:
 {
   FunctionName functioName = null;
-  FunctionSignature funcSig = null;
+  String fqFunctionName = null;
+  List<FunctionSignature> funcSigs = new ArrayList<FunctionSignature>();
 }
 {
   <APPLY> <FUNCTION> functioName = FunctionName()
     {
-       String fqFunctionName = functioName.library == null ? functioName.function : functioName.library
+ "#" + functioName.function;
-       return new FunctionSignature(functioName.dataverse, fqFunctionName, 1);
+       fqFunctionName = functioName.library == null ? functioName.function : functioName.library
+ "#" + functioName.function;
+       funcSigs.add(new FunctionSignature(functioName.dataverse, fqFunctionName, 1));
+    }
+  (
+    <COMMA> functioName = FunctionName()
+    {
+      fqFunctionName = functioName.library == null ? functioName.function : functioName.library
+ "#" + functioName.function;
+      funcSigs.add(new FunctionSignature(functioName.dataverse, fqFunctionName, 1));
+    }
+  )*
+    {
+        return funcSigs;
     }
 }
 
@@ -1165,16 +1176,16 @@ Statement FeedStatement() throws ParseException:
   Pair<Identifier,Identifier> datasetNameComponents = null;
 
   Map<String,String> configuration = null;
-  FunctionSignature appliedFunction = null;
+  List<FunctionSignature> appliedFunctions = null;
   Statement stmt = null;
   String policy = null;
 }
 {
   (
     <CONNECT> <FEED> feedNameComponents = QualifiedName() <TO> <DATASET>
datasetNameComponents = QualifiedName()
-    (appliedFunction = ApplyFunction())? (policy = GetPolicy())?
+    (appliedFunctions = ApplyFunction())? (policy = GetPolicy())?
       {
-        stmt = new ConnectFeedStatement(feedNameComponents, datasetNameComponents, appliedFunction,
policy, getVarCounter());
+        stmt = new ConnectFeedStatement(feedNameComponents, datasetNameComponents, appliedFunctions,
policy, getVarCounter());
       }
     | <DISCONNECT> <FEED> feedNameComponents = QualifiedName() <FROM> <DATASET>
datasetNameComponents = QualifiedName()
       {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/ConnectFeedStatement.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/ConnectFeedStatement.java
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/ConnectFeedStatement.java
index 0bd34ee..3289d68 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/ConnectFeedStatement.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/ConnectFeedStatement.java
@@ -36,11 +36,10 @@ public class ConnectFeedStatement implements Statement {
     private final String feedName;
     private final String policy;
     private int varCounter;
-    private final ArrayList<FunctionSignature> appliedFunctions;
+    private final List<FunctionSignature> appliedFunctions;
 
     public ConnectFeedStatement(Pair<Identifier, Identifier> feedNameCmp, Pair<Identifier,
Identifier> datasetNameCmp,
-            FunctionSignature appliedFunction, String policy, int varCounter) {
-        appliedFunctions = new ArrayList<>();
+            List<FunctionSignature> appliedFunctions, String policy, int varCounter)
{
         if (feedNameCmp.first != null && datasetNameCmp.first != null
                 && !feedNameCmp.first.getValue().equals(datasetNameCmp.first.getValue()))
{
             throw new IllegalArgumentException("Dataverse for source feed and target dataset
do not match");
@@ -51,9 +50,7 @@ public class ConnectFeedStatement implements Statement {
         this.feedName = feedNameCmp.second.getValue();
         this.policy = policy != null ? policy : BuiltinFeedPolicies.DEFAULT_POLICY.getPolicyName();
         this.varCounter = varCounter;
-        if (appliedFunction != null) {
-            this.appliedFunctions.add(appliedFunction);
-        }
+        this.appliedFunctions = appliedFunctions;
     }
 
     public Identifier getDataverseName() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index 71f96b9..e553c4d 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -840,16 +840,27 @@ boolean IfNotExists() throws ParseException:
     }
 }
 
-FunctionSignature ApplyFunction() throws ParseException:
+List<FunctionSignature> ApplyFunction() throws ParseException:
 {
   FunctionName functioName = null;
-  FunctionSignature funcSig = null;
+  String fqFunctionName = null;
+  List<FunctionSignature> funcSigs = new ArrayList<FunctionSignature>();
 }
 {
   <APPLY> <FUNCTION> functioName = FunctionName()
     {
-       String fqFunctionName = functioName.library == null ? functioName.function : functioName.library
+ "#" + functioName.function;
-       return new FunctionSignature(functioName.dataverse, fqFunctionName, 1);
+       fqFunctionName = functioName.library == null ? functioName.function : functioName.library
+ "#" + functioName.function;
+       funcSigs.add(new FunctionSignature(functioName.dataverse, fqFunctionName, 1));
+    }
+  (
+      <COMMA> functioName = FunctionName()
+      {
+        fqFunctionName = functioName.library == null ? functioName.function : functioName.library
+ "#" + functioName.function;
+        funcSigs.add(new FunctionSignature(functioName.dataverse, fqFunctionName, 1));
+      }
+  )*
+    {
+        return funcSigs;
     }
 }
 
@@ -1254,16 +1265,16 @@ Statement ConnectStatement() throws ParseException:
   Pair<Identifier,Identifier> datasetNameComponents = null;
 
   Map<String,String> configuration = null;
-  FunctionSignature appliedFunction = null;
+  List<FunctionSignature> appliedFunctions = null;
   Statement stmt = null;
   String policy = null;
 }
 {
   (
     <FEED> feedNameComponents = QualifiedName() <TO> Dataset() datasetNameComponents
= QualifiedName()
-    (appliedFunction = ApplyFunction())?  (policy = GetPolicy())?
+    (appliedFunctions = ApplyFunction())?  (policy = GetPolicy())?
       {
-        stmt = new ConnectFeedStatement(feedNameComponents, datasetNameComponents, appliedFunction,
+        stmt = new ConnectFeedStatement(feedNameComponents, datasetNameComponents, appliedFunctions,
          policy, getVarCounter());
       }
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/261dc6d0/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedConnectionTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedConnectionTupleTranslator.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedConnectionTupleTranslator.java
index e7fe5b4..0adcda5 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedConnectionTupleTranslator.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedConnectionTupleTranslator.java
@@ -168,6 +168,7 @@ public class FeedConnectionTupleTranslator extends AbstractTupleTranslator<FeedC
         if (fc.getAppliedFunctions() != null) {
             List<FunctionSignature> appliedFunctions = fc.getAppliedFunctions();
             for (FunctionSignature af : appliedFunctions) {
+                listEleBuffer.reset();
                 aString.setValue(af.getName());
                 stringSerde.serialize(aString, listEleBuffer.getDataOutput());
                 listBuilder.addItem(listEleBuffer);


Mime
View raw message