Steven Jacobs has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1723
Change subject: Added parameterized procedures
......................................................................
Added parameterized procedures
delete and query procedures can both use parameters
these will use Asterix runtime context variables
Change-Id: Ic364a81599a920913c4e38f71a48bf8c4c04e03d
---
M asterix-bad/pom.xml
M asterix-bad/src/main/java/org/apache/asterix/bad/ChannelJobService.java
M
asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java
M
asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java
M
asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/ExecuteProcedureStatement.java
M asterix-bad/src/main/resources/lang-extension/lang.txt
A
asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.1.ddl.sqlpp
A
asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.2.query.sqlpp
A
asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.3.update.sqlpp
A
asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.4.query.sqlpp
A
asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.1.ddl.sqlpp
A
asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.2.update.sqlpp
A
asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.3.update.sqlpp
A
asterix-bad/src/test/resources/runtimets/results/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.1.adm
A
asterix-bad/src/test/resources/runtimets/results/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.2.adm
A
asterix-bad/src/test/resources/runtimets/results/procedure/query_procedure_with_parameters/query_procedure_with_parameters.1.adm
A
asterix-bad/src/test/resources/runtimets/results/procedure/query_procedure_with_parameters/query_procedure_with_parameters.2.adm
M asterix-bad/src/test/resources/runtimets/testsuite.xml
18 files changed, 359 insertions(+), 46 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb-bad
refs/changes/23/1723/1
diff --git a/asterix-bad/pom.xml b/asterix-bad/pom.xml
index 90a0b89..caf1da2 100644
--- a/asterix-bad/pom.xml
+++ b/asterix-bad/pom.xml
@@ -244,6 +244,11 @@
<version>${asterix.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.asterix</groupId>
+ <artifactId>asterix-lang-common</artifactId>
+ <version>${asterix.version}</version>
+ </dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
diff --git
a/asterix-bad/src/main/java/org/apache/asterix/bad/ChannelJobService.java
b/asterix-bad/src/main/java/org/apache/asterix/bad/ChannelJobService.java
index eba8ca1..c470f0c 100644
--- a/asterix-bad/src/main/java/org/apache/asterix/bad/ChannelJobService.java
+++ b/asterix-bad/src/main/java/org/apache/asterix/bad/ChannelJobService.java
@@ -24,6 +24,7 @@
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.EnumSet;
+import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -47,14 +48,14 @@
private static final Logger LOGGER =
Logger.getLogger(ChannelJobService.class.getName());
public static ScheduledExecutorService startJob(JobSpecification jobSpec,
EnumSet<JobFlag> jobFlags, JobId jobId,
- IHyracksClientConnection hcc, long duration)
+ IHyracksClientConnection hcc, long duration, Map<String, byte[]>
contextRuntTimeVarMap)
throws Exception {
ScheduledExecutorService scheduledExecutorService =
Executors.newScheduledThreadPool(1);
scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
- executeJob(jobSpec, jobFlags, jobId, hcc);
+ executeJob(jobSpec, jobFlags, jobId, hcc,
contextRuntTimeVarMap);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Channel Job Failed to run.", e);
}
@@ -64,13 +65,13 @@
}
public static void executeJob(JobSpecification jobSpec, EnumSet<JobFlag>
jobFlags, JobId jobId,
- IHyracksClientConnection hcc)
+ IHyracksClientConnection hcc, Map<String, byte[]>
contextRuntTimeVarMap)
throws Exception {
LOGGER.info("Executing Channel Job");
if (jobId == null) {
hcc.startJob(jobSpec, jobFlags);
} else {
- hcc.startJob(jobId);
+ hcc.startJob(jobId, contextRuntTimeVarMap);
}
}
diff --git
a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java
b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java
index 571a2d7..626ef4e 100644
---
a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java
+++
b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateChannelStatement.java
@@ -248,7 +248,7 @@
jobId = hcc.distributeJob(channeljobSpec);
}
ScheduledExecutorService ses =
ChannelJobService.startJob(channeljobSpec, EnumSet.noneOf(JobFlag.class),
- jobId, hcc, ChannelJobService.findPeriod(duration));
+ jobId, hcc, ChannelJobService.findPeriod(duration), new
HashMap<>());
listener.storeDistributedInfo(jobId, ses, null);
}
diff --git
a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java
b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java
index 7373337..0dad206 100644
---
a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java
+++
b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateProcedureStatement.java
@@ -20,7 +20,6 @@
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
-import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
@@ -34,7 +33,6 @@
import org.apache.asterix.app.translator.QueryTranslator;
import org.apache.asterix.bad.BADConstants;
import org.apache.asterix.bad.lang.BADLangExtension;
-import org.apache.asterix.bad.lang.BADParserFactory;
import org.apache.asterix.bad.metadata.PrecompiledJobEventListener;
import
org.apache.asterix.bad.metadata.PrecompiledJobEventListener.PrecompiledType;
import org.apache.asterix.bad.metadata.Procedure;
@@ -44,13 +42,18 @@
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.clause.LetClause;
import org.apache.asterix.lang.common.expression.CallExpr;
import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.RuntimeContextVarExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.literal.StringLiteral;
+import org.apache.asterix.lang.common.statement.DeleteStatement;
import org.apache.asterix.lang.common.statement.Query;
import org.apache.asterix.lang.common.struct.Identifier;
import org.apache.asterix.lang.common.struct.VarIdentifier;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
import org.apache.asterix.lang.sqlpp.visitor.SqlppDeleteRewriteVisitor;
import org.apache.asterix.metadata.MetadataException;
import org.apache.asterix.metadata.MetadataManager;
@@ -76,24 +79,33 @@
private static final Logger LOGGER =
Logger.getLogger(CreateProcedureStatement.class.getName());
private final FunctionSignature signature;
- private final String functionBody;
+ private final String procedureBody;
+ private final Statement procedureBodyStatement;
private final List<String> paramList;
+ private final List<VariableExpr> varList;
private final CallExpr period;
private String duration = "";
- public String getFunctionBody() {
- return functionBody;
- }
-
- public CreateProcedureStatement(FunctionSignature signature,
List<VarIdentifier> parameterList, String functionBody,
- Expression period) {
+ public CreateProcedureStatement(FunctionSignature signature,
List<VarIdentifier> parameterList,
+ List<Integer> paramIds, String functionBody, Statement
procedureBodyStatement, Expression period) {
this.signature = signature;
- this.functionBody = functionBody;
+ this.procedureBody = functionBody;
+ this.procedureBodyStatement = procedureBodyStatement;
this.paramList = new ArrayList<>();
- for (VarIdentifier varId : parameterList) {
- this.paramList.add(varId.getValue());
+ this.varList = new ArrayList<>();
+ for (int i = 0; i < parameterList.size(); i++) {
+ this.paramList.add(parameterList.get(i).getValue());
+ this.varList.add(new VariableExpr(new
VarIdentifier(parameterList.get(i).toString(), paramIds.get(i))));
}
this.period = (CallExpr) period;
+ }
+
+ public String getProcedureBody() {
+ return procedureBody;
+ }
+
+ public Statement getProcedureBodyStatement() {
+ return procedureBodyStatement;
}
@Override
@@ -103,6 +115,10 @@
public List<String> getParamList() {
return paramList;
+ }
+
+ public List<VariableExpr> getVarList() {
+ return varList;
}
public FunctionSignature getSignature() {
@@ -158,33 +174,40 @@
return jobSpec;
}
- private Pair<JobSpecification, PrecompiledType> createProcedureJob(String
body,
- IStatementExecutor statementExecutor, MetadataProvider
metadataProvider, IHyracksClientConnection hcc,
- IHyracksDataset hdc, Stats stats) throws Exception {
- StringBuilder builder = new StringBuilder();
- builder.append(body);
- builder.append(";");
- BADParserFactory factory = new BADParserFactory();
- List<Statement> fStatements = factory.createParser(new
StringReader(builder.toString())).parse();
- if (fStatements.size() > 1) {
- throw new CompilationException("Procedure can only execute a
single statement");
+ private void addLets(SelectExpression s) {
+ for (VariableExpr var : varList) {
+ Expression con = new
RuntimeContextVarExpr(var.getVar().getValue());
+ LetClause let = new LetClause(var, con);
+ s.getLetList().add(let);
}
- if (fStatements.get(0).getKind() == Statement.Kind.INSERT) {
+ }
+
+ private Pair<JobSpecification, PrecompiledType>
createProcedureJob(IStatementExecutor statementExecutor,
+ MetadataProvider metadataProvider, IHyracksClientConnection hcc,
IHyracksDataset hdc, Stats stats)
+ throws Exception {
+ if (getProcedureBodyStatement().getKind() == Statement.Kind.INSERT) {
+ if (!varList.isEmpty()) {
+ throw new CompilationException("Insert procedures cannot have
parameters");
+ }
return new Pair<>(
((QueryTranslator)
statementExecutor).handleInsertUpsertStatement(metadataProvider,
- fStatements.get(0), hcc, hdc,
ResultDelivery.ASYNC, stats, true, null, null),
+ getProcedureBodyStatement(), hcc, hdc,
ResultDelivery.ASYNC, stats, true, null, null),
PrecompiledType.INSERT);
- } else if (fStatements.get(0).getKind() == Statement.Kind.QUERY) {
- Pair<JobSpecification, PrecompiledType> pair =
- new Pair<>(compileQueryJob(statementExecutor,
metadataProvider, hcc, (Query) fStatements.get(0)),
- PrecompiledType.QUERY);
+ } else if (getProcedureBodyStatement().getKind() ==
Statement.Kind.QUERY) {
+ Query s = (Query) getProcedureBodyStatement();
+ addLets((SelectExpression) s.getBody());
+ Pair<JobSpecification, PrecompiledType> pair = new Pair<>(
+ compileQueryJob(statementExecutor, metadataProvider, hcc,
(Query) getProcedureBodyStatement()),
+ PrecompiledType.QUERY);
metadataProvider.getLocks().unlock();
return pair;
- } else if (fStatements.get(0).getKind() == Statement.Kind.DELETE) {
+ } else if (getProcedureBodyStatement().getKind() ==
Statement.Kind.DELETE) {
SqlppDeleteRewriteVisitor visitor = new
SqlppDeleteRewriteVisitor();
- fStatements.get(0).accept(visitor, null);
+ getProcedureBodyStatement().accept(visitor, null);
+ DeleteStatement delete = (DeleteStatement)
getProcedureBodyStatement();
+ addLets((SelectExpression) delete.getQuery().getBody());
return new Pair<>(((QueryTranslator)
statementExecutor).handleDeleteStatement(metadataProvider,
- fStatements.get(0), hcc, true), PrecompiledType.DELETE);
+ getProcedureBodyStatement(), hcc, true),
PrecompiledType.DELETE);
} else {
throw new CompilationException("Procedure can only execute a
single delete, insert, or query");
}
@@ -230,7 +253,7 @@
}
procedure = new Procedure(dataverse, signature.getName(),
signature.getArity(), getParamList(),
- Function.RETURNTYPE_VOID, getFunctionBody(),
Function.LANGUAGE_AQL, duration);
+ Function.RETURNTYPE_VOID, getProcedureBody(),
Function.LANGUAGE_AQL, duration);
MetadataProvider tempMdProvider = new
MetadataProvider(metadataProvider.getApplicationContext(),
metadataProvider.getDefaultDataverse(),
metadataProvider.getStorageComponentProvider());
@@ -247,11 +270,11 @@
//Create Procedure Internal Job
Pair<JobSpecification, PrecompiledType> procedureJobSpec =
- createProcedureJob(getFunctionBody(), statementExecutor,
tempMdProvider, hcc, hdc, stats);
+ createProcedureJob(statementExecutor, tempMdProvider, hcc,
hdc, stats);
// Now we subscribe
if (listener == null) {
- //TODO: Add datasets used by channel function
+ //TODO: Add datasets used by procedure
listener = new PrecompiledJobEventListener(entityId,
procedureJobSpec.second, new ArrayList<>());
activeEventHandler.registerListener(listener);
}
diff --git
a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/ExecuteProcedureStatement.java
b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/ExecuteProcedureStatement.java
index a8ec9aa..eb14192 100644
---
a/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/ExecuteProcedureStatement.java
+++
b/asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/ExecuteProcedureStatement.java
@@ -18,7 +18,11 @@
*/
package org.apache.asterix.bad.lang.statement;
+import java.io.DataOutput;
import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import org.apache.asterix.active.ActiveJobNotificationHandler;
@@ -35,12 +39,19 @@
import
org.apache.asterix.bad.metadata.PrecompiledJobEventListener.PrecompiledType;
import org.apache.asterix.bad.metadata.Procedure;
import org.apache.asterix.common.dataflow.ICcApplicationContext;
+import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.common.exceptions.CompilationException;
+import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
import org.apache.asterix.lang.common.struct.Identifier;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
import org.apache.asterix.metadata.MetadataManager;
import org.apache.asterix.metadata.MetadataTransactionContext;
import org.apache.asterix.metadata.declared.MetadataProvider;
+import org.apache.asterix.om.base.IAObject;
+import org.apache.asterix.translator.ConstantHelper;
import org.apache.asterix.translator.IStatementExecutor;
import org.apache.asterix.translator.IStatementExecutor.ResultDelivery;
import org.apache.asterix.translator.IStatementExecutor.Stats;
@@ -50,17 +61,20 @@
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.job.JobFlag;
import org.apache.hyracks.api.job.JobId;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
public class ExecuteProcedureStatement implements IExtensionStatement {
private final String dataverseName;
private final String procedureName;
private final int arity;
+ private final List<Expression> argList;
- public ExecuteProcedureStatement(String dataverseName, String
procedureName, int arity) {
+ public ExecuteProcedureStatement(String dataverseName, String
procedureName, int arity, List<Expression> argList) {
this.dataverseName = dataverseName;
this.procedureName = procedureName;
this.arity = arity;
+ this.argList = argList;
}
public String getDataverseName() {
@@ -112,10 +126,10 @@
if (procedure == null) {
throw new AlgebricksException("There is no procedure with this
name " + procedureName + ".");
}
-
+ Map<String, byte[]> contextRuntimeVarMap =
createContextRuntimeMap(procedure);
JobId hyracksJobId = listener.getJobId();
if (procedure.getDuration().equals("")) {
- hcc.startJob(hyracksJobId);
+ hcc.startJob(hyracksJobId, contextRuntimeVarMap);
if (listener.getType() == PrecompiledType.QUERY) {
hcc.waitForCompletion(hyracksJobId);
@@ -126,7 +140,7 @@
} else {
ScheduledExecutorService ses =
ChannelJobService.startJob(null, EnumSet.noneOf(JobFlag.class),
- hyracksJobId, hcc,
ChannelJobService.findPeriod(procedure.getDuration()));
+ hyracksJobId, hcc,
ChannelJobService.findPeriod(procedure.getDuration()), contextRuntimeVarMap);
listener.storeDistributedInfo(hyracksJobId, ses,
listener.getResultReader());
}
@@ -143,4 +157,27 @@
}
}
+ private Map<String, byte[]> createContextRuntimeMap(Procedure procedure)
+ throws AsterixException, HyracksDataException {
+ Map<String, byte[]> map = new HashMap<>();
+ if (procedure.getParams().size() != argList.size()) {
+ throw
AsterixException.create(ErrorCode.COMPILATION_INVALID_PARAMETER_NUMBER,
+ procedure.getEntityId().getEntityName(), argList.size());
+ }
+ for (int i = 0; i < procedure.getParams().size(); i++) {
+ //Turn the argument expression into a byte array
+ if (!(argList.get(i) instanceof LiteralExpr)) {
+ //TODO handle nonliteral arguments to procedure
+ throw AsterixException.create(ErrorCode.TYPE_UNSUPPORTED,
procedure.getEntityId().getEntityName(),
+ argList.get(i).getClass());
+ }
+ IAObject object = ConstantHelper.objectFromLiteral(((LiteralExpr)
argList.get(i)).getValue());
+ ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
+ DataOutput dos = abvs.getDataOutput();
+
SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(object.getType()).serialize(object,
dos);
+ map.put(procedure.getParams().get(i), abvs.getByteArray());
+ }
+ return map;
+ }
+
}
\ No newline at end of file
diff --git a/asterix-bad/src/main/resources/lang-extension/lang.txt
b/asterix-bad/src/main/resources/lang-extension/lang.txt
index 6a06ea6..c6f7779 100644
--- a/asterix-bad/src/main/resources/lang-extension/lang.txt
+++ b/asterix-bad/src/main/resources/lang-extension/lang.txt
@@ -124,6 +124,7 @@
FunctionName fctName = null;
FunctionSignature signature;
List<VarIdentifier> paramList = new ArrayList<VarIdentifier>();
+ List<Integer> paramIds = new ArrayList<Integer>();
String functionBody;
Token beginPos;
Token endPos;
@@ -135,7 +136,13 @@
paramList = ParameterList()
<LEFTBRACE>
{
- beginPos = token;
+ for (VarIdentifier param : paramList)
+ {
+ VarIdentifier v = new VarIdentifier(param.toString());
+ getCurrentScope().addNewVarSymbolToScope(v);
+ paramIds.add(v.getId());
+ }
+ beginPos = token;
}
functionBodyExpr = SingleStatement() <RIGHTBRACE>
{
@@ -146,7 +153,7 @@
}
("period" period = FunctionCallExpr())?
{
- return new CreateProcedureStatement(signature, paramList, functionBody,
period);
+ return new CreateProcedureStatement(signature, paramList, paramIds,
functionBody, functionBodyExpr, period);
}
}
@@ -176,7 +183,7 @@
)*)? <RIGHTPAREN>
{
String fqFunctionName = funcName.function;
- return new ExecuteProcedureStatement(funcName.dataverse, fqFunctionName,
arity);
+ return new ExecuteProcedureStatement(funcName.dataverse, fqFunctionName,
arity, argList);
}
}
diff --git
a/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.1.ddl.sqlpp
b/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.1.ddl.sqlpp
new file mode 100644
index 0000000..781adb5
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.1.ddl.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+* Description : Simple Delete Procedure with parameters
+* Expected Res : Success
+* Date : May 2017
+* Author : Steven Jacobs
+*/
+
+drop dataverse channels if exists;
+create dataverse channels;
+use channels;
+create type myLocation as {
+ id: int
+}
+create dataset UserLocations(myLocation)
+primary key id;
+insert into UserLocations(
+ [{"id":0, "roomNumber":4815162342},
+ {"id":1, "roomNumber":"lost"},
+ {"id":2, "roomNumber":108},
+ {"id":3, "roomNumber":"jacob"}]
+);
+create procedure deleteSome(r, otherRoom) {
+delete from UserLocations
+where roomNumber = r
+or roomNumber = otherRoom
+};
diff --git
a/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.2.query.sqlpp
b/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.2.query.sqlpp
new file mode 100644
index 0000000..88166bb
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.2.query.sqlpp
@@ -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 : Simple Delete Procedure with parameters
+* Expected Res : Success
+* Date : May 2017
+* Author : Steven Jacobs
+*/
+
+use channels;
+select value count(roomNumber) from UserLocations;
\ No newline at end of file
diff --git
a/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.3.update.sqlpp
b/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.3.update.sqlpp
new file mode 100644
index 0000000..8d03794
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.3.update.sqlpp
@@ -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 : Simple Delete Procedure with parameters
+* Expected Res : Success
+* Date : May 2017
+* Author : Steven Jacobs
+*/
+
+use channels;
+execute deleteSome(108,"jacob");
\ No newline at end of file
diff --git
a/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.4.query.sqlpp
b/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.4.query.sqlpp
new file mode 100644
index 0000000..88166bb
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/queries/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.4.query.sqlpp
@@ -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 : Simple Delete Procedure with parameters
+* Expected Res : Success
+* Date : May 2017
+* Author : Steven Jacobs
+*/
+
+use channels;
+select value count(roomNumber) from UserLocations;
\ No newline at end of file
diff --git
a/asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.1.ddl.sqlpp
b/asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.1.ddl.sqlpp
new file mode 100644
index 0000000..47622bc
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.1.ddl.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Simple Query Procedure with parameters
+* Expected Res : Success
+* Date : May 2017
+* Author : Steven Jacobs
+*/
+
+drop dataverse channels if exists;
+create dataverse channels;
+use channels;
+create type myLocation as {
+ id: int
+}
+create dataset UserLocations(myLocation)
+primary key id;
+insert into UserLocations(
+ [{"id":0, "roomNumber":4815162342},
+ {"id":1, "roomNumber":"lost"},
+ {"id":2, "roomNumber":108},
+ {"id":3, "roomNumber":"jacob"}]
+);
+create procedure selectSome(r, otherRoom) {
+select roomNumber from UserLocations
+where roomNumber = r
+or roomNumber = otherRoom
+order by id;
+};
diff --git
a/asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.2.update.sqlpp
b/asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.2.update.sqlpp
new file mode 100644
index 0000000..aa0722a
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.2.update.sqlpp
@@ -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 : Simple Query Procedure with parameters
+* Expected Res : Success
+* Date : May 2017
+* Author : Steven Jacobs
+*/
+
+use channels;
+execute selectSome(108,"jacob");
\ No newline at end of file
diff --git
a/asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.3.update.sqlpp
b/asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.3.update.sqlpp
new file mode 100644
index 0000000..aa0722a
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/queries/procedure/query_procedure_with_parameters/query_procedure_with_parameters.3.update.sqlpp
@@ -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 : Simple Query Procedure with parameters
+* Expected Res : Success
+* Date : May 2017
+* Author : Steven Jacobs
+*/
+
+use channels;
+execute selectSome(108,"jacob");
\ No newline at end of file
diff --git
a/asterix-bad/src/test/resources/runtimets/results/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.1.adm
b/asterix-bad/src/test/resources/runtimets/results/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.1.adm
new file mode 100644
index 0000000..bf0d87a
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/results/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.1.adm
@@ -0,0 +1 @@
+4
\ No newline at end of file
diff --git
a/asterix-bad/src/test/resources/runtimets/results/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.2.adm
b/asterix-bad/src/test/resources/runtimets/results/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.2.adm
new file mode 100644
index 0000000..d8263ee
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/results/procedure/delete_procedure_with_parameters/delete_procedure_with_parameters.2.adm
@@ -0,0 +1 @@
+2
\ No newline at end of file
diff --git
a/asterix-bad/src/test/resources/runtimets/results/procedure/query_procedure_with_parameters/query_procedure_with_parameters.1.adm
b/asterix-bad/src/test/resources/runtimets/results/procedure/query_procedure_with_parameters/query_procedure_with_parameters.1.adm
new file mode 100644
index 0000000..bee5525
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/results/procedure/query_procedure_with_parameters/query_procedure_with_parameters.1.adm
@@ -0,0 +1,2 @@
+{ "roomNumber": 108 }
+{ "roomNumber": "jacob" }
\ No newline at end of file
diff --git
a/asterix-bad/src/test/resources/runtimets/results/procedure/query_procedure_with_parameters/query_procedure_with_parameters.2.adm
b/asterix-bad/src/test/resources/runtimets/results/procedure/query_procedure_with_parameters/query_procedure_with_parameters.2.adm
new file mode 100644
index 0000000..bee5525
--- /dev/null
+++
b/asterix-bad/src/test/resources/runtimets/results/procedure/query_procedure_with_parameters/query_procedure_with_parameters.2.adm
@@ -0,0 +1,2 @@
+{ "roomNumber": 108 }
+{ "roomNumber": "jacob" }
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/runtimets/testsuite.xml
b/asterix-bad/src/test/resources/runtimets/testsuite.xml
index 12d7d55..fc145b0 100644
--- a/asterix-bad/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-bad/src/test/resources/runtimets/testsuite.xml
@@ -37,11 +37,21 @@
</compilation-unit>
</test-case>
<test-case FilePath="procedure">
+ <compilation-unit name="delete_procedure_with_parameters">
+ <output-dir
compare="Text">delete_procedure_with_parameters</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="procedure">
<compilation-unit name="query_procedure">
<output-dir compare="Text">query_procedure</output-dir>
</compilation-unit>
</test-case>
<test-case FilePath="procedure">
+ <compilation-unit name="query_procedure_with_parameters">
+ <output-dir
compare="Text">query_procedure_with_parameters</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="procedure">
<compilation-unit name="repetitive_insert_procedure">
<output-dir compare="Text">repetitive_insert_procedure</output-dir>
</compilation-unit>
--
To view, visit https://asterix-gerrit.ics.uci.edu/1723
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic364a81599a920913c4e38f71a48bf8c4c04e03d
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: Steven Jacobs <[email protected]>