[ASTERIXDB-2181][FUN] Check whether a function is usable at creation
Verify rewrite step on a function before allowing creation
Add negative tests for bad function declarations
Change-Id: I262b8cfd29117c18f452973fed147696b83f1249
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2242
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index c69f5dc..de0c88f 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -123,6 +123,8 @@
import org.apache.asterix.lang.common.statement.TypeDropStatement;
import org.apache.asterix.lang.common.statement.WriteStatement;
import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.struct.VarIdentifier;
+import org.apache.asterix.lang.common.util.MergePolicyUtils;
import org.apache.asterix.lang.sqlpp.rewrites.SqlppRewriterFactory;
import org.apache.asterix.metadata.IDatasetDetails;
import org.apache.asterix.metadata.MetadataManager;
@@ -157,7 +159,6 @@
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.types.TypeSignature;
-import org.apache.asterix.lang.common.util.MergePolicyUtils;
import org.apache.asterix.transaction.management.service.transaction.DatasetIdFactory;
import org.apache.asterix.translator.AbstractLangTranslator;
import org.apache.asterix.translator.CompiledStatements.CompiledDeleteStatement;
@@ -1689,6 +1690,19 @@
if (dv == null) {
throw new AlgebricksException("There is no dataverse with this name " + dataverse + ".");
}
+
+ //Check whether the function is use-able
+ metadataProvider.setDefaultDataverse(dv);
+ Query wrappedQuery = new Query(false);
+ wrappedQuery.setBody(cfs.getFunctionBodyExpression());
+ wrappedQuery.setTopLevel(false);
+ List<VarIdentifier> varIds = new ArrayList<>();
+ for (String v : cfs.getParamList()) {
+ varIds.add(new VarIdentifier(v));
+ }
+ wrappedQuery.setExternalVars(varIds);
+ apiFramework.reWriteQuery(declaredFunctions, metadataProvider, wrappedQuery, sessionOutput);
+
Function function = new Function(dataverse, functionName, cfs.getFunctionSignature().getArity(),
cfs.getParamList(), Function.RETURNTYPE_VOID, cfs.getFunctionBody(),
rewriterFactory instanceof SqlppRewriterFactory ? Function.LANGUAGE_SQLPP : Function.LANGUAGE_AQL,
@@ -1701,6 +1715,7 @@
throw e;
} finally {
metadataProvider.getLocks().unlock();
+ metadataProvider.setDefaultDataverse(activeDataverse);
}
}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv11/cross-dv11.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv11/cross-dv11.1.ddl.aql
index 393d6a3..5a7b7b2 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv11/cross-dv11.1.ddl.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv11/cross-dv11.1.ddl.aql
@@ -28,11 +28,10 @@
create dataverse testdv1;
create dataverse testdv2;
-create function testdv1.fun01(){
-testdv2.fun02()
-}
-
create function testdv2.fun02(){
"function 02"
}
+create function testdv1.fun01(){
+testdv2.fun02()
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv13/cross-dv13.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv13/cross-dv13.1.ddl.aql
deleted file mode 100644
index 21ff696..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv13/cross-dv13.1.ddl.aql
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 UDFs in different dataverses
- * : Test for recursion in those UDFs
- * Expected Res : Failure - Recursion is not allowed!
- * Date : 31st Aug 2012
- * Ignored : This test is currently not part of the test build, because it being a negative test case expectedly throws an exception.
- */
-
-drop dataverse testdv1 if exists;
-drop dataverse testdv2 if exists;
-create dataverse testdv1;
-create dataverse testdv2;
-
-create function testdv1.fun01(){
-testdv2.fun02()
-}
-
-create function testdv2.fun02(){
-testdv2.fun03()
-}
-
-create function testdv2.fun03(){
-testdv1.fun01()
-}
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv13/cross-dv13.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv13/cross-dv13.2.update.aql
deleted file mode 100644
index 6f99df6..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv13/cross-dv13.2.update.aql
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 UDFs in different dataverses
- * : Test for recursion in those UDFs
- * Expected Res : Failure - Recursion is not allowed!
- * Date : 31st Aug 2012
- * Ignored : This test is currently not part of the test build, because it being a negative test case expectedly throws an exception.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv13/cross-dv13.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv13/cross-dv13.3.query.aql
deleted file mode 100644
index 1131add..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv13/cross-dv13.3.query.aql
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 UDFs in different dataverses
- * : Test for recursion in those UDFs
- * Expected Res : Failure - Recursion is not allowed!
- * Date : 31st Aug 2012
- * Ignored : This test is currently not part of the test build, because it being a negative test case expectedly throws an exception.
- */
-
-use dataverse testdv1;
-
-testdv1.fun01();
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv16/cross-dv16.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv16/cross-dv16.1.ddl.aql
deleted file mode 100644
index eb559df..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv16/cross-dv16.1.ddl.aql
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 : Detect Recursion in UDFs
- * Expected Res : Failure
- * Date : 30 Aug 2012
- * Ignored : Not part of test build, as its a negative test case that thrwos an exception
- */
-
-drop dataverse testdv1 if exists;
-create dataverse testdv1;
-
-// UDF with no inputs
-create function testdv1.fun01(){
-testdv1.fun02()
-}
-
-// UDF with one input
-create function testdv1.fun02(){
-testdv1.fun03()
-}
-
-// UDF with two inputs
-create function testdv1.fun03(){
-testdv1.fun04()
-}
-
-create function testdv1.fun04(){
-testdv1.fun02()
-}
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv16/cross-dv16.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv16/cross-dv16.2.update.aql
deleted file mode 100644
index c70f3db..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv16/cross-dv16.2.update.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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 : Detect Recursion in UDFs
- * Expected Res : Failure
- * Date : 30 Aug 2012
- * Ignored : Not part of test build, as its a negative test case that thrwos an exception
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv16/cross-dv16.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv16/cross-dv16.3.query.aql
deleted file mode 100644
index f9545d2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv16/cross-dv16.3.query.aql
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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 : Detect Recursion in UDFs
- * Expected Res : Failure
- * Date : 30 Aug 2012
- * Ignored : Not part of test build, as its a negative test case that thrwos an exception
- */
-
-use dataverse testdv1;
-
-testdv1.fun01()
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf17/udf17.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf17/udf17.1.ddl.aql
index fba90d1..0b2348a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf17/udf17.1.ddl.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf17/udf17.1.ddl.aql
@@ -28,11 +28,11 @@
use dataverse test;
-create function test.parent(){
-test.child()
-}
-
create function test.child() {
"This data is from the child function"
}
+create function test.parent(){
+test.child()
+}
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26/udf26.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26/udf26.1.ddl.aql
deleted file mode 100644
index bea7d9e..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26/udf26.1.ddl.aql
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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 UDF and define with missing references.
- * Expected Res : Failure
- * Date : Sep 6th 2012
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create function test.needs_f1($x){
- $x + f1()
-}
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26/udf26.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26/udf26.2.update.aql
deleted file mode 100644
index c6b8c48..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26/udf26.2.update.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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 UDF and define with missing references.
- * Expected Res : Failure
- * Date : Sep 6th 2012
- */
-
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26/udf26.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26/udf26.3.query.aql
deleted file mode 100644
index 1a1b73a..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26/udf26.3.query.aql
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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 UDF and define with missing references.
- * Expected Res : Failure
- * Date : Sep 6th 2012
- */
-
-use dataverse test;
-
-test.needs_f1(12345)
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv11/cross-dv11.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv11/cross-dv11.1.ddl.sqlpp
index 70ec199..6146a26 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv11/cross-dv11.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv11/cross-dv11.1.ddl.sqlpp
@@ -28,10 +28,10 @@
create dataverse testdv1;
create dataverse testdv2;
-create function testdv1.fun01(){
-testdv2.fun02()
-};
-
create function testdv2.fun02(){
'function 02'
};
+
+create function testdv1.fun01(){
+testdv2.fun02()
+};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv13/cross-dv13.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv13/cross-dv13.1.ddl.sqlpp
deleted file mode 100644
index 590ece1..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv13/cross-dv13.1.ddl.sqlpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 UDFs in different dataverses
- * : Test for recursion in those UDFs
- * Expected Res : Failure - Recursion is not allowed!
- * Date : 31st Aug 2012
- * Ignored : This test is currently not part of the test build, because it being a negative test case expectedly throws an exception.
- */
-
-drop dataverse testdv1 if exists;
-drop dataverse testdv2 if exists;
-create dataverse testdv1;
-create dataverse testdv2;
-
-create function testdv1.fun01(){
-testdv2.fun02()
-};
-
-create function testdv2.fun02(){
-testdv2.fun03()
-};
-
-create function testdv2.fun03(){
-testdv1.fun01()
-};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv13/cross-dv13.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv13/cross-dv13.2.update.sqlpp
deleted file mode 100644
index 21ae20b..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv13/cross-dv13.2.update.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 UDFs in different dataverses
- * : Test for recursion in those UDFs
- * Expected Res : Failure - Recursion is not allowed!
- * Date : 31st Aug 2012
- * Ignored : This test is currently not part of the test build, because it being a negative test case expectedly throws an exception.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv13/cross-dv13.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv13/cross-dv13.3.query.sqlpp
deleted file mode 100644
index 115179d..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv13/cross-dv13.3.query.sqlpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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 UDFs in different dataverses
- * : Test for recursion in those UDFs
- * Expected Res : Failure - Recursion is not allowed!
- * Date : 31st Aug 2012
- * Ignored : This test is currently not part of the test build, because it being a negative test case expectedly throws an exception.
- */
-
-use testdv1;
-
-
-select element testdv1.fun01();
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv16/cross-dv16.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv16/cross-dv16.1.ddl.sqlpp
deleted file mode 100644
index 02d0153..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv16/cross-dv16.1.ddl.sqlpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 : Detect Recursion in UDFs
- * Expected Res : Failure
- * Date : 30 Aug 2012
- * Ignored : Not part of test build, as its a negative test case that thrwos an exception
- */
-
-drop dataverse testdv1 if exists;
-create dataverse testdv1;
-
-// UDF with no inputs
-create function testdv1.fun01(){
-testdv1.fun02()
-};
-
-// UDF with one input
-create function testdv1.fun02(){
-testdv1.fun03()
-};
-
-// UDF with two inputs
-create function testdv1.fun03(){
-testdv1.fun04()
-};
-
-create function testdv1.fun04(){
-testdv1.fun02()
-};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv16/cross-dv16.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv16/cross-dv16.2.update.sqlpp
deleted file mode 100644
index c70f3db..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv16/cross-dv16.2.update.sqlpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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 : Detect Recursion in UDFs
- * Expected Res : Failure
- * Date : 30 Aug 2012
- * Ignored : Not part of test build, as its a negative test case that thrwos an exception
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv16/cross-dv16.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv16/cross-dv16.3.query.sqlpp
deleted file mode 100644
index 1668b59..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv16/cross-dv16.3.query.sqlpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 : Detect Recursion in UDFs
- * Expected Res : Failure
- * Date : 30 Aug 2012
- * Ignored : Not part of test build, as its a negative test case that thrwos an exception
- */
-
-use testdv1;
-
-
-select element testdv1.fun01();
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-1/bad-function-ddl-1.1.ddl.sqlpp
similarity index 69%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-1/bad-function-ddl-1.1.ddl.sqlpp
index 161929d..36eed22 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-1/bad-function-ddl-1.1.ddl.sqlpp
@@ -16,13 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
+
/*
- * Description : Create UDF and define with missing references.
- * Expected Res : Failure
- * Date : Sep 6th 2012
+ * Description : Declare a UDF on a dataset that does not exist
+ * Expected Res : Error
*/
-use test;
+drop dataverse experiments if exists;
+create dataverse experiments;
+use experiments;
-
-select element test.needs_f1(12345);
+create function bad_function(place, text) {
+ (select m.message_text
+ from TweetMessages m
+ where contains(m.message_text,text)
+ and spatial_intersect(m.sender_location, place))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-10/bad-function-ddl-10.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-10/bad-function-ddl-10.1.ddl.sqlpp
new file mode 100644
index 0000000..efeff1c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-10/bad-function-ddl-10.1.ddl.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Declare a UDF that uses a function that does not exist in the right dataverse
+ * Expected Res : Error
+ */
+
+drop dataverse experiments if exists;
+create dataverse experiments;
+use experiments;
+
+create type TweetMessageType as closed {
+ tweetid: uuid,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
+ countA: int32,
+ countB: int32
+};
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid autogenerated;
+
+create function f1(message, text){
+ contains(message,text)
+};
+
+drop dataverse two if exists;
+create dataverse two;
+use two;
+
+create function f0(message, text){
+ contains(message,text)
+};
+
+create function experiments.f2(place, text) {
+ (select m.message_text
+ from TweetMessages m
+ where contains(m.message_text,text)
+ and spatial_intersect(m.sender_location, place)
+ and f1(m.message_text,text)
+ and f0(m.message_text,text))
+};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-2/bad-function-ddl-2.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-2/bad-function-ddl-2.1.ddl.sqlpp
new file mode 100644
index 0000000..7288045
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-2/bad-function-ddl-2.1.ddl.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * 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 : Declare a UDF on a dataset that should be qualified
+ * Expected Res : Error
+ */
+
+drop dataverse experiments if exists;
+create dataverse experiments;
+use experiments;
+
+create type TweetMessageType as closed {
+ tweetid: uuid,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
+ countA: int32,
+ countB: int32
+};
+
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid autogenerated;
+
+drop dataverse experiments2 if exists;
+create dataverse experiments2;
+use experiments2;
+
+create function bad_function(place, text) {
+ (select m.message_text
+ from TweetMessages m
+ where contains(m.message_text,text)
+ and spatial_intersect(m.sender_location, place))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-3/bad-function-ddl-3.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-3/bad-function-ddl-3.1.ddl.sqlpp
new file mode 100644
index 0000000..0b7f8c7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-3/bad-function-ddl-3.1.ddl.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Declare a foreign UDF on a dataset that is local and not qualified
+ * Expected Res : Error
+ */
+
+drop dataverse experiments if exists;
+create dataverse experiments;
+drop dataverse experiments2 if exists;
+create dataverse experiments2;
+use experiments2;
+
+create type TweetMessageType as closed {
+ tweetid: uuid,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
+ countA: int32,
+ countB: int32
+};
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid autogenerated;
+
+create function experiments.bad_function(place, text) {
+ (select m.message_text
+ from TweetMessages m
+ where contains(m.message_text,text)
+ and spatial_intersect(m.sender_location, place))
+};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-4/bad-function-ddl-4.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-4/bad-function-ddl-4.1.ddl.sqlpp
new file mode 100644
index 0000000..d36bad5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-4/bad-function-ddl-4.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 : Declare a UDF on a dataset that should be qualified
+ * Expected Res : Error
+ */
+
+drop dataverse experiments if exists;
+create dataverse experiments;
+use experiments;
+
+create type TweetMessageType as closed {
+ tweetid: uuid,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
+ countA: int32,
+ countB: int32
+};
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid autogenerated;
+
+drop dataverse experiments2 if exists;
+create dataverse experiments2;
+use experiments2;
+
+create function bad_function(place, text) {
+ (select m.message_text
+ from experients.TweetMessages m
+ where contains(m.message_text,text)
+ and spatial_intersect(m.sender_location, place))
+};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-5/bad-function-ddl-5.1.ddl.sqlpp
similarity index 75%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-5/bad-function-ddl-5.1.ddl.sqlpp
index 161929d..f3b0c0f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-5/bad-function-ddl-5.1.ddl.sqlpp
@@ -16,13 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
+
/*
- * Description : Create UDF and define with missing references.
- * Expected Res : Failure
- * Date : Sep 6th 2012
+ * Description : Declare a UDF that uses a function that does not exist
+ * Expected Res : Error
*/
-use test;
+drop dataverse experiments if exists;
+create dataverse experiments;
+use experiments;
-select element test.needs_f1(12345);
+create function bad_function(place, text) {
+ function_that_does_not_exist()
+};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-6/bad-function-ddl-6.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-6/bad-function-ddl-6.1.ddl.sqlpp
new file mode 100644
index 0000000..669f979
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-6/bad-function-ddl-6.1.ddl.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 : Declare a UDF that uses a function that does not exist
+ * Expected Res : Error
+ */
+
+drop dataverse experiments if exists;
+create dataverse experiments;
+use experiments;
+
+create type TweetMessageType as closed {
+ tweetid: uuid,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
+ countA: int32,
+ countB: int32
+};
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid autogenerated;
+
+
+create function bad_function(place, text) {
+ (select m.message_text
+ from TweetMessages m
+ where function_that_does_not_exist(m.message_text,text)
+ and spatial_intersect(m.sender_location, place))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-7/bad-function-ddl-7.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-7/bad-function-ddl-7.1.ddl.sqlpp
new file mode 100644
index 0000000..6fa1d16
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-7/bad-function-ddl-7.1.ddl.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Declare a UDF that uses a dataset that does not exist
+ * Expected Res : Error
+ */
+
+drop dataverse experiments if exists;
+create dataverse experiments;
+use experiments;
+
+create type TweetMessageType as closed {
+ tweetid: uuid,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
+ countA: int32,
+ countB: int32
+};
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid autogenerated;
+
+create function good_function(place) {
+ place
+};
+
+create function bad_function(place, text) {
+ good_function((select m.sender_location
+ from TweetMessaes m))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-8/bad-function-ddl-8.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-8/bad-function-ddl-8.1.ddl.sqlpp
new file mode 100644
index 0000000..0bcb4f0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-8/bad-function-ddl-8.1.ddl.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Declare a UDF that uses a function that does not exist
+ * Expected Res : Error
+ */
+
+drop dataverse experiments if exists;
+create dataverse experiments;
+use experiments;
+
+create type TweetMessageType as closed {
+ tweetid: uuid,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
+ countA: int32,
+ countB: int32
+};
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid autogenerated;
+
+
+create function bad_function(place, text) {
+ (select * from (select m.message_text
+ from TweetMessaes m
+ where contains(m.message_text,text)
+ and spatial_intersect(m.sender_location, place)) text)
+};
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-9/bad-function-ddl-9.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-9/bad-function-ddl-9.1.ddl.sqlpp
new file mode 100644
index 0000000..23653b0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/bad-function-ddl-9/bad-function-ddl-9.1.ddl.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 : Declare a UDF that uses a function that does not exist
+ * Expected Res : Error
+ */
+
+drop dataverse experiments if exists;
+create dataverse experiments;
+use experiments;
+
+create type TweetMessageType as closed {
+ tweetid: uuid,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
+ countA: int32,
+ countB: int32
+};
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid autogenerated;
+
+create function good_function(place) {
+ place
+};
+
+create function bad_function(place, text) {
+ good_function(function_that_does_not_exist())
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf17/udf17.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf17/udf17.1.ddl.sqlpp
index 82098f8..3c5c441 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf17/udf17.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf17/udf17.1.ddl.sqlpp
@@ -29,10 +29,10 @@
use test;
-create function test.parent(){
-test.child()
-};
-
create function test.child() {
'This data is from the child function'
};
+
+create function test.parent(){
+test.child()
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.1.ddl.sqlpp
deleted file mode 100644
index fc23af0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.1.ddl.sqlpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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 UDF and define with missing references.
- * Expected Res : Failure
- * Date : Sep 6th 2012
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use test;
-
-create function test.needs_f1(x){
- x + f1()
-};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.2.update.sqlpp
deleted file mode 100644
index 62a7a0b..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/udf26/udf26.2.update.sqlpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 UDF and define with missing references.
- * Expected Res : Failure
- * Date : Sep 6th 2012
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv13/cross-dv13.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv13/cross-dv13.1.ast
deleted file mode 100644
index e69de29..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv13/cross-dv13.1.ast
+++ /dev/null
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv13/cross-dv13.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv13/cross-dv13.2.ast
deleted file mode 100644
index e69de29..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv13/cross-dv13.2.ast
+++ /dev/null
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv13/cross-dv13.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv13/cross-dv13.3.ast
deleted file mode 100644
index 3f12d12..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv13/cross-dv13.3.ast
+++ /dev/null
@@ -1,6 +0,0 @@
-DataverseUse testdv1
-Query:
-SELECT ELEMENT [
-FunctionCall testdv1.fun01@0[
-]
-]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv16/cross-dv16.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv16/cross-dv16.1.ast
deleted file mode 100644
index e69de29..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv16/cross-dv16.1.ast
+++ /dev/null
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv16/cross-dv16.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv16/cross-dv16.2.ast
deleted file mode 100644
index e69de29..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv16/cross-dv16.2.ast
+++ /dev/null
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv16/cross-dv16.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv16/cross-dv16.3.ast
deleted file mode 100644
index 3f12d12..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv16/cross-dv16.3.ast
+++ /dev/null
@@ -1,6 +0,0 @@
-DataverseUse testdv1
-Query:
-SELECT ELEMENT [
-FunctionCall testdv1.fun01@0[
-]
-]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf26/udf26.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf26/udf26.1.ast
deleted file mode 100644
index 916a59e..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf26/udf26.1.ast
+++ /dev/null
@@ -1 +0,0 @@
-DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf26/udf26.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf26/udf26.2.ast
deleted file mode 100644
index e69de29..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf26/udf26.2.ast
+++ /dev/null
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf26/udf26.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf26/udf26.3.ast
deleted file mode 100644
index c2db2b6..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf26/udf26.3.ast
+++ /dev/null
@@ -1,7 +0,0 @@
-DataverseUse test
-Query:
-SELECT ELEMENT [
-FunctionCall test.needs_f1@1[
- LiteralExpr [LONG] [12345]
-]
-]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index 17b14dc..b17db48 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -6383,12 +6383,6 @@
</compilation-unit>
</test-case>
<test-case FilePath="cross-dataverse">
- <compilation-unit name="cross-dv13">
- <output-dir compare="Text">cross-dv13</output-dir>
- <expected-error>Recursive invocation testdv2.fun03@0</expected-error>
- </compilation-unit>
- </test-case>
- <test-case FilePath="cross-dataverse">
<compilation-unit name="cross-dv14">
<output-dir compare="Text">cross-dv14</output-dir>
</compilation-unit>
@@ -6398,12 +6392,6 @@
<output-dir compare="Text">cross-dv15</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="cross-dataverse">
- <compilation-unit name="cross-dv16">
- <output-dir compare="Text">cross-dv16</output-dir>
- <expected-error>Recursive invocation testdv1.fun04@0</expected-error>
- </compilation-unit>
- </test-case>
<!--NotImplementedException: No binary comparator factory implemented for type RECORD.
<test-case FilePath="cross-dataverse">
<compilation-unit name="cross-dv17">
@@ -6631,12 +6619,6 @@
</compilation-unit>
</test-case>
-->
- <test-case FilePath="user-defined-functions">
- <compilation-unit name="udf26"><!-- Error not propagated properly -->
- <output-dir compare="Text">udf26</output-dir>
- <expected-error>function test.needs_f1@1 depends upon function test.f1@0 which is undefined</expected-error>
- </compilation-unit>
- </test-case>
<test-case FilePath="user-defined-functions"><!-- Exception is never thrown!! -->
<compilation-unit name="udf27">
<output-dir compare="Text">udf27</output-dir>
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 809ce70..2c3d855 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -7821,12 +7821,6 @@
</compilation-unit>
</test-case>
<test-case FilePath="cross-dataverse">
- <compilation-unit name="cross-dv13">
- <output-dir compare="Text">cross-dv13</output-dir>
- <expected-error>Recursive invocation testdv2.fun03@0</expected-error>
- </compilation-unit>
- </test-case>
- <test-case FilePath="cross-dataverse">
<compilation-unit name="cross-dv14">
<output-dir compare="Text">cross-dv14</output-dir>
</compilation-unit>
@@ -7836,12 +7830,6 @@
<output-dir compare="Text">cross-dv15</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="cross-dataverse">
- <compilation-unit name="cross-dv16">
- <output-dir compare="Text">cross-dv16</output-dir>
- <expected-error>Recursive invocation testdv1.fun04@0</expected-error>
- </compilation-unit>
- </test-case>
<!--NotImplementedException: No binary comparator factory implemented for type OBJECT.
<test-case FilePath="cross-dataverse">
<compilation-unit name="cross-dv17">
@@ -7879,6 +7867,66 @@
</test-group>
<test-group name="user-defined-functions">
<test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-1">
+ <output-dir compare="Text">bad-function-ddl-1</output-dir>
+ <expected-error>Cannot find dataset TweetMessages in dataverse experiments nor an alias with name TweetMessages!</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-2">
+ <output-dir compare="Text">bad-function-ddl-2</output-dir>
+ <expected-error>Cannot find dataset TweetMessages in dataverse experiments2 nor an alias with name TweetMessages!</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-3">
+ <output-dir compare="Text">bad-function-ddl-3</output-dir>
+ <expected-error>Cannot find dataset TweetMessages in dataverse experiments nor an alias with name TweetMessages!</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-4">
+ <output-dir compare="Text">bad-function-ddl-4</output-dir>
+ <expected-error>Cannot find dataset TweetMessages in dataverse experients nor an alias with name TweetMessages!</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-5">
+ <output-dir compare="Text">bad-function-ddl-5</output-dir>
+ <expected-error>function experiments.function_that_does_not_exist@0 is not defined</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-6">
+ <output-dir compare="Text">bad-function-ddl-6</output-dir>
+ <expected-error>function experiments.function_that_does_not_exist@2 is not defined</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-7">
+ <output-dir compare="Text">bad-function-ddl-7</output-dir>
+ <expected-error>Cannot find dataset TweetMessaes in dataverse experiments nor an alias with name TweetMessaes!</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-8">
+ <output-dir compare="Text">bad-function-ddl-8</output-dir>
+ <expected-error>Cannot find dataset TweetMessaes in dataverse experiments nor an alias with name TweetMessaes!</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-9">
+ <output-dir compare="Text">bad-function-ddl-9</output-dir>
+ <expected-error>function experiments.good_function@1 depends upon function experiments.function_that_does_not_exist@0 which is undefined</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="bad-function-ddl-10">
+ <output-dir compare="Text">bad-function-ddl-10</output-dir>
+ <expected-error>function experiments.f0@2 is not defined</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
<compilation-unit name="single-line-definition">
<output-dir compare="Text">single-line-definition</output-dir>
</compilation-unit>
@@ -8064,12 +8112,6 @@
</test-case>
-->
<test-case FilePath="user-defined-functions">
- <compilation-unit name="udf26">
- <output-dir compare="Text">udf26</output-dir>
- <expected-error>function test.needs_f1@1 depends upon function test.f1@0 which is undefined</expected-error>
- </compilation-unit>
- </test-case>
- <test-case FilePath="user-defined-functions">
<compilation-unit name="udf27">
<output-dir compare="Text">udf27</output-dir>
</compilation-unit>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
index af30871..283f055 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
@@ -5671,12 +5671,6 @@
</compilation-unit>
</test-case>
<test-case FilePath="cross-dataverse">
- <compilation-unit name="cross-dv13">
- <output-dir compare="AST">cross-dv13</output-dir>
- <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
- </compilation-unit>
- </test-case>
- <test-case FilePath="cross-dataverse">
<compilation-unit name="cross-dv14">
<output-dir compare="AST">cross-dv14</output-dir>
</compilation-unit>
@@ -5686,12 +5680,6 @@
<output-dir compare="AST">cross-dv15</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="cross-dataverse">
- <compilation-unit name="cross-dv16">
- <output-dir compare="AST">cross-dv16</output-dir>
- <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
- </compilation-unit>
- </test-case>
<!--NotImplementedException: No binary comparator factory implemented for type RECORD.
<test-case FilePath="cross-dataverse">
<compilation-unit name="cross-dv17">
@@ -5893,12 +5881,6 @@
</test-case>
-->
<test-case FilePath="user-defined-functions">
- <compilation-unit name="udf26">
- <output-dir compare="AST">udf26</output-dir>
- <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
- </compilation-unit>
- </test-case>
- <test-case FilePath="user-defined-functions">
<compilation-unit name="udf27">
<output-dir compare="AST">udf27</output-dir>
</compilation-unit>
diff --git a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
index 5c7c6f2..d55db87 100644
--- a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
+++ b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
@@ -725,7 +725,7 @@
signature = new FunctionSignature(fctName.dataverse, fctName.function, paramList.size());
getCurrentScope().addFunctionDescriptor(signature, false);
removeCurrentScope();
- return new CreateFunctionStatement(signature, paramList, functionBody, ifNotExists);
+ return new CreateFunctionStatement(signature, paramList, functionBody, functionBodyExpr, ifNotExists);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/CreateFunctionStatement.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/CreateFunctionStatement.java
index 84d66ce..c817885 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/CreateFunctionStatement.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/CreateFunctionStatement.java
@@ -23,6 +23,7 @@
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.base.Statement;
import org.apache.asterix.lang.common.struct.VarIdentifier;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
@@ -31,6 +32,7 @@
private final FunctionSignature signature;
private final String functionBody;
+ private final Expression functionBodyExpression;
private final boolean ifNotExists;
private final List<String> paramList;
@@ -39,9 +41,10 @@
}
public CreateFunctionStatement(FunctionSignature signature, List<VarIdentifier> parameterList, String functionBody,
- boolean ifNotExists) {
+ Expression functionBodyExpression, boolean ifNotExists) {
this.signature = signature;
this.functionBody = functionBody;
+ this.functionBodyExpression = functionBodyExpression;
this.ifNotExists = ifNotExists;
this.paramList = new ArrayList<String>();
for (VarIdentifier varId : parameterList) {
@@ -66,6 +69,10 @@
return signature;
}
+ public Expression getFunctionBodyExpression() {
+ return functionBodyExpression;
+ }
+
@Override
public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws CompilationException {
return visitor.visit(this, arg);
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index 2bf84e0..b68ffd6 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -754,11 +754,15 @@
Token beginPos;
Token endPos;
FunctionName fctName = null;
+ String currentDataverse = defaultDataverse;
createNewScope();
}
{
<FUNCTION> fctName = FunctionName()
+ {
+ defaultDataverse = fctName.dataverse;
+ }
ifNotExists = IfNotExists()
paramList = ParameterList()
<LEFTBRACE>
@@ -773,7 +777,8 @@
signature = new FunctionSignature(fctName.dataverse, fctName.function, paramList.size());
getCurrentScope().addFunctionDescriptor(signature, false);
removeCurrentScope();
- return new CreateFunctionStatement(signature, paramList, functionBody, ifNotExists);
+ defaultDataverse = currentDataverse;
+ return new CreateFunctionStatement(signature, paramList, functionBody, functionBodyExpr, ifNotExists);
}
}