merge from master
diff --git a/asterix-algebra/pom.xml b/asterix-algebra/pom.xml
index 350734b..86d621b 100644
--- a/asterix-algebra/pom.xml
+++ b/asterix-algebra/pom.xml
@@ -92,6 +92,12 @@
<version>0.0.6-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>edu.uci.ics.asterix</groupId>
+ <artifactId>asterix-transactions</artifactId>
+ <version>0.0.6-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>edu.uci.ics.hyracks</groupId>
<artifactId>algebricks-compiler</artifactId>
@@ -99,9 +105,6 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
- <version>20090211</version>
- <type>jar</type>
- <scope>compile</scope>
</dependency>
</dependencies>
</project>
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitPOperator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitPOperator.java
index ece3db6..5f3bb36 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitPOperator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitPOperator.java
@@ -17,7 +17,7 @@
import java.util.List;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.IHyracksJobBuilder;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitRuntime.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitRuntime.java
index 8533e74..266fe6d 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitRuntime.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitRuntime.java
@@ -17,13 +17,13 @@
import java.nio.ByteBuffer;
-import edu.uci.ics.asterix.common.context.AsterixAppRuntimeContext;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext.TransactionType;
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext.TransactionType;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.hyracks.algebricks.runtime.base.IPushRuntime;
import edu.uci.ics.hyracks.api.comm.IFrameWriter;
import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
@@ -46,7 +46,7 @@
private final boolean isWriteTransaction;
private final long[] longHashes;
- private TransactionContext transactionContext;
+ private ITransactionContext transactionContext;
private RecordDescriptor inputRecordDesc;
private FrameTupleAccessor frameTupleAccessor;
private FrameTupleReference frameTupleReference;
@@ -54,7 +54,7 @@
public CommitRuntime(IHyracksTaskContext ctx, JobId jobId, int datasetId, int[] primaryKeyFields,
boolean isWriteTransaction) {
this.hyracksTaskCtx = ctx;
- AsterixAppRuntimeContext runtimeCtx = (AsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext()
+ IAsterixAppRuntimeContext runtimeCtx = (IAsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext()
.getApplicationObject();
this.transactionManager = runtimeCtx.getTransactionSubsystem().getTransactionManager();
this.jobId = jobId;
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitRuntimeFactory.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitRuntimeFactory.java
index f3b6526..39ba697 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitRuntimeFactory.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/CommitRuntimeFactory.java
@@ -15,7 +15,7 @@
package edu.uci.ics.asterix.algebra.operators.physical;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.runtime.base.IPushRuntime;
import edu.uci.ics.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/InvertedIndexPOperator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/InvertedIndexPOperator.java
index 6edcc39..d17d77c 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/InvertedIndexPOperator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/InvertedIndexPOperator.java
@@ -3,9 +3,7 @@
import java.util.ArrayList;
import java.util.List;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.dataflow.IAsterixApplicationContextInfo;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.MetadataManager;
@@ -20,10 +18,12 @@
import edu.uci.ics.asterix.om.types.ARecordType;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.AsterixAppContextInfo;
import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
import edu.uci.ics.asterix.optimizer.rules.am.InvertedIndexAccessMethod;
import edu.uci.ics.asterix.optimizer.rules.am.InvertedIndexAccessMethod.SearchModifierType;
import edu.uci.ics.asterix.optimizer.rules.am.InvertedIndexJobGenParams;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/base/RuleCollections.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/base/RuleCollections.java
index d5169c7..783fbaa 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/base/RuleCollections.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/base/RuleCollections.java
@@ -20,6 +20,7 @@
import edu.uci.ics.asterix.optimizer.rules.AsterixInlineVariablesRule;
import edu.uci.ics.asterix.optimizer.rules.ByNameToByIndexFieldAccessRule;
+import edu.uci.ics.asterix.optimizer.rules.CheckFilterExpressionTypeRule;
import edu.uci.ics.asterix.optimizer.rules.ConstantFoldingRule;
import edu.uci.ics.asterix.optimizer.rules.CountVarToCountOneRule;
import edu.uci.ics.asterix.optimizer.rules.ExtractDistinctByExpressionsRule;
@@ -103,6 +104,7 @@
List<IAlgebraicRewriteRule> typeInfer = new LinkedList<IAlgebraicRewriteRule>();
typeInfer.add(new InlineUnnestFunctionRule());
typeInfer.add(new InferTypesRule());
+ typeInfer.add(new CheckFilterExpressionTypeRule());
return typeInfer;
}
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/CheckFilterExpressionTypeRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/CheckFilterExpressionTypeRule.java
new file mode 100644
index 0000000..aa57ab9
--- /dev/null
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/CheckFilterExpressionTypeRule.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+
+package edu.uci.ics.asterix.optimizer.rules;
+
+import org.apache.commons.lang3.mutable.Mutable;
+
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.SelectOperator;
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
+
+/**
+ * This rule is to check if all the filter expression are of the boolean type or a possible (determined
+ * at the runtime) boolean type.
+ * If that is not the case, an exception should be thrown.
+ *
+ * @author yingyib
+ */
+public class CheckFilterExpressionTypeRule implements IAlgebraicRewriteRule {
+
+ @Override
+ public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+ return false;
+ }
+
+ @Override
+ public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
+ throws AlgebricksException {
+ AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
+ if (op.getOperatorTag() != LogicalOperatorTag.SELECT) {
+ return false;
+ }
+ SelectOperator select = (SelectOperator) op;
+ ILogicalExpression condition = select.getCondition().getValue();
+ IVariableTypeEnvironment env = select.computeOutputTypeEnvironment(context);
+ IAType condType = (IAType) env.getType(condition);
+ if (condType.getTypeTag() != ATypeTag.BOOLEAN && condType.getTypeTag() != ATypeTag.ANY
+ && !isPossibleBoolean(condType)) {
+ throw new AlgebricksException("The select condition " + condition.toString()
+ + " should be of the boolean type.");
+ }
+ return false;
+ }
+
+ /**
+ * Check if the type is optional boolean or not
+ *
+ * @param type
+ * @return true if it is; false otherwise.
+ */
+ private boolean isPossibleBoolean(IAType type) {
+ while (type.getTypeTag() == ATypeTag.UNION && NonTaggedFormatUtil.isOptionalField((AUnionType) type)) {
+ type = ((AUnionType) type).getUnionList().get(NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ if (type.getTypeTag() == ATypeTag.BOOLEAN || type.getTypeTag() == ATypeTag.ANY) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
index 1f242b8..e494ef4 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
@@ -26,7 +26,10 @@
import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.typecomputer.base.TypeComputerUtilities;
import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
@@ -37,10 +40,10 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.InsertDeleteOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.ProjectOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities;
import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
@@ -88,62 +91,157 @@
InsertDeleteOperator insertDeleteOp = (InsertDeleteOperator) op2;
if (insertDeleteOp.getOperation() == InsertDeleteOperator.Kind.DELETE)
return false;
- AbstractLogicalOperator op3 = (AbstractLogicalOperator) op2.getInputs().get(0).getValue();
- if (op3.getOperatorTag() != LogicalOperatorTag.ASSIGN)
- return false;
InsertDeleteOperator insertDeleteOperator = (InsertDeleteOperator) op2;
- AssignOperator oldAssignOperator = (AssignOperator) op3;
-
AqlDataSource dataSource = (AqlDataSource) insertDeleteOperator.getDataSource();
IAType[] schemaTypes = (IAType[]) dataSource.getSchemaTypes();
ARecordType requiredRecordType = (ARecordType) schemaTypes[schemaTypes.length - 1];
+ ILogicalExpression expr = insertDeleteOperator.getPayloadExpression().getValue();
+ List<LogicalVariable> payloadVars = new ArrayList<LogicalVariable>();
+ expr.getUsedVariables(payloadVars);
+ LogicalVariable recordVar = payloadVars.get(0);
+ IVariableTypeEnvironment env = insertDeleteOperator.computeOutputTypeEnvironment(context);
+ IAType inputRecordType = (IAType) env.getVarType(recordVar);
- List<LogicalVariable> usedVariables = new ArrayList<LogicalVariable>();
- VariableUtilities.getUsedVariables(oldAssignOperator, usedVariables);
- LogicalVariable inputRecordVar;
- if (usedVariables.size() > 0) {
- inputRecordVar = usedVariables.get(0);
- } else {
- VariableUtilities.getLiveVariables(oldAssignOperator, usedVariables);
- inputRecordVar = usedVariables.get(0);
+ /** the input record type can be an union type -- for the case when it comes from a subplan or left-outer join */
+ boolean checkNull = false;
+ while (isOptional(inputRecordType)) {
+ /** while-loop for the case there is a nested multi-level union */
+ inputRecordType = ((AUnionType) inputRecordType).getUnionList().get(
+ NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ checkNull = true;
}
- IVariableTypeEnvironment env = oldAssignOperator.computeInputTypeEnvironment(context);
- IAType inputRecordType = (IAType) env.getVarType(inputRecordVar);
- boolean needCast = !requiredRecordType.equals(inputRecordType);
- if (!needCast)
+
+ /** see whether the input record type needs to be casted */
+ boolean cast = !compatible(requiredRecordType, inputRecordType);
+
+ if (checkNull) {
+ recordVar = addWrapperFunction(requiredRecordType, recordVar, insertDeleteOp, context,
+ AsterixBuiltinFunctions.NOT_NULL);
+ }
+ if (cast) {
+ addWrapperFunction(requiredRecordType, recordVar, insertDeleteOp, context,
+ AsterixBuiltinFunctions.CAST_RECORD);
+ }
+ return cast || checkNull;
+ }
+
+ /**
+ * Inject a function to wrap a variable when necessary
+ *
+ * @param requiredRecordType
+ * the required record type
+ * @param recordVar
+ * the record variable
+ * @param parent
+ * the current parent operator to be rewritten
+ * @param context
+ * the optimization context
+ * @param fd
+ * the function to be injected
+ * @return true if cast is injected; false otherwise.
+ * @throws AlgebricksException
+ */
+ public LogicalVariable addWrapperFunction(ARecordType requiredRecordType, LogicalVariable recordVar,
+ ILogicalOperator parent, IOptimizationContext context, FunctionIdentifier fd) throws AlgebricksException {
+ List<Mutable<ILogicalOperator>> opRefs = parent.getInputs();
+ for (int index = 0; index < opRefs.size(); index++) {
+ Mutable<ILogicalOperator> opRef = opRefs.get(index);
+ ILogicalOperator op = opRef.getValue();
+
+ /** get produced vars */
+ List<LogicalVariable> producedVars = new ArrayList<LogicalVariable>();
+ VariableUtilities.getProducedVariables(op, producedVars);
+ IVariableTypeEnvironment env = op.computeOutputTypeEnvironment(context);
+ for (int i = 0; i < producedVars.size(); i++) {
+ LogicalVariable var = producedVars.get(i);
+ if (var.equals(recordVar)) {
+ /** insert an assign operator to call the function on-top-of the variable */
+ IAType actualType = (IAType) env.getVarType(var);
+ AbstractFunctionCallExpression cast = new ScalarFunctionCallExpression(
+ FunctionUtils.getFunctionInfo(fd));
+ cast.getArguments()
+ .add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(var)));
+ /** enforce the required record type */
+ TypeComputerUtilities.setRequiredAndInputTypes(cast, requiredRecordType, actualType);
+ LogicalVariable newAssignVar = context.newVar();
+ AssignOperator newAssignOperator = new AssignOperator(newAssignVar,
+ new MutableObject<ILogicalExpression>(cast));
+ newAssignOperator.getInputs().add(new MutableObject<ILogicalOperator>(op));
+ opRef.setValue(newAssignOperator);
+ context.computeAndSetTypeEnvironmentForOperator(newAssignOperator);
+ newAssignOperator.computeOutputTypeEnvironment(context);
+ VariableUtilities.substituteVariables(parent, recordVar, newAssignVar, context);
+ return newAssignVar;
+ }
+ }
+ /** recursive descend to the operator who produced the recordVar */
+ LogicalVariable replacedVar = addWrapperFunction(requiredRecordType, recordVar, op, context, fd);
+ if (replacedVar != null) {
+ /** substitute the recordVar by the replacedVar for operators who uses recordVar */
+ VariableUtilities.substituteVariables(parent, recordVar, replacedVar, context);
+ return replacedVar;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Check whether the required record type and the input type is compatible
+ *
+ * @param reqType
+ * @param inputType
+ * @return true if compatible; false otherwise
+ * @throws AlgebricksException
+ */
+ private boolean compatible(ARecordType reqType, IAType inputType) throws AlgebricksException {
+ if (inputType.getTypeTag() == ATypeTag.ANY) {
return false;
+ }
+ if (inputType.getTypeTag() != ATypeTag.RECORD) {
+ throw new AlgebricksException("The input type " + inputType + " is not a valid record type!");
+ }
- // insert
- // project
- // assign
- // assign
- AbstractFunctionCallExpression cast = new ScalarFunctionCallExpression(
- FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.CAST_RECORD));
- cast.getArguments().add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(inputRecordVar)));
- TypeComputerUtilities.setRequiredAndInputTypes(cast, requiredRecordType, inputRecordType);
- LogicalVariable newAssignVar = context.newVar();
- AssignOperator newAssignOperator = new AssignOperator(newAssignVar, new MutableObject<ILogicalExpression>(cast));
- newAssignOperator.getInputs().add(new MutableObject<ILogicalOperator>(op3));
+ IAType[] reqTypes = reqType.getFieldTypes();
+ String[] reqFieldNames = reqType.getFieldNames();
+ IAType[] inputTypes = ((ARecordType) inputType).getFieldTypes();
+ String[] inputFieldNames = ((ARecordType) inputType).getFieldNames();
- List<LogicalVariable> projectVariables = new ArrayList<LogicalVariable>();
- VariableUtilities.getProducedVariables(oldAssignOperator, projectVariables);
- projectVariables.add(newAssignVar);
- ProjectOperator projectOperator = new ProjectOperator(projectVariables);
- projectOperator.getInputs().add(new MutableObject<ILogicalOperator>(newAssignOperator));
-
- ILogicalExpression payloadExpr = new VariableReferenceExpression(newAssignVar);
- MutableObject<ILogicalExpression> payloadRef = new MutableObject<ILogicalExpression>(payloadExpr);
- InsertDeleteOperator newInserDeleteOperator = new InsertDeleteOperator(insertDeleteOperator.getDataSource(),
- payloadRef, insertDeleteOperator.getPrimaryKeyExpressions(), insertDeleteOperator.getOperation());
- newInserDeleteOperator.getInputs().add(new MutableObject<ILogicalOperator>(projectOperator));
- insertDeleteOperator.getInputs().clear();
- op1.getInputs().get(0).setValue(newInserDeleteOperator);
-
- context.computeAndSetTypeEnvironmentForOperator(newAssignOperator);
- context.computeAndSetTypeEnvironmentForOperator(projectOperator);
- context.computeAndSetTypeEnvironmentForOperator(newInserDeleteOperator);
+ if (reqTypes.length != inputTypes.length) {
+ return false;
+ }
+ for (int i = 0; i < reqTypes.length; i++) {
+ if (!reqFieldNames[i].equals(inputFieldNames[i])) {
+ return false;
+ }
+ IAType reqTypeInside = reqTypes[i];
+ if (isOptional(reqTypes[i])) {
+ reqTypeInside = ((AUnionType) reqTypes[i]).getUnionList().get(
+ NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ }
+ IAType inputTypeInside = inputTypes[i];
+ if (isOptional(inputTypes[i])) {
+ if (!isOptional(reqTypes[i])) {
+ /** if the required type is not optional, the two types are incompatible */
+ return false;
+ }
+ inputTypeInside = ((AUnionType) inputTypes[i]).getUnionList().get(
+ NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ }
+ if (inputTypeInside.getTypeTag() != ATypeTag.NULL && !reqTypeInside.equals(inputTypeInside)) {
+ return false;
+ }
+ }
return true;
}
+ /**
+ * Decide whether a type is an optional type
+ *
+ * @param type
+ * @return true if it is optional; false otherwise
+ */
+ private boolean isOptional(IAType type) {
+ return type.getTypeTag() == ATypeTag.UNION && NonTaggedFormatUtil.isOptionalField((AUnionType) type);
+ }
}
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/ReplaceSinkOpWithCommitOpRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/ReplaceSinkOpWithCommitOpRule.java
index 30ed8e7..f277d4b 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/ReplaceSinkOpWithCommitOpRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/ReplaceSinkOpWithCommitOpRule.java
@@ -7,9 +7,9 @@
import edu.uci.ics.asterix.algebra.operators.CommitOperator;
import edu.uci.ics.asterix.algebra.operators.physical.CommitPOperator;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.metadata.declared.AqlDataSource;
import edu.uci.ics.asterix.metadata.declared.AqlMetadataProvider;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
index 6e3ab37..282d26b 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
@@ -188,9 +188,12 @@
// if already rewritten, the required type is not null
if (TypeComputerUtilities.getRequiredType(funcExpr) != null)
return false;
- TypeComputerUtilities.setRequiredAndInputTypes(funcExpr, requiredRecordType, inputRecordType);
- staticRecordTypeCast(funcExpr, requiredRecordType, inputRecordType, env);
- return true;
+ boolean casted = staticRecordTypeCast(funcExpr, requiredRecordType, inputRecordType, env);
+ if (casted) {
+ //enforce the required type if it is statically casted
+ TypeComputerUtilities.setRequiredAndInputTypes(funcExpr, requiredRecordType, inputRecordType);
+ }
+ return casted;
}
/**
@@ -245,7 +248,7 @@
* The type environment.
* @throws AlgebricksException
*/
- private static void staticRecordTypeCast(AbstractFunctionCallExpression func, ARecordType reqType,
+ private static boolean staticRecordTypeCast(AbstractFunctionCallExpression func, ARecordType reqType,
ARecordType inputType, IVariableTypeEnvironment env) throws AlgebricksException {
IAType[] reqFieldTypes = reqType.getFieldTypes();
String[] reqFieldNames = reqType.getFieldNames();
@@ -341,8 +344,10 @@
}
}
// the input has extra fields
- if (!matched && !reqType.isOpen())
- throw new AlgebricksException("static type mismatch: including an extra closed field " + fieldName);
+ if (!matched && !reqType.isOpen()) {
+ throw new AlgebricksException("static type mismatch: the input record includes an extra closed field "
+ + fieldName + ":" + fieldType + "! Please check the field name and type.");
+ }
}
// backward match: match from required to actual
@@ -385,7 +390,14 @@
nullFields[i] = true;
} else {
// no matched field in the input for a required closed field
- throw new AlgebricksException("static type mismatch: miss a required closed field " + reqFieldName);
+ if (inputType.isOpen()) {
+ //if the input type is open, return false, give that to dynamic type cast to defer the error to the runtime
+ return false;
+ } else {
+ throw new AlgebricksException(
+ "static type mismatch: the input record misses a required closed field " + reqFieldName
+ + ":" + reqFieldType + "! Please check the field name and type.");
+ }
}
}
@@ -472,6 +484,7 @@
arguments.add(expRef);
}
}
+ return true;
}
/**
@@ -505,7 +518,7 @@
* the input type
* @return true if the two types are compatiable; false otherwise
*/
- private static boolean compatible(IAType reqType, IAType inputType) {
+ public static boolean compatible(IAType reqType, IAType inputType) {
if (reqType.getTypeTag() == ATypeTag.ANY || inputType.getTypeTag() == ATypeTag.ANY) {
return true;
}
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AbstractAqlTranslator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AbstractAqlTranslator.java
index 9fe5750..792ff25 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AbstractAqlTranslator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AbstractAqlTranslator.java
@@ -30,6 +30,7 @@
import edu.uci.ics.asterix.metadata.entities.AsterixBuiltinTypeMap;
import edu.uci.ics.asterix.metadata.entities.Dataverse;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.util.AsterixClusterProperties;
import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
/**
@@ -41,6 +42,12 @@
protected static final Map<String, BuiltinType> builtinTypeMap = AsterixBuiltinTypeMap.getBuiltinTypes();
public void validateOperation(Dataverse defaultDataverse, Statement stmt) throws AsterixException {
+
+ if (AsterixClusterProperties.INSTANCE.getState().equals(AsterixClusterProperties.State.UNUSABLE)) {
+ throw new AsterixException(" Asterix Cluster is in " + AsterixClusterProperties.State.UNUSABLE + " state."
+ + "\n One or more Node Controllers have left.\n");
+ }
+
boolean invalidOperation = false;
String message = null;
String dataverse = defaultDataverse != null ? defaultDataverse.getDataverseName() : null;
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
index e07c1d0..a2545ff 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
@@ -71,7 +71,6 @@
import edu.uci.ics.asterix.aql.expression.WriteStatement;
import edu.uci.ics.asterix.aql.expression.visitor.IAqlExpressionVisitor;
import edu.uci.ics.asterix.aql.util.FunctionUtils;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
@@ -92,10 +91,10 @@
import edu.uci.ics.asterix.om.base.AString;
import edu.uci.ics.asterix.om.constants.AsterixConstantValue;
import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
-import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions.FunctionNamespace;
import edu.uci.ics.asterix.om.functions.AsterixFunctionInfo;
import edu.uci.ics.asterix.om.types.BuiltinType;
import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.AsterixAppContextInfo;
import edu.uci.ics.asterix.runtime.formats.FormatUtils;
import edu.uci.ics.asterix.translator.CompiledStatements.ICompiledDmlStatement;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -507,14 +506,10 @@
if (builtinAquafi != null) {
fi = builtinAquafi;
} else {
- fi = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(), functionName, arity);
+ fi = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, functionName, arity);
afi = AsterixBuiltinFunctions.lookupFunction(fi);
if (afi == null) {
- fi = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(), functionName, arity);
- afi = AsterixBuiltinFunctions.lookupFunction(fi);
- if (afi == null) {
- return null;
- }
+ return null;
}
}
if (AsterixBuiltinFunctions.isBuiltinAggregateFunction(fi)) {
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlPlusExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlPlusExpressionToPlanTranslator.java
index 92add99..0f636a9 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlPlusExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlPlusExpressionToPlanTranslator.java
@@ -79,6 +79,7 @@
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.common.functions.FunctionSignature;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.formats.base.IDataFormat;
import edu.uci.ics.asterix.metadata.declared.AqlMetadataProvider;
import edu.uci.ics.asterix.metadata.declared.FileSplitDataSink;
@@ -89,12 +90,10 @@
import edu.uci.ics.asterix.om.base.AString;
import edu.uci.ics.asterix.om.constants.AsterixConstantValue;
import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
-import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions.FunctionNamespace;
import edu.uci.ics.asterix.om.functions.AsterixFunctionInfo;
import edu.uci.ics.asterix.om.types.ARecordType;
import edu.uci.ics.asterix.om.types.BuiltinType;
import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.asterix.translator.CompiledStatements.ICompiledDmlStatement;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
@@ -465,14 +464,10 @@
if (builtinAquafi != null) {
fi = builtinAquafi;
} else {
- fi = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(), signature.getName());
+ fi = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, signature.getName());
FunctionIdentifier builtinAsterixFi = AsterixBuiltinFunctions.getBuiltinFunctionIdentifier(fi);
if (builtinAsterixFi != null) {
fi = builtinAsterixFi;
- } else {
- fi = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(), signature.getName());
- builtinAsterixFi = AsterixBuiltinFunctions.getBuiltinFunctionIdentifier(fi);
- fi = builtinAsterixFi;
}
}
AbstractFunctionCallExpression f;
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/CompiledStatements.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/CompiledStatements.java
index a91f2eb..49e2ed6 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/CompiledStatements.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/CompiledStatements.java
@@ -35,6 +35,7 @@
import edu.uci.ics.asterix.aql.expression.WhereClause;
import edu.uci.ics.asterix.aql.literal.StringLiteral;
import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
+import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.common.functions.FunctionSignature;
import edu.uci.ics.asterix.metadata.declared.AqlMetadataProvider;
import edu.uci.ics.asterix.metadata.entities.Dataset;
@@ -496,7 +497,7 @@
arguments.add(argumentLiteral);
CallExpr callExpression = new CallExpr(new FunctionSignature(
- AsterixBuiltinFunctions.FunctionNamespace.ASTERIX_PUBLIC.name(), "dataset", 1), arguments);
+ FunctionConstants.ASTERIX_NS, "dataset", 1), arguments);
List<Clause> clauseList = new ArrayList<Clause>();
Clause forClause = new ForClause(var, callExpression);
clauseList.add(forClause);
diff --git a/asterix-app/data/tinysocial/fbm.adm b/asterix-app/data/tinysocial/fbm.adm
new file mode 100644
index 0000000..58d7f08
--- /dev/null
+++ b/asterix-app/data/tinysocial/fbm.adm
@@ -0,0 +1,15 @@
+{"message-id":1,"author-id":3,"in-response-to":2,"sender-location":point("47.16,77.75"),"message":" love sprint its shortcut-menu is awesome:)"}
+{"message-id":2,"author-id":1,"in-response-to":4,"sender-location":point("41.66,80.87"),"message":" dislike iphone its touch-screen is horrible"}
+{"message-id":3,"author-id":2,"in-response-to":4,"sender-location":point("48.09,81.01"),"message":" like samsung the plan is amazing"}
+{"message-id":4,"author-id":1,"in-response-to":2,"sender-location":point("37.73,97.04"),"message":" can't stand at&t the network is horrible:("}
+{"message-id":5,"author-id":6,"in-response-to":2,"sender-location":point("34.7,90.76"),"message":" love sprint the customization is mind-blowing"}
+{"message-id":6,"author-id":2,"in-response-to":1,"sender-location":point("31.5,75.56"),"message":" like t-mobile its platform is mind-blowing"}
+{"message-id":7,"author-id":5,"in-response-to":15,"sender-location":point("32.91,85.05"),"message":" dislike sprint the speed is horrible"}
+{"message-id":8,"author-id":1,"in-response-to":11,"sender-location":point("40.33,80.87"),"message":" like verizon the 3G is awesome:)"}
+{"message-id":9,"author-id":3,"in-response-to":12,"sender-location":point("34.45,96.48"),"message":" love verizon its wireless is good"}
+{"message-id":10,"author-id":1,"in-response-to":12,"sender-location":point("42.5,70.01"),"message":" can't stand motorola the touch-screen is terrible"}
+{"message-id":11,"author-id":1,"in-response-to":1,"sender-location":point("38.97,77.49"),"message":" can't stand at&t its plan is terrible"}
+{"message-id":12,"author-id":10,"in-response-to":6,"sender-location":point("42.26,77.76"),"message":" can't stand t-mobile its voicemail-service is OMG:("}
+{"message-id":13,"author-id":10,"in-response-to":4,"sender-location":point("42.77,78.92"),"message":" dislike iphone the voice-command is bad:("}
+{"message-id":14,"author-id":9,"in-response-to":12,"sender-location":point("41.33,85.28"),"message":" love at&t its 3G is good:)"}
+{"message-id":15,"author-id":7,"in-response-to":11,"sender-location":point("44.47,67.11"),"message":" like iphone the voicemail-service is awesome"}
diff --git a/asterix-app/data/tinysocial/fbu.adm b/asterix-app/data/tinysocial/fbu.adm
new file mode 100644
index 0000000..7e99ea4
--- /dev/null
+++ b/asterix-app/data/tinysocial/fbu.adm
@@ -0,0 +1,10 @@
+{"id":1,"alias":"Margarita","name":"MargaritaStoddard","user-since":datetime("2012-08-20T10:10:00"),"friend-ids":{{2,3,6,10}},"employment":[{"organization-name":"Codetechno","start-date":date("2006-08-06")}]}
+{"id":2,"alias":"Isbel","name":"IsbelDull","user-since":datetime("2011-01-22T10:10:00"),"friend-ids":{{1,4}},"employment":[{"organization-name":"Hexviafind","start-date":date("2010-04-27")}]}
+{"id":3,"alias":"Emory","name":"EmoryUnk","user-since":datetime("2012-07-10T10:10:00"),"friend-ids":{{1,5,8,9}},"employment":[{"organization-name":"geomedia","start-date":date("2010-06-17"),"end-date":date("2010-01-26")}]}
+{"id":4,"alias":"Nicholas","name":"NicholasStroh","user-since":datetime("2010-12-27T10:10:00"),"friend-ids":{{2}},"employment":[{"organization-name":"Zamcorporation","start-date":date("2010-06-08")}]}
+{"id":5,"alias":"Von","name":"VonKemble","user-since":datetime("2010-01-05T10:10:00"),"friend-ids":{{3,6,10}},"employment":[{"organization-name":"Kongreen","start-date":date("2010-11-27")}]}
+{"id":6,"alias":"Willis","name":"WillisWynne","user-since":datetime("2005-01-17T10:10:00"),"friend-ids":{{1,3,7}},"employment":[{"organization-name":"jaydax","start-date":date("2009-05-15")}]}
+{"id":7,"alias":"Suzanna","name":"SuzannaTillson","user-since":datetime("2012-08-07T10:10:00"),"friend-ids":{{6}},"employment":[{"organization-name":"Labzatron","start-date":date("2011-04-19")}]}
+{"id":8,"alias":"Nila","name":"NilaMilliron","user-since":datetime("2008-01-01T10:10:00"),"friend-ids":{{3}},"employment":[{"organization-name":"Plexlane","start-date":date("2010-02-28")}]}
+{"id":9,"alias":"Woodrow","name":"WoodrowNehling","user-since":datetime("2005-09-20T10:10:00"),"friend-ids":{{3,10}},"employment":[{"organization-name":"Zuncan","start-date":date("2003-04-22"),"end-date":date("2009-12-13")}]}
+{"id":10,"alias":"Bram","name":"BramHatch","user-since":datetime("2010-10-16T10:10:00"),"friend-ids":{{1,5,9}},"employment":[{"organization-name":"physcane","start-date":date("2007-06-05"),"end-date":date("2011-11-05")}]}
diff --git a/asterix-app/data/tinysocial/twm.adm b/asterix-app/data/tinysocial/twm.adm
new file mode 100644
index 0000000..fa764af
--- /dev/null
+++ b/asterix-app/data/tinysocial/twm.adm
@@ -0,0 +1,12 @@
+{"tweetid":"1","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("47.44,80.65"),"send-time":datetime("2008-04-26T10:10:00"),"referred-topics":{{"t-mobile","customization"}},"message-text":" love t-mobile its customization is good:)"}
+{"tweetid":"2","user":{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159},"sender-location":point("32.84,67.14"),"send-time":datetime("2010-05-13T10:10:00"),"referred-topics":{{"verizon","shortcut-menu"}},"message-text":" like verizon its shortcut-menu is awesome:)"}
+{"tweetid":"3","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("29.72,75.8"),"send-time":datetime("2006-11-04T10:10:00"),"referred-topics":{{"motorola","speed"}},"message-text":" like motorola the speed is good:)"}
+{"tweetid":"4","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("39.28,70.48"),"send-time":datetime("2011-12-26T10:10:00"),"referred-topics":{{"sprint","voice-command"}},"message-text":" like sprint the voice-command is mind-blowing:)"}
+{"tweetid":"5","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("40.09,92.69"),"send-time":datetime("2006-08-04T10:10:00"),"referred-topics":{{"motorola","speed"}},"message-text":" can't stand motorola its speed is terrible:("}
+{"tweetid":"6","user":{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159},"sender-location":point("47.51,83.99"),"send-time":datetime("2010-05-07T10:10:00"),"referred-topics":{{"iphone","voice-clarity"}},"message-text":" like iphone the voice-clarity is good:)"}
+{"tweetid":"7","user":{"screen-name":"ChangEwing_573","lang":"en","friends_count":182,"statuses_count":394,"name":"Chang Ewing","followers_count":32136},"sender-location":point("36.21,72.6"),"send-time":datetime("2011-08-25T10:10:00"),"referred-topics":{{"samsung","platform"}},"message-text":" like samsung the platform is good"}
+{"tweetid":"8","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("46.05,93.34"),"send-time":datetime("2005-10-14T10:10:00"),"referred-topics":{{"t-mobile","shortcut-menu"}},"message-text":" like t-mobile the shortcut-menu is awesome:)"}
+{"tweetid":"9","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("36.86,74.62"),"send-time":datetime("2012-07-21T10:10:00"),"referred-topics":{{"verizon","voicemail-service"}},"message-text":" love verizon its voicemail-service is awesome"}
+{"tweetid":"10","user":{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159},"sender-location":point("29.15,76.53"),"send-time":datetime("2008-01-26T10:10:00"),"referred-topics":{{"verizon","voice-clarity"}},"message-text":" hate verizon its voice-clarity is OMG:("}
+{"tweetid":"11","user":{"screen-name":"NilaMilliron_tw","lang":"en","friends_count":445,"statuses_count":164,"name":"Nila Milliron","followers_count":22649},"sender-location":point("37.59,68.42"),"send-time":datetime("2008-03-09T10:10:00"),"referred-topics":{{"iphone","platform"}},"message-text":" can't stand iphone its platform is terrible"}
+{"tweetid":"12","user":{"screen-name":"OliJackson_512","lang":"en","friends_count":445,"statuses_count":164,"name":"Oli Jackson","followers_count":22649},"sender-location":point("24.82,94.63"),"send-time":datetime("2010-02-13T10:10:00"),"referred-topics":{{"samsung","voice-command"}},"message-text":" like samsung the voice-command is amazing:)"}
diff --git a/asterix-app/data/tinysocial/twu.adm b/asterix-app/data/tinysocial/twu.adm
new file mode 100644
index 0000000..32a1917
--- /dev/null
+++ b/asterix-app/data/tinysocial/twu.adm
@@ -0,0 +1,4 @@
+{"screen-name":"NathanGiesen@211","lang":"en","friends_count":18,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416}
+{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159}
+{"screen-name":"NilaMilliron_tw","lang":"en","friends_count":445,"statuses_count":164,"name":"Nila Milliron","followers_count":22649}
+{"screen-name":"ChangEwing_573","lang":"en","friends_count":182,"statuses_count":394,"name":"Chang Ewing","followers_count":32136}
diff --git a/asterix-app/pom.xml b/asterix-app/pom.xml
index 15af3bc..de5558d 100644
--- a/asterix-app/pom.xml
+++ b/asterix-app/pom.xml
@@ -100,9 +100,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.5</version>
<type>jar</type>
- <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@@ -182,6 +180,12 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>edu.uci.ics.asterix</groupId>
+ <artifactId>asterix-transactions</artifactId>
+ <version>0.0.6-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
@@ -210,11 +214,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>net.sourceforge.cobertura</groupId>
- <artifactId>cobertura</artifactId>
- <version>1.9.4</version>
- </dependency>
- <dependency>
<groupId>edu.uci.ics.asterix</groupId>
<artifactId>asterix-test-framework</artifactId>
<version>0.0.6-SNAPSHOT</version>
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
index e1114eb..a9d20d0 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
@@ -26,9 +26,9 @@
import edu.uci.ics.asterix.aql.expression.Query;
import edu.uci.ics.asterix.aql.expression.visitor.AQLPrintVisitor;
import edu.uci.ics.asterix.aql.rewrites.AqlRewriter;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
import edu.uci.ics.asterix.common.config.AsterixCompilerProperties;
import edu.uci.ics.asterix.common.config.OptimizationConfUtil;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.dataflow.data.common.AqlExpressionTypeComputer;
import edu.uci.ics.asterix.dataflow.data.common.AqlMergeAggregationExpressionFactory;
@@ -40,9 +40,9 @@
import edu.uci.ics.asterix.metadata.MetadataTransactionContext;
import edu.uci.ics.asterix.metadata.declared.AqlMetadataProvider;
import edu.uci.ics.asterix.metadata.entities.Dataverse;
+import edu.uci.ics.asterix.om.util.AsterixAppContextInfo;
import edu.uci.ics.asterix.optimizer.base.RuleCollections;
import edu.uci.ics.asterix.runtime.job.listener.JobEventListenerFactory;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
import edu.uci.ics.asterix.transaction.management.service.transaction.JobIdFactory;
import edu.uci.ics.asterix.translator.AqlExpressionToPlanTranslator;
import edu.uci.ics.asterix.translator.CompiledStatements.ICompiledDmlStatement;
@@ -220,7 +220,7 @@
}
- edu.uci.ics.asterix.transaction.management.service.transaction.JobId asterixJobId = JobIdFactory
+ edu.uci.ics.asterix.common.transactions.JobId asterixJobId = JobIdFactory
.generateJobId();
queryMetadataProvider.setJobId(asterixJobId);
AqlExpressionToPlanTranslator t = new AqlExpressionToPlanTranslator(queryMetadataProvider, varCounter,
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContext.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixAppRuntimeContext.java
similarity index 87%
rename from asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContext.java
rename to asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixAppRuntimeContext.java
index 8fe3341..e64f68f 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContext.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixAppRuntimeContext.java
@@ -1,8 +1,9 @@
-package edu.uci.ics.asterix.common.context;
+package edu.uci.ics.asterix.api.common;
import java.io.IOException;
import java.util.logging.Logger;
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
import edu.uci.ics.asterix.common.config.AsterixCompilerProperties;
import edu.uci.ics.asterix.common.config.AsterixExternalProperties;
import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
@@ -10,15 +11,18 @@
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.AsterixTransactionProperties;
import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
+import edu.uci.ics.asterix.common.context.AsterixFileMapManager;
+import edu.uci.ics.asterix.common.context.ConstantMergePolicy;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.transactions.IAsterixAppRuntimeContextProvider;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
import edu.uci.ics.asterix.transaction.management.ioopcallbacks.LSMBTreeIOOperationCallbackFactory;
import edu.uci.ics.asterix.transaction.management.ioopcallbacks.LSMInvertedIndexIOOperationCallbackFactory;
import edu.uci.ics.asterix.transaction.management.ioopcallbacks.LSMRTreeIOOperationCallbackFactory;
import edu.uci.ics.asterix.transaction.management.opcallbacks.IndexOperationTrackerFactory;
import edu.uci.ics.asterix.transaction.management.resource.PersistentLocalResourceRepository;
import edu.uci.ics.asterix.transaction.management.resource.PersistentLocalResourceRepositoryFactory;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IAsterixAppRuntimeContextProvider;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
import edu.uci.ics.hyracks.api.application.INCApplicationContext;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
@@ -26,7 +30,6 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndex;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
import edu.uci.ics.hyracks.storage.am.common.dataflow.IndexLifecycleManager;
-import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMMergePolicy;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory;
@@ -46,7 +49,12 @@
import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactoryProvider;
-public class AsterixAppRuntimeContext implements IAsterixPropertiesProvider {
+public class AsterixAppRuntimeContext implements IAsterixAppRuntimeContext, IAsterixPropertiesProvider {
+ private static final int DEFAULT_BUFFER_CACHE_PAGE_SIZE = 32768;
+ private static final int DEFAULT_LIFECYCLEMANAGER_MEMORY_BUDGET = 1024 * 1024 * 1024; // 1GB
+ private static final int DEFAULT_MAX_OPEN_FILES = Integer.MAX_VALUE;
+ private static final int METADATA_IO_DEVICE_ID = 0;
+
private final INCApplicationContext ncApplicationContext;
private AsterixCompilerProperties compilerProperties;
@@ -58,14 +66,14 @@
private IIndexLifecycleManager indexLifecycleManager;
private IFileMapManager fileMapManager;
private IBufferCache bufferCache;
- private TransactionSubsystem txnSubsystem;
+ private ITransactionSubsystem txnSubsystem;
private ILSMMergePolicy mergePolicy;
private ILSMOperationTrackerFactory lsmBTreeOpTrackerFactory;
private ILSMOperationTrackerFactory lsmRTreeOpTrackerFactory;
private ILSMOperationTrackerFactory lsmInvertedIndexOpTrackerFactory;
private ILSMIOOperationScheduler lsmIOScheduler;
- private PersistentLocalResourceRepository localResourceRepository;
+ private ILocalResourceRepository localResourceRepository;
private ResourceIdFactory resourceIdFactory;
private IIOManager ioManager;
private boolean isShuttingdown;
@@ -137,7 +145,7 @@
return fileMapManager;
}
- public TransactionSubsystem getTransactionSubsystem() {
+ public ITransactionSubsystem getTransactionSubsystem() {
return txnSubsystem;
}
@@ -165,22 +173,6 @@
return lsmInvertedIndexOpTrackerFactory;
}
- public ILSMIOOperationCallbackProvider getLSMBTreeIOOperationCallbackProvider() {
- return AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER;
- }
-
- public ILSMIOOperationCallbackProvider getLSMRTreeIOOperationCallbackProvider() {
- return AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER;
- }
-
- public ILSMIOOperationCallbackProvider getLSMInvertedIndexIOOperationCallbackProvider() {
- return AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER;
- }
-
- public ILSMIOOperationCallbackProvider getNoOpIOOperationCallbackProvider() {
- return AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER;
- }
-
public ILSMIOOperationScheduler getLSMIOScheduler() {
return lsmIOScheduler;
}
@@ -197,6 +189,10 @@
return ioManager;
}
+ public int getMetaDataIODeviceId() {
+ return METADATA_IO_DEVICE_ID;
+ }
+
@Override
public AsterixStorageProperties getStorageProperties() {
return storageProperties;
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContextProviderForRecovery.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixAppRuntimeContextProviderForRecovery.java
similarity index 83%
rename from asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContextProviderForRecovery.java
rename to asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixAppRuntimeContextProviderForRecovery.java
index 10660cc..8c73a63 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContextProviderForRecovery.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixAppRuntimeContextProviderForRecovery.java
@@ -1,7 +1,7 @@
-package edu.uci.ics.asterix.common.context;
+package edu.uci.ics.asterix.api.common;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IAsterixAppRuntimeContextProvider;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.IAsterixAppRuntimeContextProvider;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
import edu.uci.ics.hyracks.api.io.IIOManager;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackProvider;
@@ -32,7 +32,7 @@
}
@Override
- public TransactionSubsystem getTransactionSubsystem() {
+ public ITransactionSubsystem getTransactionSubsystem() {
return asterixAppRuntimeContext.getTransactionSubsystem();
}
@@ -88,21 +88,26 @@
@Override
public ILSMIOOperationCallbackProvider getLSMBTreeIOOperationCallbackProvider() {
- return asterixAppRuntimeContext.getLSMBTreeIOOperationCallbackProvider();
+ // TODO Auto-generated method stub
+ return null;
}
@Override
public ILSMIOOperationCallbackProvider getLSMRTreeIOOperationCallbackProvider() {
- return asterixAppRuntimeContext.getLSMRTreeIOOperationCallbackProvider();
+ // TODO Auto-generated method stub
+ return null;
}
@Override
public ILSMIOOperationCallbackProvider getLSMInvertedIndexIOOperationCallbackProvider() {
- return asterixAppRuntimeContext.getLSMInvertedIndexIOOperationCallbackProvider();
+ // TODO Auto-generated method stub
+ return null;
}
@Override
public ILSMIOOperationCallbackProvider getNoOpIOOperationCallbackProvider() {
- return asterixAppRuntimeContext.getNoOpIOOperationCallbackProvider();
+ // TODO Auto-generated method stub
+ return null;
}
+
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
index 272050f..fb87a8e1 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -1,5 +1,6 @@
package edu.uci.ics.asterix.api.common;
+import java.io.File;
import java.util.EnumSet;
import edu.uci.ics.asterix.common.config.GlobalConfig;
@@ -50,6 +51,8 @@
ncConfig1.datasetIPAddress = "127.0.0.1";
ncConfig1.resultHistorySize = 1000;
ncConfig1.nodeId = NC1_ID;
+ ncConfig1.ioDevices = System.getProperty("java.io.tmpdir") + File.separator + "nc1/iodevice0" + ","
+ + System.getProperty("java.io.tmpdir") + File.separator + "nc1/iodevice1";
ncConfig1.appNCMainClass = NCApplicationEntryPoint.class.getName();
nc1 = new NodeControllerService(ncConfig1);
nc1.start();
@@ -62,6 +65,8 @@
ncConfig2.datasetIPAddress = "127.0.0.1";
ncConfig2.resultHistorySize = 1000;
ncConfig2.nodeId = NC2_ID;
+ ncConfig2.ioDevices = System.getProperty("java.io.tmpdir") + File.separator + "nc2/iodevice0" + ","
+ + System.getProperty("java.io.tmpdir") + File.separator + "nc2/iodevice1";
ncConfig2.appNCMainClass = NCApplicationEntryPoint.class.getName();
nc2 = new NodeControllerService(ncConfig2);
nc2.start();
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
index 12fa51a..d378429 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
@@ -23,6 +23,7 @@
import edu.uci.ics.asterix.common.config.GlobalConfig;
import edu.uci.ics.asterix.metadata.MetadataManager;
import edu.uci.ics.asterix.result.ResultReader;
+import edu.uci.ics.asterix.result.ResultUtils;
import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
import edu.uci.ics.hyracks.api.dataset.IHyracksDataset;
import edu.uci.ics.hyracks.client.dataset.HyracksDataset;
@@ -80,6 +81,7 @@
duration = (endTime - startTime) / 1000.00;
out.println("<PRE>Duration of all jobs: " + duration + "</PRE>");
} catch (ParseException | TokenMgrError | edu.uci.ics.asterix.aqlplus.parser.TokenMgrError pe) {
+ GlobalConfig.ASTERIX_LOGGER.log(Level.INFO, pe.toString(), pe);
out.println("<pre class=\"error\">");
String message = pe.getMessage();
message = message.replace("<", "<");
@@ -99,9 +101,10 @@
}
out.println("</pre>");
} catch (Exception e) {
- GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, e.getMessage(), e);
+ String errorMessage = ResultUtils.extractErrorMessage(e);
+ GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, errorMessage, e);
out.println("<pre class=\"error\">");
- out.println(e.getMessage());
+ out.println(errorMessage);
out.println("</pre>");
}
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
index 2c15578..dff759d 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
@@ -97,9 +97,9 @@
aqlTranslator.compileAndExecute(hcc, hds, asyncResults);
} catch (ParseException pe) {
- GlobalConfig.ASTERIX_LOGGER.log(Level.INFO, pe.getMessage(), pe);
+ GlobalConfig.ASTERIX_LOGGER.log(Level.INFO, pe.toString(), pe);
StringBuilder errorMessage = new StringBuilder();
- String message = pe.getMessage();
+ String message = pe.getLocalizedMessage();
message = message.replace("<", "<");
message = message.replace(">", ">");
errorMessage.append("SyntaxError:" + message + "\n");
@@ -113,10 +113,9 @@
JSONObject errorResp = ResultUtils.getErrorResponse(2, errorMessage.toString());
out.write(errorResp.toString());
} catch (Exception e) {
- GlobalConfig.ASTERIX_LOGGER.log(Level.INFO, e.getMessage(), e);
- StringBuilder errorMessage = new StringBuilder();
- errorMessage.append(e.getMessage());
- JSONObject errorResp = ResultUtils.getErrorResponse(99, errorMessage.toString());
+ String errorMessage = ResultUtils.extractErrorMessage(e);
+ GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, errorMessage, e);
+ JSONObject errorResp = ResultUtils.getErrorResponse(99, errorMessage);
out.write(errorResp.toString());
}
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/java/AsterixJavaClient.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/java/AsterixJavaClient.java
index cb786d7..0fbe9fa 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/java/AsterixJavaClient.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/java/AsterixJavaClient.java
@@ -9,6 +9,11 @@
import edu.uci.ics.asterix.api.common.Job;
import edu.uci.ics.asterix.api.common.SessionConfig;
import edu.uci.ics.asterix.aql.base.Statement;
+import edu.uci.ics.asterix.aql.translator.AqlTranslator;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.metadata.MetadataManager;
+import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
+import edu.uci.ics.hyracks.api.job.JobSpecification;
import edu.uci.ics.asterix.aql.parser.AQLParser;
import edu.uci.ics.asterix.aql.parser.ParseException;
import edu.uci.ics.asterix.aql.translator.AqlTranslator;
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
index d4e5e22..911f6fd 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
@@ -62,6 +62,7 @@
import edu.uci.ics.asterix.aql.util.FunctionUtils;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.common.functions.FunctionSignature;
import edu.uci.ics.asterix.file.DatasetOperations;
@@ -90,7 +91,6 @@
import edu.uci.ics.asterix.om.types.TypeSignature;
import edu.uci.ics.asterix.result.ResultReader;
import edu.uci.ics.asterix.result.ResultUtils;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetIdFactory;
import edu.uci.ics.asterix.translator.AbstractAqlTranslator;
import edu.uci.ics.asterix.translator.CompiledStatements.CompiledBeginFeedStatement;
@@ -384,11 +384,7 @@
Dataset dataset = null;
try {
DatasetDecl dd = (DatasetDecl) stmt;
- dataverseName = dd.getDataverse() != null ? dd.getDataverse().getValue()
- : activeDefaultDataverse != null ? activeDefaultDataverse.getDataverseName() : null;
- if (dataverseName == null) {
- throw new AlgebricksException(" dataverse not specified ");
- }
+ dataverseName = getActiveDataverseName(dd.getDataverse());
datasetName = dd.getName().getValue();
DatasetType dsType = dd.getDatasetType();
@@ -553,11 +549,7 @@
JobSpecification spec = null;
try {
CreateIndexStatement stmtCreateIndex = (CreateIndexStatement) stmt;
- dataverseName = stmtCreateIndex.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : stmtCreateIndex.getDataverseName().getValue();
- if (dataverseName == null) {
- throw new AlgebricksException(" dataverse not specified ");
- }
+ dataverseName = getActiveDataverseName(stmtCreateIndex.getDataverseName());
datasetName = stmtCreateIndex.getDatasetName().getValue();
Dataset ds = MetadataManager.INSTANCE.getDataset(metadataProvider.getMetadataTxnContext(), dataverseName,
@@ -686,15 +678,11 @@
try {
TypeDecl stmtCreateType = (TypeDecl) stmt;
- String dataverseName = stmtCreateType.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : stmtCreateType.getDataverseName().getValue();
- if (dataverseName == null) {
- throw new AlgebricksException(" dataverse not specified ");
- }
+ String dataverseName = getActiveDataverseName(stmtCreateType.getDataverseName());
String typeName = stmtCreateType.getIdent().getValue();
Dataverse dv = MetadataManager.INSTANCE.getDataverse(mdTxnCtx, dataverseName);
if (dv == null) {
- throw new AlgebricksException("Unknonw dataverse " + dataverseName);
+ throw new AlgebricksException("Unknown dataverse " + dataverseName);
}
Datatype dt = MetadataManager.INSTANCE.getDatatype(mdTxnCtx, dataverseName, typeName);
if (dt != null) {
@@ -849,11 +837,7 @@
List<JobSpecification> jobsToExecute = new ArrayList<JobSpecification>();
try {
DropStatement stmtDelete = (DropStatement) stmt;
- dataverseName = stmtDelete.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : stmtDelete.getDataverseName().getValue();
- if (dataverseName == null) {
- throw new AlgebricksException(" dataverse not specified ");
- }
+ dataverseName = getActiveDataverseName(stmtDelete.getDataverseName());
datasetName = stmtDelete.getDatasetName().getValue();
Dataset ds = MetadataManager.INSTANCE.getDataset(mdTxnCtx, dataverseName, datasetName);
@@ -960,11 +944,7 @@
try {
IndexDropStatement stmtIndexDrop = (IndexDropStatement) stmt;
datasetName = stmtIndexDrop.getDatasetName().getValue();
- dataverseName = stmtIndexDrop.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : stmtIndexDrop.getDataverseName().getValue();
- if (dataverseName == null) {
- throw new AlgebricksException(" dataverse not specified ");
- }
+ dataverseName = getActiveDataverseName(stmtIndexDrop.getDataverseName());
Dataset ds = MetadataManager.INSTANCE.getDataset(mdTxnCtx, dataverseName, datasetName);
if (ds == null) {
@@ -1062,11 +1042,7 @@
try {
TypeDropStatement stmtTypeDrop = (TypeDropStatement) stmt;
- String dataverseName = stmtTypeDrop.getDataverseName() == null ? (activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName()) : stmtTypeDrop.getDataverseName().getValue();
- if (dataverseName == null) {
- throw new AlgebricksException(" dataverse not specified ");
- }
+ String dataverseName = getActiveDataverseName(stmtTypeDrop.getDataverseName());
String typeName = stmtTypeDrop.getTypeName().getValue();
Datatype dt = MetadataManager.INSTANCE.getDatatype(mdTxnCtx, dataverseName, typeName);
if (dt == null) {
@@ -1117,11 +1093,7 @@
try {
CreateFunctionStatement cfs = (CreateFunctionStatement) stmt;
- String dataverse = cfs.getSignature().getNamespace() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : cfs.getSignature().getNamespace();
- if (dataverse == null) {
- throw new AlgebricksException(" dataverse not specified ");
- }
+ String dataverse = getActiveDataverseName(cfs.getSignature().getNamespace());
Dataverse dv = MetadataManager.INSTANCE.getDataverse(mdTxnCtx, dataverse);
if (dv == null) {
throw new AlgebricksException("There is no dataverse with this name " + dataverse + ".");
@@ -1174,8 +1146,7 @@
List<JobSpecification> jobsToExecute = new ArrayList<JobSpecification>();
try {
LoadFromFileStatement loadStmt = (LoadFromFileStatement) stmt;
- String dataverseName = loadStmt.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : loadStmt.getDataverseName().getValue();
+ String dataverseName = getActiveDataverseName(loadStmt.getDataverseName());
CompiledLoadFromFileStatement cls = new CompiledLoadFromFileStatement(dataverseName, loadStmt
.getDatasetName().getValue(), loadStmt.getAdapter(), loadStmt.getProperties(),
loadStmt.dataIsAlreadySorted());
@@ -1223,8 +1194,7 @@
try {
metadataProvider.setWriteTransaction(true);
WriteFromQueryResultStatement st1 = (WriteFromQueryResultStatement) stmt;
- String dataverseName = st1.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : st1.getDataverseName().getValue();
+ String dataverseName = getActiveDataverseName(st1.getDataverseName());
CompiledWriteFromQueryResultStatement clfrqs = new CompiledWriteFromQueryResultStatement(dataverseName, st1
.getDatasetName().getValue(), st1.getQuery(), st1.getVarCounter());
@@ -1255,8 +1225,7 @@
try {
metadataProvider.setWriteTransaction(true);
InsertStatement stmtInsert = (InsertStatement) stmt;
- String dataverseName = stmtInsert.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : stmtInsert.getDataverseName().getValue();
+ String dataverseName = getActiveDataverseName(stmtInsert.getDataverseName());
CompiledInsertStatement clfrqs = new CompiledInsertStatement(dataverseName, stmtInsert.getDatasetName()
.getValue(), stmtInsert.getQuery(), stmtInsert.getVarCounter());
JobSpecification compiled = rewriteCompileQuery(metadataProvider, clfrqs.getQuery(), clfrqs);
@@ -1289,8 +1258,7 @@
try {
metadataProvider.setWriteTransaction(true);
DeleteStatement stmtDelete = (DeleteStatement) stmt;
- String dataverseName = stmtDelete.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : stmtDelete.getDataverseName().getValue();
+ String dataverseName = getActiveDataverseName(stmtDelete.getDataverseName());
CompiledDeleteStatement clfrqs = new CompiledDeleteStatement(stmtDelete.getVariableExpr(), dataverseName,
stmtDelete.getDatasetName().getValue(), stmtDelete.getCondition(), stmtDelete.getVarCounter(),
metadataProvider);
@@ -1340,8 +1308,7 @@
try {
BeginFeedStatement bfs = (BeginFeedStatement) stmt;
- String dataverseName = bfs.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : bfs.getDataverseName().getValue();
+ String dataverseName = getActiveDataverseName(bfs.getDataverseName());
CompiledBeginFeedStatement cbfs = new CompiledBeginFeedStatement(dataverseName, bfs.getDatasetName()
.getValue(), bfs.getQuery(), bfs.getVarCounter());
@@ -1389,8 +1356,7 @@
try {
ControlFeedStatement cfs = (ControlFeedStatement) stmt;
- String dataverseName = cfs.getDataverseName() == null ? activeDefaultDataverse == null ? null
- : activeDefaultDataverse.getDataverseName() : cfs.getDatasetName().getValue();
+ String dataverseName = getActiveDataverseName(cfs.getDataverseName());
CompiledControlFeedStatement clcfs = new CompiledControlFeedStatement(cfs.getOperationType(),
dataverseName, cfs.getDatasetName().getValue(), cfs.getAlterAdapterConfParams());
JobSpecification jobSpec = FeedOperations.buildControlFeedJobSpec(clcfs, metadataProvider);
@@ -1463,6 +1429,7 @@
return queryResult;
} catch (Exception e) {
+ e.printStackTrace();
if (bActiveTxn) {
abort(e, e, mdTxnCtx);
}
@@ -1535,6 +1502,23 @@
return format;
}
+ private String getActiveDataverseName(String dataverse)
+ throws AlgebricksException {
+ if (dataverse != null) {
+ return dataverse;
+ }
+ if (activeDefaultDataverse != null) {
+ return activeDefaultDataverse.getDataverseName();
+ }
+ throw new AlgebricksException("dataverse not specified");
+ }
+
+ private String getActiveDataverseName(Identifier dataverse)
+ throws AlgebricksException {
+ return getActiveDataverseName(
+ dataverse != null ? dataverse.getValue() : null);
+ }
+
private void acquireWriteLatch() {
MetadataManager.INSTANCE.acquireWriteLatch();
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
index 3600bea..e22c215 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
@@ -22,12 +22,11 @@
import java.util.logging.Logger;
import edu.uci.ics.asterix.api.common.Job;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.GlobalConfig;
import edu.uci.ics.asterix.common.config.OptimizationConfUtil;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.formats.base.IDataFormat;
import edu.uci.ics.asterix.metadata.MetadataManager;
@@ -40,10 +39,11 @@
import edu.uci.ics.asterix.metadata.utils.DatasetUtils;
import edu.uci.ics.asterix.om.types.ARecordType;
import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.om.util.AsterixAppContextInfo;
import edu.uci.ics.asterix.transaction.management.resource.ILocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.LSMBTreeLocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.PersistentLocalResourceFactoryProvider;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.translator.CompiledStatements.CompiledDatasetDropStatement;
import edu.uci.ics.asterix.translator.CompiledStatements.CompiledLoadFromFileStatement;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
@@ -171,7 +171,7 @@
//prepare a LocalResourceMetadata which will be stored in NC's local resource repository
ILocalResourceMetadata localResourceMetadata = new LSMBTreeLocalResourceMetadata(typeTraits,
comparatorFactories, blooFilterKeyFields, true, storageProperties.getMemoryComponentPageSize(),
- storageProperties.getMemoryComponentNumPages());
+ storageProperties.getMemoryComponentNumPages(), fs);
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMBTreeResource);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java
index 67bdabb..90a1ef0 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java
@@ -1,12 +1,12 @@
package edu.uci.ics.asterix.file;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.OptimizationConfUtil;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.declared.AqlMetadataProvider;
+import edu.uci.ics.asterix.om.util.AsterixAppContextInfo;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.translator.CompiledStatements.CompiledCreateIndexStatement;
import edu.uci.ics.asterix.translator.CompiledStatements.CompiledIndexDropStatement;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryBTreeCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryBTreeCreator.java
index c3a2c01..ebd1a9c 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryBTreeCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryBTreeCreator.java
@@ -2,11 +2,11 @@
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.transaction.management.resource.ILocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.LSMBTreeLocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.PersistentLocalResourceFactoryProvider;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraintHelper;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.ConnectorPolicyAssignmentPolicy;
@@ -40,7 +40,8 @@
//prepare a LocalResourceMetadata which will be stored in NC's local resource repository
ILocalResourceMetadata localResourceMetadata = new LSMBTreeLocalResourceMetadata(
secondaryRecDesc.getTypeTraits(), secondaryComparatorFactories, secondaryBloomFilterKeyFields, false,
- storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages());
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages(),
+ secondaryFileSplitProvider.getFileSplits());
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMBTreeResource);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java
index 253df4b..b79102b 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java
@@ -19,11 +19,9 @@
import java.io.IOException;
import java.util.List;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryBooleanInspectorImpl;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
@@ -37,9 +35,11 @@
import edu.uci.ics.asterix.metadata.utils.DatasetUtils;
import edu.uci.ics.asterix.om.types.ARecordType;
import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.AsterixAppContextInfo;
import edu.uci.ics.asterix.runtime.evaluators.functions.AndDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.functions.IsNullDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.functions.NotDescriptor;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.translator.CompiledStatements.CompiledCreateIndexStatement;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraintHelper;
@@ -76,7 +76,8 @@
import edu.uci.ics.hyracks.storage.am.lsm.btree.dataflow.LSMBTreeDataflowHelperFactory;
@SuppressWarnings("rawtypes")
-// TODO: We should eventually have a hierarchy of classes that can create all possible index job specs,
+// TODO: We should eventually have a hierarchy of classes that can create all
+// possible index job specs,
// not just for creation.
public abstract class SecondaryIndexCreator {
protected final PhysicalOptimizationConfig physOptConf;
@@ -336,16 +337,13 @@
for (int i = 0; i < numSecondaryKeyFields + numPrimaryKeys; i++) {
fieldPermutation[i] = i;
}
- Pair<IFileSplitProvider, AlgebricksPartitionConstraint> secondarySplitsAndConstraint = metadataProvider
- .splitProviderAndPartitionConstraintsForInternalOrFeedDataset(dataverseName, datasetName,
- secondaryIndexName);
TreeIndexBulkLoadOperatorDescriptor treeIndexBulkLoadOp = new TreeIndexBulkLoadOperatorDescriptor(spec,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- secondarySplitsAndConstraint.first, secondaryRecDesc.getTypeTraits(), secondaryComparatorFactories,
+ secondaryFileSplitProvider, secondaryRecDesc.getTypeTraits(), secondaryComparatorFactories,
secondaryBloomFilterKeyFields, fieldPermutation, fillFactor, false, numElementsHint,
dataflowHelperFactory, NoOpOperationCallbackFactory.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, treeIndexBulkLoadOp,
- secondarySplitsAndConstraint.second);
+ secondaryPartitionConstraint);
return treeIndexBulkLoadOp;
}
@@ -365,7 +363,8 @@
}
ICopyEvaluatorFactory selectCond = null;
if (numSecondaryKeyFields > 1) {
- // Create conjunctive condition where all secondary index keys must satisfy 'is not null'.
+ // Create conjunctive condition where all secondary index keys must
+ // satisfy 'is not null'.
AndDescriptor andDesc = new AndDescriptor();
selectCond = andDesc.createEvaluatorFactory(andArgsEvalFactories);
} else {
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java
index 366e247..ef94ec2 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java
@@ -5,7 +5,6 @@
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.metadata.declared.AqlMetadataProvider;
import edu.uci.ics.asterix.metadata.entities.Index;
@@ -15,6 +14,7 @@
import edu.uci.ics.asterix.transaction.management.resource.ILocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.LSMInvertedIndexLocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.PersistentLocalResourceFactoryProvider;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.translator.CompiledStatements.CompiledCreateIndexStatement;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraintHelper;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -157,7 +157,7 @@
ILocalResourceMetadata localResourceMetadata = new LSMInvertedIndexLocalResourceMetadata(invListsTypeTraits,
primaryComparatorFactories, tokenTypeTraits, tokenComparatorFactories, tokenizerFactory,
storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages(),
- isPartitioned);
+ isPartitioned, secondaryFileSplitProvider.getFileSplits());
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMInvertedIndexResource);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryRTreeCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryRTreeCreator.java
index 89a59e8..b7e4886 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryRTreeCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryRTreeCreator.java
@@ -4,7 +4,6 @@
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.dataflow.data.nontagged.valueproviders.AqlPrimitiveValueProviderFactory;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
@@ -18,6 +17,7 @@
import edu.uci.ics.asterix.transaction.management.resource.ILocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.LSMRTreeLocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.PersistentLocalResourceFactoryProvider;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.translator.CompiledStatements.CompiledCreateIndexStatement;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraintHelper;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -65,7 +65,7 @@
secondaryRecDesc.getTypeTraits(), secondaryComparatorFactories, primaryComparatorFactories,
valueProviderFactories, RTreePolicyType.RTREE, AqlMetadataProvider.proposeLinearizer(keyType,
secondaryComparatorFactories.length), storageProperties.getMemoryComponentPageSize(),
- storageProperties.getMemoryComponentNumPages());
+ storageProperties.getMemoryComponentNumPages(), secondaryFileSplitProvider.getFileSplits());
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMRTreeResource);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
index 01cbca0..5d4f6ec 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
@@ -13,12 +13,12 @@
import edu.uci.ics.asterix.api.http.servlet.QueryResultAPIServlet;
import edu.uci.ics.asterix.api.http.servlet.QueryStatusAPIServlet;
import edu.uci.ics.asterix.api.http.servlet.UpdateAPIServlet;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
import edu.uci.ics.asterix.common.config.AsterixExternalProperties;
import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
import edu.uci.ics.asterix.metadata.MetadataManager;
import edu.uci.ics.asterix.metadata.api.IAsterixStateProxy;
import edu.uci.ics.asterix.metadata.bootstrap.AsterixStateProxy;
+import edu.uci.ics.asterix.om.util.AsterixAppContextInfo;
import edu.uci.ics.hyracks.api.application.ICCApplicationContext;
import edu.uci.ics.hyracks.api.application.ICCApplicationEntryPoint;
import edu.uci.ics.hyracks.api.client.HyracksConnection;
@@ -54,6 +54,7 @@
webServer.start();
setupJSONAPIServer(externalProperties);
jsonAPIServer.start();
+ ccAppCtx.addClusterLifecycleListener(ClusterLifecycleListener.INSTANCE);
}
@Override
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/ClusterLifecycleListener.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
new file mode 100644
index 0000000..e8a1ad2
--- /dev/null
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+package edu.uci.ics.asterix.hyracks.bootstrap;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import edu.uci.ics.asterix.om.util.AsterixClusterProperties;
+import edu.uci.ics.hyracks.api.application.IClusterLifecycleListener;
+
+public class ClusterLifecycleListener implements IClusterLifecycleListener {
+
+ public static ClusterLifecycleListener INSTANCE = new ClusterLifecycleListener();
+
+ private ClusterLifecycleListener() {
+ }
+
+ private static final Logger LOGGER = Logger.getLogger(ClusterLifecycleListener.class.getName());
+
+ @Override
+ public void notifyNodeJoin(String nodeId, Map<String, String> ncConfiguration) {
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("NC: " + nodeId + " joined");
+ }
+ AsterixClusterProperties.INSTANCE.addNCConfiguration(nodeId, ncConfiguration);
+ }
+
+ public void notifyNodeFailure(Set<String> deadNodeIds) {
+ for (String deadNode : deadNodeIds) {
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("NC: " + deadNode + " left");
+ }
+ AsterixClusterProperties.INSTANCE.removeNCConfiguration(deadNode);
+ }
+
+ }
+
+}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
index 7dad984..4569088 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
@@ -5,16 +5,18 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import edu.uci.ics.asterix.api.common.AsterixAppRuntimeContext;
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
-import edu.uci.ics.asterix.common.context.AsterixAppRuntimeContext;
+import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
+import edu.uci.ics.asterix.common.transactions.IRecoveryManager;
+import edu.uci.ics.asterix.common.transactions.IRecoveryManager.SystemState;
import edu.uci.ics.asterix.metadata.MetadataManager;
import edu.uci.ics.asterix.metadata.MetadataNode;
import edu.uci.ics.asterix.metadata.api.IAsterixStateProxy;
import edu.uci.ics.asterix.metadata.api.IMetadataNode;
import edu.uci.ics.asterix.metadata.bootstrap.MetadataBootstrap;
import edu.uci.ics.asterix.transaction.management.resource.PersistentLocalResourceRepository;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IRecoveryManager;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IRecoveryManager.SystemState;
import edu.uci.ics.hyracks.api.application.INCApplicationContext;
import edu.uci.ics.hyracks.api.application.INCApplicationEntryPoint;
@@ -22,7 +24,7 @@
private static final Logger LOGGER = Logger.getLogger(NCApplicationEntryPoint.class.getName());
private INCApplicationContext ncApplicationContext = null;
- private AsterixAppRuntimeContext runtimeContext;
+ private IAsterixAppRuntimeContext runtimeContext;
private String nodeId;
private boolean isMetadataNode = false;
private boolean stopInitiated = false;
@@ -87,7 +89,7 @@
@Override
public void notifyStartupComplete() throws Exception {
IAsterixStateProxy proxy = (IAsterixStateProxy) ncApplicationContext.getDistributedState();
- AsterixMetadataProperties metadataProperties = runtimeContext.getMetadataProperties();
+ AsterixMetadataProperties metadataProperties = ((IAsterixPropertiesProvider)runtimeContext).getMetadataProperties();
if (systemState == SystemState.NEW_UNIVERSE) {
if (LOGGER.isLoggable(Level.INFO)) {
@@ -111,7 +113,7 @@
}
MetadataManager.INSTANCE = new MetadataManager(proxy, metadataProperties);
MetadataManager.INSTANCE.init();
- MetadataBootstrap.startUniverse(runtimeContext, ncApplicationContext,
+ MetadataBootstrap.startUniverse( ((IAsterixPropertiesProvider)runtimeContext), ncApplicationContext,
systemState == SystemState.NEW_UNIVERSE);
MetadataBootstrap.startDDLRecovery();
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java b/asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java
index dec3128..02cf6a4 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java
@@ -79,4 +79,24 @@
// TODO(madhusudancs): Figure out what to do when JSONException occurs while building the results.
}
}
+
+ /**
+ * extract meaningful part of a stack trace:
+ * a. the causes in the stack trace hierarchy
+ * b. the top exception for each cause
+ *
+ * @param e
+ * @return the contacted message containing a and b.
+ */
+ public static String extractErrorMessage(Throwable e) {
+ StringBuilder errorMessageBuilder = new StringBuilder();
+ Throwable cause = e;
+ errorMessageBuilder.append(cause.getLocalizedMessage());
+ while (cause != null) {
+ StackTraceElement[] stackTraceElements = cause.getStackTrace();
+ errorMessageBuilder.append(stackTraceElements.length > 0 ? "\n caused by: " + stackTraceElements[0] : "");
+ cause = cause.getCause();
+ }
+ return errorMessageBuilder.toString();
+ }
}
diff --git a/asterix-app/src/test/resources/AQLTS/queries/3.aql b/asterix-app/src/test/resources/AQLTS/queries/3.aql
deleted file mode 100644
index 3d71b27..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries/3.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-for $current_sig in dataset('SIGroup')
-where
- every $old_sig in dataset('SIGroup', getCurrentDateTime() - dtduration(0, 24, 0, 0))
- satisfies $old_sig.name != $current_sig.name
-return $current_sig
diff --git a/asterix-app/src/test/resources/AQLTS/queries/createInternalDataSet.aql b/asterix-app/src/test/resources/AQLTS/queries/createInternalDataSet.aql
new file mode 100644
index 0000000..f141e45
--- /dev/null
+++ b/asterix-app/src/test/resources/AQLTS/queries/createInternalDataSet.aql
@@ -0,0 +1,3 @@
+create dataset ds1(someType) primary key id;
+create internal dataset ds2(someType) primary key id;
+
diff --git a/asterix-app/src/test/resources/AQLTS/queries/utf-8.aql b/asterix-app/src/test/resources/AQLTS/queries/utf-8.aql
new file mode 100644
index 0000000..b9c58ea
--- /dev/null
+++ b/asterix-app/src/test/resources/AQLTS/queries/utf-8.aql
@@ -0,0 +1,3 @@
+string-to-codepoint("äöß");
+string-to-codepoint("迎");
+/* currently fails (issue 277) string-to-codepoint("欢") */
diff --git a/asterix-app/src/test/resources/AQLTS/queries/variables.aql b/asterix-app/src/test/resources/AQLTS/queries/variables.aql
new file mode 100644
index 0000000..57bfa6b
--- /dev/null
+++ b/asterix-app/src/test/resources/AQLTS/queries/variables.aql
@@ -0,0 +1,4 @@
+let $a:=1
+let $b:=1
+return
+ $b-$a
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_0/issue_363_temporal_sec_key_0.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_0/issue_363_temporal_sec_key_0.1.ddl.aql
new file mode 100644
index 0000000..73d63c9
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_0/issue_363_temporal_sec_key_0.1.ddl.aql
@@ -0,0 +1,19 @@
+/*
+ * Description : create a dataset using year-month-duration for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:year-month-duration,
+dur:year-month-duration,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
+create index TestSecondIndex on Employee(dur);
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_0/issue_363_temporal_sec_key_0.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_0/issue_363_temporal_sec_key_0.2.update.aql
new file mode 100644
index 0000000..bd96595
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_0/issue_363_temporal_sec_key_0.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : create a dataset using year-month-duration for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":year-month-duration("P16Y"), "dur":year-month-duration("-P23Y"), "name": "John"})
+insert into dataset Employee({"id":year-month-duration("-P37M"), "dur":year-month-duration("P1Y48M"), "name": "Alex"})
+insert into dataset Employee({"id":year-month-duration("P2013Y"), "dur":year-month-duration("P7M"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_0/issue_363_temporal_sec_key_0.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_0/issue_363_temporal_sec_key_0.3.query.aql
new file mode 100644
index 0000000..8244c6d
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_0/issue_363_temporal_sec_key_0.3.query.aql
@@ -0,0 +1,13 @@
+/*
+ * Description : create a dataset using year-month-duration for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.dur > year-month-duration("P1Y")
+return $x
+
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_1/issue_363_temporal_sec_key_1.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_1/issue_363_temporal_sec_key_1.1.ddl.aql
new file mode 100644
index 0000000..9697c32
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_1/issue_363_temporal_sec_key_1.1.ddl.aql
@@ -0,0 +1,19 @@
+/*
+ * Description : create a dataset using datetime for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:datetime,
+dt:datetime,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
+create index TestSecondIndex on Employee(dt);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_1/issue_363_temporal_sec_key_1.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_1/issue_363_temporal_sec_key_1.2.update.aql
new file mode 100644
index 0000000..d66da92
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_1/issue_363_temporal_sec_key_1.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : create a dataset using datetime for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":datetime("1900-01-01T00:00:00"), "dt":datetime("1900-01-01T00:00:00"), "name": "John"})
+insert into dataset Employee({"id":datetime("2000-01-01T00:00:00"), "dt":datetime("2000-01-01T00:00:00"), "name": "Alex"})
+insert into dataset Employee({"id":datetime("2013-01-01T00:00:00"), "dt":datetime("2013-01-01T00:00:00"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_1/issue_363_temporal_sec_key_1.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_1/issue_363_temporal_sec_key_1.3.query.aql
new file mode 100644
index 0000000..eb92aea
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_1/issue_363_temporal_sec_key_1.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : create a dataset using datetime for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.dt > datetime("2007-07-07T07:07:07.777Z")
+return $x
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_2/issue_363_temporal_sec_key_2.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_2/issue_363_temporal_sec_key_2.1.ddl.aql
new file mode 100644
index 0000000..d3c19f4
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_2/issue_363_temporal_sec_key_2.1.ddl.aql
@@ -0,0 +1,19 @@
+/*
+ * Description : create a dataset using time for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:time,
+tm:time,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
+create index TestSecondIndex on Employee(tm);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_2/issue_363_temporal_sec_key_2.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_2/issue_363_temporal_sec_key_2.2.update.aql
new file mode 100644
index 0000000..6f44d6c
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_2/issue_363_temporal_sec_key_2.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : create a dataset using time for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":time("03:10:00.493Z"), "tm":time("03:10:00.493Z"), "name": "John"})
+insert into dataset Employee({"id":time("20:37:19+08:00"), "tm":time("20:37:19+08:00"), "name": "Alex"})
+insert into dataset Employee({"id":time("21:39:17.948-04:00"), "tm":time("21:39:17.948-04:00"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_2/issue_363_temporal_sec_key_2.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_2/issue_363_temporal_sec_key_2.3.query.aql
new file mode 100644
index 0000000..f0392b1
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_2/issue_363_temporal_sec_key_2.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : create a dataset using time for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.tm > time("07:07:07.777Z")
+return $x
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_3/issue_363_temporal_sec_key_3.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_3/issue_363_temporal_sec_key_3.1.ddl.aql
new file mode 100644
index 0000000..ab88978
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_3/issue_363_temporal_sec_key_3.1.ddl.aql
@@ -0,0 +1,19 @@
+/*
+ * Description : create a dataset using date for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:date,
+dt:date,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
+create index TestSecondIndex on Employee(dt);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_3/issue_363_temporal_sec_key_3.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_3/issue_363_temporal_sec_key_3.2.update.aql
new file mode 100644
index 0000000..b8d415e
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_3/issue_363_temporal_sec_key_3.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : create a dataset using date for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":date("2010-01-01"), "dt":date("2010-01-01"), "name": "John"})
+insert into dataset Employee({"id":date("-1912-10-11"), "dt":date("-1912-10-11"), "name": "Alex"})
+insert into dataset Employee({"id":date("0732-02-02"), "dt":date("0732-02-02"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_3/issue_363_temporal_sec_key_3.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_3/issue_363_temporal_sec_key_3.3.query.aql
new file mode 100644
index 0000000..128a2a6
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_3/issue_363_temporal_sec_key_3.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : create a dataset using date for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.dt > date("2007-07-07")
+return $x
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_4/issue_363_temporal_sec_key_4.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_4/issue_363_temporal_sec_key_4.1.ddl.aql
new file mode 100644
index 0000000..c6a8836
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_4/issue_363_temporal_sec_key_4.1.ddl.aql
@@ -0,0 +1,19 @@
+/*
+ * Description : create a dataset using day-time-duration for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:day-time-duration,
+dur:day-time-duration,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
+create index TestSecondIndex on Employee(dt);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_4/issue_363_temporal_sec_key_4.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_4/issue_363_temporal_sec_key_4.2.update.aql
new file mode 100644
index 0000000..d5aafe9
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_4/issue_363_temporal_sec_key_4.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : create a dataset using day-time-duration for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":day-time-duration("P380DT983M"), "dur":day-time-duration("P380DT983M"), "name": "John"})
+insert into dataset Employee({"id":day-time-duration("-P3829H849.392S"), "dur":day-time-duration("-P3829H849.392S"), "name": "Alex"})
+insert into dataset Employee({"id":day-time-duration("PT93847M0.392S"), "dur":day-time-duration("PT93847M0.392S"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_4/issue_363_temporal_sec_key_4.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_4/issue_363_temporal_sec_key_4.3.query.aql
new file mode 100644
index 0000000..dbca351
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_sec_key_4/issue_363_temporal_sec_key_4.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : create a dataset using day-time-duration for the secondary index
+ * Expected Res : Success
+ * Date : 26 May 2013
+ * Issue : 461
+ */
+
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.dur > day-time-duration("P350D")
+return $x
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_0/issue363_temporal_sec_key_0.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_0/issue363_temporal_sec_key_0.1.adm
new file mode 100644
index 0000000..f1a3b14
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_0/issue363_temporal_sec_key_0.1.adm
@@ -0,0 +1 @@
+{ "id": year-month-duration("-P3Y1M"), "dur": year-month-duration("P5Y"), "name": "Alex" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_1/issue363_temporal_sec_key_1.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_1/issue363_temporal_sec_key_1.1.adm
new file mode 100644
index 0000000..1703ccd
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_1/issue363_temporal_sec_key_1.1.adm
@@ -0,0 +1 @@
+{ "id": datetime("2013-01-01T00:00:00.000Z"), "dt": datetime("2013-01-01T00:00:00.000Z"), "name": "Bob" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_2/issue363_temporal_sec_key_2.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_2/issue363_temporal_sec_key_2.1.adm
new file mode 100644
index 0000000..1e32e45
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_2/issue363_temporal_sec_key_2.1.adm
@@ -0,0 +1,2 @@
+{ "id": time("12:37:19.000Z"), "tm": time("12:37:19.000Z"), "name": "Alex" }
+{ "id": time("01:39:17.948Z"), "tm": time("01:39:17.948Z"), "name": "Bob" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_3/issue363_temporal_sec_key_3.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_3/issue363_temporal_sec_key_3.1.adm
new file mode 100644
index 0000000..fb4a286
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_3/issue363_temporal_sec_key_3.1.adm
@@ -0,0 +1 @@
+{ "id": date("2010-01-01"), "dt": date("2010-01-01"), "name": "John" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_4/issue363_temporal_sec_key_4.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_4/issue363_temporal_sec_key_4.1.adm
new file mode 100644
index 0000000..dacaf15
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_sec_key_4/issue363_temporal_sec_key_4.1.adm
@@ -0,0 +1 @@
+{ "id": day-time-duration("P380DT16H23M"), "dur": day-time-duration("P380DT16H23M"), "name": "John" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/testsuite.xml b/asterix-app/src/test/resources/metadata/testsuite.xml
index 63487d4..e9ed34d 100644
--- a/asterix-app/src/test/resources/metadata/testsuite.xml
+++ b/asterix-app/src/test/resources/metadata/testsuite.xml
@@ -175,6 +175,31 @@
<output-dir compare="Text">issue_363_temporal_key_4</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="basic">
+ <compilation-unit name="issue_363_temporal_sec_key_0">
+ <output-dir compare="Text">issue_363_temporal_sec_key_0</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="basic">
+ <compilation-unit name="issue_363_temporal_sec_key_1">
+ <output-dir compare="Text">issue_363_temporal_sec_key_1</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="basic">
+ <compilation-unit name="issue_363_temporal_sec_key_2">
+ <output-dir compare="Text">issue_363_temporal_sec_key_2</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="basic">
+ <compilation-unit name="issue_363_temporal_sec_key_3">
+ <output-dir compare="Text">issue_363_temporal_sec_key_3</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="basic">
+ <compilation-unit name="issue_363_temporal_sec_key_4">
+ <output-dir compare="Text">issue_363_temporal_sec_key_4</output-dir>
+ </compilation-unit>
+ </test-case>
</test-group>
<test-group name="exception">
<test-case FilePath="exception">
diff --git a/asterix-app/src/test/resources/optimizerts/results/fj-phase1.plan b/asterix-app/src/test/resources/optimizerts/results/fj-phase1.plan
index 494b208..76fd0bd 100644
--- a/asterix-app/src/test/resources/optimizerts/results/fj-phase1.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/fj-phase1.plan
@@ -11,11 +11,11 @@
-- NESTED_TUPLE_SOURCE |LOCAL|
}
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- STABLE_SORT [$$23(ASC), $$6(ASC)] |PARTITIONED|
+ -- STABLE_SORT [$$23(ASC), $$4(ASC)] |PARTITIONED|
-- HASH_PARTITION_EXCHANGE [$$23] |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- HYBRID_HASH_JOIN [$$1][$$6] |PARTITIONED|
+ -- HYBRID_HASH_JOIN [$$1][$$4] |PARTITIONED|
-- HASH_PARTITION_EXCHANGE [$$1] |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- UNNEST |PARTITIONED|
@@ -25,7 +25,7 @@
-- DATASOURCE_SCAN |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
- -- HASH_PARTITION_EXCHANGE [$$6] |PARTITIONED|
+ -- HASH_PARTITION_EXCHANGE [$$4] |PARTITIONED|
-- RUNNING_AGGREGATE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- SORT_MERGE_EXCHANGE [$$24(DESC) ] |PARTITIONED|
@@ -37,13 +37,13 @@
-- NESTED_TUPLE_SOURCE |LOCAL|
}
-- HASH_PARTITION_MERGE_EXCHANGE MERGE:[$$30(ASC)] HASH:[$$30] |PARTITIONED|
- -- PRE_CLUSTERED_GROUP_BY[$$5] |PARTITIONED|
+ -- PRE_CLUSTERED_GROUP_BY[$$3] |PARTITIONED|
{
-- AGGREGATE |LOCAL|
-- NESTED_TUPLE_SOURCE |LOCAL|
}
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- STABLE_SORT [$$5(ASC)] |PARTITIONED|
+ -- STABLE_SORT [$$3(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- UNNEST |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inlined_q18_large_volume_customer.plan b/asterix-app/src/test/resources/optimizerts/results/inlined_q18_large_volume_customer.plan
index 0713f96..0c7b95d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inlined_q18_large_volume_customer.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inlined_q18_large_volume_customer.plan
@@ -28,7 +28,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- HYBRID_HASH_JOIN [$$57][$$4] |PARTITIONED|
+ -- HYBRID_HASH_JOIN [$$57][$$3] |PARTITIONED|
-- HASH_PARTITION_EXCHANGE [$$57] |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
@@ -47,7 +47,7 @@
-- DATASOURCE_SCAN |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
- -- HASH_PARTITION_EXCHANGE [$$4] |PARTITIONED|
+ -- HASH_PARTITION_EXCHANGE [$$3] |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-contains.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-contains.plan
index 84bc4de..d7c4c08 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-contains.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-contains.plan
@@ -11,7 +11,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-edit-distance-check.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-edit-distance-check.plan
index d7a4c06..1f53ded 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-edit-distance-check.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-edit-distance-check.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-edit-distance.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-edit-distance.plan
index d7a4c06..1f53ded 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-edit-distance.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-edit-distance.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-fuzzyeq-edit-distance.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-fuzzyeq-edit-distance.plan
index 021f810..8a40be1 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-fuzzyeq-edit-distance.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-fuzzyeq-edit-distance.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-fuzzyeq-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-fuzzyeq-jaccard.plan
index aec97d2..f26c81d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-fuzzyeq-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-fuzzyeq-jaccard.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-jaccard-check.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-jaccard-check.plan
index 2a2ccc4..7ad0078 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-jaccard-check.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-jaccard-check.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-jaccard.plan
index 2a2ccc4..7ad0078 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ngram-jaccard.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-edit-distance-check.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-edit-distance-check.plan
index 7e8a594..7fcefa6 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-edit-distance-check.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-edit-distance-check.plan
@@ -11,7 +11,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-edit-distance.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-edit-distance.plan
index 7e8a594..7fcefa6 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-edit-distance.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-edit-distance.plan
@@ -11,7 +11,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-fuzzyeq-edit-distance.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-fuzzyeq-edit-distance.plan
index 5eef58e..dca0403 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-fuzzyeq-edit-distance.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-fuzzyeq-edit-distance.plan
@@ -11,7 +11,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-fuzzyeq-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-fuzzyeq-jaccard.plan
index d7a4c06..1f53ded 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-fuzzyeq-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-fuzzyeq-jaccard.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-jaccard-check.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-jaccard-check.plan
index aec97d2..f26c81d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-jaccard-check.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-jaccard-check.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-jaccard.plan
index aec97d2..f26c81d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/olist-jaccard.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-fuzzyeq-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-fuzzyeq-jaccard.plan
index d7a4c06..1f53ded 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-fuzzyeq-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-fuzzyeq-jaccard.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-jaccard-check.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-jaccard-check.plan
index aec97d2..f26c81d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-jaccard-check.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-jaccard-check.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-jaccard.plan
index aec97d2..f26c81d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/ulist-jaccard.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-fuzzyeq-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-fuzzyeq-jaccard.plan
index aec97d2..f26c81d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-fuzzyeq-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-fuzzyeq-jaccard.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-jaccard-check.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-jaccard-check.plan
index 2a2ccc4..7ad0078 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-jaccard-check.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-jaccard-check.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-jaccard.plan
index 2a2ccc4..7ad0078 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-basic/word-jaccard.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.plan
index 3028f9a..a59363b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.plan
@@ -11,7 +11,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.plan
index 3028f9a..a59363b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.plan
@@ -11,7 +11,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let.plan
index aec97d2..f26c81d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-edit-distance-check-let.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-jaccard-check-let.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-jaccard-check-let.plan
index 78e761f..e4516f1 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-jaccard-check-let.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-jaccard-check-let.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-jaccard-check-multi-let.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-jaccard-check-multi-let.plan
index 57730fe..6900fe8 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-jaccard-check-multi-let.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ngram-jaccard-check-multi-let.plan
@@ -13,7 +13,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/olist-edit-distance-check-let.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/olist-edit-distance-check-let.plan
index a1a1253..e62367e 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/olist-edit-distance-check-let.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/olist-edit-distance-check-let.plan
@@ -11,7 +11,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/olist-jaccard-check-let.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/olist-jaccard-check-let.plan
index 2a2ccc4..7ad0078 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/olist-jaccard-check-let.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/olist-jaccard-check-let.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ulist-jaccard-check-let.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ulist-jaccard-check-let.plan
index 2a2ccc4..7ad0078 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ulist-jaccard-check-let.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/ulist-jaccard-check-let.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/word-jaccard-check-let.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/word-jaccard-check-let.plan
index 78e761f..e4516f1 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/word-jaccard-check-let.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/word-jaccard-check-let.plan
@@ -9,7 +9,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/word-jaccard-check-multi-let.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/word-jaccard-check-multi-let.plan
index 57730fe..6900fe8 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/word-jaccard-check-multi-let.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-complex/word-jaccard-check-multi-let.plan
@@ -13,7 +13,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- ASSIGN |PARTITIONED|
-- EMPTY_TUPLE_SOURCE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-edit-distance-inline.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-edit-distance-inline.plan
index 0fab288..c683c43 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-edit-distance-inline.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-edit-distance-inline.plan
@@ -15,7 +15,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$31(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-edit-distance.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-edit-distance.plan
index f7d3cb4..0aaa618 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-edit-distance.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-edit-distance.plan
@@ -14,7 +14,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$28(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.plan
index 1be3fb1..fc5a042 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.plan
@@ -14,7 +14,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$27(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.plan
index 7c74f83..7629035 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.plan
@@ -12,7 +12,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-jaccard-inline.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-jaccard-inline.plan
index c5534d6..4972d0f 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-jaccard-inline.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-jaccard-inline.plan
@@ -13,7 +13,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$30(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-jaccard.plan
index fdbf50f..a8c2925 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ngram-jaccard.plan
@@ -12,7 +12,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$27(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-edit-distance-inline.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-edit-distance-inline.plan
index 0fab288..c683c43 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-edit-distance-inline.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-edit-distance-inline.plan
@@ -15,7 +15,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$31(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-edit-distance.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-edit-distance.plan
index f7d3cb4..0aaa618 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-edit-distance.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-edit-distance.plan
@@ -14,7 +14,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$28(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.plan
index 1be3fb1..fc5a042 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.plan
@@ -14,7 +14,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$27(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.plan
index 88c4469..a2236b0 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.plan
@@ -12,7 +12,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$24(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-jaccard-inline.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-jaccard-inline.plan
index 8b6b08b..ebebe4d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-jaccard-inline.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-jaccard-inline.plan
@@ -13,7 +13,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$28(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-jaccard.plan
index ba9879d..0ee49d0 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/olist-jaccard.plan
@@ -12,7 +12,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.plan
index 88c4469..a2236b0 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.plan
@@ -12,7 +12,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$24(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-jaccard-inline.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-jaccard-inline.plan
index 8b6b08b..ebebe4d 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-jaccard-inline.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-jaccard-inline.plan
@@ -13,7 +13,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$28(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-jaccard.plan
index ba9879d..0ee49d0 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/ulist-jaccard.plan
@@ -12,7 +12,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.plan
index 7c74f83..7629035 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.plan
@@ -12,7 +12,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-jaccard-inline.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-jaccard-inline.plan
index c5534d6..4972d0f 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-jaccard-inline.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-jaccard-inline.plan
@@ -13,7 +13,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$30(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-jaccard.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-jaccard.plan
index fdbf50f..a8c2925 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-jaccard.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join-noeqjoin/word-jaccard.plan
@@ -12,7 +12,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$27(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_01.plan
index a04e378..b274dfc 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_01.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_02.plan
index 1800e75..9fe499b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_02.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_03.plan
index a04e378..b274dfc 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_03.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_04.plan
index abd2c39..dbeabdd 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_04.plan
@@ -22,7 +22,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$31(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_01.plan
index a04e378..b274dfc 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_01.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_02.plan
index 1800e75..9fe499b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_02.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_03.plan
index a04e378..b274dfc 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_03.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_04.plan
index dffe718..7a789d2 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_04.plan
@@ -22,7 +22,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$31(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_01.plan
index 65be14f..16f2bfd 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_01.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_02.plan
index bfee1a5..595587e 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_02.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_03.plan
index bfee1a5..595587e 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_03.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_01.plan
index ab5cf83..b7fe0db 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$24(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_02.plan
index 7877b30..7160d6f 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$24(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_03.plan
index ab5cf83..b7fe0db 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-jaccard_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$24(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_01.plan
index 3f7ecb1..2710b67 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_02.plan
index 4b767ab..c3bf90e 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_03.plan
index 3f7ecb1..2710b67 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_04.plan
index 77b00ff..5ed5498 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard-check_04.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$30(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_01.plan
index 3f7ecb1..2710b67 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_02.plan
index 4b767ab..c3bf90e 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_03.plan
index 3f7ecb1..2710b67 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_04.plan
index 32d7e09..c995dafa 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-jaccard_04.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$30(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_01.plan
index a04e378..b274dfc 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_01.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_02.plan
index 1800e75..9fe499b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_02.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_03.plan
index a04e378..b274dfc 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_03.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_04.plan
index abd2c39..dbeabdd 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_04.plan
@@ -22,7 +22,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$31(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_01.plan
index a04e378..b274dfc 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_01.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_02.plan
index 1800e75..9fe499b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_02.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_03.plan
index a04e378..b274dfc 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_03.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$26(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_04.plan
index dffe718..7a789d2 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_04.plan
@@ -22,7 +22,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$31(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_01.plan
index bfee1a5..595587e 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_01.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_02.plan
index 65be14f..16f2bfd 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_02.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_03.plan
index bfee1a5..595587e 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_03.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_SELECT |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_01.plan
index 2a4e9de..74bdea2 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$22(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_02.plan
index 06826c1..be387f0 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$22(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_03.plan
index 2a4e9de..74bdea2 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-jaccard_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$22(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_01.plan
index 7c16cef..dc2073c 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_02.plan
index 3d0f3f1..8a7e71b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_03.plan
index 7c16cef..dc2073c 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_04.plan
index 156dd43..4934b82 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard-check_04.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$28(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_01.plan
index 7c16cef..dc2073c 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_02.plan
index 3d0f3f1..8a7e71b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_03.plan
index 7c16cef..dc2073c 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_04.plan
index 47f5c91..710ba98 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-jaccard_04.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$28(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_01.plan
index 2a4e9de..74bdea2 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$22(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_02.plan
index 06826c1..be387f0 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$22(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_03.plan
index 2a4e9de..74bdea2 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-fuzzyeq-jaccard_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$22(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_01.plan
index 7c16cef..dc2073c 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_02.plan
index 3d0f3f1..8a7e71b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_03.plan
index 7c16cef..dc2073c 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_04.plan
index 156dd43..4934b82 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard-check_04.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$28(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_01.plan
index 7c16cef..dc2073c 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_02.plan
index 3d0f3f1..8a7e71b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_03.plan
index 7c16cef..dc2073c 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$23(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_04.plan
index 47f5c91..710ba98 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ulist-jaccard_04.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$28(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_01.plan
index ab5cf83..b7fe0db 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$24(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_02.plan
index 7877b30..7160d6f 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$24(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_03.plan
index ab5cf83..b7fe0db 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-fuzzyeq-jaccard_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$24(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_01.plan
index 3f7ecb1..2710b67 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_02.plan
index 0fced26..e58089b 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_03.plan
index 3f7ecb1..2710b67 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_04.plan
index 77b00ff..5ed5498 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard-check_04.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$30(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_01.plan
index 3f7ecb1..2710b67 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_01.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_02.plan
index 4b767ab..c3bf90e 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_02.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_03.plan
index 3f7ecb1..2710b67 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_03.plan
@@ -18,7 +18,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$25(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_04.plan
index 32d7e09..c995dafa 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/word-jaccard_04.plan
@@ -20,7 +20,7 @@
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
-- STABLE_SORT [$$30(ASC)] |PARTITIONED|
-- ONE_TO_ONE_EXCHANGE |PARTITIONED|
- -- INVERTED_INDEX_SEARCH |PARTITIONED|
+ -- FUZZY_INVERTED_INDEX_SEARCH |PARTITIONED|
-- BROADCAST_EXCHANGE |PARTITIONED|
-- STREAM_PROJECT |PARTITIONED|
-- ASSIGN |PARTITIONED|
diff --git a/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.1.ddl.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.1.ddl.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.3.query.aql
new file mode 100644
index 0000000..6b09eec
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : This test case is to verify the fix for issue443
+ : https://code.google.com/p/asterixdb/issues/detail?id=443
+ * Expected Res : Fail
+ * Date : 22th May 2013
+ */
+
+
+for $a in [ {"f" : 19, "g": 1} , {"f" : 12, "g": 2} , {"f" : 10, "g": 1} , {"f" : 17, "g": 1}, {"f" : 12, "g": 4} ]
+distinct by $a.f
+return $a
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443/query-issue443.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443/query-issue443.1.ddl.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443/query-issue443.1.ddl.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443/query-issue443.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443/query-issue443.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443/query-issue443.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443/query-issue443.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443/query-issue443.3.query.aql
new file mode 100644
index 0000000..602468c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443/query-issue443.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : This test case is to verify the fix for issue443
+ : https://code.google.com/p/asterixdb/issues/detail?id=443
+ * Expected Res : Fail
+ * Date : 22th May 2013
+ */
+
+
+for $a in [ {"f" : 19} , {"f" : 12} , {"f" : 10} , {"f" : 17}, {"f" : 12} ]
+distinct by $a.f
+return $a
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.1.ddl.aql
deleted file mode 100644
index d00347d..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.1.ddl.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string?,
- authors: string,
- misc: string
-}
-
-create dataset DBLP(DBLPType) primary key id;
-
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.2.update.aql
deleted file mode 100644
index 1d5d4fd..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.2.update.aql
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-load dataset DBLP using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-nulls.adm"),("format"="adm"));
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.3.ddl.aql
deleted file mode 100644
index a79828c..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.3.ddl.aql
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-create index fuzzy_ngram_index on DBLP(title) type fuzzy ngram(3);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.4.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.4.update.aql
deleted file mode 100644
index 7e917b5..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.4.update.aql
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-delete $o from dataset DBLP where $o.id>50;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.5.query.aql
deleted file mode 100644
index c1c6247..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.5.query.aql
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-for $o in dataset('DBLP')
-where contains($o.title, "Multimedia")
-order by $o.id
-return $o
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.1.ddl.aql
deleted file mode 100644
index e98b328..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.1.ddl.aql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create dataset DBLP(DBLPType) primary key id;
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.2.update.aql
deleted file mode 100644
index 381ce87..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.2.update.aql
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-load dataset DBLP using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.3.ddl.aql
deleted file mode 100644
index ede69f6..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.3.ddl.aql
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-create index fuzzy_ngram_index on DBLP(title) type fuzzy ngram(3);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.4.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.4.update.aql
deleted file mode 100644
index 9c58c7e..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.4.update.aql
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-delete $o from dataset DBLP where $o.id>50;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.5.query.aql
deleted file mode 100644
index ca070fc..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-ngram-secondary-index/scan-delete-inverted-index-fuzzy-ngram-secondary-index.5.query.aql
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-for $o in dataset('DBLP')
-where contains($o.title, "Multimedia")
-order by $o.id
-return $o
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.1.ddl.aql
deleted file mode 100644
index 45570ac..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.1.ddl.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string?,
- authors: string,
- misc: string
-}
-
-create dataset DBLP(DBLPType) primary key id;
-
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.2.update.aql
deleted file mode 100644
index d26c270..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.2.update.aql
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-load dataset DBLP using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-nulls.adm"),("format"="adm"));
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.3.ddl.aql
deleted file mode 100644
index 3747bb1..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.3.ddl.aql
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-create index fuzzy_keyword_index on DBLP(title) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.4.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.4.update.aql
deleted file mode 100644
index eb15450..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.4.update.aql
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-delete $o from dataset DBLP where $o.id<50;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.5.query.aql
deleted file mode 100644
index c1fb278..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable/scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.5.query.aql
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-for $o in dataset('DBLP')
-let $jacc := similarity-jaccard-check(word-tokens($o.title), word-tokens("Transactions for Cooperative Environments"), 0.5f)
-where $jacc[0]
-return $o
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.1.ddl.aql
deleted file mode 100644
index 9d04c14..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.1.ddl.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create dataset DBLP(DBLPType) primary key id;
-
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.2.update.aql
deleted file mode 100644
index a5995f6..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.2.update.aql
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-load dataset DBLP using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.3.ddl.aql
deleted file mode 100644
index 97aef53..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.3.ddl.aql
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-create index fuzzy_keyword_index on DBLP(title) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.4.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.4.update.aql
deleted file mode 100644
index 001e605..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.4.update.aql
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-delete $o from dataset DBLP where $o.id<50;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.5.query.aql
deleted file mode 100644
index 7910859..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-inverted-index-fuzzy-word-secondary-index/scan-delete-inverted-index-fuzzy-word-secondary-index.5.query.aql
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Test case Name : scan-delete-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test deletion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-for $o in dataset('DBLP')
-let $jacc := similarity-jaccard-check(word-tokens($o.title), word-tokens("Transactions for Cooperative Environments"), 0.5f)
-where $jacc[0]
-return $o
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.1.ddl.aql
deleted file mode 100644
index 21ff64a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string?,
- authors: string,
- misc: string
-}
-
-create dataset DBLP(DBLPType) primary key id;
-create dataset DBLP1(DBLPType) primary key id;
-
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.2.update.aql
deleted file mode 100644
index 9108ad6..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.2.update.aql
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-load dataset DBLP using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-nulls.adm"),("format"="adm"));
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.3.ddl.aql
deleted file mode 100644
index 426654c..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.3.ddl.aql
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-create index fuzzy_ngram_index on DBLP(title) type fuzzy ngram(3);
-create index fuzzy_ngram_index1 on DBLP1(title) type fuzzy ngram(3);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.4.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.4.update.aql
deleted file mode 100644
index 2fe30df..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.4.update.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-insert into dataset DBLP1 (
-for $o in dataset('DBLP')
-where contains($o.title, "Multimedia")
-order by $o.id
-return {
- "id": $o.id,
- "dblpid": $o.dblpid,
- "title": $o.title,
- "authors": $o.authors,
- "misc": $o.misc
- }
-);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.5.query.aql
deleted file mode 100644
index f61df2a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable/scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.5.query.aql
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-for $o in dataset('DBLP1')
-where contains($o.title, "Multimedia")
-order by $o.id
-return $o
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.1.ddl.aql
deleted file mode 100644
index af890c4..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create dataset DBLP(DBLPType) primary key id;
-create dataset DBLP1(DBLPType) primary key id;
-
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.2.update.aql
deleted file mode 100644
index 382a4a6..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.2.update.aql
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-load dataset DBLP using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.3.ddl.aql
deleted file mode 100644
index 8109213..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.3.ddl.aql
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-create index fuzzy_ngram_index on DBLP(title) type fuzzy ngram(3);
-create index fuzzy_ngram_index1 on DBLP1(title) type fuzzy ngram(3);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.4.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.4.update.aql
deleted file mode 100644
index b829b15..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.4.update.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-insert into dataset DBLP1 (
-for $o in dataset('DBLP')
-where contains($o.title, "Multimedia")
-order by $o.id
-return {
- "id": $o.id,
- "dblpid": $o.dblpid,
- "title": $o.title,
- "authors": $o.authors,
- "misc": $o.misc
- }
-);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.5.query.aql
deleted file mode 100644
index 324b351..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-ngram-secondary-index/scan-insert-inverted-index-fuzzy-ngram-secondary-index.5.query.aql
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-ngram-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy ngram inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-for $o in dataset('DBLP1')
-where contains($o.title, "Multimedia")
-order by $o.id
-return $o
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.1.ddl.aql
deleted file mode 100644
index 7dbf7ee..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string?,
- authors: string,
- misc: string
-}
-
-create dataset DBLP(DBLPType) primary key id;
-create dataset DBLP1(DBLPType) primary key id;
-
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.2.update.aql
deleted file mode 100644
index 1d8126f..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.2.update.aql
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-load dataset DBLP using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-nulls.adm"),("format"="adm"));
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.3.ddl.aql
deleted file mode 100644
index 798622a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.3.ddl.aql
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-create index fuzzy_keyword_index on DBLP(title) type fuzzy keyword;
-create index fuzzy_keyword_index1 on DBLP1(title) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.4.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.4.update.aql
deleted file mode 100644
index 3234c4e..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.4.update.aql
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-insert into dataset DBLP1 (
-for $o in dataset('DBLP')
-order by $o.id
-return {
- "id": $o.id,
- "dblpid": $o.dblpid,
- "title": $o.title,
- "authors": $o.authors,
- "misc": $o.misc
- }
-);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.5.query.aql
deleted file mode 100644
index 43ad95c..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable/scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.5.query.aql
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index-nullable.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index that are built on nullable fields.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-for $o in dataset('DBLP1')
-let $jacc := similarity-jaccard-check(word-tokens($o.title), word-tokens("Transactions for Cooperative Environments"), 0.5f)
-where $jacc[0]
-return $o
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.1.ddl.aql
deleted file mode 100644
index 5dd6f1a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create dataset DBLP(DBLPType) primary key id;
-create dataset DBLP1(DBLPType) primary key id;
-
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.2.update.aql
deleted file mode 100644
index 25e9446..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.2.update.aql
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-load dataset DBLP using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.3.ddl.aql
deleted file mode 100644
index f43c5cf..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.3.ddl.aql
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-create index fuzzy_keyword_index on DBLP(title) type fuzzy keyword;
-create index fuzzy_keyword_index1 on DBLP1(title) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.4.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.4.update.aql
deleted file mode 100644
index b8a1af1..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.4.update.aql
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-insert into dataset DBLP1 (
-for $o in dataset('DBLP')
-order by $o.id
-return {
- "id": $o.id,
- "dblpid": $o.dblpid,
- "title": $o.title,
- "authors": $o.authors,
- "misc": $o.misc
- }
-);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.5.query.aql
deleted file mode 100644
index 0fe611a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-inverted-index-fuzzy-word-secondary-index/scan-insert-inverted-index-fuzzy-word-secondary-index.5.query.aql
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Test case Name : scan-insert-inverted-index-fuzzy-word-secondary-index.aql
- * Description : This test is intended to test insertion from secondary fuzzy keyword inverted index.
- * Expected Result : Success
- * Date : March 31 2013
- */
-
-use dataverse test;
-
-for $o in dataset('DBLP1')
-let $jacc := similarity-jaccard-check(word-tokens($o.title), word-tokens("Transactions for Cooperative Environments"), 0.5f)
-where $jacc[0]
-return $o
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/feeds/feeds_02/feeds_02.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/feeds/feeds_02/feeds_02.3.query.aql
index 01ef318..230aa40 100644
--- a/asterix-app/src/test/resources/runtimets/queries/feeds/feeds_02/feeds_02.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/feeds/feeds_02/feeds_02.3.query.aql
@@ -8,4 +8,5 @@
use dataverse feeds;
for $x in dataset('TweetFeed')
+order by $x.id
return $x
diff --git a/asterix-app/src/test/resources/runtimets/queries/feeds/feeds_04/feeds_04.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/feeds/feeds_04/feeds_04.3.query.aql
index 5146fb5..714dd80 100644
--- a/asterix-app/src/test/resources/runtimets/queries/feeds/feeds_04/feeds_04.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/feeds/feeds_04/feeds_04.3.query.aql
@@ -8,4 +8,5 @@
use dataverse feeds;
for $x in dataset('TweetFeed')
+order by $x.id
return $x
diff --git a/asterix-app/src/test/resources/runtimets/queries/feeds/issue_230_feeds/issue_230_feeds.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/feeds/issue_230_feeds/issue_230_feeds.3.query.aql
index d94576b..48e18e2 100644
--- a/asterix-app/src/test/resources/runtimets/queries/feeds/issue_230_feeds/issue_230_feeds.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/feeds/issue_230_feeds/issue_230_feeds.3.query.aql
@@ -7,4 +7,5 @@
use dataverse feeds;
for $x in dataset('TweetFeed')
+order by $x.id
return $x
diff --git a/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/opentype/opentype.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/opentype/opentype.1.ddl.aql
new file mode 100644
index 0000000..17da24b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/opentype/opentype.1.ddl.aql
@@ -0,0 +1,13 @@
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TweetMessageType as open {
+ tweetid: string
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid
+hints(cardinality=100);
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/opentype/opentype.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/opentype/opentype.2.update.aql
new file mode 100644
index 0000000..627623a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/opentype/opentype.2.update.aql
@@ -0,0 +1,5 @@
+use dataverse TinySocial;
+
+load dataset TweetMessages
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tinysocial/twm.adm"),("format"="adm"));
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/opentype/opentype.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/opentype/opentype.3.query.aql
new file mode 100644
index 0000000..f40e884
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/opentype/opentype.3.query.aql
@@ -0,0 +1,15 @@
+use dataverse TinySocial;
+
+set simfunction "jaccard";
+set simthreshold "0.3";
+
+for $t in dataset TweetMessages
+order by $t.tweetid
+return {
+ "tweet": $t,
+ "similar-tweets": for $t2 in dataset TweetMessages
+ order by $t2.tweetid
+ where $t2.referred-topics ~= $t.referred-topics
+ and $t2.tweetid != $t.tweetid
+ return $t2.referred-topics
+};
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/hints/issue_251_dataset_hint_7/issue_251_dataset_hint_7.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/hints/issue_251_dataset_hint_7/issue_251_dataset_hint_7.3.query.aql
index efa1f9c..f1127f0 100644
--- a/asterix-app/src/test/resources/runtimets/queries/hints/issue_251_dataset_hint_7/issue_251_dataset_hint_7.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/hints/issue_251_dataset_hint_7/issue_251_dataset_hint_7.3.query.aql
@@ -9,5 +9,6 @@
use dataverse feeds;
for $x in dataset('TweetFeed')
+order by $x.id
return $x
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-contains/fuzzy-inverted-index-ngram-contains.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-contains/fuzzy-inverted-index-ngram-contains.1.ddl.aql
deleted file mode 100644
index d9ca825..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-contains/fuzzy-inverted-index-ngram-contains.1.ddl.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create nodegroup group1 if not exists on nc1, nc2;
-
-create dataset DBLP(DBLPType)
- primary key id on group1;
-
-create index ngram_index on DBLP(title) type fuzzy ngram(3);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-contains/fuzzy-inverted-index-ngram-contains.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-contains/fuzzy-inverted-index-ngram-contains.2.update.aql
deleted file mode 100644
index 830e08a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-contains/fuzzy-inverted-index-ngram-contains.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset DBLP
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-contains/fuzzy-inverted-index-ngram-contains.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-contains/fuzzy-inverted-index-ngram-contains.3.query.aql
deleted file mode 100644
index 866b045..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-contains/fuzzy-inverted-index-ngram-contains.3.query.aql
+++ /dev/null
@@ -1,6 +0,0 @@
-use dataverse test;
-
-for $o in dataset('DBLP')
-where contains($o.title, "Multimedia")
-order by $o.id
-return $o
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance-panic/fuzzy-inverted-index-ngram-edit-distance-panic.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance-panic/fuzzy-inverted-index-ngram-edit-distance-panic.1.ddl.aql
deleted file mode 100644
index 7afd29a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance-panic/fuzzy-inverted-index-ngram-edit-distance-panic.1.ddl.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create nodegroup group1 if not exists on nc1, nc2;
-
-create dataset DBLP(DBLPType)
- primary key id on group1;
-
-create index ngram_index on DBLP(authors) type fuzzy ngram(3);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance-panic/fuzzy-inverted-index-ngram-edit-distance-panic.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance-panic/fuzzy-inverted-index-ngram-edit-distance-panic.2.update.aql
deleted file mode 100644
index 830e08a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance-panic/fuzzy-inverted-index-ngram-edit-distance-panic.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset DBLP
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance-panic/fuzzy-inverted-index-ngram-edit-distance-panic.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance-panic/fuzzy-inverted-index-ngram-edit-distance-panic.3.query.aql
deleted file mode 100644
index 45ac926..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance-panic/fuzzy-inverted-index-ngram-edit-distance-panic.3.query.aql
+++ /dev/null
@@ -1,6 +0,0 @@
-use dataverse test;
-
-for $o in dataset('DBLP')
-let $ed := edit-distance-check($o.authors, "Amihay Motro", 5)
-where $ed[0]
-return $o
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance/fuzzy-inverted-index-ngram-edit-distance.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance/fuzzy-inverted-index-ngram-edit-distance.1.ddl.aql
deleted file mode 100644
index 7afd29a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance/fuzzy-inverted-index-ngram-edit-distance.1.ddl.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create nodegroup group1 if not exists on nc1, nc2;
-
-create dataset DBLP(DBLPType)
- primary key id on group1;
-
-create index ngram_index on DBLP(authors) type fuzzy ngram(3);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance/fuzzy-inverted-index-ngram-edit-distance.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance/fuzzy-inverted-index-ngram-edit-distance.2.update.aql
deleted file mode 100644
index 830e08a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance/fuzzy-inverted-index-ngram-edit-distance.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset DBLP
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance/fuzzy-inverted-index-ngram-edit-distance.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance/fuzzy-inverted-index-ngram-edit-distance.3.query.aql
deleted file mode 100644
index 0f4c003..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-edit-distance/fuzzy-inverted-index-ngram-edit-distance.3.query.aql
+++ /dev/null
@@ -1,6 +0,0 @@
-use dataverse test;
-
-for $o in dataset('DBLP')
-let $ed := edit-distance-check($o.authors, "Amihay Motro", 1)
-where $ed[0]
-return $o
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-jaccard/fuzzy-inverted-index-ngram-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-jaccard/fuzzy-inverted-index-ngram-jaccard.1.ddl.aql
deleted file mode 100644
index d9ca825..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-jaccard/fuzzy-inverted-index-ngram-jaccard.1.ddl.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create nodegroup group1 if not exists on nc1, nc2;
-
-create dataset DBLP(DBLPType)
- primary key id on group1;
-
-create index ngram_index on DBLP(title) type fuzzy ngram(3);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-jaccard/fuzzy-inverted-index-ngram-jaccard.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-jaccard/fuzzy-inverted-index-ngram-jaccard.2.update.aql
deleted file mode 100644
index 830e08a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-jaccard/fuzzy-inverted-index-ngram-jaccard.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset DBLP
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-jaccard/fuzzy-inverted-index-ngram-jaccard.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-jaccard/fuzzy-inverted-index-ngram-jaccard.3.query.aql
deleted file mode 100644
index dc18182..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ngram-jaccard/fuzzy-inverted-index-ngram-jaccard.3.query.aql
+++ /dev/null
@@ -1,7 +0,0 @@
-use dataverse test;
-set import-private-functions 'true';
-
-for $o in dataset('DBLP')
-let $jacc := similarity-jaccard-check(gram-tokens($o.title, 3, false), gram-tokens("Transactions for Cooperative Environments", 3, false), 0.5f)
-where $jacc[0]
-return $o
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance-panic/fuzzy-inverted-index-olist-edit-distance-panic.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance-panic/fuzzy-inverted-index-olist-edit-distance-panic.1.ddl.aql
deleted file mode 100644
index 8a57319..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance-panic/fuzzy-inverted-index-olist-edit-distance-panic.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type AddressType as closed {
- number: int32,
- street: string,
- city: string
-}
-
-create type CustomerType as closed {
- cid: int32,
- name: string,
- age: int32?,
- address: AddressType?,
- interests: [string],
- children: [ { name: string, age: int32? } ]
-}
-
-create nodegroup group1 if not exists on nc1;
-
-create dataset Customers(CustomerType)
- primary key cid on group1;
-
-create index interests_index on Customers(interests) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance-panic/fuzzy-inverted-index-olist-edit-distance-panic.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance-panic/fuzzy-inverted-index-olist-edit-distance-panic.2.update.aql
deleted file mode 100644
index 063b172..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance-panic/fuzzy-inverted-index-olist-edit-distance-panic.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset Customers
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance-panic/fuzzy-inverted-index-olist-edit-distance-panic.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance-panic/fuzzy-inverted-index-olist-edit-distance-panic.3.query.aql
deleted file mode 100644
index d4a4f60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance-panic/fuzzy-inverted-index-olist-edit-distance-panic.3.query.aql
+++ /dev/null
@@ -1,7 +0,0 @@
-use dataverse test;
-
-for $c in dataset('Customers')
-let $ed := edit-distance-check($c.interests, ["computers", "wine", "walking"], 3)
-where $ed[0]
-order by $c.cid
-return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance/fuzzy-inverted-index-olist-edit-distance.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance/fuzzy-inverted-index-olist-edit-distance.1.ddl.aql
deleted file mode 100644
index 8a57319..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance/fuzzy-inverted-index-olist-edit-distance.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type AddressType as closed {
- number: int32,
- street: string,
- city: string
-}
-
-create type CustomerType as closed {
- cid: int32,
- name: string,
- age: int32?,
- address: AddressType?,
- interests: [string],
- children: [ { name: string, age: int32? } ]
-}
-
-create nodegroup group1 if not exists on nc1;
-
-create dataset Customers(CustomerType)
- primary key cid on group1;
-
-create index interests_index on Customers(interests) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance/fuzzy-inverted-index-olist-edit-distance.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance/fuzzy-inverted-index-olist-edit-distance.2.update.aql
deleted file mode 100644
index 063b172..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance/fuzzy-inverted-index-olist-edit-distance.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset Customers
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance/fuzzy-inverted-index-olist-edit-distance.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance/fuzzy-inverted-index-olist-edit-distance.3.query.aql
deleted file mode 100644
index 7ebd73e..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-edit-distance/fuzzy-inverted-index-olist-edit-distance.3.query.aql
+++ /dev/null
@@ -1,7 +0,0 @@
-use dataverse test;
-
-for $c in dataset('Customers')
-let $ed := edit-distance-check($c.interests, ["computers", "wine", "walking"], 1)
-where $ed[0]
-order by $c.cid
-return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-jaccard/fuzzy-inverted-index-olist-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-jaccard/fuzzy-inverted-index-olist-jaccard.1.ddl.aql
deleted file mode 100644
index 8a57319..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-jaccard/fuzzy-inverted-index-olist-jaccard.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type AddressType as closed {
- number: int32,
- street: string,
- city: string
-}
-
-create type CustomerType as closed {
- cid: int32,
- name: string,
- age: int32?,
- address: AddressType?,
- interests: [string],
- children: [ { name: string, age: int32? } ]
-}
-
-create nodegroup group1 if not exists on nc1;
-
-create dataset Customers(CustomerType)
- primary key cid on group1;
-
-create index interests_index on Customers(interests) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-jaccard/fuzzy-inverted-index-olist-jaccard.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-jaccard/fuzzy-inverted-index-olist-jaccard.2.update.aql
deleted file mode 100644
index 063b172..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-jaccard/fuzzy-inverted-index-olist-jaccard.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset Customers
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-jaccard/fuzzy-inverted-index-olist-jaccard.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-jaccard/fuzzy-inverted-index-olist-jaccard.3.query.aql
deleted file mode 100644
index 27a838ba..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-olist-jaccard/fuzzy-inverted-index-olist-jaccard.3.query.aql
+++ /dev/null
@@ -1,6 +0,0 @@
-use dataverse test;
-
-for $c in dataset('Customers')
-let $jacc := similarity-jaccard-check($c.interests, ["databases", "computers", "wine"], 0.7f)
-where $jacc[0]
-return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ulist-jaccard/fuzzy-inverted-index-ulist-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ulist-jaccard/fuzzy-inverted-index-ulist-jaccard.1.ddl.aql
deleted file mode 100644
index 3e2562a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ulist-jaccard/fuzzy-inverted-index-ulist-jaccard.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type AddressType as closed {
- number: int32,
- street: string,
- city: string
-}
-
-create type CustomerType as closed {
- cid: int32,
- name: string,
- age: int32?,
- address: AddressType?,
- interests: {{string}},
- children: [ { name: string, age: int32? } ]
-}
-
-create nodegroup group1 if not exists on nc1;
-
-create dataset Customers(CustomerType)
- primary key cid on group1;
-
-create index interests_index on Customers(interests) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ulist-jaccard/fuzzy-inverted-index-ulist-jaccard.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ulist-jaccard/fuzzy-inverted-index-ulist-jaccard.2.update.aql
deleted file mode 100644
index 0deeabc..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ulist-jaccard/fuzzy-inverted-index-ulist-jaccard.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset Customers
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/semistructured/co1k/customer.adm"),("format"="adm"));
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ulist-jaccard/fuzzy-inverted-index-ulist-jaccard.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ulist-jaccard/fuzzy-inverted-index-ulist-jaccard.3.query.aql
deleted file mode 100644
index 27a838ba..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-ulist-jaccard/fuzzy-inverted-index-ulist-jaccard.3.query.aql
+++ /dev/null
@@ -1,6 +0,0 @@
-use dataverse test;
-
-for $c in dataset('Customers')
-let $jacc := similarity-jaccard-check($c.interests, ["databases", "computers", "wine"], 0.7f)
-where $jacc[0]
-return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-contains/fuzzy-inverted-index-word-contains.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-contains/fuzzy-inverted-index-word-contains.1.ddl.aql
deleted file mode 100644
index 326b264..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-contains/fuzzy-inverted-index-word-contains.1.ddl.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create nodegroup group1 if not exists on nc1, nc2;
-
-create dataset DBLP(DBLPType)
- primary key id on group1;
-
-create index keyword_index on DBLP(title) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-contains/fuzzy-inverted-index-word-contains.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-contains/fuzzy-inverted-index-word-contains.2.update.aql
deleted file mode 100644
index 830e08a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-contains/fuzzy-inverted-index-word-contains.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset DBLP
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-contains/fuzzy-inverted-index-word-contains.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-contains/fuzzy-inverted-index-word-contains.3.query.aql
deleted file mode 100644
index d6de89d..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-contains/fuzzy-inverted-index-word-contains.3.query.aql
+++ /dev/null
@@ -1,6 +0,0 @@
-use dataverse test;
-
-for $o in dataset('DBLP')
-where contains($o.title, "Multimedia")
-order by $o.id
-return $o
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-jaccard/fuzzy-inverted-index-word-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-jaccard/fuzzy-inverted-index-word-jaccard.1.ddl.aql
deleted file mode 100644
index 326b264..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-jaccard/fuzzy-inverted-index-word-jaccard.1.ddl.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type DBLPType as closed {
- id: int32,
- dblpid: string,
- title: string,
- authors: string,
- misc: string
-}
-
-create nodegroup group1 if not exists on nc1, nc2;
-
-create dataset DBLP(DBLPType)
- primary key id on group1;
-
-create index keyword_index on DBLP(title) type fuzzy keyword;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-jaccard/fuzzy-inverted-index-word-jaccard.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-jaccard/fuzzy-inverted-index-word-jaccard.2.update.aql
deleted file mode 100644
index 830e08a..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-jaccard/fuzzy-inverted-index-word-jaccard.2.update.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse test;
-
-load dataset DBLP
-using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-jaccard/fuzzy-inverted-index-word-jaccard.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-jaccard/fuzzy-inverted-index-word-jaccard.3.query.aql
deleted file mode 100644
index 7ce908c..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/fuzzy-inverted-index-word-jaccard/fuzzy-inverted-index-word-jaccard.3.query.aql
+++ /dev/null
@@ -1,7 +0,0 @@
-use dataverse test;
-
-for $o in dataset('DBLP')
-let $jacc := similarity-jaccard-check(word-tokens($o.title), word-tokens("Transactions for Cooperative Environments"), 0.5f)
-where $jacc[0]
-return $o
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql
index 5d9ad67..dc18182 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql
@@ -1,4 +1,5 @@
use dataverse test;
+set import-private-functions 'true';
for $o in dataset('DBLP')
let $jacc := similarity-jaccard-check(gram-tokens($o.title, 3, false), gram-tokens("Transactions for Cooperative Environments", 3, false), 0.5f)
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/caret0/caret0.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/caret0/caret0.1.ddl.aql
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/caret0/caret0.1.ddl.aql
@@ -0,0 +1,2 @@
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/caret0/caret0.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/caret0/caret0.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/caret0/caret0.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/caret0/caret0.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/caret0/caret0.3.query.aql
new file mode 100644
index 0000000..825b269
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/caret0/caret0.3.query.aql
@@ -0,0 +1,5 @@
+let $n1 := 2.0
+let $n2 := 4096.0
+let $n3 := 3
+let $n4 := 2
+return { "c1": $n1^$n2, "c2": $n2^$n1, "c3": $n3^$n4 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/query-issue355/query-issue355.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/query-issue355/query-issue355.1.ddl.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/query-issue355/query-issue355.1.ddl.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/query-issue355/query-issue355.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/query-issue355/query-issue355.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/query-issue355/query-issue355.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/query-issue355/query-issue355.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/query-issue355/query-issue355.3.query.aql
new file mode 100644
index 0000000..599bc16
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/query-issue355/query-issue355.3.query.aql
@@ -0,0 +1,3 @@
+for $a in [{"name":"Bob","age":10,"sex":"Male"},{"name":"John","age":45,"sex":"Female"},{"name":"Raj","age":35,"sex":"Male"}]
+where string-length($a.name) > -10000000000000000000
+return [$a.age, string-equal(lowercase($a.name), "john")]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue258/query-issue258.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue258/query-issue258.1.ddl.aql
new file mode 100644
index 0000000..5b219b5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue258/query-issue258.1.ddl.aql
@@ -0,0 +1,18 @@
+/*
+ * Description : This test case is to verify the fix for issue258
+ : https://code.google.com/p/asterixdb/issues/detail?id=258
+ * Expected Res : Success
+ * Date : 21 May 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test if not exists;
+use dataverse test;
+
+create type t1 as closed {
+id:int32
+};
+
+
+create dataset ds1(t1) primary key id;
+create dataset ds2(t1) primary key id;
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue258/query-issue258.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue258/query-issue258.2.update.aql
new file mode 100644
index 0000000..fb334ad
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue258/query-issue258.2.update.aql
@@ -0,0 +1,20 @@
+/*
+ * Description : This test case is to verify the fix for issue258
+ : https://code.google.com/p/asterixdb/issues/detail?id=258
+ * Expected Res : Success
+ * Date : 21 May 2013
+ */
+
+use dataverse test;
+
+insert into dataset ds1(
+let $L:=
+ for $x in dataset('ds2')
+ where $x.id = 10
+ return $x
+return
+ if (count($L) <= 0) then
+ {"id": 10}
+ else
+ {"id": 5}
+);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue258/query-issue258.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue258/query-issue258.3.query.aql
new file mode 100644
index 0000000..fff488a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue258/query-issue258.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : This test case is to verify the fix for issue258
+ : https://code.google.com/p/asterixdb/issues/detail?id=258
+ * Expected Res : Success
+ * Date : 21 May 2013
+ */
+
+use dataverse test;
+
+for $d in dataset ds1
+return $d;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue377/query-issue377.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue377/query-issue377.3.query.aql
index 81d6cf6..02ff97d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue377/query-issue377.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue377/query-issue377.3.query.aql
@@ -11,6 +11,7 @@
set simthreshold "3";
for $fbu in dataset FacebookUsers
+order by $fbu.id
return {
"id": $fbu.id,
"name": $fbu.name,
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue423/query-issue423.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue423/query-issue423.1.ddl.aql
new file mode 100644
index 0000000..05eb126
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue423/query-issue423.1.ddl.aql
@@ -0,0 +1,8 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as open { id : int32 ,fname:string, lname:string}
+
+create dataset t2(TestType) primary key fname,lname;
+create dataset t1(TestType) primary key fname,lname;
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue423/query-issue423.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue423/query-issue423.2.update.aql
new file mode 100644
index 0000000..71904f1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue423/query-issue423.2.update.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+insert into dataset t1({"id":123,"fname":"John","lname":"Doe"});
+insert into dataset t1({"id":122,"fname":"Bruce","lname":"Li"});
+insert into dataset t2({"id":23,"fname":"John","lname":"Doe"});
+insert into dataset t2({"id":24,"fname":"Ravi","lname":"Khanna"});
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue423/query-issue423.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue423/query-issue423.3.query.aql
new file mode 100644
index 0000000..a07b185
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue423/query-issue423.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $l in dataset t1
+for $m in dataset t2
+ where $l.name=$m.name
+return {"l":$l,"m":$m};
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue442/query-issue442.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue442/query-issue442.1.ddl.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue442/query-issue442.1.ddl.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue442/query-issue442.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue442/query-issue442.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue442/query-issue442.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue442/query-issue442.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue442/query-issue442.3.query.aql
new file mode 100644
index 0000000..4da91be
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue442/query-issue442.3.query.aql
@@ -0,0 +1,10 @@
+/*
+ * Description : This test case is to verify the fix for issue442
+ : https://code.google.com/p/asterixdb/issues/detail?id=442
+ * Expected Res : Fail
+ * Date : 22th May 2013
+ */
+
+for $a in [ {"f" : 100} , {"f" : 0}, {"f" : -1}, {"f" : null}, {"f" : 999999}, {"f" : 1} , {"f" : "zzzzz"}]
+order by $a.f desc
+return $a
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453-2/query-issue453-2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453-2/query-issue453-2.1.ddl.aql
new file mode 100644
index 0000000..6fcce66
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453-2/query-issue453-2.1.ddl.aql
@@ -0,0 +1,20 @@
+/*
+ * Description : This test case is to verify the fix for issue453
+ : https://code.google.com/p/asterixdb/issues/detail?id=453
+ * Expected Res : SUCCESS
+ * Date : 18th May 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TypeOpen as open {
+ id : int32,
+ int_m : int32,
+ int_o : int32?,
+ string_m : string,
+ string_o : string?
+};
+
+create dataset DataOpen(TypeOpen) primary key id;
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453-2/query-issue453-2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453-2/query-issue453-2.2.update.aql
new file mode 100644
index 0000000..2682e84
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453-2/query-issue453-2.2.update.aql
@@ -0,0 +1,27 @@
+/*
+ * Description : This test case is to verify the fix for issue453
+ : https://code.google.com/p/asterixdb/issues/detail?id=453
+ * Expected Res : SUCCESS
+ * Date : 18th May 2013
+ */
+
+use dataverse test;
+
+insert into dataset DataOpen(
+ for $arr at $pos in (
+ for $i1 in [1, 2]
+ for $i2 in [1, null]
+ for $s1 in ["a", "b"]
+ for $s2 in ["a", null]
+ return
+ [ $i1, $i2, $s1, $s2]
+ )
+ return
+ {
+ "id" : $pos,
+ "int_m" : $arr[0],
+ "int_o" : $arr[1],
+ "string_m" : $arr[2],
+ "string_o" : $arr[3]
+ }
+ )
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453-2/query-issue453-2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453-2/query-issue453-2.3.query.aql
new file mode 100644
index 0000000..1381365
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453-2/query-issue453-2.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : This test case is to verify the fix for issue453
+ : https://code.google.com/p/asterixdb/issues/detail?id=453
+ * Expected Res : SUCCESS
+ * Date : 18th May 2013
+ */
+
+use dataverse test;
+
+for $d in dataset DataOpen
+order by $d.id
+return $d
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453/query-issue453.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453/query-issue453.1.ddl.aql
new file mode 100644
index 0000000..6fcce66
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453/query-issue453.1.ddl.aql
@@ -0,0 +1,20 @@
+/*
+ * Description : This test case is to verify the fix for issue453
+ : https://code.google.com/p/asterixdb/issues/detail?id=453
+ * Expected Res : SUCCESS
+ * Date : 18th May 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TypeOpen as open {
+ id : int32,
+ int_m : int32,
+ int_o : int32?,
+ string_m : string,
+ string_o : string?
+};
+
+create dataset DataOpen(TypeOpen) primary key id;
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453/query-issue453.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453/query-issue453.2.update.aql
new file mode 100644
index 0000000..3346f52
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453/query-issue453.2.update.aql
@@ -0,0 +1,16 @@
+/*
+ * Description : This test case is to verify the fix for issue453
+ : https://code.google.com/p/asterixdb/issues/detail?id=453
+ * Expected Res : SUCCESS
+ * Date : 18th May 2013
+ */
+
+use dataverse test;
+
+insert into dataset DataOpen(
+ for $o in {{
+ { "id": 0, "int_m": 1, "int_o": 1, "string_m": "a", "string_o": "a" },
+ { "id": 1, "int_m": 1, "int_o": 1, "string_m": "a", "string_o": null }
+ }}
+ return $o
+)
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453/query-issue453.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453/query-issue453.3.query.aql
new file mode 100644
index 0000000..1381365
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue453/query-issue453.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : This test case is to verify the fix for issue453
+ : https://code.google.com/p/asterixdb/issues/detail?id=453
+ * Expected Res : SUCCESS
+ * Date : 18th May 2013
+ */
+
+use dataverse test;
+
+for $d in dataset DataOpen
+order by $d.id
+return $d
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue487/query-issue487.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue487/query-issue487.1.ddl.aql
new file mode 100644
index 0000000..4d74b83
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue487/query-issue487.1.ddl.aql
@@ -0,0 +1,18 @@
+/*
+ * Description : This test case is to verify the fix for issue487
+ : https://code.google.com/p/asterixdb/issues/detail?id=487
+ * Expected Res : FAIL
+ * Date : 30th May 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type EmpType as open {
+id : int32,
+name : string
+}
+
+create dataset Employee(EmpType) primary key id;
+
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue487/query-issue487.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue487/query-issue487.2.update.aql
new file mode 100644
index 0000000..6913b4f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue487/query-issue487.2.update.aql
@@ -0,0 +1,10 @@
+/*
+ * Description : This test case is to verify the fix for issue487
+ : https://code.google.com/p/asterixdb/issues/detail?id=487
+ * Expected Res : FAIL
+ * Date : 30th May 2013
+ */
+
+use dataverse test;
+
+insert into dataset Employee ({ "id":123});
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue487/query-issue487.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue487/query-issue487.3.query.aql
new file mode 100644
index 0000000..d53aba9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue487/query-issue487.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : This test case is to verify the fix for issue487
+ : https://code.google.com/p/asterixdb/issues/detail?id=487
+ * Expected Res : FAIL
+ * Date : 30th May 2013
+ */
+
+use dataverse test;
+
+for $l in dataset Employee
+return $l;
+
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/create-rtree-index/create-rtree-index.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/create-rtree-index/create-rtree-index.3.query.aql
index 53b1c30..515acc0 100644
--- a/asterix-app/src/test/resources/runtimets/queries/spatial/create-rtree-index/create-rtree-index.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/create-rtree-index/create-rtree-index.3.query.aql
@@ -6,4 +6,5 @@
use dataverse test;
for $a in dataset('MyData')
+order by $a.id
return $a.id
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/string-to-codepoint2/string-to-codepoint2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/string-to-codepoint2/string-to-codepoint2.1.ddl.aql
new file mode 100644
index 0000000..754ea81
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/string-to-codepoint2/string-to-codepoint2.1.ddl.aql
@@ -0,0 +1,3 @@
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/string-to-codepoint2/string-to-codepoint2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/string-to-codepoint2/string-to-codepoint2.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/string-to-codepoint2/string-to-codepoint2.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/string-to-codepoint2/string-to-codepoint2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/string-to-codepoint2/string-to-codepoint2.3.query.aql
new file mode 100644
index 0000000..88f0dfa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/string-to-codepoint2/string-to-codepoint2.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+let $x := "欢迎"
+let $c := string-to-codepoint($x)
+
+return {"result1": $c}
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.1.ddl.aql
new file mode 100644
index 0000000..a6af75e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.1.ddl.aql
@@ -0,0 +1,44 @@
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+ screen-name: string,
+ lang: string,
+ friends_count: int32,
+ statuses_count: int32,
+ name: string,
+ followers_count: int32
+}
+
+create type TweetMessageType as closed {
+ tweetid: string,
+ user: TwitterUserType,
+ sender-location: point?,
+ send-time: datetime,
+ referred-topics: {{ string }},
+ message-text: string
+}
+
+create type EmploymentType as open {
+ organization-name: string,
+ start-date: date,
+ end-date: date?
+}
+
+create type FacebookUserType as closed {
+ id: int32,
+ alias: string,
+ name: string,
+ user-since: datetime,
+ friend-ids: {{ int32 }},
+ employment: [EmploymentType]
+}
+
+create type FacebookMessageType as closed {
+ message-id: int32,
+ author-id: int32,
+ in-response-to: int32?,
+ sender-location: point?,
+ message: string
+}
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.10.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.10.query.aql
new file mode 100644
index 0000000..24da0fb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.10.query.aql
@@ -0,0 +1,15 @@
+/**
+* Query 4 - Theta Join
+*/
+
+use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+order by $t.message-text
+return {
+"message": $t.message-text,
+"nearby-messages": for $t2 in dataset TweetMessages
+ where spatial-distance($t.sender-location, $t2.sender-location) <= 1
+ order by $t2.message-text
+ return { "msgtxt":$t2.message-text}
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.11.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.11.query.aql
new file mode 100644
index 0000000..5f428cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.11.query.aql
@@ -0,0 +1,22 @@
+/**
+* Query 5 - Fuzzy Join
+*/
+
+use dataverse TinySocial;
+
+set simfunction "edit-distance";
+set simthreshold "3";
+
+for $fbu in dataset FacebookUsers
+order by $fbu.id
+return {
+ "id": $fbu.id,
+ "name": $fbu.name,
+ "similar-users": for $t in dataset TweetMessages
+ let $tu := $t.user
+ where $tu.name ~= $fbu.name
+ return {
+ "twitter-screenname": $tu.screen-name,
+ "twitter-name": $tu.name
+ }
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.12.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.12.query.aql
new file mode 100644
index 0000000..869b4ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.12.query.aql
@@ -0,0 +1,10 @@
+/**
+* Query 6 - Existential Quantification
+*/
+
+use dataverse TinySocial;
+
+for $fbu in dataset FacebookUsers
+where (some $e in $fbu.employment satisfies is-null($e.end-date))
+order by $fbu.id
+return $fbu;
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.13.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.13.query.aql
new file mode 100644
index 0000000..056cf9a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.13.query.aql
@@ -0,0 +1,11 @@
+/**
+* Query 7 - Universal Quantification
+*/
+
+use dataverse TinySocial;
+
+
+for $fbu in dataset FacebookUsers
+where (every $e in $fbu.employment satisfies not(is-null($e.end-date)))
+order by $fbu.id
+return $fbu;
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.14.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.14.query.aql
new file mode 100644
index 0000000..5593669
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.14.query.aql
@@ -0,0 +1,7 @@
+/**
+* Query 8 - Simple Aggregation
+*/
+
+use dataverse TinySocial;
+
+count(for $fbu in dataset FacebookUsers return $fbu);
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.15.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.15.query.aql
new file mode 100644
index 0000000..2b45b00
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.15.query.aql
@@ -0,0 +1,13 @@
+/**
+* Query 9-A - Grouping and Aggregation
+*/
+
+use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+group by $uid := $t.user.screen-name with $t
+order by $uid
+return {
+"user": $uid,
+"count": count($t)
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.16.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.16.query.aql
new file mode 100644
index 0000000..22c1e50
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.16.query.aql
@@ -0,0 +1,14 @@
+/**
+* Query 9-B - (Hash-Based) Grouping and Aggregation
+*/
+
+use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+/*+ hash*/
+group by $uid := $t.user.screen-name with $t
+order by $uid
+return {
+"user": $uid,
+"count": count($t)
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.17.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.17.query.aql
new file mode 100644
index 0000000..9b88ac4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.17.query.aql
@@ -0,0 +1,15 @@
+/**
+* Query 10 - Grouping and Limits
+*/
+
+use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+group by $uid := $t.user.screen-name with $t
+let $c := count($t)
+order by $c desc
+limit 3
+return {
+ "user": $uid,
+ "count": $c
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.18.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.18.query.aql
new file mode 100644
index 0000000..2d69ba2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.18.query.aql
@@ -0,0 +1,19 @@
+/**
+* Query 11 - Left Outer Fuzzy Join
+*/
+
+use dataverse TinySocial;
+
+set simfunction "jaccard";
+set simthreshold "0.3";
+
+for $t in dataset TweetMessages
+order by $t.tweetid
+return {
+ "tweet": $t,
+ "similar-tweets": for $t2 in dataset TweetMessages
+ where $t2.referred-topics ~= $t.referred-topics
+ and $t2.tweetid != $t.tweetid
+ order by $t2.tweetid
+ return $t2.referred-topics
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.19.update.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.19.update.aql
new file mode 100644
index 0000000..2a6fd83
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.19.update.aql
@@ -0,0 +1,23 @@
+/**
+* Inserting New Data
+*/
+
+use dataverse TinySocial;
+
+insert into dataset TweetMessages
+(
+ {"tweetid":"13",
+ "user":
+ {"screen-name":"NathanGiesen@211",
+ "lang":"en",
+ "friends_count":39345,
+ "statuses_count":479,
+ "name":"Nathan Giesen",
+ "followers_count":49420
+ },
+ "sender-location":point("47.44,80.65"),
+ "send-time":datetime("2008-04-26T10:10:35"),
+ "referred-topics":{{"tweeting"}},
+ "message-text":"tweety tweet, my fellow tweeters!"
+ }
+);
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.2.ddl.aql
new file mode 100644
index 0000000..1fcc52e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.2.ddl.aql
@@ -0,0 +1,19 @@
+use dataverse TinySocial;
+
+create dataset FacebookUsers(FacebookUserType)
+primary key id;
+
+create dataset FacebookMessages(FacebookMessageType)
+primary key message-id;
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid
+hints(cardinality=100);
+
+create index fbUserSinceIdx on FacebookUsers(user-since);
+create index fbAuthorIdx on FacebookMessages(author-id) type btree;
+create index fbSenderLocIndex on FacebookMessages(sender-location) type rtree;
+create index fbMessageIdx on FacebookMessages(message) type keyword;
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.20.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.20.query.aql
new file mode 100644
index 0000000..ee7bb3f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.20.query.aql
@@ -0,0 +1,9 @@
+/**
+* Inserting New Data - Verification
+*/
+
+use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+order by $t.tweetid
+return $t
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.21.update.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.21.update.aql
new file mode 100644
index 0000000..a8912cc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.21.update.aql
@@ -0,0 +1,7 @@
+/**
+* Deleting Existing Data
+*/
+
+use dataverse TinySocial;
+
+delete $tm from dataset TweetMessages where $tm.tweetid = "13";
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.22.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.22.query.aql
new file mode 100644
index 0000000..395b7c1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.22.query.aql
@@ -0,0 +1,11 @@
+/**
+* Deleting Existing Data - Verification
+*/
+
+use dataverse TinySocial;
+
+count(
+for $t in dataset TweetMessages
+where $t.tweetid = "13"
+return $t
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.3.update.aql
new file mode 100644
index 0000000..92db8a1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.3.update.aql
@@ -0,0 +1,13 @@
+use dataverse TinySocial;
+
+load dataset FacebookUsers using localfs
+(("path"="nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load dataset FacebookMessages using localfs
+(("path"="nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load dataset TwitterUsers using localfs
+(("path"="nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load dataset TweetMessages using localfs
+(("path"="nc1://data/tinysocial/twm.adm"),("format"="adm"));
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.4.query.aql
new file mode 100644
index 0000000..0bf0d89
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.4.query.aql
@@ -0,0 +1,9 @@
+/**
+* Query 0-A - Exact-Match Lookup
+*/
+
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.id = 8
+return $user;
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.5.query.aql
new file mode 100644
index 0000000..a7b40de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.5.query.aql
@@ -0,0 +1,10 @@
+/**
+* Query 0-B - Range Scan
+*/
+
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.id >= 2 and $user.id <= 4
+order by $user.id
+return $user;
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.6.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.6.query.aql
new file mode 100644
index 0000000..40234f6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.6.query.aql
@@ -0,0 +1,11 @@
+/**
+* Query 1 - Other Query Filters
+*/
+
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.user-since >= datetime('2010-07-22T00:00:00')
+ and $user.user-since <= datetime('2012-07-29T23:59:59')
+order by $user.id
+return $user;
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.7.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.7.query.aql
new file mode 100644
index 0000000..98112ae
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.7.query.aql
@@ -0,0 +1,14 @@
+/**
+* Query 2-A - Equijoin
+*/
+
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+for $message in dataset FacebookMessages
+where $message.author-id = $user.id
+order by $user.name,$message.message-id
+return {
+"uname": $user.name,
+"message": $message.message
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.8.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.8.query.aql
new file mode 100644
index 0000000..e274571
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.8.query.aql
@@ -0,0 +1,14 @@
+/**
+* Query 2-B - Index join
+*/
+
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+for $message in dataset FacebookMessages
+where $message.author-id /*+ indexnl */ = $user.id
+order by $user.name,$message.message-id
+return {
+"uname": $user.name,
+"message": $message.message
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.9.query.aql b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.9.query.aql
new file mode 100644
index 0000000..c4e70c6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/tinysocial/tinysocial-suite/tinysocial-suite.9.query.aql
@@ -0,0 +1,15 @@
+/**
+* Query 3 - Nested Outer Join
+*/
+
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+order by $user.name
+return {
+"uname": $user.name,
+"messages": for $message in dataset FacebookMessages
+ where $message.author-id = $user.id
+ order by $message.message-id
+ return $message.message
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries/tpch/q15_top_supplier/q15_top_supplier.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/tpch/q15_top_supplier/q15_top_supplier.3.query.aql
index f61ceb5..9f1080d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/tpch/q15_top_supplier/q15_top_supplier.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/tpch/q15_top_supplier/q15_top_supplier.3.query.aql
@@ -17,7 +17,7 @@
for $s in dataset('Supplier')
for $r in revenue()
- where $s.s_suppkey = $r.supplier_no and $r.total_revenue=$m
+ where $s.s_suppkey = $r.supplier_no and $r.total_revenue<$m+0.000000001 and $r.total_revenue>$m-0.000000001
return {
"s_suppkey": $s.s_suppkey,
"s_name": $s.s_name,
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf27/udf27.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf27/udf27.3.query.aql
index 50a1cb2..fd383cf 100644
--- a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf27/udf27.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf27/udf27.3.query.aql
@@ -10,4 +10,4 @@
use dataverse test;
let $a := true
-return some $i in [100,200] satisfies test.f1()
+return some $i in [100,200] satisfies $i<test.f1()
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf30/udf30.1.query.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf30/udf30.1.query.aql
new file mode 100644
index 0000000..ffe6981
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf30/udf30.1.query.aql
@@ -0,0 +1,14 @@
+/*
+ * Description : Declare a UDF and try to use the function parameter outside
+ * of the function.
+ * Expected Res : Failure
+ * Date : Apr 10th 2013
+ */
+
+declare function abc($y) {
+ let $x:=3
+ return $x
+};
+
+let $z:=$y
+return $z
diff --git a/asterix-app/src/test/resources/runtimets/results/distinct/query-issue443-2/query-issue443.1.adm b/asterix-app/src/test/resources/runtimets/results/distinct/query-issue443-2/query-issue443.1.adm
new file mode 100644
index 0000000..1a6e796
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/distinct/query-issue443-2/query-issue443.1.adm
@@ -0,0 +1,4 @@
+{ "f": 10, "g": 1 }
+{ "f": 12, "g": 4 }
+{ "f": 17, "g": 1 }
+{ "f": 19, "g": 1 }
diff --git a/asterix-app/src/test/resources/runtimets/results/distinct/query-issue443/query-issue443.1.adm b/asterix-app/src/test/resources/runtimets/results/distinct/query-issue443/query-issue443.1.adm
new file mode 100644
index 0000000..a4a6e48
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/distinct/query-issue443/query-issue443.1.adm
@@ -0,0 +1,4 @@
+{ "f": 10 }
+{ "f": 12 }
+{ "f": 17 }
+{ "f": 19 }
diff --git a/asterix-app/src/test/resources/runtimets/results/fuzzyjoin/opentype/opentype.1.adm b/asterix-app/src/test/resources/runtimets/results/fuzzyjoin/opentype/opentype.1.adm
new file mode 100644
index 0000000..ae0c4cb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/fuzzyjoin/opentype/opentype.1.adm
@@ -0,0 +1,12 @@
+{ "tweet": { "tweetid": "1", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("47.44,80.65"), "send-time": datetime("2008-04-26T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "customization" }}, "message-text": " love t-mobile its customization is good:)" }, "similar-tweets": [ {{ "t-mobile", "shortcut-menu" }} ] }
+{ "tweet": { "tweetid": "10", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("29.15,76.53"), "send-time": datetime("2008-01-26T10:10:00.000Z"), "referred-topics": {{ "verizon", "voice-clarity" }}, "message-text": " hate verizon its voice-clarity is OMG:(" }, "similar-tweets": [ {{ "verizon", "shortcut-menu" }}, {{ "iphone", "voice-clarity" }}, {{ "verizon", "voicemail-service" }} ] }
+{ "tweet": { "tweetid": "11", "user": { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }, "sender-location": point("37.59,68.42"), "send-time": datetime("2008-03-09T10:10:00.000Z"), "referred-topics": {{ "iphone", "platform" }}, "message-text": " can't stand iphone its platform is terrible" }, "similar-tweets": [ {{ "iphone", "voice-clarity" }}, {{ "samsung", "platform" }} ] }
+{ "tweet": { "tweetid": "12", "user": { "screen-name": "OliJackson_512", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Oli Jackson", "followers_count": 22649 }, "sender-location": point("24.82,94.63"), "send-time": datetime("2010-02-13T10:10:00.000Z"), "referred-topics": {{ "samsung", "voice-command" }}, "message-text": " like samsung the voice-command is amazing:)" }, "similar-tweets": [ {{ "sprint", "voice-command" }}, {{ "samsung", "platform" }} ] }
+{ "tweet": { "tweetid": "2", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("32.84,67.14"), "send-time": datetime("2010-05-13T10:10:00.000Z"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" }, "similar-tweets": [ {{ "verizon", "voice-clarity" }}, {{ "t-mobile", "shortcut-menu" }}, {{ "verizon", "voicemail-service" }} ] }
+{ "tweet": { "tweetid": "3", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("29.72,75.8"), "send-time": datetime("2006-11-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " like motorola the speed is good:)" }, "similar-tweets": [ {{ "motorola", "speed" }} ] }
+{ "tweet": { "tweetid": "4", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("39.28,70.48"), "send-time": datetime("2011-12-26T10:10:00.000Z"), "referred-topics": {{ "sprint", "voice-command" }}, "message-text": " like sprint the voice-command is mind-blowing:)" }, "similar-tweets": [ {{ "samsung", "voice-command" }} ] }
+{ "tweet": { "tweetid": "5", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("40.09,92.69"), "send-time": datetime("2006-08-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " can't stand motorola its speed is terrible:(" }, "similar-tweets": [ {{ "motorola", "speed" }} ] }
+{ "tweet": { "tweetid": "6", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("47.51,83.99"), "send-time": datetime("2010-05-07T10:10:00.000Z"), "referred-topics": {{ "iphone", "voice-clarity" }}, "message-text": " like iphone the voice-clarity is good:)" }, "similar-tweets": [ {{ "verizon", "voice-clarity" }}, {{ "iphone", "platform" }} ] }
+{ "tweet": { "tweetid": "7", "user": { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }, "sender-location": point("36.21,72.6"), "send-time": datetime("2011-08-25T10:10:00.000Z"), "referred-topics": {{ "samsung", "platform" }}, "message-text": " like samsung the platform is good" }, "similar-tweets": [ {{ "iphone", "platform" }}, {{ "samsung", "voice-command" }} ] }
+{ "tweet": { "tweetid": "8", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("46.05,93.34"), "send-time": datetime("2005-10-14T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "shortcut-menu" }}, "message-text": " like t-mobile the shortcut-menu is awesome:)" }, "similar-tweets": [ {{ "t-mobile", "customization" }}, {{ "verizon", "shortcut-menu" }} ] }
+{ "tweet": { "tweetid": "9", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("36.86,74.62"), "send-time": datetime("2012-07-21T10:10:00.000Z"), "referred-topics": {{ "verizon", "voicemail-service" }}, "message-text": " love verizon its voicemail-service is awesome" }, "similar-tweets": [ {{ "verizon", "voice-clarity" }}, {{ "verizon", "shortcut-menu" }} ] }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/caret0/caret0.1.adm b/asterix-app/src/test/resources/runtimets/results/numeric/caret0/caret0.1.adm
new file mode 100644
index 0000000..1edec8a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/caret0/caret0.1.adm
@@ -0,0 +1 @@
+{ "c1": Infinityd, "c2": 1.6777216E7d, "c3": 9 }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/query-issue355/query-issue355.1.adm b/asterix-app/src/test/resources/runtimets/results/numeric/query-issue355/query-issue355.1.adm
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/query-issue355/query-issue355.1.adm
@@ -0,0 +1 @@
+
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue258/query-issue258.1.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue258/query-issue258.1.adm
new file mode 100644
index 0000000..0e739c3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue258/query-issue258.1.adm
@@ -0,0 +1 @@
+{ "id": 10 }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue377/query-issue377.1.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue377/query-issue377.1.adm
index c3bb80f..1a7caf5 100644
--- a/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue377/query-issue377.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue377/query-issue377.1.adm
@@ -1,23 +1,18 @@
{ "id": 9142198, "similar-users": [ ], "name": "SherryFea" }
{ "id": 9313492, "similar-users": [ ], "name": "TeraWolfe" }
{ "id": 9478720, "similar-users": [ ], "name": "AngeliaKettlewell" }
-{ "id": 10001080, "similar-users": [ ], "name": "GarrettBode" }
-{ "id": 10179538, "similar-users": [ ], "name": "OrlandoBaxter" }
-{ "id": 10307032, "similar-users": [ ], "name": "QuentinSauter" }
-{ "id": 10394488, "similar-users": [ ], "name": "OswaldRay" }
-{ "id": 10423588, "similar-users": [ ], "name": "ShirleneRuch" }
-{ "id": 10495420, "similar-users": [ ], "name": "WendyMcloskey" }
-{ "id": 11307946, "similar-users": [ ], "name": "HelgaStough" }
-{ "id": 11447332, "similar-users": [ ], "name": "SherisseMaugham" }
-{ "id": 11570326, "similar-users": [ ], "name": "LindenFilby" }
-{ "id": 11951098, "similar-users": [ ], "name": "TeraByers" }
-{ "id": 11954992, "similar-users": [ ], "name": "CaitlinLangston" }
{ "id": 9510451, "similar-users": [ ], "name": "ChuckFinck" }
{ "id": 9594523, "similar-users": [ ], "name": "TamWillcox" }
{ "id": 9629395, "similar-users": [ ], "name": "JuliusWire" }
{ "id": 9988417, "similar-users": [ ], "name": "ColineLane" }
+{ "id": 10001080, "similar-users": [ ], "name": "GarrettBode" }
+{ "id": 10179538, "similar-users": [ ], "name": "OrlandoBaxter" }
{ "id": 10272571, "similar-users": [ ], "name": "JarrettGoldvogel" }
+{ "id": 10307032, "similar-users": [ ], "name": "QuentinSauter" }
{ "id": 10361965, "similar-users": [ ], "name": "ArlenFlick" }
+{ "id": 10394488, "similar-users": [ ], "name": "OswaldRay" }
+{ "id": 10423588, "similar-users": [ ], "name": "ShirleneRuch" }
+{ "id": 10495420, "similar-users": [ ], "name": "WendyMcloskey" }
{ "id": 10498285, "similar-users": [ ], "name": "KileyBridger" }
{ "id": 10733617, "similar-users": [ ], "name": "LeonardoKight" }
{ "id": 10874791, "similar-users": [ ], "name": "HaydeeGarratt" }
@@ -25,5 +20,10 @@
{ "id": 11061631, "similar-users": [ ], "name": "MaxeneKellogg" }
{ "id": 11068231, "similar-users": [ ], "name": "DinahSwink" }
{ "id": 11140213, "similar-users": [ ], "name": "MontgomeryWhittier" }
+{ "id": 11307946, "similar-users": [ ], "name": "HelgaStough" }
{ "id": 11381089, "similar-users": [ ], "name": "EarleneAmmons" }
+{ "id": 11447332, "similar-users": [ ], "name": "SherisseMaugham" }
+{ "id": 11570326, "similar-users": [ ], "name": "LindenFilby" }
{ "id": 11675221, "similar-users": [ ], "name": "CalantheGearhart" }
+{ "id": 11951098, "similar-users": [ ], "name": "TeraByers" }
+{ "id": 11954992, "similar-users": [ ], "name": "CaitlinLangston" }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue423/query-issue423.1.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue423/query-issue423.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue423/query-issue423.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue442/query-issue442.1.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue442/query-issue442.1.adm
new file mode 100644
index 0000000..e34c554
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue442/query-issue442.1.adm
@@ -0,0 +1,7 @@
+{ "f": "zzzzz" }
+{ "f": 999999 }
+{ "f": 100 }
+{ "f": 1 }
+{ "f": 0 }
+{ "f": -1 }
+{ "f": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue453-2/query-issue453-2.1.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue453-2/query-issue453-2.1.adm
new file mode 100644
index 0000000..b573845
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue453-2/query-issue453-2.1.adm
@@ -0,0 +1,16 @@
+{ "id": 0, "int_m": 1, "int_o": 1, "string_m": "a", "string_o": "a" }
+{ "id": 1, "int_m": 1, "int_o": 1, "string_m": "a", "string_o": null }
+{ "id": 2, "int_m": 1, "int_o": 1, "string_m": "b", "string_o": "a" }
+{ "id": 3, "int_m": 1, "int_o": 1, "string_m": "b", "string_o": null }
+{ "id": 4, "int_m": 1, "int_o": null, "string_m": "a", "string_o": "a" }
+{ "id": 5, "int_m": 1, "int_o": null, "string_m": "a", "string_o": null }
+{ "id": 6, "int_m": 1, "int_o": null, "string_m": "b", "string_o": "a" }
+{ "id": 7, "int_m": 1, "int_o": null, "string_m": "b", "string_o": null }
+{ "id": 8, "int_m": 2, "int_o": 1, "string_m": "a", "string_o": "a" }
+{ "id": 9, "int_m": 2, "int_o": 1, "string_m": "a", "string_o": null }
+{ "id": 10, "int_m": 2, "int_o": 1, "string_m": "b", "string_o": "a" }
+{ "id": 11, "int_m": 2, "int_o": 1, "string_m": "b", "string_o": null }
+{ "id": 12, "int_m": 2, "int_o": null, "string_m": "a", "string_o": "a" }
+{ "id": 13, "int_m": 2, "int_o": null, "string_m": "a", "string_o": null }
+{ "id": 14, "int_m": 2, "int_o": null, "string_m": "b", "string_o": "a" }
+{ "id": 15, "int_m": 2, "int_o": null, "string_m": "b", "string_o": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue453/query-issue453.1.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue453/query-issue453.1.adm
new file mode 100644
index 0000000..c076685
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue453/query-issue453.1.adm
@@ -0,0 +1,2 @@
+{ "id": 0, "int_m": 1, "int_o": 1, "string_m": "a", "string_o": "a" }
+{ "id": 1, "int_m": 1, "int_o": 1, "string_m": "a", "string_o": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue487/query-issue487.1.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue487/query-issue487.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/query-issue487/query-issue487.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/spatial/create-rtree-index/create-rtree-index.1.adm b/asterix-app/src/test/resources/runtimets/results/spatial/create-rtree-index/create-rtree-index.1.adm
index b9c6dc7..d4de868 100644
--- a/asterix-app/src/test/resources/runtimets/results/spatial/create-rtree-index/create-rtree-index.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/spatial/create-rtree-index/create-rtree-index.1.adm
@@ -1,21 +1,21 @@
-2
-4
-6
-8
-10
-12
-14
-16
-18
-20
1
+2
3
+4
5
+6
7
+8
9
+10
11
+12
13
+14
15
+16
17
+18
19
+20
21
diff --git a/asterix-app/src/test/resources/runtimets/results/string/string-to-codepoint2/string-to-codepoint2.1.adm b/asterix-app/src/test/resources/runtimets/results/string/string-to-codepoint2/string-to-codepoint2.1.adm
new file mode 100644
index 0000000..eacdb11
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/string-to-codepoint2/string-to-codepoint2.1.adm
@@ -0,0 +1 @@
+{ "result1": [ 27426, 36814 ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/.tinysocial-suite.5.adm.swp b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/.tinysocial-suite.5.adm.swp
new file mode 100644
index 0000000..e7eb7a1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/.tinysocial-suite.5.adm.swp
Binary files differ
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.10.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.10.adm
new file mode 100644
index 0000000..5451c76
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.10.adm
@@ -0,0 +1,12 @@
+{ "message": " can't stand iphone its platform is terrible", "nearby-messages": [ { "msgtxt": " can't stand iphone its platform is terrible" } ] }
+{ "message": " can't stand motorola its speed is terrible:(", "nearby-messages": [ { "msgtxt": " can't stand motorola its speed is terrible:(" } ] }
+{ "message": " hate verizon its voice-clarity is OMG:(", "nearby-messages": [ { "msgtxt": " hate verizon its voice-clarity is OMG:(" }, { "msgtxt": " like motorola the speed is good:)" } ] }
+{ "message": " like iphone the voice-clarity is good:)", "nearby-messages": [ { "msgtxt": " like iphone the voice-clarity is good:)" } ] }
+{ "message": " like motorola the speed is good:)", "nearby-messages": [ { "msgtxt": " hate verizon its voice-clarity is OMG:(" }, { "msgtxt": " like motorola the speed is good:)" } ] }
+{ "message": " like samsung the platform is good", "nearby-messages": [ { "msgtxt": " like samsung the platform is good" } ] }
+{ "message": " like samsung the voice-command is amazing:)", "nearby-messages": [ { "msgtxt": " like samsung the voice-command is amazing:)" } ] }
+{ "message": " like sprint the voice-command is mind-blowing:)", "nearby-messages": [ { "msgtxt": " like sprint the voice-command is mind-blowing:)" } ] }
+{ "message": " like t-mobile the shortcut-menu is awesome:)", "nearby-messages": [ { "msgtxt": " like t-mobile the shortcut-menu is awesome:)" } ] }
+{ "message": " like verizon its shortcut-menu is awesome:)", "nearby-messages": [ { "msgtxt": " like verizon its shortcut-menu is awesome:)" } ] }
+{ "message": " love t-mobile its customization is good:)", "nearby-messages": [ { "msgtxt": " love t-mobile its customization is good:)" } ] }
+{ "message": " love verizon its voicemail-service is awesome", "nearby-messages": [ { "msgtxt": " love verizon its voicemail-service is awesome" } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.11.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.11.adm
new file mode 100644
index 0000000..a5ec171
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.11.adm
@@ -0,0 +1,10 @@
+{ "id": 1, "name": "MargaritaStoddard", "similar-users": [ ] }
+{ "id": 2, "name": "IsbelDull", "similar-users": [ ] }
+{ "id": 3, "name": "EmoryUnk", "similar-users": [ ] }
+{ "id": 4, "name": "NicholasStroh", "similar-users": [ ] }
+{ "id": 5, "name": "VonKemble", "similar-users": [ ] }
+{ "id": 6, "name": "WillisWynne", "similar-users": [ ] }
+{ "id": 7, "name": "SuzannaTillson", "similar-users": [ ] }
+{ "id": 8, "name": "NilaMilliron", "similar-users": [ { "twitter-screenname": "NilaMilliron_tw", "twitter-name": "Nila Milliron" } ] }
+{ "id": 9, "name": "WoodrowNehling", "similar-users": [ ] }
+{ "id": 10, "name": "BramHatch", "similar-users": [ ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.12.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.12.adm
new file mode 100644
index 0000000..975222c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.12.adm
@@ -0,0 +1,7 @@
+{ "id": 1, "alias": "Margarita", "name": "MargaritaStoddard", "user-since": datetime("2012-08-20T10:10:00.000Z"), "friend-ids": {{ 2, 3, 6, 10 }}, "employment": [ { "organization-name": "Codetechno", "start-date": date("2006-08-06"), "end-date": null } ] }
+{ "id": 2, "alias": "Isbel", "name": "IsbelDull", "user-since": datetime("2011-01-22T10:10:00.000Z"), "friend-ids": {{ 1, 4 }}, "employment": [ { "organization-name": "Hexviafind", "start-date": date("2010-04-27"), "end-date": null } ] }
+{ "id": 4, "alias": "Nicholas", "name": "NicholasStroh", "user-since": datetime("2010-12-27T10:10:00.000Z"), "friend-ids": {{ 2 }}, "employment": [ { "organization-name": "Zamcorporation", "start-date": date("2010-06-08"), "end-date": null } ] }
+{ "id": 5, "alias": "Von", "name": "VonKemble", "user-since": datetime("2010-01-05T10:10:00.000Z"), "friend-ids": {{ 3, 6, 10 }}, "employment": [ { "organization-name": "Kongreen", "start-date": date("2010-11-27"), "end-date": null } ] }
+{ "id": 6, "alias": "Willis", "name": "WillisWynne", "user-since": datetime("2005-01-17T10:10:00.000Z"), "friend-ids": {{ 1, 3, 7 }}, "employment": [ { "organization-name": "jaydax", "start-date": date("2009-05-15"), "end-date": null } ] }
+{ "id": 7, "alias": "Suzanna", "name": "SuzannaTillson", "user-since": datetime("2012-08-07T10:10:00.000Z"), "friend-ids": {{ 6 }}, "employment": [ { "organization-name": "Labzatron", "start-date": date("2011-04-19"), "end-date": null } ] }
+{ "id": 8, "alias": "Nila", "name": "NilaMilliron", "user-since": datetime("2008-01-01T10:10:00.000Z"), "friend-ids": {{ 3 }}, "employment": [ { "organization-name": "Plexlane", "start-date": date("2010-02-28"), "end-date": null } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.13.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.13.adm
new file mode 100644
index 0000000..2df77f6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.13.adm
@@ -0,0 +1,3 @@
+{ "id": 3, "alias": "Emory", "name": "EmoryUnk", "user-since": datetime("2012-07-10T10:10:00.000Z"), "friend-ids": {{ 1, 5, 8, 9 }}, "employment": [ { "organization-name": "geomedia", "start-date": date("2010-06-17"), "end-date": date("2010-01-26") } ] }
+{ "id": 9, "alias": "Woodrow", "name": "WoodrowNehling", "user-since": datetime("2005-09-20T10:10:00.000Z"), "friend-ids": {{ 3, 10 }}, "employment": [ { "organization-name": "Zuncan", "start-date": date("2003-04-22"), "end-date": date("2009-12-13") } ] }
+{ "id": 10, "alias": "Bram", "name": "BramHatch", "user-since": datetime("2010-10-16T10:10:00.000Z"), "friend-ids": {{ 1, 5, 9 }}, "employment": [ { "organization-name": "physcane", "start-date": date("2007-06-05"), "end-date": date("2011-11-05") } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.14.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.14.adm
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.14.adm
@@ -0,0 +1 @@
+10
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.15.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.15.adm
new file mode 100644
index 0000000..954b583
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.15.adm
@@ -0,0 +1,5 @@
+{ "user": "ChangEwing_573", "count": 1 }
+{ "user": "ColineGeyer@63", "count": 3 }
+{ "user": "NathanGiesen@211", "count": 6 }
+{ "user": "NilaMilliron_tw", "count": 1 }
+{ "user": "OliJackson_512", "count": 1 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.16.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.16.adm
new file mode 100644
index 0000000..954b583
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.16.adm
@@ -0,0 +1,5 @@
+{ "user": "ChangEwing_573", "count": 1 }
+{ "user": "ColineGeyer@63", "count": 3 }
+{ "user": "NathanGiesen@211", "count": 6 }
+{ "user": "NilaMilliron_tw", "count": 1 }
+{ "user": "OliJackson_512", "count": 1 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.17.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.17.adm
new file mode 100644
index 0000000..1dd9016
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.17.adm
@@ -0,0 +1,3 @@
+{ "user": "NathanGiesen@211", "count": 6 }
+{ "user": "ColineGeyer@63", "count": 3 }
+{ "user": "NilaMilliron_tw", "count": 1 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.18.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.18.adm
new file mode 100644
index 0000000..b59a814
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.18.adm
@@ -0,0 +1,12 @@
+{ "tweet": { "tweetid": "1", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("47.44,80.65"), "send-time": datetime("2008-04-26T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "customization" }}, "message-text": " love t-mobile its customization is good:)" }, "similar-tweets": [ {{ "t-mobile", "shortcut-menu" }} ] }
+{ "tweet": { "tweetid": "10", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("29.15,76.53"), "send-time": datetime("2008-01-26T10:10:00.000Z"), "referred-topics": {{ "verizon", "voice-clarity" }}, "message-text": " hate verizon its voice-clarity is OMG:(" }, "similar-tweets": [ {{ "verizon", "shortcut-menu" }}, {{ "iphone", "voice-clarity" }}, {{ "verizon", "voicemail-service" }} ] }
+{ "tweet": { "tweetid": "11", "user": { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }, "sender-location": point("37.59,68.42"), "send-time": datetime("2008-03-09T10:10:00.000Z"), "referred-topics": {{ "iphone", "platform" }}, "message-text": " can't stand iphone its platform is terrible" }, "similar-tweets": [ {{ "iphone", "voice-clarity" }}, {{ "samsung", "platform" }} ] }
+{ "tweet": { "tweetid": "12", "user": { "screen-name": "OliJackson_512", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Oli Jackson", "followers_count": 22649 }, "sender-location": point("24.82,94.63"), "send-time": datetime("2010-02-13T10:10:00.000Z"), "referred-topics": {{ "samsung", "voice-command" }}, "message-text": " like samsung the voice-command is amazing:)" }, "similar-tweets": [ {{ "sprint", "voice-command" }}, {{ "samsung", "platform" }} ] }
+{ "tweet": { "tweetid": "2", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("32.84,67.14"), "send-time": datetime("2010-05-13T10:10:00.000Z"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" }, "similar-tweets": [ {{ "verizon", "voice-clarity" }}, {{ "t-mobile", "shortcut-menu" }}, {{ "verizon", "voicemail-service" }} ] }
+{ "tweet": { "tweetid": "3", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("29.72,75.8"), "send-time": datetime("2006-11-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " like motorola the speed is good:)" }, "similar-tweets": [ {{ "motorola", "speed" }} ] }
+{ "tweet": { "tweetid": "4", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("39.28,70.48"), "send-time": datetime("2011-12-26T10:10:00.000Z"), "referred-topics": {{ "sprint", "voice-command" }}, "message-text": " like sprint the voice-command is mind-blowing:)" }, "similar-tweets": [ {{ "samsung", "voice-command" }} ] }
+{ "tweet": { "tweetid": "5", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("40.09,92.69"), "send-time": datetime("2006-08-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " can't stand motorola its speed is terrible:(" }, "similar-tweets": [ {{ "motorola", "speed" }} ] }
+{ "tweet": { "tweetid": "6", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("47.51,83.99"), "send-time": datetime("2010-05-07T10:10:00.000Z"), "referred-topics": {{ "iphone", "voice-clarity" }}, "message-text": " like iphone the voice-clarity is good:)" }, "similar-tweets": [ {{ "verizon", "voice-clarity" }}, {{ "iphone", "platform" }} ] }
+{ "tweet": { "tweetid": "7", "user": { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }, "sender-location": point("36.21,72.6"), "send-time": datetime("2011-08-25T10:10:00.000Z"), "referred-topics": {{ "samsung", "platform" }}, "message-text": " like samsung the platform is good" }, "similar-tweets": [ {{ "iphone", "platform" }}, {{ "samsung", "voice-command" }} ] }
+{ "tweet": { "tweetid": "8", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("46.05,93.34"), "send-time": datetime("2005-10-14T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "shortcut-menu" }}, "message-text": " like t-mobile the shortcut-menu is awesome:)" }, "similar-tweets": [ {{ "t-mobile", "customization" }}, {{ "verizon", "shortcut-menu" }} ] }
+{ "tweet": { "tweetid": "9", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("36.86,74.62"), "send-time": datetime("2012-07-21T10:10:00.000Z"), "referred-topics": {{ "verizon", "voicemail-service" }}, "message-text": " love verizon its voicemail-service is awesome" }, "similar-tweets": [ {{ "verizon", "voice-clarity" }}, {{ "verizon", "shortcut-menu" }} ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.20.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.20.adm
new file mode 100644
index 0000000..5c8c013
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.20.adm
@@ -0,0 +1,13 @@
+{ "tweetid": "1", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("47.44,80.65"), "send-time": datetime("2008-04-26T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "customization" }}, "message-text": " love t-mobile its customization is good:)" }
+{ "tweetid": "10", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("29.15,76.53"), "send-time": datetime("2008-01-26T10:10:00.000Z"), "referred-topics": {{ "verizon", "voice-clarity" }}, "message-text": " hate verizon its voice-clarity is OMG:(" }
+{ "tweetid": "11", "user": { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }, "sender-location": point("37.59,68.42"), "send-time": datetime("2008-03-09T10:10:00.000Z"), "referred-topics": {{ "iphone", "platform" }}, "message-text": " can't stand iphone its platform is terrible" }
+{ "tweetid": "12", "user": { "screen-name": "OliJackson_512", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Oli Jackson", "followers_count": 22649 }, "sender-location": point("24.82,94.63"), "send-time": datetime("2010-02-13T10:10:00.000Z"), "referred-topics": {{ "samsung", "voice-command" }}, "message-text": " like samsung the voice-command is amazing:)" }
+{ "tweetid": "13", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39345, "statuses_count": 479, "name": "Nathan Giesen", "followers_count": 49420 }, "sender-location": point("47.44,80.65"), "send-time": datetime("2008-04-26T10:10:35.000Z"), "referred-topics": {{ "tweeting" }}, "message-text": "tweety tweet, my fellow tweeters!" }
+{ "tweetid": "2", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("32.84,67.14"), "send-time": datetime("2010-05-13T10:10:00.000Z"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" }
+{ "tweetid": "3", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("29.72,75.8"), "send-time": datetime("2006-11-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " like motorola the speed is good:)" }
+{ "tweetid": "4", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("39.28,70.48"), "send-time": datetime("2011-12-26T10:10:00.000Z"), "referred-topics": {{ "sprint", "voice-command" }}, "message-text": " like sprint the voice-command is mind-blowing:)" }
+{ "tweetid": "5", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("40.09,92.69"), "send-time": datetime("2006-08-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " can't stand motorola its speed is terrible:(" }
+{ "tweetid": "6", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("47.51,83.99"), "send-time": datetime("2010-05-07T10:10:00.000Z"), "referred-topics": {{ "iphone", "voice-clarity" }}, "message-text": " like iphone the voice-clarity is good:)" }
+{ "tweetid": "7", "user": { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }, "sender-location": point("36.21,72.6"), "send-time": datetime("2011-08-25T10:10:00.000Z"), "referred-topics": {{ "samsung", "platform" }}, "message-text": " like samsung the platform is good" }
+{ "tweetid": "8", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("46.05,93.34"), "send-time": datetime("2005-10-14T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "shortcut-menu" }}, "message-text": " like t-mobile the shortcut-menu is awesome:)" }
+{ "tweetid": "9", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("36.86,74.62"), "send-time": datetime("2012-07-21T10:10:00.000Z"), "referred-topics": {{ "verizon", "voicemail-service" }}, "message-text": " love verizon its voicemail-service is awesome" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.22.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.22.adm
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.22.adm
@@ -0,0 +1 @@
+0
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.4.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.4.adm
new file mode 100644
index 0000000..e6d8392
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.4.adm
@@ -0,0 +1 @@
+{ "id": 8, "alias": "Nila", "name": "NilaMilliron", "user-since": datetime("2008-01-01T10:10:00.000Z"), "friend-ids": {{ 3 }}, "employment": [ { "organization-name": "Plexlane", "start-date": date("2010-02-28"), "end-date": null } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.5.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.5.adm
new file mode 100644
index 0000000..5e2b105
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.5.adm
@@ -0,0 +1,3 @@
+{ "id": 2, "alias": "Isbel", "name": "IsbelDull", "user-since": datetime("2011-01-22T10:10:00.000Z"), "friend-ids": {{ 1, 4 }}, "employment": [ { "organization-name": "Hexviafind", "start-date": date("2010-04-27"), "end-date": null } ] }
+{ "id": 3, "alias": "Emory", "name": "EmoryUnk", "user-since": datetime("2012-07-10T10:10:00.000Z"), "friend-ids": {{ 1, 5, 8, 9 }}, "employment": [ { "organization-name": "geomedia", "start-date": date("2010-06-17"), "end-date": date("2010-01-26") } ] }
+{ "id": 4, "alias": "Nicholas", "name": "NicholasStroh", "user-since": datetime("2010-12-27T10:10:00.000Z"), "friend-ids": {{ 2 }}, "employment": [ { "organization-name": "Zamcorporation", "start-date": date("2010-06-08"), "end-date": null } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.6.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.6.adm
new file mode 100644
index 0000000..dba1e35
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.6.adm
@@ -0,0 +1,4 @@
+{ "id": 2, "alias": "Isbel", "name": "IsbelDull", "user-since": datetime("2011-01-22T10:10:00.000Z"), "friend-ids": {{ 1, 4 }}, "employment": [ { "organization-name": "Hexviafind", "start-date": date("2010-04-27"), "end-date": null } ] }
+{ "id": 3, "alias": "Emory", "name": "EmoryUnk", "user-since": datetime("2012-07-10T10:10:00.000Z"), "friend-ids": {{ 1, 5, 8, 9 }}, "employment": [ { "organization-name": "geomedia", "start-date": date("2010-06-17"), "end-date": date("2010-01-26") } ] }
+{ "id": 4, "alias": "Nicholas", "name": "NicholasStroh", "user-since": datetime("2010-12-27T10:10:00.000Z"), "friend-ids": {{ 2 }}, "employment": [ { "organization-name": "Zamcorporation", "start-date": date("2010-06-08"), "end-date": null } ] }
+{ "id": 10, "alias": "Bram", "name": "BramHatch", "user-since": datetime("2010-10-16T10:10:00.000Z"), "friend-ids": {{ 1, 5, 9 }}, "employment": [ { "organization-name": "physcane", "start-date": date("2007-06-05"), "end-date": date("2011-11-05") } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.7.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.7.adm
new file mode 100644
index 0000000..a403f1b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.7.adm
@@ -0,0 +1,15 @@
+{ "uname": "BramHatch", "message": " can't stand t-mobile its voicemail-service is OMG:(" }
+{ "uname": "BramHatch", "message": " dislike iphone the voice-command is bad:(" }
+{ "uname": "EmoryUnk", "message": " love sprint its shortcut-menu is awesome:)" }
+{ "uname": "EmoryUnk", "message": " love verizon its wireless is good" }
+{ "uname": "IsbelDull", "message": " like samsung the plan is amazing" }
+{ "uname": "IsbelDull", "message": " like t-mobile its platform is mind-blowing" }
+{ "uname": "MargaritaStoddard", "message": " dislike iphone its touch-screen is horrible" }
+{ "uname": "MargaritaStoddard", "message": " can't stand at&t the network is horrible:(" }
+{ "uname": "MargaritaStoddard", "message": " like verizon the 3G is awesome:)" }
+{ "uname": "MargaritaStoddard", "message": " can't stand motorola the touch-screen is terrible" }
+{ "uname": "MargaritaStoddard", "message": " can't stand at&t its plan is terrible" }
+{ "uname": "SuzannaTillson", "message": " like iphone the voicemail-service is awesome" }
+{ "uname": "VonKemble", "message": " dislike sprint the speed is horrible" }
+{ "uname": "WillisWynne", "message": " love sprint the customization is mind-blowing" }
+{ "uname": "WoodrowNehling", "message": " love at&t its 3G is good:)" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.8.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.8.adm
new file mode 100644
index 0000000..a403f1b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.8.adm
@@ -0,0 +1,15 @@
+{ "uname": "BramHatch", "message": " can't stand t-mobile its voicemail-service is OMG:(" }
+{ "uname": "BramHatch", "message": " dislike iphone the voice-command is bad:(" }
+{ "uname": "EmoryUnk", "message": " love sprint its shortcut-menu is awesome:)" }
+{ "uname": "EmoryUnk", "message": " love verizon its wireless is good" }
+{ "uname": "IsbelDull", "message": " like samsung the plan is amazing" }
+{ "uname": "IsbelDull", "message": " like t-mobile its platform is mind-blowing" }
+{ "uname": "MargaritaStoddard", "message": " dislike iphone its touch-screen is horrible" }
+{ "uname": "MargaritaStoddard", "message": " can't stand at&t the network is horrible:(" }
+{ "uname": "MargaritaStoddard", "message": " like verizon the 3G is awesome:)" }
+{ "uname": "MargaritaStoddard", "message": " can't stand motorola the touch-screen is terrible" }
+{ "uname": "MargaritaStoddard", "message": " can't stand at&t its plan is terrible" }
+{ "uname": "SuzannaTillson", "message": " like iphone the voicemail-service is awesome" }
+{ "uname": "VonKemble", "message": " dislike sprint the speed is horrible" }
+{ "uname": "WillisWynne", "message": " love sprint the customization is mind-blowing" }
+{ "uname": "WoodrowNehling", "message": " love at&t its 3G is good:)" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.9.adm b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.9.adm
new file mode 100644
index 0000000..09b0f08
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tinysocial/tinysocial-suite/tinysocial-suite.9.adm
@@ -0,0 +1,10 @@
+{ "uname": "BramHatch", "messages": [ " can't stand t-mobile its voicemail-service is OMG:(", " dislike iphone the voice-command is bad:(" ] }
+{ "uname": "EmoryUnk", "messages": [ " love sprint its shortcut-menu is awesome:)", " love verizon its wireless is good" ] }
+{ "uname": "IsbelDull", "messages": [ " like samsung the plan is amazing", " like t-mobile its platform is mind-blowing" ] }
+{ "uname": "MargaritaStoddard", "messages": [ " dislike iphone its touch-screen is horrible", " can't stand at&t the network is horrible:(", " like verizon the 3G is awesome:)", " can't stand motorola the touch-screen is terrible", " can't stand at&t its plan is terrible" ] }
+{ "uname": "NicholasStroh", "messages": [ ] }
+{ "uname": "NilaMilliron", "messages": [ ] }
+{ "uname": "SuzannaTillson", "messages": [ " like iphone the voicemail-service is awesome" ] }
+{ "uname": "VonKemble", "messages": [ " dislike sprint the speed is horrible" ] }
+{ "uname": "WillisWynne", "messages": [ " love sprint the customization is mind-blowing" ] }
+{ "uname": "WoodrowNehling", "messages": [ " love at&t its 3G is good:)" ] }
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 7f5556b..f609bf4 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -1040,16 +1040,6 @@
</compilation-unit>
</test-case>
<test-case FilePath="dml">
- <compilation-unit name="scan-insert-inverted-index-fuzzy-ngram-secondary-index">
- <output-dir compare="Text">scan-insert-inverted-index-fuzzy-ngram-secondary-index</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="dml">
- <compilation-unit name="scan-insert-inverted-index-fuzzy-word-secondary-index">
- <output-dir compare="Text">scan-insert-inverted-index-fuzzy-word-secondary-index</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="dml">
<compilation-unit name="scan-insert-inverted-index-ngram-secondary-index-nullable">
<output-dir compare="Text">scan-insert-inverted-index-ngram-secondary-index-nullable</output-dir>
</compilation-unit>
@@ -1060,16 +1050,6 @@
</compilation-unit>
</test-case>
<test-case FilePath="dml">
- <compilation-unit name="scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable">
- <output-dir compare="Text">scan-insert-inverted-index-fuzzy-ngram-secondary-index-nullable</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="dml">
- <compilation-unit name="scan-insert-inverted-index-fuzzy-word-secondary-index-nullable">
- <output-dir compare="Text">scan-insert-inverted-index-fuzzy-word-secondary-index-nullable</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="dml">
<compilation-unit name="scan-delete-inverted-index-ngram-secondary-index">
<output-dir compare="Text">scan-delete-inverted-index-ngram-secondary-index</output-dir>
</compilation-unit>
@@ -1080,16 +1060,6 @@
</compilation-unit>
</test-case>
<test-case FilePath="dml">
- <compilation-unit name="scan-delete-inverted-index-fuzzy-ngram-secondary-index">
- <output-dir compare="Text">scan-delete-inverted-index-fuzzy-ngram-secondary-index</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="dml">
- <compilation-unit name="scan-delete-inverted-index-fuzzy-word-secondary-index">
- <output-dir compare="Text">scan-delete-inverted-index-fuzzy-word-secondary-index</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="dml">
<compilation-unit name="scan-delete-inverted-index-ngram-secondary-index-nullable">
<output-dir compare="Text">scan-delete-inverted-index-ngram-secondary-index-nullable</output-dir>
</compilation-unit>
@@ -1099,16 +1069,6 @@
<output-dir compare="Text">scan-delete-inverted-index-word-secondary-index-nullable</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="dml">
- <compilation-unit name="scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable">
- <output-dir compare="Text">scan-delete-inverted-index-fuzzy-ngram-secondary-index-nullable</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="dml">
- <compilation-unit name="scan-delete-inverted-index-fuzzy-word-secondary-index-nullable">
- <output-dir compare="Text">scan-delete-inverted-index-fuzzy-word-secondary-index-nullable</output-dir>
- </compilation-unit>
- </test-case>
</test-group>
<test-group name="employee">
<test-case FilePath="employee">
@@ -1556,7 +1516,6 @@
</test-group>
-->
<test-group name="fuzzyjoin">
- <!-- internal function
<test-case FilePath="fuzzyjoin">
<compilation-unit name="dblp-1_1">
<output-dir compare="Text">dblp-1_1</output-dir>
@@ -1577,8 +1536,6 @@
<output-dir compare="Text">dblp-1_2</output-dir>
</compilation-unit>
</test-case>
- -->
- <!-- internal function
<test-case FilePath="fuzzyjoin">
<compilation-unit name="dblp-2.1_5.3.1">
<output-dir compare="Text">dblp-2.1_5.3.1</output-dir>
@@ -1649,7 +1606,6 @@
<output-dir compare="Text">dblp-3_1</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="fuzzyjoin">
<compilation-unit name="dblp-aqlplus_1">
<output-dir compare="Text">dblp-aqlplus_1</output-dir>
@@ -1661,7 +1617,6 @@
<expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="fuzzyjoin">
<compilation-unit name="dblp-csx-2_1">
<output-dir compare="Text">dblp-csx-2_1</output-dir>
@@ -1795,6 +1750,11 @@
</compilation-unit>
</test-case>
-->
+ <test-case FilePath="fuzzyjoin">
+ <compilation-unit name="opentype">
+ <output-dir compare="Text">opentype</output-dir>
+ </compilation-unit>
+ </test-case>
</test-group>
<test-group name="index-join">
<test-case FilePath="index-join">
@@ -1835,58 +1795,6 @@
</compilation-unit>
</test-case>
<test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-ngram-contains">
- <output-dir compare="Text">fuzzy-inverted-index-ngram-contains</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-ngram-edit-distance-panic">
- <output-dir compare="Text">fuzzy-inverted-index-ngram-edit-distance-panic</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-ngram-edit-distance">
- <output-dir compare="Text">fuzzy-inverted-index-ngram-edit-distance</output-dir>
- </compilation-unit>
- </test-case>
- <!-- internal function
- <test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-ngram-jaccard">
- <output-dir compare="Text">fuzzy-inverted-index-ngram-jaccard</output-dir>
- </compilation-unit>
- </test-case>
- -->
- <test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-olist-edit-distance-panic">
- <output-dir compare="Text">fuzzy-inverted-index-olist-edit-distance-panic</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-olist-edit-distance">
- <output-dir compare="Text">fuzzy-inverted-index-olist-edit-distance</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-olist-jaccard">
- <output-dir compare="Text">fuzzy-inverted-index-olist-jaccard</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-ulist-jaccard">
- <output-dir compare="Text">fuzzy-inverted-index-ulist-jaccard</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-word-contains">
- <output-dir compare="Text">fuzzy-inverted-index-word-contains</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="index-selection">
- <compilation-unit name="fuzzy-inverted-index-word-jaccard">
- <output-dir compare="Text">fuzzy-inverted-index-word-jaccard</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="index-selection">
<compilation-unit name="inverted-index-ngram-contains">
<output-dir compare="Text">inverted-index-ngram-contains</output-dir>
</compilation-unit>
@@ -1901,13 +1809,11 @@
<output-dir compare="Text">inverted-index-ngram-edit-distance</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="index-selection">
<compilation-unit name="inverted-index-ngram-jaccard">
<output-dir compare="Text">inverted-index-ngram-jaccard</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="index-selection">
<compilation-unit name="inverted-index-olist-edit-distance-panic">
<output-dir compare="Text">inverted-index-olist-edit-distance-panic</output-dir>
@@ -1995,20 +1901,16 @@
<output-dir compare="Text">ngram-edit-distance-inline</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="inverted-index-join">
<compilation-unit name="ngram-jaccard">
<output-dir compare="Text">ngram-jaccard</output-dir>
</compilation-unit>
</test-case>
- -->
- <!-- internal function
<test-case FilePath="inverted-index-join">
<compilation-unit name="ngram-jaccard-inline">
<output-dir compare="Text">ngram-jaccard-inline</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="inverted-index-join">
<compilation-unit name="olist-edit-distance">
<output-dir compare="Text">olist-edit-distance</output-dir>
@@ -2061,7 +1963,6 @@
<output-dir compare="Text">ngram-edit-distance-inline</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="inverted-index-join-noeqjoin">
<compilation-unit name="ngram-jaccard">
<output-dir compare="Text">ngram-jaccard</output-dir>
@@ -2072,7 +1973,6 @@
<output-dir compare="Text">ngram-jaccard-inline</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="inverted-index-join-noeqjoin">
<compilation-unit name="olist-edit-distance">
<output-dir compare="Text">olist-edit-distance</output-dir>
@@ -2260,6 +2160,11 @@
</test-group>
<test-group name="numeric">
<test-case FilePath="numeric">
+ <compilation-unit name="caret0">
+ <output-dir compare="Text">caret0</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="numeric">
<compilation-unit name="abs0">
<output-dir compare="Text">abs0</output-dir>
</compilation-unit>
@@ -2569,6 +2474,12 @@
<output-dir compare="Text">unary-minus_null</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="numeric">
+ <compilation-unit name="query-issue355">
+ <output-dir compare="Text">query-issue355</output-dir>
+ <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+ </compilation-unit>
+ </test-case>
</test-group>
<test-group name="open-closed">
<!--
@@ -2801,7 +2712,34 @@
</test-case>
<test-case FilePath="open-closed">
<compilation-unit name="query-issue410">
- <output-dir compare="Text">query-issue40</output-dir>
+ <output-dir compare="Text">query-issue410</output-dir>
+ <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="open-closed">
+ <compilation-unit name="query-issue453">
+ <output-dir compare="Text">query-issue453</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="open-closed">
+ <compilation-unit name="query-issue453-2">
+ <output-dir compare="Text">query-issue453-2</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="open-closed">
+ <compilation-unit name="query-issue258">
+ <output-dir compare="Text">query-issue258</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="open-closed">
+ <compilation-unit name="query-issue442">
+ <output-dir compare="Text">query-issue442</output-dir>
+ <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="open-closed">
+ <compilation-unit name="query-issue487">
+ <output-dir compare="Text">query-issue487</output-dir>
<expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
</compilation-unit>
</test-case>
@@ -2869,7 +2807,6 @@
</test-case>
</test-group>
<test-group name="records">
- <!-- internal function
<test-case FilePath="records">
<compilation-unit name="closed-record-constructor_01">
<output-dir compare="Text">closed-record-constructor_01</output-dir>
@@ -2891,19 +2828,16 @@
<output-dir compare="Text">expFieldName</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="records">
<compilation-unit name="field-access-by-index_01">
<output-dir compare="Text">field-access-by-index_01</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="records">
<compilation-unit name="field-access-on-open-field">
<output-dir compare="Text">field-access-on-open-field</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="records">
<compilation-unit name="open-record-constructor_01">
<output-dir compare="Text">open-record-constructor_01</output-dir>
@@ -2914,7 +2848,6 @@
<output-dir compare="Text">open-record-constructor_02</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="records">
<compilation-unit name="closed-closed-fieldname-conflict_issue173">
<output-dir compare="Text">closed-closed-fieldname-conflict_issue173</output-dir>
@@ -3034,7 +2967,6 @@
<output-dir compare="Text">edit-distance-check_strings</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="similarity">
<compilation-unit name="edit-distance-list-is-filterable">
<output-dir compare="Text">edit-distance-list-is-filterable</output-dir>
@@ -3045,7 +2977,6 @@
<output-dir compare="Text">edit-distance-string-is-filterable</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="similarity">
<compilation-unit name="edit-distance_ints">
<output-dir compare="Text">edit-distance_ints</output-dir>
@@ -3066,13 +2997,11 @@
<output-dir compare="Text">fuzzyeq-similarity-jaccard</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="similarity">
<compilation-unit name="prefix-len-jaccard">
<output-dir compare="Text">prefix-len-jaccard</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="similarity">
<compilation-unit name="similarity-jaccard-check_ints">
<output-dir compare="Text">similarity-jaccard-check_ints</output-dir>
@@ -3088,7 +3017,6 @@
<output-dir compare="Text">similarity-jaccard-check_strings</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="similarity">
<compilation-unit name="similarity-jaccard-prefix-check">
<output-dir compare="Text">similarity-jaccard-prefix-check</output-dir>
@@ -3114,8 +3042,6 @@
<output-dir compare="Text">similarity-jaccard-sorted-check_strings</output-dir>
</compilation-unit>
</test-case>
- -->
- <!-- internal functions
<test-case FilePath="similarity">
<compilation-unit name="similarity-jaccard-sorted_ints">
<output-dir compare="Text">similarity-jaccard-sorted_ints</output-dir>
@@ -3146,7 +3072,6 @@
<output-dir compare="Text">similarity-jaccard_strings</output-dir>
</compilation-unit>
</test-case>
- -->
</test-group>
<test-group name="spatial">
<test-case FilePath="spatial">
@@ -3528,7 +3453,6 @@
<output-dir compare="Text">string-concat1</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="string">
<compilation-unit name="string-equal1">
<output-dir compare="Text">string-equal1</output-dir>
@@ -3549,7 +3473,6 @@
<output-dir compare="Text">string-equal4</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="string">
<compilation-unit name="string-join1">
<output-dir compare="Text">string-join1</output-dir>
@@ -3566,6 +3489,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="string">
+ <compilation-unit name="string-to-codepoint2">
+ <output-dir compare="Text">string-to-codepoint2</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="string">
<compilation-unit name="strlen02">
<output-dir compare="Text">strlen02</output-dir>
</compilation-unit>
@@ -3688,7 +3616,6 @@
</compilation-unit>
</test-case>
</test-group>
- <!-- internal function
<test-group name="subset-collection">
<test-case FilePath="subset-collection">
<compilation-unit name="01">
@@ -3706,11 +3633,6 @@
</compilation-unit>
</test-case>
<test-case FilePath="subset-collection">
- <compilation-unit name="04">
- <output-dir compare="Text">04</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="subset-collection">
<compilation-unit name="05">
<output-dir compare="Text">05</output-dir>
</compilation-unit>
@@ -3726,9 +3648,7 @@
</compilation-unit>
</test-case>
</test-group>
- -->
<test-group name="tokenizers">
- <!-- internal function
<test-case FilePath="tokenizers">
<compilation-unit name="counthashed-gram-tokens_01">
<output-dir compare="Text">counthashed-gram-tokens_01</output-dir>
@@ -3744,8 +3664,6 @@
<output-dir compare="Text">counthashed-word-tokens_01</output-dir>
</compilation-unit>
</test-case>
- -->
- <!-- internal function
<test-case FilePath="tokenizers">
<compilation-unit name="gram-tokens_01">
<output-dir compare="Text">gram-tokens_01</output-dir>
@@ -3756,8 +3674,6 @@
<output-dir compare="Text">gram-tokens_02</output-dir>
</compilation-unit>
</test-case>
- -->
- <!-- internal function
<test-case FilePath="tokenizers">
<compilation-unit name="hashed-gram-tokens_01">
<output-dir compare="Text">hashed-gram-tokens_01</output-dir>
@@ -3773,7 +3689,6 @@
<output-dir compare="Text">hashed-word-tokens_01</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="tokenizers">
<compilation-unit name="word-tokens_01">
<output-dir compare="Text">word-tokens_01</output-dir>
@@ -3846,13 +3761,11 @@
<output-dir compare="Text">q18_large_volume_customer</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="tpch">
<compilation-unit name="q19_discounted_revenue">
<output-dir compare="Text">q19_discounted_revenue</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="tpch">
<compilation-unit name="q1_pricing_summary_report_nt">
<output-dir compare="Text">q1_pricing_summary_report_nt</output-dir>
@@ -4205,6 +4118,12 @@
</compilation-unit>
</test-case>
<test-case FilePath="user-defined-functions">
+ <compilation-unit name="udf30">
+ <output-dir compare="Text">udf30</output-dir>
+ <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
<compilation-unit name="f01">
<output-dir compare="Text">f01</output-dir>
<expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
@@ -4318,7 +4237,6 @@
<output-dir compare="Text">adjust_timezone</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="temporal">
<compilation-unit name="calendar_duration">
<output-dir compare="Text">calendar_duration</output-dir>
@@ -4334,7 +4252,6 @@
<output-dir compare="Text">datetime_functions</output-dir>
</compilation-unit>
</test-case>
- -->
<!--
<test-case FilePath="temporal">
<compilation-unit name="insert_from_delimited_ds">
@@ -4352,25 +4269,21 @@
<output-dir compare="Text">interval_functions</output-dir>
</compilation-unit>
</test-case>
- <!-- internal functions
<test-case FilePath="temporal">
<compilation-unit name="time_functions">
<output-dir compare="Text">time_functions</output-dir>
</compilation-unit>
</test-case>
- -->
<test-case FilePath="constructor">
<compilation-unit name="interval">
<output-dir compare="Text">interval</output-dir>
</compilation-unit>
</test-case>
- <!-- internal function
<test-case FilePath="temporal">
<compilation-unit name="duration_comps">
<output-dir compare="Text">duration_comps</output-dir>
</compilation-unit>
</test-case>
- -->
</test-group>
<test-group name="leftouterjoin">
<test-case FilePath="leftouterjoin">
@@ -4384,4 +4297,23 @@
</compilation-unit>
</test-case>
</test-group>
+ <test-group name="distinct">
+ <test-case FilePath="distinct">
+ <compilation-unit name="query-issue443">
+ <output-dir compare="Text">query-issue443</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="distinct">
+ <compilation-unit name="query-issue443-2">
+ <output-dir compare="Text">query-issue443-2</output-dir>
+ </compilation-unit>
+ </test-case>
+ </test-group>
+ <test-group name="tinysocial">
+ <test-case FilePath="tinysocial">
+ <compilation-unit name="tinysocial-suite">
+ <output-dir compare="Text">tinysocial-suite</output-dir>
+ </compilation-unit>
+ </test-case>
+ </test-group>
</test-suite>
diff --git a/asterix-aql/pom.xml b/asterix-aql/pom.xml
index 249299c..f8c652f 100644
--- a/asterix-aql/pom.xml
+++ b/asterix-aql/pom.xml
@@ -30,6 +30,7 @@
</goals>
<configuration>
<isStatic>false</isStatic>
+ <javaUnicodeEscape>true</javaUnicodeEscape>
</configuration>
</execution>
<execution>
diff --git a/asterix-aql/src/main/java/edu/uci/ics/asterix/aql/rewrites/AqlRewriter.java b/asterix-aql/src/main/java/edu/uci/ics/asterix/aql/rewrites/AqlRewriter.java
index 7969941..ae5f3ef 100644
--- a/asterix-aql/src/main/java/edu/uci/ics/asterix/aql/rewrites/AqlRewriter.java
+++ b/asterix-aql/src/main/java/edu/uci/ics/asterix/aql/rewrites/AqlRewriter.java
@@ -155,7 +155,8 @@
if (expression == null) {
return;
}
-
+ String value = metadataProvider.getConfig().get(FunctionUtils.IMPORT_PRIVATE_FUNCTIONS);
+ boolean includePrivateFunctions = (value != null) ? Boolean.valueOf(value.toLowerCase()) : false;
Set<FunctionSignature> functionCalls = getFunctionCalls(expression);
for (FunctionSignature signature : functionCalls) {
@@ -172,9 +173,7 @@
buildOtherUdfs(functionDecl.getFuncBody(), functionDecls, declaredFunctions);
}
} else {
- String value = metadataProvider.getConfig().get(FunctionUtils.IMPORT_PRIVATE_FUNCTIONS);
- boolean includePrivateFunctions = (value != null) ? Boolean.valueOf(value.toLowerCase()) : false;
- if (isBuiltinFunction(signature, includePrivateFunctions)) {
+ if (AsterixBuiltinFunctions.isBuiltinCompilerFunction(signature, includePrivateFunctions)) {
continue;
} else {
throw new AsterixException(" unknown function " + signature);
@@ -195,31 +194,6 @@
}
- private boolean isBuiltinFunction(FunctionSignature signature, boolean includePrivateFunctions) {
- signature.setNamespace(AsterixBuiltinFunctions.FunctionNamespace.ASTERIX_PUBLIC.name());
- if (AsterixBuiltinFunctions.isBuiltinCompilerFunction(new FunctionIdentifier(signature.getNamespace(),
- signature.getName(), signature.getArity()))) {
- return true;
- }
-
- if (includePrivateFunctions) {
- signature.setNamespace(AlgebricksBuiltinFunctions.ALGEBRICKS_NS);
- if (AsterixBuiltinFunctions.isBuiltinCompilerFunction(new FunctionIdentifier(signature.getNamespace(),
- signature.getName(), signature.getArity()))) {
- return true;
- }
-
- signature.setNamespace(AsterixBuiltinFunctions.FunctionNamespace.ASTERIX_PRIVATE.name());
- if (AsterixBuiltinFunctions.isBuiltinCompilerFunction(new FunctionIdentifier(signature.getNamespace(),
- signature.getName(), signature.getArity()))) {
- return true;
- }
- }
-
- return false;
-
- }
-
private Set<FunctionSignature> getFunctionCalls(Expression expression) throws AsterixException {
Map<AsterixFunction, DfsColor> color = new HashMap<AsterixFunction, DfsColor>();
Map<AsterixFunction, List<AsterixFunction>> arcs = new HashMap<AsterixFunction, List<AsterixFunction>>();
diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index dc01648..bd21581 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -301,7 +301,7 @@
fdd,
ifNotExists);
}
- | <DATASET> nameComponents = QualifiedName()
+ | ("internal")? <DATASET> nameComponents = QualifiedName()
<LEFTPAREN> typeName = Identifier() <RIGHTPAREN>
ifNotExists = IfNotExists()
primaryKeyFields = PrimaryKey() ("on" nodeGroupName = Identifier() )?
@@ -376,20 +376,10 @@
}
| "keyword"
{
- type = IndexType.WORD_INVIX;
- }
- | "fuzzy keyword"
- {
type = IndexType.FUZZY_WORD_INVIX;
}
| "ngram" <LEFTPAREN> <INTEGER_LITERAL>
{
- type = IndexType.NGRAM_INVIX;
- gramLength = Integer.valueOf(token.image);
- }
- <RIGHTPAREN>
- | "fuzzy ngram" <LEFTPAREN> <INTEGER_LITERAL>
- {
type = IndexType.FUZZY_NGRAM_INVIX;
gramLength = Integer.valueOf(token.image);
}
@@ -420,7 +410,6 @@
boolean ifNotExists = false;
List<VarIdentifier> paramList = new ArrayList<VarIdentifier>();
String functionBody;
- VarIdentifier var = null;
Expression functionBodyExpr;
Token beginPos;
Token endPos;
@@ -431,6 +420,29 @@
{
"function" nameComponents = FunctionOrTypeName()
ifNotExists = IfNotExists()
+ paramList = ParameterList()
+ "{"
+ {
+ beginPos = token;
+ }
+ functionBodyExpr = Expression() "}"
+ {
+ endPos = token;
+ functionBody = extractFragment(beginPos.beginLine, beginPos.beginColumn, endPos.beginLine, endPos.beginColumn);
+ String dataverse = nameComponents.first.getValue();
+ String functionName = nameComponents.second.getValue();
+ signature = new FunctionSignature(dataverse, functionName, paramList.size());
+ getCurrentScope().addFunctionDescriptor(signature, false);
+ return new CreateFunctionStatement(signature, paramList, functionBody, ifNotExists);
+ }
+}
+
+List<VarIdentifier> ParameterList() throws ParseException:
+{
+ List<VarIdentifier> paramList = new ArrayList<VarIdentifier>();
+ VarIdentifier var = null;
+}
+{
<LEFTPAREN> (<VARIABLE>
{
var = new VarIdentifier();
@@ -445,19 +457,9 @@
paramList.add(var);
getCurrentScope().addNewVarSymbolToScope(var);
}
- )*)? <RIGHTPAREN> "{"
+ )*)? <RIGHTPAREN>
{
- beginPos = token;
- }
- functionBodyExpr = Expression() "}"
- {
- endPos = token;
- functionBody = extractFragment(beginPos.beginLine, beginPos.beginColumn, endPos.beginLine, endPos.beginColumn);
- String dataverse = nameComponents.first.getValue();
- String functionName = nameComponents.second.getValue();
- signature = new FunctionSignature(dataverse, functionName, paramList.size());
- getCurrentScope().addFunctionDescriptor(signature, false);
- return new CreateFunctionStatement(signature, paramList, functionBody, ifNotExists);
+ return paramList;
}
}
@@ -1093,34 +1095,19 @@
FunctionDecl funcDecl;
FunctionSignature signature;
String functionName;
- int arity = 0;
List<VarIdentifier> paramList = new ArrayList<VarIdentifier>();
Expression funcBody;
- VarIdentifier var = null;
createNewScope();
}
{
- "declare" "function" functionName = Identifier() <LEFTPAREN> (<VARIABLE>
+ "declare" "function" functionName = Identifier()
+ paramList = ParameterList()
+ "{" funcBody = Expression() "}"
{
- var = new VarIdentifier();
- var.setValue(token.image);
- paramList.add(var);
- getCurrentScope().addNewVarSymbolToScope(var);
- arity++;
- }
- ("," <VARIABLE>
- {
- var = new VarIdentifier();
- var.setValue(token.image);
- paramList.add(var);
- getCurrentScope().addNewVarSymbolToScope(var);
- arity++;
- }
- )*)? <RIGHTPAREN> "{" funcBody = Expression() "}"
- {
- signature = new FunctionSignature(defaultDataverse, functionName, arity);
+ signature = new FunctionSignature(defaultDataverse, functionName, paramList.size());
getCurrentScope().addFunctionDescriptor(signature, false);
funcDecl = new FunctionDecl(signature, paramList, funcBody);
+ removeCurrentScope();
return funcDecl;
}
}
@@ -1539,7 +1526,7 @@
VarIdentifier var = new VarIdentifier();
}
{
- <VARIABLE>
+ <VARIABLE>
{
String varName = token.image;
Identifier ident = lookupSymbol(varName);
@@ -1564,7 +1551,7 @@
VarIdentifier var = new VarIdentifier();
}
{
- <VARIABLE>
+ <VARIABLE>
{
Identifier ident = lookupSymbol(token.image);
if(ident != null) { // exist such ident
@@ -1716,49 +1703,34 @@
Expression DatasetAccessExpression() throws ParseException:
{
- CallExpr callExpr;
- List<Expression> argList = new ArrayList<Expression>();
String funcName;
- String dataverse;
String arg1 = null;
String arg2 = null;
- LiteralExpr ds;
Expression nameArg;
- int arity = 0;
}
{
<DATASET>
{
- dataverse = MetadataConstants.METADATA_DATAVERSE_NAME;
funcName = token.image;
}
( ( arg1 = Identifier() ( "." arg2 = Identifier() )? )
{
String name = arg2 == null ? arg1 : arg1 + "." + arg2;
- ds = new LiteralExpr();
+ LiteralExpr ds = new LiteralExpr();
ds.setValue( new StringLiteral(name) );
- argList.add(ds);
- arity ++;
+ nameArg = ds;
}
- | ( <LEFTPAREN> nameArg = Expression()
+ | ( <LEFTPAREN> nameArg = Expression() <RIGHTPAREN> ) )
{
+ String dataverse = MetadataConstants.METADATA_DATAVERSE_NAME;
+ FunctionSignature signature = lookupFunctionSignature(dataverse, funcName, 1);
+ if (signature == null) {
+ signature = new FunctionSignature(dataverse, funcName, 1);
+ }
+ List<Expression> argList = new ArrayList<Expression>();
argList.add(nameArg);
- arity ++;
+ return new CallExpr(signature, argList);
}
- ( "," nameArg = Expression()
- {
- argList.add(nameArg);
- arity++;
- }
- )* <RIGHTPAREN> ) )
- {
- FunctionSignature signature = lookupFunctionSignature(dataverse, funcName, arity);
- if (signature == null) {
- signature = new FunctionSignature(dataverse, funcName, arity);
- }
- callExpr = new CallExpr(signature,argList);
- return callExpr;
- }
}
Expression ParenthesizedExpression() throws ParseException:
@@ -1838,21 +1810,14 @@
extendCurrentScope();
}
{
- "for" varExp = Variable()
- {
- getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
- }
- ("at" varPos = Variable()
- {
- getCurrentScope().addNewVarSymbolToScope(varPos.getVar());
- }
- )?
- "in" ( inExp = Expression() )
+ "for" varExp = Variable() ("at" varPos = Variable())? "in" ( inExp = Expression() )
{
fc.setVarExpr(varExp);
+ getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
fc.setInExpr(inExp);
if (varPos != null) {
fc.setPosExpr(varPos);
+ getCurrentScope().addNewVarSymbolToScope(varPos.getVar());
}
return fc;
}
@@ -2204,7 +2169,7 @@
<DEFAULT>
TOKEN :
{
- <VARIABLE : "$" <IDENTIFIER> >
+ <VARIABLE : "$" (<LETTER>)+ (<LETTER> | <DIGIT> | "_")* >
}
SKIP:
diff --git a/asterix-common/pom.xml b/asterix-common/pom.xml
index 1a0e782..db20c29 100644
--- a/asterix-common/pom.xml
+++ b/asterix-common/pom.xml
@@ -99,13 +99,6 @@
<version>3.0.1</version>
</dependency>
<dependency>
- <groupId>edu.uci.ics.asterix</groupId>
- <artifactId>asterix-transactions</artifactId>
- <version>0.0.6-SNAPSHOT</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>edu.uci.ics.hyracks</groupId>
<artifactId>hyracks-storage-am-lsm-common</artifactId>
</dependency>
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixContextInfo.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixContextInfo.java
new file mode 100644
index 0000000..969aa65
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixContextInfo.java
@@ -0,0 +1,26 @@
+package edu.uci.ics.asterix.common.api;
+
+import edu.uci.ics.hyracks.api.application.ICCApplicationContext;
+
+public class AsterixContextInfo implements IAsterixContextInfo {
+
+ public static AsterixContextInfo INSTANCE;
+
+ private final ICCApplicationContext appCtx;
+
+ public static void initialize(ICCApplicationContext ccAppCtx) {
+ if (INSTANCE == null) {
+ INSTANCE = new AsterixContextInfo(ccAppCtx);
+ }
+ }
+
+ private AsterixContextInfo(ICCApplicationContext ccAppCtx) {
+ this.appCtx = ccAppCtx;
+ }
+
+ @Override
+ public ICCApplicationContext getCCApplicationContext() {
+ return appCtx;
+ }
+
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/IAsterixAppRuntimeContext.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/IAsterixAppRuntimeContext.java
new file mode 100644
index 0000000..e053989
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/IAsterixAppRuntimeContext.java
@@ -0,0 +1,50 @@
+package edu.uci.ics.asterix.common.api;
+
+import java.io.IOException;
+
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMMergePolicy;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory;
+import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
+import edu.uci.ics.hyracks.storage.common.file.IFileMapProvider;
+import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
+import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
+
+public interface IAsterixAppRuntimeContext {
+
+ public ITransactionSubsystem getTransactionSubsystem();
+
+ public boolean isShuttingdown();
+
+ public ILSMIOOperationScheduler getLSMIOScheduler();
+
+ public int getMetaDataIODeviceId();
+
+ public ILSMMergePolicy getLSMMergePolicy();
+
+ public IBufferCache getBufferCache();
+
+ public IFileMapProvider getFileMapManager();
+
+ public ILocalResourceRepository getLocalResourceRepository();
+
+ public IIndexLifecycleManager getIndexLifecycleManager();
+
+ public ResourceIdFactory getResourceIdFactory();
+
+ public ILSMOperationTrackerFactory getLSMBTreeOperationTrackerFactory();
+
+ public void initialize() throws IOException, ACIDException, AsterixException;
+
+ public void setShuttingdown(boolean b);
+
+ public void deinitialize() throws HyracksDataException;
+
+ public double getBloomFilterFalsePositiveRate();
+
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/IAsterixContextInfo.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/IAsterixContextInfo.java
new file mode 100644
index 0000000..1c43f2f
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/IAsterixContextInfo.java
@@ -0,0 +1,15 @@
+package edu.uci.ics.asterix.common.api;
+
+import edu.uci.ics.hyracks.api.application.ICCApplicationContext;
+
+public interface IAsterixContextInfo {
+
+ /**
+ * Returns an instance of the implementation for ICCApplicationContext.
+ *
+ * @return ICCApplicationContext implementation instance
+ */
+ public ICCApplicationContext getCCApplicationContext();
+
+
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/IAsterixAppRuntimeContextProvider.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/IAsterixRuntimeComponentsProvider.java
similarity index 85%
copy from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/IAsterixAppRuntimeContextProvider.java
copy to asterix-common/src/main/java/edu/uci/ics/asterix/common/api/IAsterixRuntimeComponentsProvider.java
index d96d5c2..d03b15c 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/IAsterixAppRuntimeContextProvider.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/IAsterixRuntimeComponentsProvider.java
@@ -1,6 +1,5 @@
-package edu.uci.ics.asterix.transaction.management.service.recovery;
+package edu.uci.ics.asterix.common.api;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
import edu.uci.ics.hyracks.api.io.IIOManager;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackProvider;
@@ -12,14 +11,12 @@
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
-public interface IAsterixAppRuntimeContextProvider {
+public interface IAsterixRuntimeComponentsProvider {
public IBufferCache getBufferCache();
public IFileMapProvider getFileMapManager();
- public TransactionSubsystem getTransactionSubsystem();
-
public IIndexLifecycleManager getIndexLifecycleManager();
public double getBloomFilterFalsePositiveRate();
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixStorageProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixStorageProperties.java
index d34e4ac..91bdca6 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixStorageProperties.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixStorageProperties.java
@@ -15,7 +15,7 @@
private static final int STORAGE_MEMORYCOMPONENT_PAGESIZE_DEFAULT = (32 << 10); // 32KB
private static final String STORAGE_MEMORYCOMPONENT_NUMPAGES_KEY = "storage.memorycomponent.numpages";
- private static final int STORAGE_MEMORYCOMPONENT_NUMPAGES_DEFAULT = 4096; // ... so 128MB components
+ private static final int STORAGE_MEMORYCOMPONENT_NUMPAGES_DEFAULT = 2048; // ... so 64MB components
private static final String STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_KEY = "storage.memorycomponent.globalbudget";
private static final long STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_DEFAULT = (1 << 30); // 1GB
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/ConstantMergePolicy.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/ConstantMergePolicy.java
index 74b0aa6..2daed08 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/ConstantMergePolicy.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/ConstantMergePolicy.java
@@ -15,6 +15,7 @@
package edu.uci.ics.asterix.common.context;
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
import edu.uci.ics.hyracks.storage.am.common.impls.NoOpOperationCallback;
@@ -26,9 +27,9 @@
public class ConstantMergePolicy implements ILSMMergePolicy {
private final int threshold;
- private final AsterixAppRuntimeContext ctx;
+ private final IAsterixAppRuntimeContext ctx;
- public ConstantMergePolicy(int threshold, AsterixAppRuntimeContext ctx) {
+ public ConstantMergePolicy(int threshold, IAsterixAppRuntimeContext ctx) {
this.threshold = threshold;
this.ctx = ctx;
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/ITransactionSubsystemProvider.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/ITransactionSubsystemProvider.java
similarity index 79%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/ITransactionSubsystemProvider.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/context/ITransactionSubsystemProvider.java
index 857d8ae..a95890b 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/ITransactionSubsystemProvider.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/ITransactionSubsystemProvider.java
@@ -13,12 +13,13 @@
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.transaction;
+package edu.uci.ics.asterix.common.context;
import java.io.Serializable;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
public interface ITransactionSubsystemProvider extends Serializable{
- public TransactionSubsystem getTransactionSubsystem(IHyracksTaskContext ctx);
+ public ITransactionSubsystem getTransactionSubsystem(IHyracksTaskContext ctx);
}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/TransactionSubsystemProvider.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/TransactionSubsystemProvider.java
index 85e5375..33f20f7 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/TransactionSubsystemProvider.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/TransactionSubsystemProvider.java
@@ -15,8 +15,8 @@
package edu.uci.ics.asterix.common.context;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionSubsystemProvider;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
/**
@@ -26,8 +26,8 @@
*/
public class TransactionSubsystemProvider implements ITransactionSubsystemProvider {
@Override
- public TransactionSubsystem getTransactionSubsystem(IHyracksTaskContext ctx) {
- AsterixAppRuntimeContext runtimeCtx = (AsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext()
+ public ITransactionSubsystem getTransactionSubsystem(IHyracksTaskContext ctx) {
+ IAsterixAppRuntimeContext runtimeCtx = (IAsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext()
.getApplicationObject();
return runtimeCtx.getTransactionSubsystem();
}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/dataflow/IAsterixApplicationContextInfo.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/dataflow/IAsterixApplicationContextInfo.java
index 401af28..a057f91 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/dataflow/IAsterixApplicationContextInfo.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/dataflow/IAsterixApplicationContextInfo.java
@@ -19,10 +19,16 @@
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
/**
- * Provides methods for obtaining the IIndexRegistryProvider, IStorageManager and
+ * Provides methods for obtaining the IIndexLifecycleManagerProvider, IStorageManagerInterface and
* ICCApplicationContext implementation.
*/
public interface IAsterixApplicationContextInfo {
+
+ /**
+ * Returns an instance of the implementation for IIndexLifecycleManagerProvider.
+ *
+ * @return IIndexLifecycleManagerProvider implementation instance
+ */
public IIndexLifecycleManagerProvider getIndexLifecycleManagerProvider();
/**
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/exception/ACIDException.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/exceptions/ACIDException.java
similarity index 74%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/exception/ACIDException.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/exceptions/ACIDException.java
index 2bc9935..eb00d10 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/exception/ACIDException.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/exceptions/ACIDException.java
@@ -12,14 +12,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.exception;
+package edu.uci.ics.asterix.common.exceptions;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
/**
* Represents an exception related to an unexpected behavior that prevents the
* system from supporting ACID guarantees. The exception contains the
- * TransactionContext but it may not always be set. For example, an
+ * ITransactionContext but it may not always be set. For example, an
* ACIDException encountered during crash recovery shall not have a transaction
* context as recovery does not happen as part of a transaction.
*/
@@ -29,22 +29,22 @@
*
*/
private static final long serialVersionUID = -8855848112541877323L;
- private TransactionContext txnContext;
+ private ITransactionContext txnContext;
- public TransactionContext getTxnContext() {
+ public ITransactionContext getTxnContext() {
return txnContext;
}
- public void setTxnContext(TransactionContext txnContext) {
+ public void setTxnContext(ITransactionContext txnContext) {
this.txnContext = txnContext;
}
- public ACIDException(TransactionContext txnContext, String message) {
+ public ACIDException(ITransactionContext txnContext, String message) {
super(message);
this.txnContext = txnContext;
}
- public ACIDException(TransactionContext txnContext, String message, Throwable cause) {
+ public ACIDException(ITransactionContext txnContext, String message, Throwable cause) {
super(message, cause);
this.txnContext = txnContext;
}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java
index 563b2cf..7520b1f 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java
@@ -30,7 +30,7 @@
}
public String toString() {
- return rep;
+ return namespace + "." + name + "@" + arity;
}
@Override
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/AbstractOperationCallback.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/AbstractOperationCallback.java
similarity index 74%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/AbstractOperationCallback.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/AbstractOperationCallback.java
index fdbb707..dc7b543 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/AbstractOperationCallback.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/AbstractOperationCallback.java
@@ -13,41 +13,34 @@
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.opcallbacks;
+package edu.uci.ics.asterix.common.transactions;
-import edu.uci.ics.asterix.transaction.management.service.locking.ILockManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
import edu.uci.ics.hyracks.storage.am.bloomfilter.impls.MurmurHash128Bit;
public abstract class AbstractOperationCallback {
-
+
private final static long SEED = 0L;
-
+
protected final DatasetId datasetId;
protected final int[] primaryKeyFields;
+ protected final ITransactionContext txnCtx;
protected final ILockManager lockManager;
- protected final TransactionContext txnCtx;
protected int transactorLocalNumActiveOperations = 0;
protected final long[] longHashes;
- public AbstractOperationCallback(int datasetId, int[] primaryKeyFields,
- TransactionContext txnCtx, ILockManager lockManager) {
+ public AbstractOperationCallback(int datasetId, int[] primaryKeyFields, ITransactionContext txnCtx,
+ ILockManager lockManager) {
this.datasetId = new DatasetId(datasetId);
this.primaryKeyFields = primaryKeyFields;
this.txnCtx = txnCtx;
this.lockManager = lockManager;
- this.longHashes= new long[2];
+ this.longHashes = new long[2];
}
public int computePrimaryKeyHashValue(ITupleReference tuple, int[] primaryKeyFields) {
MurmurHash128Bit.hash3_x64_128(tuple, primaryKeyFields, SEED, longHashes);
- return Math.abs((int) longHashes[0]);
- }
-
- public TransactionContext getTransactionContext() {
- return txnCtx;
+ return Math.abs((int) longHashes[0]);
}
public int getLocalNumActiveOperations() {
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/AbstractOperationCallbackFactory.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/AbstractOperationCallbackFactory.java
similarity index 85%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/AbstractOperationCallbackFactory.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/AbstractOperationCallbackFactory.java
index 386dce5..5c0d5f1 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/AbstractOperationCallbackFactory.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/AbstractOperationCallbackFactory.java
@@ -13,12 +13,12 @@
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.opcallbacks;
+package edu.uci.ics.asterix.common.transactions;
import java.io.Serializable;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionSubsystemProvider;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
+import edu.uci.ics.asterix.common.context.ITransactionSubsystemProvider;
+import edu.uci.ics.asterix.common.transactions.JobId;
public abstract class AbstractOperationCallbackFactory implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/Buffer.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/Buffer.java
new file mode 100644
index 0000000..d70288f
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/Buffer.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+package edu.uci.ics.asterix.common.transactions;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+/**
+ * Represents a wrapper over @see ByteBuffer supporting some custom APIs for
+ * transaction support. This class is not "thread-safe". For performance
+ * concerns, it is required for multiple writers to be able to write to the
+ * buffer concurrently and that a writer is never blocked by another writer. The
+ * users of this class must ensure that two concurrent writers get to write in
+ * exclusive areas in the buffer. A reader and writer may or may not conflict
+ * with each other. For example, reading of logs during roll back of a
+ * transaction t1 does not conflict with writing of logs by another transaction
+ * t2 as they are concerned with exclusive areas of the buffer. On the contrary,
+ * a flushing the buffer to disk conflicts with a reader reading the buffer.
+ * Appropriate locks are taken on the Buffer in the application logic and not
+ * directly imposed by synchronized methods.
+ */
+
+public class Buffer implements IBuffer {
+
+ ByteBuffer buffer;
+
+ public Buffer(ByteBuffer buffer) {
+ this.buffer = buffer;
+ }
+
+ protected Buffer() {
+ }
+
+ public void setBuffer(ByteBuffer buffer) {
+ this.buffer = buffer;
+ }
+
+ @Override
+ public byte getByte(int offset) {
+ return buffer.get(offset);
+ }
+
+ @Override
+ public byte getByte() {
+ return buffer.get();
+ }
+
+ @Override
+ public void getBytes(byte[] bytes, int offset, int size) {
+ System.arraycopy(buffer.array(), offset, bytes, 0, size);
+ }
+
+ @Override
+ public int getSize() {
+ return buffer.capacity();
+ }
+
+ @Override
+ public int readInt() {
+ return buffer.getInt();
+ }
+
+ @Override
+ public int readInt(int offset) {
+ return buffer.getInt(offset);
+ }
+
+ @Override
+ public long readLong(int offset) {
+ return buffer.getLong(offset);
+ }
+
+ @Override
+ public void put(byte b) {
+ buffer.put(b);
+ }
+
+ @Override
+ public void put(int offset, byte b) {
+ buffer.put(offset, b);
+ }
+
+ @Override
+ public void put(byte[] bytes, int start, int length) {
+ buffer.put(bytes, start, length);
+
+ }
+
+ @Override
+ public void put(byte[] bytes) {
+ buffer.put(bytes);
+ }
+
+ @Override
+ public void writeInt(int value) {
+ buffer.putInt(value);
+ }
+
+ @Override
+ public void writeInt(int offset, int value) {
+ buffer.putInt(offset, value);
+
+ }
+
+ @Override
+ public void writeLong(long value) {
+ buffer.putLong(value);
+ }
+
+ @Override
+ public void writeLong(int offset, long value) {
+ buffer.putLong(offset, value);
+
+ }
+
+ @Override
+ public byte[] getArray() {
+ return buffer.array();
+ }
+
+ @Override
+ public void erase() {
+ Arrays.fill(buffer.array(), (byte) 0);
+ }
+
+ @Override
+ public ByteBuffer getByteBuffer() {
+ return buffer;
+ }
+
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/DatasetId.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/DatasetId.java
similarity index 80%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/DatasetId.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/DatasetId.java
index 9aded2a..9f964f1 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/DatasetId.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/DatasetId.java
@@ -1,8 +1,12 @@
-package edu.uci.ics.asterix.transaction.management.service.transaction;
+package edu.uci.ics.asterix.common.transactions;
import java.io.Serializable;
public class DatasetId implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
int id;
public DatasetId(int id) {
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/FileBasedBuffer.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/FileBasedBuffer.java
similarity index 98%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/FileBasedBuffer.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/FileBasedBuffer.java
index e88d74e..0e80817 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/FileBasedBuffer.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/FileBasedBuffer.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
import java.io.File;
import java.io.IOException;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/FileUtil.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/FileUtil.java
similarity index 95%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/FileUtil.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/FileUtil.java
index 46e03f1..2ba0a08 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/FileUtil.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/FileUtil.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
import java.io.File;
import java.io.IOException;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/IAsterixAppRuntimeContextProvider.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IAsterixAppRuntimeContextProvider.java
similarity index 88%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/IAsterixAppRuntimeContextProvider.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IAsterixAppRuntimeContextProvider.java
index d96d5c2..f762b16 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/IAsterixAppRuntimeContextProvider.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IAsterixAppRuntimeContextProvider.java
@@ -1,6 +1,5 @@
-package edu.uci.ics.asterix.transaction.management.service.recovery;
+package edu.uci.ics.asterix.common.transactions;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
import edu.uci.ics.hyracks.api.io.IIOManager;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackProvider;
@@ -18,7 +17,7 @@
public IFileMapProvider getFileMapManager();
- public TransactionSubsystem getTransactionSubsystem();
+ public ITransactionSubsystem getTransactionSubsystem();
public IIndexLifecycleManager getIndexLifecycleManager();
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IBuffer.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IBuffer.java
similarity index 95%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IBuffer.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IBuffer.java
index 8f39cbf..abb8ab8 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IBuffer.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IBuffer.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
import java.nio.ByteBuffer;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/ICloseable.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ICloseable.java
similarity index 81%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/ICloseable.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ICloseable.java
index f62fd66..4315a03 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/ICloseable.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ICloseable.java
@@ -13,10 +13,9 @@
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.resource;
+package edu.uci.ics.asterix.common.transactions;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
/**
* Represents a closeable resource that implements a close(@see
@@ -35,6 +34,6 @@
* @param context
* @throws ACIDException
*/
- public void close(TransactionContext context) throws ACIDException;
+ public void close(ITransactionContext context) throws ACIDException;
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IFileBasedBuffer.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IFileBasedBuffer.java
similarity index 95%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IFileBasedBuffer.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IFileBasedBuffer.java
index a4ea3cb..5093ca0 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IFileBasedBuffer.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IFileBasedBuffer.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
import java.io.IOException;
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILockHashTable.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILockHashTable.java
new file mode 100644
index 0000000..8c0e373
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILockHashTable.java
@@ -0,0 +1,21 @@
+package edu.uci.ics.asterix.common.transactions;
+
+/**
+ * @author pouria Interface for a hashTable, used in the internal data
+ * structures of lockManager
+ * @param <K>
+ * Type of the objects, used as keys
+ * @param <V>
+ * Type of the objects, used as values
+ */
+public interface ILockHashTable<K, V> {
+
+ public void put(K key, V value);
+
+ public V get(K key);
+
+ public V remove(K key);
+
+ public int getKeysetSize();
+
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/ILockManager.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILockManager.java
similarity index 78%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/ILockManager.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILockManager.java
index 1341cc1..6e42e2d 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/ILockManager.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILockManager.java
@@ -12,18 +12,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.locking;
+package edu.uci.ics.asterix.common.transactions;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
/**
* Interface for the lockManager
*
- * @author pouria
+ * @author pouria
* @author kisskys
- *
*/
public interface ILockManager {
@@ -40,13 +37,15 @@
* has a "weaker" lock, then the request would be interpreted as a convert
* request
* Waiting transaction would eventually garb the lock, or get timed-out
+ *
* @param datasetId
* @param entityHashValue
* @param lockMode
* @param txnContext
* @throws ACIDException
*/
- public void lock(DatasetId datasetId, int entityHashValue, byte lockMode, TransactionContext txnContext) throws ACIDException;
+ public void lock(DatasetId datasetId, int entityHashValue, byte lockMode, ITransactionContext txnContext)
+ throws ACIDException;
/**
* The method releases "All" the locks taken/waiting-on by a specific
@@ -57,41 +56,42 @@
* @param txnContext
* @throws ACIDException
*/
- public void releaseLocks(TransactionContext txnContext) throws ACIDException;
+ public void releaseLocks(ITransactionContext txnContext) throws ACIDException;
/**
- *
* @param datasetId
* @param entityHashValue
* @param txnContext
- * @throws ACIDException TODO
+ * @throws ACIDException
+ * TODO
*/
- public void unlock(DatasetId datasetId, int entityHashValue, TransactionContext txnContext) throws ACIDException;
+ public void unlock(DatasetId datasetId, int entityHashValue, ITransactionContext txnContext) throws ACIDException;
/**
- *
* @param datasetId
* @param entityHashValue
* @param txnContext
- * @throws ACIDException TODO
+ * @throws ACIDException
+ * TODO
*/
- public void unlock(DatasetId datasetId, int entityHashValue, TransactionContext txnContext, boolean commitFlag) throws ACIDException;
-
+ public void unlock(DatasetId datasetId, int entityHashValue, ITransactionContext txnContext, boolean commitFlag)
+ throws ACIDException;
+
/**
* Call to lock and unlock a specific resource in a specific lock mode
+ *
* @param datasetId
* @param entityHashValue
- * @param lockMode TODO
+ * @param lockMode
+ * TODO
* @param context
- *
* @return
* @throws ACIDException
*/
- public void instantLock(DatasetId datasetId, int entityHashValue, byte lockMode, TransactionContext context) throws ACIDException;
-
+ public void instantLock(DatasetId datasetId, int entityHashValue, byte lockMode, ITransactionContext context)
+ throws ACIDException;
/**
- *
* @param datasetId
* @param entityHashValue
* @param lockMode
@@ -99,10 +99,10 @@
* @return
* @throws ACIDException
*/
- public boolean tryLock(DatasetId datasetId, int entityHashValue, byte lockMode, TransactionContext context) throws ACIDException;
-
+ public boolean tryLock(DatasetId datasetId, int entityHashValue, byte lockMode, ITransactionContext context)
+ throws ACIDException;
+
/**
- *
* @param datasetId
* @param entityHashValue
* @param lockMode
@@ -110,8 +110,9 @@
* @return
* @throws ACIDException
*/
- boolean instantTryLock(DatasetId datasetId, int entityHashValue, byte lockMode, TransactionContext txnContext)
+ boolean instantTryLock(DatasetId datasetId, int entityHashValue, byte lockMode, ITransactionContext txnContext)
throws ACIDException;
+
/**
* Prints out the contents of the transactions' table in a readable fashion
*
@@ -120,6 +121,4 @@
*/
public String prettyPrint() throws ACIDException;
-
-
}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILockMatrix.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILockMatrix.java
new file mode 100644
index 0000000..e819b9a
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILockMatrix.java
@@ -0,0 +1,30 @@
+package edu.uci.ics.asterix.common.transactions;
+
+/**
+ * @author pouria
+ * Shows: - The conflict matrix for the locking protocol (whether two
+ * lock modes conflict with each other or not on a single resource) -
+ * Whether request to convert a lock mode to a new one is a conversion
+ * (i.e. the new lock mode is stringer than the current one) or not
+ * Each lock mode is shown/interpreted as an integer
+ */
+
+public interface ILockMatrix {
+
+ /**
+ * @param mask
+ * (current/expected) lock mask on the resource
+ * @param reqLockMode
+ * index of the requested lockMode
+ * @return true if the lock request conflicts with the mask
+ */
+ public boolean conflicts(int mask, int reqLockMode);
+
+ /**
+ * @param currentLockMode
+ * @param reqLockMode
+ * @return true if the request is a conversion
+ */
+ public boolean isConversion(int currentLockMode, int reqLockMode);
+
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogCursor.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogCursor.java
similarity index 83%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogCursor.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogCursor.java
index 991de1b..ab2dcc2 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogCursor.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogCursor.java
@@ -12,11 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
import java.io.IOException;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
/**
* Provides a cursor over the logs created to date.
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogFilter.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogFilter.java
similarity index 88%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogFilter.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogFilter.java
index 4c7eda2..9986add6 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogFilter.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogFilter.java
@@ -12,7 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
+
+import edu.uci.ics.asterix.common.transactions.IBuffer;
/**
* Represents a predicate or a filter that needs to be applied when selectively
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogManager.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogManager.java
similarity index 80%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogManager.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogManager.java
index 26229a7..9470d17 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogManager.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogManager.java
@@ -12,14 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
import java.io.IOException;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.logging.IndexLogger.ReusableLogContentObject;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
public interface ILogManager {
@@ -36,7 +33,7 @@
* @param logicalLogLocator
* @throws ACIDException
*/
- void log(byte logType, TransactionContext context, int datasetId, int PKHashValue, long resourceId,
+ void log(byte logType, ITransactionContext context, int datasetId, int PKHashValue, long resourceId,
byte resourceMgrId, int logContentSize, ReusableLogContentObject reusableLogContentObject, ILogger logger,
LogicalLogLocator logicalLogLocator) throws ACIDException;
@@ -53,7 +50,10 @@
ACIDException;
/**
- * @param logicalLogLocator TODO
+ * @param logicalLogLocator
+ * TODO
+ * @param logicalLogLocator
+ * TODO
* @param PhysicalLogLocator
* specifies the location of the log record to be read
* @throws ACIDException
@@ -83,6 +83,6 @@
*
* @return TransactionSubsystem
*/
- public TransactionSubsystem getTransactionSubsystem();
+ public ITransactionSubsystem getTransactionSubsystem();
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogRecordHelper.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogRecordHelper.java
similarity index 85%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogRecordHelper.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogRecordHelper.java
index 0e24f9d..13fc722 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogRecordHelper.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogRecordHelper.java
@@ -13,9 +13,7 @@
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
-
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+package edu.uci.ics.asterix.common.transactions;
/**
* Helper class for writing/reading of log header and checksum as well as
@@ -36,9 +34,9 @@
public PhysicalLogLocator getPrevLSN(LogicalLogLocator logicalLogLocator);
public boolean getPrevLSN(PhysicalLogLocator physicalLogLocator, LogicalLogLocator logicalLogLocator);
-
+
public long getResourceId(LogicalLogLocator logicalLogLocator);
-
+
public byte getResourceMgrId(LogicalLogLocator logicalLogLocater);
public int getLogContentSize(LogicalLogLocator logicalLogLocater);
@@ -51,8 +49,9 @@
public String getLogRecordForDisplay(LogicalLogLocator logicalLogLocator);
- public void writeLogHeader(LogicalLogLocator logicalLogLocator, byte logType, TransactionContext context, int datasetId,
- int PKHashValue, long prevLogicalLogLocator, long resourceId, byte resourceMgrId, int logRecordSize);
+ public void writeLogHeader(LogicalLogLocator logicalLogLocator, byte logType, ITransactionContext context,
+ int datasetId, int PKHashValue, long prevLogicalLogLocator, long resourceId, byte resourceMgrId,
+ int logRecordSize);
public boolean validateLogRecord(LogicalLogLocator logicalLogLocator);
@@ -61,7 +60,7 @@
public int getLogHeaderSize(byte logType);
public int getLogChecksumSize();
-
+
public int getCommitLogSize();
-}
+}
\ No newline at end of file
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogger.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogger.java
new file mode 100644
index 0000000..78dd50b
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILogger.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+package edu.uci.ics.asterix.common.transactions;
+
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+
+/**
+ * An interface providing call back APIs that are invoked {@link ILogManager} for providing the content for the log record and doing any pre/post
+ * processing.
+ */
+public interface ILogger {
+
+ public void preLog(ITransactionContext context, ReusableLogContentObject reusableLogContentObject)
+ throws ACIDException;
+
+ public void log(ITransactionContext context, final LogicalLogLocator logicalLogLocator, int logContentSize,
+ ReusableLogContentObject reusableLogContentObject) throws ACIDException;
+
+ public void postLog(ITransactionContext context, ReusableLogContentObject reusableLogContentObject)
+ throws ACIDException;
+
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILoggerRepository.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILoggerRepository.java
new file mode 100644
index 0000000..036d66c
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ILoggerRepository.java
@@ -0,0 +1,6 @@
+package edu.uci.ics.asterix.common.transactions;
+
+public interface ILoggerRepository {
+
+ public ILogger getIndexLogger(long resourceId, byte resourceType);
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/IRecoveryManager.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IRecoveryManager.java
similarity index 87%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/IRecoveryManager.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IRecoveryManager.java
index 38802a2..dd9e734 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/IRecoveryManager.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IRecoveryManager.java
@@ -12,12 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.recovery;
+package edu.uci.ics.asterix.common.transactions;
import java.io.IOException;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
/**
* Provides API for failure recovery. Failure could be at application level and
@@ -67,7 +67,7 @@
* the transaction context associated with the transaction
* @throws ACIDException
*/
- public void rollbackTransaction(TransactionContext txnContext) throws ACIDException;
+ public void rollbackTransaction(ITransactionContext txnContext) throws ACIDException;
public void checkpoint(boolean isSharpCheckpoint) throws ACIDException;
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/IResourceManager.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IResourceManager.java
similarity index 88%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/IResourceManager.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IResourceManager.java
index f7715e8..6874c7e 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/IResourceManager.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/IResourceManager.java
@@ -12,11 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.transaction;
+package edu.uci.ics.asterix.common.transactions;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogRecordHelper;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.ILogRecordHelper;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
/**
* Provides APIs for undo or redo of an operation on a resource.
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ITransactionContext.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ITransactionContext.java
new file mode 100644
index 0000000..a06cc75
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ITransactionContext.java
@@ -0,0 +1,55 @@
+package edu.uci.ics.asterix.common.transactions;
+
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext.TransactionType;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager.TransactionState;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndex;
+
+public interface ITransactionContext {
+
+ public void registerIndexAndCallback(ILSMIndex index, AbstractOperationCallback callback);
+
+ public void updateLastLSNForIndexes(long lastLSN);
+
+ public void decreaseActiveTransactionCountOnIndexes() throws HyracksDataException;
+
+ public LogicalLogLocator getFirstLogLocator();
+
+ public LogicalLogLocator getLastLogLocator();
+
+ public void addCloseableResource(ICloseable resource);
+
+ public JobId getJobId();
+
+ public void setStartWaitTime(long time);
+
+ public long getStartWaitTime();
+
+ public void setStatus(int status);
+
+ public int getStatus();
+
+ public void setTxnState(TransactionState txnState);
+
+ public TransactionState getTxnState();
+
+ public void releaseResources() throws ACIDException;
+
+ public void setLastLSN(long lsn);
+
+ public TransactionType getTransactionType();
+
+ public void setTransactionType(TransactionType transactionType);
+
+ public static final long INVALID_TIME = -1l; // used for showing a
+ // transaction is not waiting.
+ public static final int ACTIVE_STATUS = 0;
+ public static final int TIMED_OUT_STATUS = 1;
+
+ public enum TransactionType {
+ READ,
+ READ_WRITE
+ }
+
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/ITransactionManager.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ITransactionManager.java
similarity index 70%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/ITransactionManager.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ITransactionManager.java
index 3f55ac9..2bfc00d 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/ITransactionManager.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ITransactionManager.java
@@ -12,9 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.transaction;
+package edu.uci.ics.asterix.common.transactions;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
/**
* Provides APIs for managing life cycle of a transaction, that is beginning a
@@ -43,10 +43,10 @@
* @param jobId
* a unique value for the transaction id.
* @return the transaction context associated with the initiated transaction
- * @see TransactionContext
+ * @see ITransactionContext
* @throws ACIDException
*/
- public TransactionContext beginTransaction(JobId jobId) throws ACIDException;
+ public ITransactionContext beginTransaction(JobId jobId) throws ACIDException;
/**
* Returns the transaction context of an active transaction given the
@@ -57,33 +57,39 @@
* @return
* @throws ACIDException
*/
- public TransactionContext getTransactionContext(JobId jobId) throws ACIDException;
+ public ITransactionContext getTransactionContext(JobId jobId) throws ACIDException;
/**
* Commits a transaction.
*
* @param txnContext
* the transaction context associated with the transaction
- * @param datasetId TODO
- * @param PKHashVal TODO
+ * @param datasetId
+ * TODO
+ * @param PKHashVal
+ * TODO
* @throws ACIDException
- * @see transactionContextimport edu.uci.ics.hyracks.api.job.JobId;
+ * @see ITransactionContextimport edu.uci.ics.hyracks.api.job.JobId;
* @see ACIDException
*/
- public void commitTransaction(TransactionContext txnContext, DatasetId datasetId, int PKHashVal) throws ACIDException;
+ public void commitTransaction(ITransactionContext txnContext, DatasetId datasetId, int PKHashVal)
+ throws ACIDException;
/**
* Aborts a transaction.
*
* @param txnContext
* the transaction context associated with the transaction
- * @param datasetId TODO
- * @param PKHashVal TODO
+ * @param datasetId
+ * TODO
+ * @param PKHashVal
+ * TODO
* @throws ACIDException
- * @see transactionContext
+ * @see ITransactionContext
* @see ACIDException
*/
- public void abortTransaction(TransactionContext txnContext, DatasetId datasetId, int PKHashVal) throws ACIDException;
+ public void abortTransaction(ITransactionContext txnContext, DatasetId datasetId, int PKHashVal)
+ throws ACIDException;
/**
* Indicates end of all activity for a transaction. In other words, all
@@ -92,23 +98,27 @@
*
* @param txnContext
* the transaction context associated with the transaction
- * @param datasetId TODO
- * @param PKHashVal TODO
+ * @param datasetId
+ * TODO
+ * @param PKHashVal
+ * TODO
* @param success
* indicates the success or failure. The transaction is committed
* or aborted accordingly.
* @throws ACIDException
*/
- public void completedTransaction(TransactionContext txnContext, DatasetId datasetId, int PKHashVal, boolean success) throws ACIDException;
+ public void completedTransaction(ITransactionContext txnContext, DatasetId datasetId, int PKHashVal, boolean success)
+ throws ACIDException;
/**
* Returns the Transaction Provider for the transaction eco-system. A
* transaction eco-system consists of a Log Manager, a Recovery Manager, a
* Transaction Manager and a Lock Manager.
*
- * @see TransactionSubsystem
+ * @see ITransactionSubsystem
* @return TransactionProvider
*/
- public TransactionSubsystem getTransactionProvider();
+ public ITransactionSubsystem getTransactionProvider();
+
}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ITransactionSubsystem.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ITransactionSubsystem.java
new file mode 100644
index 0000000..e5462da
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ITransactionSubsystem.java
@@ -0,0 +1,21 @@
+package edu.uci.ics.asterix.common.transactions;
+
+
+public interface ITransactionSubsystem {
+
+ public ILogManager getLogManager();
+
+ public ILockManager getLockManager();
+
+ public ITransactionManager getTransactionManager();
+
+ public IRecoveryManager getRecoveryManager();
+
+ public TransactionalResourceManagerRepository getTransactionalResourceRepository();
+
+ public ILoggerRepository getTreeLoggerRepository();
+
+ public IAsterixAppRuntimeContextProvider getAsterixAppRuntimeContextProvider();
+
+ public String getId();
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/JobId.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/JobId.java
similarity index 90%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/JobId.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/JobId.java
index d306670..1246f22 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/JobId.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/JobId.java
@@ -1,4 +1,4 @@
-package edu.uci.ics.asterix.transaction.management.service.transaction;
+package edu.uci.ics.asterix.common.transactions;
import java.io.Serializable;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogManagerProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogManagerProperties.java
similarity index 98%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogManagerProperties.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogManagerProperties.java
index 581ce4c..4dc943c 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogManagerProperties.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogManagerProperties.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
import java.io.Serializable;
import java.util.Properties;
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogUtil.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogUtil.java
new file mode 100644
index 0000000..acf3346
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogUtil.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+package edu.uci.ics.asterix.common.transactions;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+
+/**
+ * A utility class providing helper methods for the {@link ILogManager}
+ */
+public class LogUtil {
+
+ private static final Logger LOGGER = Logger.getLogger(LogUtil.class.getName());
+
+ // read the log directory and initialize log anchor to point to the
+ // current log partition file and the offset where the log manager shall
+ // continue to insert log records.
+
+ public static PhysicalLogLocator initializeLogAnchor(ILogManager logManager) throws ACIDException {
+ int fileId = 0;
+ long offset = 0;
+ LogManagerProperties logManagerProperties = logManager.getLogManagerProperties();
+ File logDir = new File(logManagerProperties.getLogDir());
+ try {
+ if (logDir.exists()) {
+ List<String> logFiles = getLogFiles(logManagerProperties);
+ if (logFiles == null || logFiles.size() == 0) {
+ FileUtil.createFileIfNotExists(getLogFilePath(logManagerProperties, 0));
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("created a log file: " + getLogFilePath(logManagerProperties, 0));
+ }
+ } else {
+ File logFile = new File(LogUtil.getLogFilePath(logManagerProperties,
+ Long.parseLong(logFiles.get(logFiles.size() - 1))));
+ fileId = logFiles.size() - 1;
+ offset = logFile.length();
+ }
+ } else {
+ FileUtil.createNewDirectory(logManagerProperties.getLogDir());
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("created the log directory: " + logManagerProperties.getLogDir());
+ }
+ FileUtil.createFileIfNotExists(getLogFilePath(logManagerProperties, 0));
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("created a log file: " + getLogFilePath(logManagerProperties, 0));
+ }
+ }
+ } catch (IOException ioe) {
+ throw new ACIDException("Unable to initialize log anchor", ioe);
+ }
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info(" file id :" + fileId + " offset " + offset);
+ }
+ return new PhysicalLogLocator(fileId, offset, logManager);
+ }
+
+ public static List<String> getLogFiles(final LogManagerProperties logManagerProperties) {
+ File logDir = new File(logManagerProperties.getLogDir());
+ String[] logFiles = new String[0];
+ List<String> logFileCollection = new ArrayList<String>();
+ if (logDir.exists()) {
+ logFiles = logDir.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ if (name.startsWith(logManagerProperties.getLogFilePrefix())) {
+ return true;
+ }
+ return false;
+ }
+ });
+ }
+ for (String logFile : logFiles) {
+ logFileCollection.add(logFile.substring(logManagerProperties.getLogFilePrefix().length() + 1));
+ }
+ Collections.sort(logFileCollection, new Comparator<String>() {
+ @Override
+ public int compare(String arg0, String arg1) {
+ return Integer.parseInt(arg0) - Integer.parseInt(arg1);
+ }
+ });
+ return logFileCollection;
+ }
+
+ public static long getFileId(String logFilePath, LogManagerProperties logManagerProperties) {
+ String logFileName = logFilePath;
+ if (logFilePath.contains(File.separator)) {
+ logFileName = logFilePath.substring(logFilePath.lastIndexOf(File.separator));
+ }
+ return Long.parseLong(logFileName.substring(logFileName.indexOf(logManagerProperties.getLogFilePrefix())));
+ }
+
+ public static String getLogFilePath(LogManagerProperties logManagerProperties, long fileId) {
+ return logManagerProperties.getLogDir() + File.separator + logManagerProperties.getLogFilePrefix() + "_"
+ + fileId;
+ }
+
+ public static LogicalLogLocator getDummyLogicalLogLocator(ILogManager logManager) {
+ LogicalLogLocator logicalLogLocator = new LogicalLogLocator(-1, null, -1, logManager);
+ return logicalLogLocator;
+ }
+
+ /*
+ * given a lsn, get the offset within the log file where the corresponding
+ * log record is (to be) placed.
+ */
+ public static long getFileOffset(ILogManager logManager, long lsn) {
+ return lsn % logManager.getLogManagerProperties().getLogPartitionSize();
+ }
+
+ /*
+ * given a lsn, get the file id that contains the log record.
+ */
+ public static long getFileId(ILogManager logManager, long lsn) {
+ return lsn / logManager.getLogManagerProperties().getLogPartitionSize();
+ }
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogicalLogLocator.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogicalLogLocator.java
similarity index 96%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogicalLogLocator.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogicalLogLocator.java
index f9eec7d..81dc6e2 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogicalLogLocator.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/LogicalLogLocator.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
import java.util.concurrent.atomic.AtomicInteger;
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/MutableResourceId.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/MutableResourceId.java
new file mode 100644
index 0000000..a6cebd6
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/MutableResourceId.java
@@ -0,0 +1,30 @@
+package edu.uci.ics.asterix.common.transactions;
+
+public class MutableResourceId{
+ long id;
+
+ public MutableResourceId(long id) {
+ this.id = id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public int hashCode() {
+ return (int)id;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if ((o == null) || !(o instanceof MutableResourceId)) {
+ return false;
+ }
+ return ((MutableResourceId) o).id == this.id;
+ }
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/PhysicalLogLocator.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/PhysicalLogLocator.java
similarity index 96%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/PhysicalLogLocator.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/PhysicalLogLocator.java
index d8de007..7c0cff7 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/PhysicalLogLocator.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/PhysicalLogLocator.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.service.logging;
+package edu.uci.ics.asterix.common.transactions;
import java.util.concurrent.atomic.AtomicLong;
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ReusableLogContentObject.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ReusableLogContentObject.java
new file mode 100644
index 0000000..a327c10
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/ReusableLogContentObject.java
@@ -0,0 +1,67 @@
+package edu.uci.ics.asterix.common.transactions;
+
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
+import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
+
+/**
+ * Represents the state of a transaction thread. The state contains information
+ * that includes the tuple being operated, the operation and the location of the
+ * log record corresponding to the operation.
+ */
+public class ReusableLogContentObject {
+
+ private LogicalLogLocator logicalLogLocator;
+ private IndexOperation newOperation;
+ private ITupleReference newValue;
+ private IndexOperation oldOperation;
+ private ITupleReference oldValue;
+
+ public ReusableLogContentObject(LogicalLogLocator logicalLogLocator, IndexOperation newOperation,
+ ITupleReference newValue, IndexOperation oldOperation, ITupleReference oldValue) {
+ this.logicalLogLocator = logicalLogLocator;
+ this.newOperation = newOperation;
+ this.newValue = newValue;
+ this.oldOperation = oldOperation;
+ this.oldValue = oldValue;
+ }
+
+ public synchronized LogicalLogLocator getLogicalLogLocator() {
+ return logicalLogLocator;
+ }
+
+ public synchronized void setLogicalLogLocator(LogicalLogLocator logicalLogLocator) {
+ this.logicalLogLocator = logicalLogLocator;
+ }
+
+ public synchronized void setNewOperation(IndexOperation newOperation) {
+ this.newOperation = newOperation;
+ }
+
+ public synchronized IndexOperation getNewOperation() {
+ return newOperation;
+ }
+
+ public synchronized void setNewValue(ITupleReference newValue) {
+ this.newValue = newValue;
+ }
+
+ public synchronized ITupleReference getNewValue() {
+ return newValue;
+ }
+
+ public synchronized void setOldOperation(IndexOperation oldOperation) {
+ this.oldOperation = oldOperation;
+ }
+
+ public synchronized IndexOperation getOldOperation() {
+ return oldOperation;
+ }
+
+ public synchronized void setOldValue(ITupleReference oldValue) {
+ this.oldValue = oldValue;
+ }
+
+ public synchronized ITupleReference getOldValue() {
+ return oldValue;
+ }
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/TransactionalResourceManagerRepository.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/TransactionalResourceManagerRepository.java
similarity index 92%
rename from asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/TransactionalResourceManagerRepository.java
rename to asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/TransactionalResourceManagerRepository.java
index d38226b..35f69d4 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/TransactionalResourceManagerRepository.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/transactions/TransactionalResourceManagerRepository.java
@@ -13,13 +13,11 @@
* limitations under the License.
*/
-package edu.uci.ics.asterix.transaction.management.resource;
+package edu.uci.ics.asterix.common.transactions;
import java.util.HashMap;
import java.util.Map;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager;
-
/**
* Represents a repository containing Resource Managers and Resources in the
* transaction eco-system. Operations on a resource require acquiring
diff --git a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
index 8449971..acb1e6a 100644
--- a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
+++ b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
@@ -342,8 +342,7 @@
List<CompilationUnit> cUnits = testCaseCtx.getTestCase().getCompilationUnit();
for (CompilationUnit cUnit : cUnits) {
- LOGGER.info("[TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName());
-
+
testFileCtxs = testCaseCtx.getTestFiles(cUnit);
expectedResultFileCtxs = testCaseCtx.getExpectedResultFiles(cUnit);
@@ -360,10 +359,8 @@
break;
case "query":
result = TestsUtils.executeQuery(statement);
- if (!cUnit.getExpectedError().isEmpty()) {
- if (!result.has("error")) {
- throw new Exception("Test \"" + testFile + "\" FAILED!");
- }
+ if (result.has("error-code")) {
+ throw new Exception("Test \"" + testFile + "\" FAILED!\n" + result + "\n");
} else {
expectedResultFile = expectedResultFileCtxs.get(queryCount).getFile();
@@ -378,6 +375,7 @@
TestsUtils.runScriptAndCompareWithResult(testFile, new PrintWriter(System.err),
expectedResultFile, actualFile);
+ LOGGER.info("[TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName() + " PASSED ");
}
queryCount++;
break;
@@ -387,6 +385,7 @@
default:
throw new IllegalArgumentException("No statements of type " + ctx.getType());
}
+
} catch (Exception e) {
if (cUnit.getExpectedError().isEmpty()) {
throw new Exception("Test \"" + testFile + "\" FAILED!", e);
diff --git a/asterix-doc/pom.xml b/asterix-doc/pom.xml
index f44c06d..d987e5f 100644
--- a/asterix-doc/pom.xml
+++ b/asterix-doc/pom.xml
@@ -12,6 +12,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
+ <configuration>
+ <generateReports>false</generateReports>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git a/asterix-doc/src/site/markdown/AccessingExternalDataInAsterixDB.md b/asterix-doc/src/site/markdown/AccessingExternalDataInAsterixDB.md
new file mode 100644
index 0000000..7319094
--- /dev/null
+++ b/asterix-doc/src/site/markdown/AccessingExternalDataInAsterixDB.md
@@ -0,0 +1,199 @@
+# Accessing External Data in AsterixDB #
+
+## Introduction ##
+Data that needs to be processed by ASTERIX could be residing outside ASTERIX storage. Examples include data files on a distributed file system such as HDFS or on the local file system of a machine that is part of an ASTERIX cluster. For ASTERIX to process such data, end-user may create a regular dataset in ASTERIX (a.k.a. internal dataset) and load the dataset with the data. ASTERIX supports ''external datasets'' so that it is not necessary to “load” all data prior to using it. This also avoids creating multiple copies of data and the need to keep the copies in sync.
+
+### Adapter for an External Dataset ###
+External data is accessed using wrappers (adapters in ASTERIX) that abstract away the mechanism of connecting with an external service, receiving data and transforming the data into ADM records that are understood by ASTERIX. ASTERIX comes with built-in adapters for common storage systems such as HDFS or the local file system.
+
+### Creating an External Dataset ###
+
+As an example we consider the Lineitem dataset from [TPCH schema](http://www.openlinksw.com/dataspace/doc/dav/wiki/Main/VOSTPCHLinkedData/tpch.sql).
+
+We assume that you have successfully created an ASTERIX instance following the instructions at [Installing Asterix Using Managix](InstallingAsterixUsingManagix.html).
+_For constructing an example, we assume a single machine setup._
+
+Similar to a regular dataset, an external dataset has an associated datatype. We shall first create the datatype associated with each record in Lineitem data.
+Paste the following in the query textbox on the webpage at http://127.0.0.1:19001 and hit 'Execute'.
+
+
+ create dataverse ExternalFileDemo;
+ use dataverse ExternalFileDemo;
+
+ create type LineitemType as closed {
+ l_orderkey:int32,
+ l_partkey: int32,
+ l_suppkey: int32,
+ l_linenumber: int32,
+ l_quantity: double,
+ l_extendedprice: double,
+ l_discount: double,
+ l_tax: double,
+ l_returnflag: string,
+ l_linestatus: string,
+ l_shipdate: string,
+ l_commitdate: string,
+ l_receiptdate: string,
+ l_shipinstruct: string,
+ l_shipmode: string,
+ l_comment: string}
+
+
+We describe here two scenarios.
+
+#### 1) Data file resides on the local file system of a host####
+Prerequisite: The host is a part of the ASTERIX cluster.
+
+Earlier, we assumed a single machine ASTERIX setup. To satisfy the prerequisite, log-in to the machine running ASTERIX.
+
+ * Download the [data file](https://code.google.com/p/asterixdb/downloads/detail?name=lineitem.tbl&can=2&q=) to an appropriate location. We denote this location by SOURCE_PATH.
+
+ASTERIX provides a built-in adapter for data residing on the local file system. The adapter is referred by its alias- 'localfs'. We create an external dataset named Lineitem and use the 'localfs' adapter.
+
+
+ create external dataset Lineitem(LineitemType)
+ using localfs
+
+Above, the definition is not complete as we need to provide a set of parameters that are specific to the source file.
+
+<table>
+<tr>
+ <td> Parameter </td>
+ <td> Description </td>
+</tr>
+<tr>
+ <td> path </td>
+ <td> A fully qualified path of the form <tt>host://<absolute path></tt>.
+ Use a comma separated list if there are multiple files.
+ E.g. <tt>host1://<absolute path></tt>, <tt>host2://<absolute path></tt> and so forth. </td>
+</tr>
+<tr>
+ <td> format </td>
+ <td> The format for the content. Use 'adm' for data in ADM (ASTERIX Data Model) or <a href="http://www.json.org/">JSON</a> format. Use 'delimited-text' if fields are separted by . </td></tr>
+<tr><td>delimiter</td><td>The delimiting character in the source file if format is 'delimited text'</td></tr>
+</table>
+
+As we are using a single single machine ASTERIX instance, we use 127.0.0.1 as host in the path parameter.
+We *complete the create dataset statement* as follows.
+
+
+ use dataverse ExternalFileDemo;
+
+ create external dataset Lineitem(LineitemType)
+ using localfs
+ (("path"="127.0.0.1://SOURCE_PATH"),
+ ("format"="delimited-text"),
+ ("delimiter"="|"));
+
+
+Please substitute SOURCE_PATH with the absolute path to the source file on the local file system.
+
+#### Common source of error ####
+
+An incorrect value for the path parameter will give the following exception message when the dataset is used in a query.
+
+ edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: edu.uci.ics.hyracks.api.exceptions.HyracksDataException: edu.uci.ics.hyracks.api.exceptions.HyracksDataException: Job failed.
+
+
+Verify the correctness of the path parameter provided to the localfs adapter. Note that the path parameter must be an absolute path to the data file. For e.g. if you saved your file in your home directory (assume it to be /home/joe), then the path value should be
+
+ 127.0.0.1:///home/joe/lineitem.tbl.
+
+
+In your web-browser, navigate to 127.0.0.1:19001 and paste the above to the query text box. Finally hit 'Execute'.
+
+Next we move over to the the section [Writing Queries against an External Dataset](#Writing_Queries_against_an_External_Dataset) and try a sample query against the external dataset.
+
+#### 2) Data file resides on an HDFS instance ####
+Pre-requisite: It is required that the Namenode and atleast one of the HDFS Datanodes are reachable from the hosts that form the ASTERIX cluster. ASTERIX provides a built-in adapter for data residing on HDFS. The HDFS adapter is referred (in AQL) by its alias - 'hdfs'. We create an external dataset named Lineitem and associate the HDFS adapter with it.
+
+
+ create external dataset Lineitem(LineitemType)
+ using hdfs
+
+
+The above statement is *not complete* as we need to provide a set of parameters specific to the HDFS instance and the source file.
+These parameters are described below.
+
+<table>
+<tr>
+ <td> Parameter </td>
+ <td> Description </td>
+</tr>
+<tr>
+ <td> hdfs </td>
+ <td> The HDFS URL </td>
+</tr>
+<tr>
+ <td> path </td>
+ <td> The absolute path to the source HDFS file. Use a comma separated list if there are multiple files. </td></tr>
+<tr>
+ <td> input-format </td>
+ <td> The associated input format. Use 'text-input-format' for textual data or 'sequence-input-format' for binary data (sequence files). </td>
+</tr>
+<tr>
+ <td> format </td>
+ <td> The format for the content. Use 'adm' for data in ADM (ASTERIX Data Model) or
+ <a href="http://www.json.org/">JSON</a> format and use 'delimited-text' for delimited data
+ that has fields separated by a delimiting character. </td>
+</tr>
+<tr>
+ <td> delimiter </td>
+ <td> The delimiting character in the source file if format is 'delimited text' </td>
+</tr>
+</table>
+
+*Difference between 'input-format' and 'format'*
+
+*input-format*: File stored under HDFS have an associated storage format For example, TextInputFormat represents plain text files. SequenceFileInputFormat indicates binary compressed file. The parameter 'input-format' is used to distinguish between these two kind of files.
+
+*format*:
+The parameter 'format' refers to the type of the data contained in the file. For example data contained in a file could be in json, ADM format or could be delimited-text with fields separated by a delimiting character.
+
+As an example. consider the [data file](https://code.google.com/p/asterixdb/downloads/detail?name=lineitem.tbl&can=2&q=). The file is a text file with each line representing a record. The fields in each record are separated by the '|' character.
+
+We assume the HDFS URL to be hdfs://host:port. We further assume that the example data file is copied to the HDFS at a path denoted by HDFS_PATH.
+
+The complete set of parameters for our example file are as follows. (("hdfs"="HDFS_URL",("path"="HDFS_PATH"),("input-format"="text-input-format"),("format"="delimited-text"),("delimiter"="|"))
+
+We modify the create external dataset statement as follows.
+
+
+ create external dataset Lineitem('LineitemType)
+ using hdfs
+ (("hdfs"="HDFS_URL"),("path"="HDFS_PATH"),("input-format"="text-input-format"),("format"="delimited-text"),("delimiter"="|"));
+
+
+Once you have copied the source data file to your HDFS instance, substitute the values of HDFS_URL and HDFS_PATH in the above statement. In your web-browser, navigate to http://127.0.0.1:19001 and execute the above statement with substituted values.
+
+You may now run the sample query in next section.
+
+## Writing Queries against an External Dataset ##
+You may write AQL queries against an external dataset. Following is an example AQL query that applies a filter and returns an ordered result.
+
+
+ use dataverse ExternalFileDemo;
+
+ for $c in dataset('Lineitem')
+ where $c.l_orderkey <= 3
+ order by $c.l_orderkey, $c.l_linenumber
+ return $c
+
+
+The expected result is:
+
+
+ { "l_orderkey": 1, "l_partkey": 156, "l_suppkey": 4, "l_linenumber": 1, "l_quantity": 17, "l_extendedprice": 17954.55d, "l_discount": 0.04d, "l_tax": 0.02d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-03-13", "l_commitdate": "1996-02-12", "l_receiptdate": "1996-03-22", "l_shipinstruct": "DELIVER IN PERSON", "l_shipmode": "TRUCK", "l_comment": "egular courts above the" }
+ { "l_orderkey": 1, "l_partkey": 68, "l_suppkey": 9, "l_linenumber": 2, "l_quantity": 36, "l_extendedprice": 34850.16d, "l_discount": 0.09d, "l_tax": 0.06d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-04-12", "l_commitdate": "1996-02-28", "l_receiptdate": "1996-04-20", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "MAIL", "l_comment": "ly final dependencies: slyly bold " }
+ { "l_orderkey": 1, "l_partkey": 64, "l_suppkey": 5, "l_linenumber": 3, "l_quantity": 8, "l_extendedprice": 7712.48d, "l_discount": 0.1d, "l_tax": 0.02d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-01-29", "l_commitdate": "1996-03-05", "l_receiptdate": "1996-01-31", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "REG AIR", "l_comment": "riously. regular, express dep" }
+ { "l_orderkey": 1, "l_partkey": 3, "l_suppkey": 6, "l_linenumber": 4, "l_quantity": 28, "l_extendedprice": 25284.0d, "l_discount": 0.09d, "l_tax": 0.06d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-04-21", "l_commitdate": "1996-03-30", "l_receiptdate": "1996-05-16", "l_shipinstruct": "NONE", "l_shipmode": "AIR", "l_comment": "lites. fluffily even de" }
+ { "l_orderkey": 1, "l_partkey": 25, "l_suppkey": 8, "l_linenumber": 5, "l_quantity": 24, "l_extendedprice": 22200.48d, "l_discount": 0.1d, "l_tax": 0.04d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-03-30", "l_commitdate": "1996-03-14", "l_receiptdate": "1996-04-01", "l_shipinstruct": "NONE", "l_shipmode": "FOB", "l_comment": " pending foxes. slyly re" }
+ { "l_orderkey": 1, "l_partkey": 16, "l_suppkey": 3, "l_linenumber": 6, "l_quantity": 32, "l_extendedprice": 29312.32d, "l_discount": 0.07d, "l_tax": 0.02d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-01-30", "l_commitdate": "1996-02-07", "l_receiptdate": "1996-02-03", "l_shipinstruct": "DELIVER IN PERSON", "l_shipmode": "MAIL", "l_comment": "arefully slyly ex" }
+ { "l_orderkey": 2, "l_partkey": 107, "l_suppkey": 2, "l_linenumber": 1, "l_quantity": 38, "l_extendedprice": 38269.8d, "l_discount": 0.0d, "l_tax": 0.05d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1997-01-28", "l_commitdate": "1997-01-14", "l_receiptdate": "1997-02-02", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "RAIL", "l_comment": "ven requests. deposits breach a" }
+ { "l_orderkey": 3, "l_partkey": 5, "l_suppkey": 2, "l_linenumber": 1, "l_quantity": 45, "l_extendedprice": 40725.0d, "l_discount": 0.06d, "l_tax": 0.0d, "l_returnflag": "R", "l_linestatus": "F", "l_shipdate": "1994-02-02", "l_commitdate": "1994-01-04", "l_receiptdate": "1994-02-23", "l_shipinstruct": "NONE", "l_shipmode": "AIR", "l_comment": "ongside of the furiously brave acco" }
+ { "l_orderkey": 3, "l_partkey": 20, "l_suppkey": 10, "l_linenumber": 2, "l_quantity": 49, "l_extendedprice": 45080.98d, "l_discount": 0.1d, "l_tax": 0.0d, "l_returnflag": "R", "l_linestatus": "F", "l_shipdate": "1993-11-09", "l_commitdate": "1993-12-20", "l_receiptdate": "1993-11-24", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "RAIL", "l_comment": " unusual accounts. eve" }
+ { "l_orderkey": 3, "l_partkey": 129, "l_suppkey": 8, "l_linenumber": 3, "l_quantity": 27, "l_extendedprice": 27786.24d, "l_discount": 0.06d, "l_tax": 0.07d, "l_returnflag": "A", "l_linestatus": "F", "l_shipdate": "1994-01-16", "l_commitdate": "1993-11-22", "l_receiptdate": "1994-01-23", "l_shipinstruct": "DELIVER IN PERSON", "l_shipmode": "SHIP", "l_comment": "nal foxes wake. " }
+ { "l_orderkey": 3, "l_partkey": 30, "l_suppkey": 5, "l_linenumber": 4, "l_quantity": 2, "l_extendedprice": 1860.06d, "l_discount": 0.01d, "l_tax": 0.06d, "l_returnflag": "A", "l_linestatus": "F", "l_shipdate": "1993-12-04", "l_commitdate": "1994-01-07", "l_receiptdate": "1994-01-01", "l_shipinstruct": "NONE", "l_shipmode": "TRUCK", "l_comment": "y. fluffily pending d" }
+ { "l_orderkey": 3, "l_partkey": 184, "l_suppkey": 5, "l_linenumber": 5, "l_quantity": 28, "l_extendedprice": 30357.04d, "l_discount": 0.04d, "l_tax": 0.0d, "l_returnflag": "R", "l_linestatus": "F", "l_shipdate": "1993-12-14", "l_commitdate": "1994-01-10", "l_receiptdate": "1994-01-01", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "FOB", "l_comment": "ages nag slyly pending" }
+ { "l_orderkey": 3, "l_partkey": 63, "l_suppkey": 8, "l_linenumber": 6, "l_quantity": 26, "l_extendedprice": 25039.56d, "l_discount": 0.1d, "l_tax": 0.02d, "l_returnflag": "A", "l_linestatus": "F", "l_shipdate": "1993-10-29", "l_commitdate": "1993-12-18", "l_receiptdate": "1993-11-04", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "RAIL", "l_comment": "ges sleep after the caref" }
+
diff --git a/asterix-doc/src/site/markdown/AdmAql101.md b/asterix-doc/src/site/markdown/AdmAql101.md
new file mode 100644
index 0000000..ed4736e
--- /dev/null
+++ b/asterix-doc/src/site/markdown/AdmAql101.md
@@ -0,0 +1,897 @@
+# AsterixDB 101: An ADM and AQL Primer #
+
+## Welcome to AsterixDB! ##
+This document introduces the main features of AsterixDB's data model (ADM) and query language (AQL) by example.
+The example is a simple scenario involving (synthetic) sample data modeled after data from the social domain.
+This document describes a set of sample ADM datasets, together with a set of illustrative AQL queries,
+to introduce you to the "AsterixDB user experience".
+The complete set of steps required to create and load a handful of sample datasets, along with runnable queries
+and the expected results for each query, are included.
+
+This document assumes that you are at least vaguely familiar with AsterixDB and why you might want to use it.
+Most importantly, it assumes you already have a running instance of AsterixDB and that you know how to query
+it using AsterixDB's basic web interface.
+For more information on these topics, you should go through the steps in
+[Installing Asterix Using Managix](InstallingAsterixUsingManagix.html)
+before reading this document and make sure that you have a running AsterixDB instance ready to go.
+To get your feet wet, you should probably start with a simple local installation of AsterixDB on your favorite
+machine, accepting all of the default settings that Managix offers.
+Later you can graduate to trying AsterixDB on a cluster, its real intended home (since it targets Big Data).
+(Note: With the exception of specifying the correct locations where you put the source data for this example,
+there should no changes needed in your ADM or AQL statements to run the examples locally and/or to run them
+on a cluster when you are ready to take that step.)
+
+As you read through this document, you should try each step for yourself on your own AsterixDB instance.
+Once you have reached the end, you will be fully armed and dangerous, with all the basic AsterixDB knowledge
+that you'll need to start down the path of modeling, storing, and querying your own semistructured data.
+
+----
+## ADM: Modeling Semistructed Data in AsterixDB ##
+In this section you will learn all about modeling Big Data using
+ADM, the data model of the AsterixDB BDMS.
+
+### Dataverses, Datatypes, and Datasets ###
+The top-level organizing concept in the AsterixDB world is the _dataverse_.
+A dataverse---short for "data universe"---is a place (similar to a database in a relational DBMS) in which
+to create and manage the types, datasets, functions, and other artifacts for a given AsterixDB application.
+When you start using an AsterixDB instance for the first time, it starts out "empty"; it contains no data
+other than the AsterixDB system catalogs (which live in a special dataverse called the Metadata dataverse).
+To store your data in AsterixDB, you will first create a dataverse and then you use it for the _datatypes_
+and _datasets_ for managing your own data.
+A datatype tells AsterixDB what you know (or more accurately, what you want it to know) a priori about one
+of the kinds of data instances that you want AsterixDB to hold for you.
+A dataset is a collection of data instances of a datatype,
+and AsterixDB makes sure that the data instances that you put in it conform to its specified type.
+Since AsterixDB targets semistructured data, you can use _open_ datatypes and tell it as little or as
+much as you wish about your data up front; the more you tell it up front, the less information it will
+have to store repeatedly in the individual data instances that you give it.
+Instances of open datatypes are permitted to have additional content, beyond what the datatype says,
+as long as they at least contain the information prescribed by the datatype definition.
+Open typing allows data to vary from one instance to another and it leaves wiggle room for application
+evolution in terms of what might need to be stored in the future.
+If you want to restrict data instances in a dataset to have only what the datatype says, and nothing extra,
+you can define a _closed_ datatype for that dataset and AsterixDB will keep users from storing objects
+that have extra data in them.
+Datatypes are open by default unless you tell AsterixDB otherwise.
+Let's put these concepts to work
+
+Our little sample scenario involves hypothetical information about users of two popular social networks,
+Facebook and Twitter, and their messages.
+We'll start by defining a dataverse called "TinySocial" to hold our datatypes and datasets.
+The AsterixDB data model (ADM) is essentially a superset of JSON---it's what you get by extending
+JSON with more data types and additional data modeling constructs borrowed from object databases.
+The following is how we can create the TinySocial dataverse plus a set of ADM types for modeling
+Twitter users, their Tweets, Facebook users, their users' employment information, and their messages.
+(Note: Keep in mind that this is just a tiny and somewhat silly example intended for illustrating
+some of the key features of AsterixDB. :-))
+
+
+ drop dataverse TinySocial if exists;
+ create dataverse TinySocial;
+ use dataverse TinySocial;
+
+ create type TwitterUserType as open {
+ screen-name: string,
+ lang: string,
+ friends_count: int32,
+ statuses_count: int32,
+ name: string,
+ followers_count: int32
+ }
+
+ create type TweetMessageType as closed {
+ tweetid: string,
+ user: TwitterUserType,
+ sender-location: point?,
+ send-time: datetime,
+ referred-topics: {{ string }},
+ message-text: string
+ }
+
+ create type EmploymentType as open {
+ organization-name: string,
+ start-date: date,
+ end-date: date?
+ }
+
+ create type FacebookUserType as closed {
+ id: int32,
+ alias: string,
+ name: string,
+ user-since: datetime,
+ friend-ids: {{ int32 }},
+ employment: [EmploymentType]
+ }
+
+ create type FacebookMessageType as closed {
+ message-id: int32,
+ author-id: int32,
+ in-response-to: int32?,
+ sender-location: point?,
+ message: string
+ }
+
+
+
+The first three lines above tell AsterixDB to drop the old TinySocial dataverse, if one already
+exists, and then to create a brand new one and make it the focus of the statements that follow.
+The first type creation statement creates a datatype for holding information about Twitter users.
+It is a record type with a mix of integer and string data, very much like a (flat) relational tuple.
+The indicated fields are all mandatory, but because the type is open, additional fields are welcome.
+The second statement creates a datatype for Twitter messages; this shows how to specify a closed type.
+Interestingly (based on one of Twitter's APIs), each Twitter message actually embeds an instance of the
+sending user's information (current as of when the message was sent), so this is an example of a nested
+record in ADM.
+Twitter messages can optionally contain the sender's location, which is modeled via the sender-location
+field of spatial type _point_; the question mark following the field type indicates its optionality.
+An optional field is like a nullable field in SQL---it may be present or missing, but when it's present,
+its data type will conform to the datatype's specification.
+The send-time field illustrates the use of a temporal primitive type, _datetime_.
+Lastly, the referred-topics field illustrates another way that ADM is richer than the relational model;
+this field holds a bag (a.k.a. an unordered list) of strings.
+Since the overall datatype definition for Twitter messages says "closed", the fields that it lists are
+the only fields that instances of this type will be allowed to contain.
+The next two create type statements create a record type for holding information about one component of
+the employment history of a Facebook user and then a record type for holding the user information itself.
+The Facebook user type highlights a few additional ADM data model features.
+Its friend-ids field is a bag of integers, presumably the Facebook user ids for this user's friends,
+and its employment field is an ordered list of employment records.
+The final create type statement defines a type for handling the content of a Facebook message in our
+hypothetical social data storage scenario.
+
+Before going on, we need to once again emphasize the idea that AsterixDB is aimed at storing
+and querying not just Big Data, but Big _Semistructured_ Data.
+This means that most of the fields listed in the create type statements above could have been
+omitted without changing anything other than the resulting size of stored data instances on disk.
+AsterixDB stores its information about the fields defined a priori as separate metadata, whereas
+the information about other fields that are "just there" in instances of open datatypes is stored
+with each instance---making for more bits on disk and longer times for operations affected by
+data size (e.g., dataset scans).
+The only fields that _must_ be specified a priori are the primary key and any fields that you
+would like to build indexes on.
+(AsterixDB does not yet support auto-generated keys or indexes on the unspecified "open" fields
+of its data instances).
+
+### Creating Datasets and Indexes ###
+
+Now that we have defined our datatypes, we can move on and create datasets to store the actual data.
+(If we wanted to, we could even have several named datasets based on any one of these datatypes.)
+We can do this as follows, utilizing the DDL capabilities of AsterixDB.
+
+
+
+ use dataverse TinySocial;
+
+ create dataset FacebookUsers(FacebookUserType)
+ primary key id;
+
+ create dataset FacebookMessages(FacebookMessageType)
+ primary key message-id;
+
+ create dataset TwitterUsers(TwitterUserType)
+ primary key screen-name;
+
+ create dataset TweetMessages(TweetMessageType)
+ primary key tweetid
+ hints(cardinality=100);
+
+ create index fbUserSinceIdx on FacebookUsers(user-since);
+ create index fbAuthorIdx on FacebookMessages(author-id) type btree;
+ create index fbSenderLocIndex on FacebookMessages(sender-location) type rtree;
+ create index fbMessageIdx on FacebookMessages(message) type keyword;
+
+ for $ds in dataset Metadata.Dataset return $ds;
+ for $ix in dataset Metadata.Index return $ix;
+
+
+
+The ADM DDL statements above create four datasets for holding our social data in the TinySocial
+dataverse: FacebookUsers, FacebookMessages, TwitterUsers, and TweetMessages.
+The first statement creates the FacebookUsers data set.
+It specifies that this dataset will store data instances conforming to FacebookUserType and that
+it has a primary key which is the id field of each instance.
+The primary key information is used by AsterixDB to uniquely identify instances for the purpose
+of later lookup and for use in secondary indexes.
+Each AsterixDB dataset is stored (and indexed) in the form of a B+ tree on primary key;
+secondary indexes point to their indexed data by primary key.
+In AsterixDB clusters, the primary key is also used to hash-partition (a.k.a. shard) the
+dataset across the nodes of the cluster.
+The next three create dataset statements are similar.
+The last one illustrates an optional clause for providing useful hints to AsterixDB.
+In this case, the hint tells AsterixDB that the dataset definer is anticipating that the
+TweetMessages dataset will contain roughly 100 objects; knowing this can help AsterixDB
+to more efficiently manage and query this dataset.
+(AsterixDB does not yet gather and maintain data statistics; it will currently, abitrarily,
+assume a cardinality of one million objects per dataset in the absence of such an optional
+definition-time hint.)
+
+The create dataset statements above are followed by four more DDL statements, each of which
+creates a secondary index on a field of one of the datasets.
+The first one indexes the FacebookUsers dataset on its user-since field.
+This index will be a B+ tree index; its type is unspecified and _btree_ is the default type.
+The other three illustrate how you can explicitly specify the desired type of index.
+In addition to btree, _rtree_ and inverted _keyword_ indexes are supported by AsterixDB.
+Indexes can also have composite keys, and there are more advanced flavors of text indexing
+available as well (_fuzzy keyword_ and _ngram(k)_, where _k_ is the desired gram length).
+
+### Querying the Metadata Dataverse ###
+
+The last two statements above show how you can use queries in AQL to examine the AsterixDB
+system catalogs and tell what artifacts you have created.
+Just as relational DBMSs use their own tables to store their catalogs, AsterixDB uses
+its own datasets to persist descriptions of its datasets, datatypes, indexes, and so on.
+Running the first of the two queries above will list all of your newly created datasets,
+and it will also show you a full list of all the metadata datasets.
+(You can then explore from there on your own if you are curious)
+These last two queries also illustrate one other factoid worth knowing:
+AsterixDB allows queries to span dataverses by allowing the optional use
+of fully-qualified dataset names (i.e., _dataversename.datasetname_)
+to reference datasets that live in a dataverse other than the one that
+was named in the most recently executed _use dataverse_ directive.
+
+----
+## Loading Data Into AsterixDB ##
+Okay, so far so good---AsterixDB is now ready for data, so let's give it some data to store
+Our next task will be to load some sample data into the four datasets that we just defined.
+Here we will load a tiny set of records, defined in ADM format (a superset of JSON), into each dataset.
+In the boxes below you can see the actual data instances contained in each of the provided sample files.
+In order to load this data yourself, you should first store the four corresponding `.adm` files
+(whose URLs are indicated on top of each box below) into a filesystem directory accessible to your
+running AsterixDB instance.
+Take a few minutes to look carefully at each of the sample data sets.
+This will give you a better sense of the nature of the data that we are about to load and query.
+We should note that ADM format is a textual serialization of what AsterixDB will actually store;
+when persisted in AsterixDB, the data format will be binary and the data in the predefined fields
+of the data instances will be stored separately from their associated field name and type metadata.
+
+[Twitter Users](http://asterixdb.googlecode.com/files/twu.adm)
+
+ {"screen-name":"NathanGiesen@211","lang":"en","friends_count":18,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416}
+ {"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159}
+ {"screen-name":"NilaMilliron_tw","lang":"en","friends_count":445,"statuses_count":164,"name":"Nila Milliron","followers_count":22649}
+ {"screen-name":"ChangEwing_573","lang":"en","friends_count":182,"statuses_count":394,"name":"Chang Ewing","followers_count":32136}
+
+[Tweet Messages](http://asterixdb.googlecode.com/files/twm.adm)
+
+ {"tweetid":"1","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("47.44,80.65"),"send-time":datetime("2008-04-26T10:10:00"),"referred-topics":{{"t-mobile","customization"}},"message-text":" love t-mobile its customization is good:)"}
+ {"tweetid":"2","user":{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159},"sender-location":point("32.84,67.14"),"send-time":datetime("2010-05-13T10:10:00"),"referred-topics":{{"verizon","shortcut-menu"}},"message-text":" like verizon its shortcut-menu is awesome:)"}
+ {"tweetid":"3","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("29.72,75.8"),"send-time":datetime("2006-11-04T10:10:00"),"referred-topics":{{"motorola","speed"}},"message-text":" like motorola the speed is good:)"}
+ {"tweetid":"4","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("39.28,70.48"),"send-time":datetime("2011-12-26T10:10:00"),"referred-topics":{{"sprint","voice-command"}},"message-text":" like sprint the voice-command is mind-blowing:)"}
+ {"tweetid":"5","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("40.09,92.69"),"send-time":datetime("2006-08-04T10:10:00"),"referred-topics":{{"motorola","speed"}},"message-text":" can't stand motorola its speed is terrible:("}
+ {"tweetid":"6","user":{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159},"sender-location":point("47.51,83.99"),"send-time":datetime("2010-05-07T10:10:00"),"referred-topics":{{"iphone","voice-clarity"}},"message-text":" like iphone the voice-clarity is good:)"}
+ {"tweetid":"7","user":{"screen-name":"ChangEwing_573","lang":"en","friends_count":182,"statuses_count":394,"name":"Chang Ewing","followers_count":32136},"sender-location":point("36.21,72.6"),"send-time":datetime("2011-08-25T10:10:00"),"referred-topics":{{"samsung","platform"}},"message-text":" like samsung the platform is good"}
+ {"tweetid":"8","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("46.05,93.34"),"send-time":datetime("2005-10-14T10:10:00"),"referred-topics":{{"t-mobile","shortcut-menu"}},"message-text":" like t-mobile the shortcut-menu is awesome:)"}
+ {"tweetid":"9","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("36.86,74.62"),"send-time":datetime("2012-07-21T10:10:00"),"referred-topics":{{"verizon","voicemail-service"}},"message-text":" love verizon its voicemail-service is awesome"}
+ {"tweetid":"10","user":{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159},"sender-location":point("29.15,76.53"),"send-time":datetime("2008-01-26T10:10:00"),"referred-topics":{{"verizon","voice-clarity"}},"message-text":" hate verizon its voice-clarity is OMG:("}
+ {"tweetid":"11","user":{"screen-name":"NilaMilliron_tw","lang":"en","friends_count":445,"statuses_count":164,"name":"Nila Milliron","followers_count":22649},"sender-location":point("37.59,68.42"),"send-time":datetime("2008-03-09T10:10:00"),"referred-topics":{{"iphone","platform"}},"message-text":" can't stand iphone its platform is terrible"}
+ {"tweetid":"12","user":{"screen-name":"OliJackson_512","lang":"en","friends_count":445,"statuses_count":164,"name":"Oli Jackson","followers_count":22649},"sender-location":point("24.82,94.63"),"send-time":datetime("2010-02-13T10:10:00"),"referred-topics":{{"samsung","voice-command"}},"message-text":" like samsung the voice-command is amazing:)"}
+
+[Facebook Users](http://asterixdb.googlecode.com/files/fbu.adm)
+
+ {"id":1,"alias":"Margarita","name":"MargaritaStoddard","user-since":datetime("2012-08-20T10:10:00"),"friend-ids":{{2,3,6,10}},"employment":[{"organization-name":"Codetechno","start-date":date("2006-08-06")}]}
+ {"id":2,"alias":"Isbel","name":"IsbelDull","user-since":datetime("2011-01-22T10:10:00"),"friend-ids":{{1,4}},"employment":[{"organization-name":"Hexviafind","start-date":date("2010-04-27")}]}
+ {"id":3,"alias":"Emory","name":"EmoryUnk","user-since":datetime("2012-07-10T10:10:00"),"friend-ids":{{1,5,8,9}},"employment":[{"organization-name":"geomedia","start-date":date("2010-06-17"),"end-date":date("2010-01-26")}]}
+ {"id":4,"alias":"Nicholas","name":"NicholasStroh","user-since":datetime("2010-12-27T10:10:00"),"friend-ids":{{2}},"employment":[{"organization-name":"Zamcorporation","start-date":date("2010-06-08")}]}
+ {"id":5,"alias":"Von","name":"VonKemble","user-since":datetime("2010-01-05T10:10:00"),"friend-ids":{{3,6,10}},"employment":[{"organization-name":"Kongreen","start-date":date("2010-11-27")}]}
+ {"id":6,"alias":"Willis","name":"WillisWynne","user-since":datetime("2005-01-17T10:10:00"),"friend-ids":{{1,3,7}},"employment":[{"organization-name":"jaydax","start-date":date("2009-05-15")}]}
+ {"id":7,"alias":"Suzanna","name":"SuzannaTillson","user-since":datetime("2012-08-07T10:10:00"),"friend-ids":{{6}},"employment":[{"organization-name":"Labzatron","start-date":date("2011-04-19")}]}
+ {"id":8,"alias":"Nila","name":"NilaMilliron","user-since":datetime("2008-01-01T10:10:00"),"friend-ids":{{3}},"employment":[{"organization-name":"Plexlane","start-date":date("2010-02-28")}]}
+ {"id":9,"alias":"Woodrow","name":"WoodrowNehling","user-since":datetime("2005-09-20T10:10:00"),"friend-ids":{{3,10}},"employment":[{"organization-name":"Zuncan","start-date":date("2003-04-22"),"end-date":date("2009-12-13")}]}
+ {"id":10,"alias":"Bram","name":"BramHatch","user-since":datetime("2010-10-16T10:10:00"),"friend-ids":{{1,5,9}},"employment":[{"organization-name":"physcane","start-date":date("2007-06-05"),"end-date":date("2011-11-05")}]}
+
+[Facebook Messages](http://asterixdb.googlecode.com/files/fbm.adm)
+
+ {"message-id":1,"author-id":3,"in-response-to":2,"sender-location":point("47.16,77.75"),"message":" love sprint its shortcut-menu is awesome:)"}
+ {"message-id":2,"author-id":1,"in-response-to":4,"sender-location":point("41.66,80.87"),"message":" dislike iphone its touch-screen is horrible"}
+ {"message-id":3,"author-id":2,"in-response-to":4,"sender-location":point("48.09,81.01"),"message":" like samsung the plan is amazing"}
+ {"message-id":4,"author-id":1,"in-response-to":2,"sender-location":point("37.73,97.04"),"message":" can't stand at&t the network is horrible:("}
+ {"message-id":5,"author-id":6,"in-response-to":2,"sender-location":point("34.7,90.76"),"message":" love sprint the customization is mind-blowing"}
+ {"message-id":6,"author-id":2,"in-response-to":1,"sender-location":point("31.5,75.56"),"message":" like t-mobile its platform is mind-blowing"}
+ {"message-id":7,"author-id":5,"in-response-to":15,"sender-location":point("32.91,85.05"),"message":" dislike sprint the speed is horrible"}
+ {"message-id":8,"author-id":1,"in-response-to":11,"sender-location":point("40.33,80.87"),"message":" like verizon the 3G is awesome:)"}
+ {"message-id":9,"author-id":3,"in-response-to":12,"sender-location":point("34.45,96.48"),"message":" love verizon its wireless is good"}
+ {"message-id":10,"author-id":1,"in-response-to":12,"sender-location":point("42.5,70.01"),"message":" can't stand motorola the touch-screen is terrible"}
+ {"message-id":11,"author-id":1,"in-response-to":1,"sender-location":point("38.97,77.49"),"message":" can't stand at&t its plan is terrible"}
+ {"message-id":12,"author-id":10,"in-response-to":6,"sender-location":point("42.26,77.76"),"message":" can't stand t-mobile its voicemail-service is OMG:("}
+ {"message-id":13,"author-id":10,"in-response-to":4,"sender-location":point("42.77,78.92"),"message":" dislike iphone the voice-command is bad:("}
+ {"message-id":14,"author-id":9,"in-response-to":12,"sender-location":point("41.33,85.28"),"message":" love at&t its 3G is good:)"}
+ {"message-id":15,"author-id":7,"in-response-to":11,"sender-location":point("44.47,67.11"),"message":" like iphone the voicemail-service is awesome"}
+
+
+It's loading time! We can use AQL _load_ statements to populate our datasets with the sample records shown above.
+The following shows how loading can be done for data stored in `.adm` files in your local filesystem.
+*Note:* You _MUST_ replace the `<Host Name>` and `<Absolute File Path>` placeholders in each load
+statement below with valid values based on the host IP address (or host name) for the machine and
+directory that you have downloaded the provided `.adm` files to.
+As you do so, be very, very careful to retain the two slashes in the load statements, i.e.,
+do not delete the two slashes that appear in front of the absolute path to your `.adm` files.
+(This will lead to a three-slash character sequence at the start of each load statement's file
+input path specification.)
+
+
+ use dataverse TinySocial;
+
+ load dataset FacebookUsers using localfs
+ (("path"="<Host Name>://<Absolute File Path>/fbu.adm"),("format"="adm"));
+
+ load dataset FacebookMessages using localfs
+ (("path"="<Host Name>://<Absolute File Path>/fbm.adm"),("format"="adm"));
+
+ load dataset TwitterUsers using localfs
+ (("path"="<Host Name>://<Absolute File Path>/twu.adm"),("format"="adm"));
+
+ load dataset TweetMessages using localfs
+ (("path"="<Host Name>://<Absolute File Path>/twm.adm"),("format"="adm"));
+
+
+----
+## AQL: Querying Your AsterixDB Data ##
+Congratulations! You now have sample social data stored (and indexed) in AsterixDB.
+(You are part of an elite and adventurous group of individuals. :-))
+Now that you have successfully loaded the provided sample data into the datasets that we defined,
+you can start running queries against them.
+
+The query language for AsterixDB is AQL---the Asterix Query Language.
+AQL is loosely based on XQuery, the language developed and standardized in the early to mid 2000's
+by the World Wide Web Consortium (W3C) for querying semistructured data stored in their XML format.
+We have tossed all of the "XML cruft" out of their language but retained many of its core ideas.
+We did this because its design was developed over a period of years by a diverse committee of smart
+and experienced language designers, including "SQL people", "functional programming people", and
+"XML people", all of whom were focused on how to design a new query language that operates well over
+semistructured data.
+(We decided to stand on their shoulders instead of starting from scratch and revisiting many of the
+same issues.)
+Note that AQL is not SQL and not based on SQL: In other words, AsterixDB is fully "NoSQL compliant". :-)
+
+In this section we introduce AQL via a set of example queries, along with their expected results,
+based on the data above, to help you get started.
+Many of the most important features of AQL are presented in this set of representative queries.
+You can find a BNF description of the current AQL grammar at [wiki:AsterixDBGrammar], and someday
+in the not-too-distant future we will also provide a complete reference manual for the language.
+In the meantime, this will get you started down the path of using AsterixDB.
+A more complete list of the supported AsterixDB primitive types and built-in functions can be
+found at [AsterixDataTypesAndFunctions](AsterixDataTypesAndFunctions.html).
+
+AQL is an expression language.
+Even the expression 1+1 is a valid AQL query that evaluates to 2.
+(Try it for yourself!
+Okay, maybe that's _not_ the best use of a 512-node shared-nothing compute cluster.)
+Most useful AQL queries will be based on the _FLWOR_ (pronounced "flower") expression structure
+that AQL has borrowed from XQuery ((http://en.wikipedia.org/wiki/FLWOR)).
+The FLWOR expression syntax supports both the incremental binding (_for_) of variables to ADM data
+instances in a dataset (or in the result of any AQL expression, actually) and the full binding (_let_)
+of variables to entire intermediate results in a fashion similar to temporary views in the SQL world.
+FLWOR is an acronym that is short for _for_-_let_-_where_-_order by_-_return_,
+naming five of the most frequently used clauses from the syntax of a full AQL query.
+AQL also includes _group by_ and _limit_ clauses, as you will see shortly.
+Roughly speaking, for SQL afficiandos, the _for_ clause in AQL is like the _from_ clause in SQL,
+the _return_ clause in AQL is like the _select_ clause in SQL (but appears at the end instead of
+the beginning of a query), the _let_ clause in AQL is like SQL's _with_ clause, and the _where_
+and _order by_ clauses in both languages are similar.
+
+Enough talk!
+Let's go ahead and try writing some queries and see about learning AQL by example.
+
+### Query 0-A - Exact-Match Lookup ###
+For our first query, let's find a Facebook user based on his or her user id.
+Suppose the user we want is the user whose id is 8:
+
+
+ use dataverse TinySocial;
+
+ for $user in dataset FacebookUsers
+ where $user.id = 8
+ return $user;
+
+The query's _for_ clause binds the variable `$user` incrementally to the data instances residing in
+the dataset named FacebookUsers.
+Its _where_ clause selects only those bindings having a user id of interest, filtering out the rest.
+The _return_ clause returns the (entire) data instance for each binding that satisfies the predicate.
+Since this dataset is indexed on user id (its primary key), this query will be done via a quick index lookup.
+
+The expected result for our sample data is as follows:
+
+ { "id": 8, "alias": "Nila", "name": "NilaMilliron", "user-since": datetime("2008-01-01T10:10:00.000Z"), "friend-ids": {{ 3 }}, "employment": [ { "organization-name": "Plexlane", "start-date": date("2010-02-28"), "end-date": null } ] }
+
+
+### Query 0-B - Range Scan ###
+AQL, like SQL, supports a variety of different predicates.
+For example, for our next query, let's find the Facebook users whose ids are in the range between 2 and 4:
+
+ use dataverse TinySocial;
+
+ for $user in dataset FacebookUsers
+ where $user.id >= 2 and $user.id <= 4
+ return $user;
+
+This query's expected result, also evaluable using the primary index on user id, is:
+
+ { "id": 2, "alias": "Isbel", "name": "IsbelDull", "user-since": datetime("2011-01-22T10:10:00.000Z"), "friend-ids": {{ 1, 4 }}, "employment": [ { "organization-name": "Hexviafind", "start-date": date("2010-04-27"), "end-date": null } ] }
+ { "id": 3, "alias": "Emory", "name": "EmoryUnk", "user-since": datetime("2012-07-10T10:10:00.000Z"), "friend-ids": {{ 1, 5, 8, 9 }}, "employment": [ { "organization-name": "geomedia", "start-date": date("2010-06-17"), "end-date": date("2010-01-26") } ] }
+ { "id": 4, "alias": "Nicholas", "name": "NicholasStroh", "user-since": datetime("2010-12-27T10:10:00.000Z"), "friend-ids": {{ 2 }}, "employment": [ { "organization-name": "Zamcorporation", "start-date": date("2010-06-08"), "end-date": null } ] }
+
+
+### Query 1 - Other Query Filters ###
+AQL can do range queries on any data type that supports the appropriate set of comparators.
+As an example, this next query retrieves the Facebook users who joined between July 22, 2010 and July 29, 2012:
+
+ use dataverse TinySocial;
+
+ for $user in dataset FacebookUsers
+ where $user.user-since >= datetime('2010-07-22T00:00:00')
+ and $user.user-since <= datetime('2012-07-29T23:59:59')
+ return $user;
+
+The expected result for this query, also an indexable query, is as follows:
+
+ { "id": 2, "alias": "Isbel", "name": "IsbelDull", "user-since": datetime("2011-01-22T10:10:00.000Z"), "friend-ids": {{ 1, 4 }}, "employment": [ { "organization-name": "Hexviafind", "start-date": date("2010-04-27"), "end-date": null } ] }
+ { "id": 3, "alias": "Emory", "name": "EmoryUnk", "user-since": datetime("2012-07-10T10:10:00.000Z"), "friend-ids": {{ 1, 5, 8, 9 }}, "employment": [ { "organization-name": "geomedia", "start-date": date("2010-06-17"), "end-date": date("2010-01-26") } ] }
+ { "id": 4, "alias": "Nicholas", "name": "NicholasStroh", "user-since": datetime("2010-12-27T10:10:00.000Z"), "friend-ids": {{ 2 }}, "employment": [ { "organization-name": "Zamcorporation", "start-date": date("2010-06-08"), "end-date": null } ] }
+ { "id": 10, "alias": "Bram", "name": "BramHatch", "user-since": datetime("2010-10-16T10:10:00.000Z"), "friend-ids": {{ 1, 5, 9 }}, "employment": [ { "organization-name": "physcane", "start-date": date("2007-06-05"), "end-date": date("2011-11-05") } ] }
+
+
+### Query 2-A - Equijoin ###
+In addition to simply binding variables to data instances and returning them "whole",
+an AQL query can construct new ADM instances to return based on combinations of its variable bindings.
+This gives AQL the power to do joins much like those done using multi-table _from_ clauses in SQL.
+For example, suppose we wanted a list of all Facebook users paired with their associated messages,
+with the list enumerating the author name and the message text associated with each Facebook message.
+We could do this as follows in AQL:
+
+ use dataverse TinySocial;
+
+ for $user in dataset FacebookUsers
+ for $message in dataset FacebookMessages
+ where $message.author-id = $user.id
+ return {
+ "uname": $user.name,
+ "message": $message.message
+ };
+
+The result of this query is a sequence of new ADM instances, one for each author/message pair.
+Each instance in the result will be an ADM record containing two fields, "uname" and "message",
+containing the user's name and the message text, respectively, for each author/message pair.
+(Note that "uname" and "message" are both simple AQL expressions themselves---so in the most
+general case, even the resulting field names can be computed as part of the query, making AQL
+a very powerful tool for slicing and dicing semistructured data.)
+
+The expected result of this example AQL join query for our sample data set is:
+
+ { "uname": "MargaritaStoddard", "message": " dislike iphone its touch-screen is horrible" }
+ { "uname": "MargaritaStoddard", "message": " can't stand at&t the network is horrible:(" }
+ { "uname": "MargaritaStoddard", "message": " like verizon the 3G is awesome:)" }
+ { "uname": "MargaritaStoddard", "message": " can't stand motorola the touch-screen is terrible" }
+ { "uname": "MargaritaStoddard", "message": " can't stand at&t its plan is terrible" }
+ { "uname": "IsbelDull", "message": " like samsung the plan is amazing" }
+ { "uname": "IsbelDull", "message": " like t-mobile its platform is mind-blowing" }
+ { "uname": "EmoryUnk", "message": " love sprint its shortcut-menu is awesome:)" }
+ { "uname": "EmoryUnk", "message": " love verizon its wireless is good" }
+ { "uname": "VonKemble", "message": " dislike sprint the speed is horrible" }
+ { "uname": "WillisWynne", "message": " love sprint the customization is mind-blowing" }
+ { "uname": "SuzannaTillson", "message": " like iphone the voicemail-service is awesome" }
+ { "uname": "WoodrowNehling", "message": " love at&t its 3G is good:)" }
+ { "uname": "BramHatch", "message": " can't stand t-mobile its voicemail-service is OMG:(" }
+ { "uname": "BramHatch", "message": " dislike iphone the voice-command is bad:(" }
+
+
+### Query 2-B - Index join ###
+By default, AsterixDB evaluates equijoin queries using hash-based join methods that work
+well for doing ad hoc joins of very large data sets
+([http://en.wikipedia.org/wiki/Hash_join](http://en.wikipedia.org/wiki/Hash_join)).
+On a cluster, hash partitioning is employed as AsterixDB's divide-and-conquer strategy for
+computing large parallel joins.
+AsterixDB includes other join methods, but in the absence of data statistics and selectivity
+estimates, it doesn't (yet) have the know-how to intelligently choose among its alternatives.
+We therefore asked ourselves the classic question---WWOD?---What Would Oracle Do?---and in the
+interim, AQL includes a clunky (but useful) hint-based mechanism for addressing the occasional
+need to suggest to AsterixDB which join method it should use for a particular AQL query.
+
+The following query is similar to Query 2-A but includes a suggestion to AsterixDB that it
+should consider employing an index-based nested-loop join technique to process the query:
+
+ use dataverse TinySocial;
+
+ for $user in dataset FacebookUsers
+ for $message in dataset FacebookMessages
+ where $message.author-id /*+ indexnl */ = $user.id
+ return {
+ "uname": $user.name,
+ "message": $message.message
+ };
+
+
+The expected result is (of course) the same as before, modulo the order of the instances.
+Result ordering is (intentionally) undefined in AQL in the absence of an _order by_ clause.
+The query result for our sample data in this case is:
+
+ { "uname": "EmoryUnk", "message": " love sprint its shortcut-menu is awesome:)" }
+ { "uname": "MargaritaStoddard", "message": " dislike iphone its touch-screen is horrible" }
+ { "uname": "IsbelDull", "message": " like samsung the plan is amazing" }
+ { "uname": "MargaritaStoddard", "message": " can't stand at&t the network is horrible:(" }
+ { "uname": "WillisWynne", "message": " love sprint the customization is mind-blowing" }
+ { "uname": "IsbelDull", "message": " like t-mobile its platform is mind-blowing" }
+ { "uname": "VonKemble", "message": " dislike sprint the speed is horrible" }
+ { "uname": "MargaritaStoddard", "message": " like verizon the 3G is awesome:)" }
+ { "uname": "EmoryUnk", "message": " love verizon its wireless is good" }
+ { "uname": "MargaritaStoddard", "message": " can't stand motorola the touch-screen is terrible" }
+ { "uname": "MargaritaStoddard", "message": " can't stand at&t its plan is terrible" }
+ { "uname": "BramHatch", "message": " can't stand t-mobile its voicemail-service is OMG:(" }
+ { "uname": "BramHatch", "message": " dislike iphone the voice-command is bad:(" }
+ { "uname": "WoodrowNehling", "message": " love at&t its 3G is good:)" }
+ { "uname": "SuzannaTillson", "message": " like iphone the voicemail-service is awesome" }
+
+
+(It is worth knowing, with respect to influencing AsterixDB's query evaluation, that nested _for_
+clauses---a.k.a. joins--- are currently evaluated with the "outer" clause probing the data of the "inner"
+clause.)
+
+### Query 3 - Nested Outer Join ###
+In order to support joins between tables with missing/dangling join tuples, the designers of SQL ended
+up shoe-horning a subset of the relational algebra into SQL's _from_ clause syntax---and providing a
+variety of join types there for users to choose from.
+Left outer joins are particularly important in SQL, e.g., to print a summary of customers and orders,
+grouped by customer, without omitting those customers who haven't placed any orders yet.
+
+The AQL language supports nesting, both of queries and of query results, and the combination allows for
+an arguably cleaner/more natural approach to such queries.
+As an example, supposed we wanted, for each Facebook user, to produce a record that has his/her name
+plus a list of the messages written by that user.
+In SQL, this would involve a left outer join between users and messages, grouping by user, and having
+the user name repeated along side each message.
+In AQL, this sort of use case can be handled (more naturally) as follows:
+
+ use dataverse TinySocial;
+
+ for $user in dataset FacebookUsers
+ return {
+ "uname": $user.name,
+ "messages": for $message in dataset FacebookMessages
+ where $message.author-id = $user.id
+ return $message.message
+ };
+
+This AQL query binds the variable `$user` to the data instances in FacebookUsers;
+for each user, it constructs a result record containing a "uname" field with the user's
+name and a "messages" field with a nested collection of all messages for that user.
+The nested collection for each user is specified by using a correlated subquery.
+(Note: While it looks like nested loops could be involved in computing the result,
+AsterixDB recogizes the equivalence of such a query to an outerjoin, and it will
+use an efficient hash-based strategy when actually computing the query's result.)
+
+Here is this example query's expected output:
+
+ { "uname": "MargaritaStoddard", "messages": [ " dislike iphone its touch-screen is horrible", " can't stand at&t the network is horrible:(", " like verizon the 3G is awesome:)", " can't stand motorola the touch-screen is terrible", " can't stand at&t its plan is terrible" ] }
+ { "uname": "IsbelDull", "messages": [ " like samsung the plan is amazing", " like t-mobile its platform is mind-blowing" ] }
+ { "uname": "EmoryUnk", "messages": [ " love sprint its shortcut-menu is awesome:)", " love verizon its wireless is good" ] }
+ { "uname": "NicholasStroh", "messages": [ ] }
+ { "uname": "VonKemble", "messages": [ " dislike sprint the speed is horrible" ] }
+ { "uname": "WillisWynne", "messages": [ " love sprint the customization is mind-blowing" ] }
+ { "uname": "SuzannaTillson", "messages": [ " like iphone the voicemail-service is awesome" ] }
+ { "uname": "NilaMilliron", "messages": [ ] }
+ { "uname": "WoodrowNehling", "messages": [ " love at&t its 3G is good:)" ] }
+ { "uname": "BramHatch", "messages": [ " dislike iphone the voice-command is bad:(", " can't stand t-mobile its voicemail-service is OMG:(" ] }
+
+
+### Query 4 - Theta Join ###
+Not all joins are expressible as equijoins and computable using equijoin-oriented algorithms.
+The join predicates for some use cases involve predicates with functions; AsterixDB supports the
+expression of such queries and will still evaluate them as best it can using nested loop based
+techniques (and broadcast joins in the parallel case).
+
+As an example of such a use case, suppose that we wanted, for each tweet T, to find all of the
+other tweets that originated from within a circle of radius of 1 surrounding tweet T's location.
+In AQL, this can be specified in a manner similar to the previous query using one of the built-in
+functions on the spatial data type instead of id equality in the correlated query's _where_ clause:
+
+ use dataverse TinySocial;
+
+ for $t in dataset TweetMessages
+ return {
+ "message": $t.message-text,
+ "nearby-messages": for $t2 in dataset TweetMessages
+ where spatial-distance($t.sender-location, $t2.sender-location) <= 1
+ return { "msgtxt":$t2.message-text}
+ };
+
+Here is the expected result for this query:
+
+ { "message": " love t-mobile its customization is good:)", "nearby-messages": [ { "msgtxt": " love t-mobile its customization is good:)" } ] }
+ { "message": " hate verizon its voice-clarity is OMG:(", "nearby-messages": [ { "msgtxt": " like motorola the speed is good:)" }, { "msgtxt": " hate verizon its voice-clarity is OMG:(" } ] }
+ { "message": " can't stand iphone its platform is terrible", "nearby-messages": [ { "msgtxt": " can't stand iphone its platform is terrible" } ] }
+ { "message": " like samsung the voice-command is amazing:)", "nearby-messages": [ { "msgtxt": " like samsung the voice-command is amazing:)" } ] }
+ { "message": " like verizon its shortcut-menu is awesome:)", "nearby-messages": [ { "msgtxt": " like verizon its shortcut-menu is awesome:)" } ] }
+ { "message": " like motorola the speed is good:)", "nearby-messages": [ { "msgtxt": " hate verizon its voice-clarity is OMG:(" }, { "msgtxt": " like motorola the speed is good:)" } ] }
+ { "message": " like sprint the voice-command is mind-blowing:)", "nearby-messages": [ { "msgtxt": " like sprint the voice-command is mind-blowing:)" } ] }
+ { "message": " can't stand motorola its speed is terrible:(", "nearby-messages": [ { "msgtxt": " can't stand motorola its speed is terrible:(" } ] }
+ { "message": " like iphone the voice-clarity is good:)", "nearby-messages": [ { "msgtxt": " like iphone the voice-clarity is good:)" } ] }
+ { "message": " like samsung the platform is good", "nearby-messages": [ { "msgtxt": " like samsung the platform is good" } ] }
+ { "message": " like t-mobile the shortcut-menu is awesome:)", "nearby-messages": [ { "msgtxt": " like t-mobile the shortcut-menu is awesome:)" } ] }
+ { "message": " love verizon its voicemail-service is awesome", "nearby-messages": [ { "msgtxt": " love verizon its voicemail-service is awesome" } ] }
+
+
+### Query 5 - Fuzzy Join ###
+As another example of a non-equijoin use case, we could ask AsterixDB to find, for each Facebook user,
+all Twitter users with names "similar" to their name.
+AsterixDB supports a variety of "fuzzy match" functions for use with textual and set-based data.
+As one example, we could choose to use edit distance with a threshold of 3 as the definition of name
+similarity, in which case we could write the following query using AQL's operator-based syntax (~=)
+for testing whether or not two values are similar:
+
+ use dataverse TinySocial;
+
+ set simfunction "edit-distance";
+ set simthreshold "3";
+
+ for $fbu in dataset FacebookUsers
+ return {
+ "id": $fbu.id,
+ "name": $fbu.name,
+ "similar-users": for $t in dataset TweetMessages
+ let $tu := $t.user
+ where $tu.name ~= $fbu.name
+ return {
+ "twitter-screenname": $tu.screen-name,
+ "twitter-name": $tu.name
+ }
+ };
+
+The expected result for this query against our sample data is:
+
+ { "id": 1, "name": "MargaritaStoddard", "similar-users": [ ] }
+ { "id": 2, "name": "IsbelDull", "similar-users": [ ] }
+ { "id": 3, "name": "EmoryUnk", "similar-users": [ ] }
+ { "id": 4, "name": "NicholasStroh", "similar-users": [ ] }
+ { "id": 5, "name": "VonKemble", "similar-users": [ ] }
+ { "id": 6, "name": "WillisWynne", "similar-users": [ ] }
+ { "id": 7, "name": "SuzannaTillson", "similar-users": [ ] }
+ { "id": 8, "name": "NilaMilliron", "similar-users": [ { "twitter-screenname": "NilaMilliron_tw", "twitter-name": "Nila Milliron" } ] }
+ { "id": 9, "name": "WoodrowNehling", "similar-users": [ ] }
+ { "id": 10, "name": "BramHatch", "similar-users": [ ] }
+
+
+### Query 6 - Existential Quantification ###
+The expressive power of AQL includes support for queries involving "some" (existentially quantified)
+and "all" (universally quantified) query semantics.
+As an example of an existential AQL query, here we show a query to list the Facebook users who are currently employed.
+Such employees will have an employment history containing a record with a null end-date value, which leads us to the
+following AQL query:
+
+ use dataverse TinySocial;
+
+ for $fbu in dataset FacebookUsers
+ where (some $e in $fbu.employment satisfies is-null($e.end-date))
+ return $fbu;
+
+The expected result in this case is:
+
+ { "id": 1, "alias": "Margarita", "name": "MargaritaStoddard", "user-since": datetime("2012-08-20T10:10:00.000Z"), "friend-ids": {{ 2, 3, 6, 10 }}, "employment": [ { "organization-name": "Codetechno", "start-date": date("2006-08-06"), "end-date": null } ] }
+ { "id": 2, "alias": "Isbel", "name": "IsbelDull", "user-since": datetime("2011-01-22T10:10:00.000Z"), "friend-ids": {{ 1, 4 }}, "employment": [ { "organization-name": "Hexviafind", "start-date": date("2010-04-27"), "end-date": null } ] }
+ { "id": 4, "alias": "Nicholas", "name": "NicholasStroh", "user-since": datetime("2010-12-27T10:10:00.000Z"), "friend-ids": {{ 2 }}, "employment": [ { "organization-name": "Zamcorporation", "start-date": date("2010-06-08"), "end-date": null } ] }
+ { "id": 5, "alias": "Von", "name": "VonKemble", "user-since": datetime("2010-01-05T10:10:00.000Z"), "friend-ids": {{ 3, 6, 10 }}, "employment": [ { "organization-name": "Kongreen", "start-date": date("2010-11-27"), "end-date": null } ] }
+ { "id": 6, "alias": "Willis", "name": "WillisWynne", "user-since": datetime("2005-01-17T10:10:00.000Z"), "friend-ids": {{ 1, 3, 7 }}, "employment": [ { "organization-name": "jaydax", "start-date": date("2009-05-15"), "end-date": null } ] }
+ { "id": 7, "alias": "Suzanna", "name": "SuzannaTillson", "user-since": datetime("2012-08-07T10:10:00.000Z"), "friend-ids": {{ 6 }}, "employment": [ { "organization-name": "Labzatron", "start-date": date("2011-04-19"), "end-date": null } ] }
+ { "id": 8, "alias": "Nila", "name": "NilaMilliron", "user-since": datetime("2008-01-01T10:10:00.000Z"), "friend-ids": {{ 3 }}, "employment": [ { "organization-name": "Plexlane", "start-date": date("2010-02-28"), "end-date": null } ] }
+
+
+### Query 7 - Universal Quantification ###
+As an example of a universal AQL query, here we show a query to list the Facebook users who are currently unemployed.
+Such employees will have an employment history containing no records with null end-date values, leading us to the
+following AQL query:
+
+ use dataverse TinySocial;
+
+ for $fbu in dataset FacebookUsers
+ where (every $e in $fbu.employment satisfies not(is-null($e.end-date)))
+ return $fbu;
+
+Here is the expected result for our sample data:
+
+ { "id": 3, "alias": "Emory", "name": "EmoryUnk", "user-since": datetime("2012-07-10T10:10:00.000Z"), "friend-ids": {{ 1, 5, 8, 9 }}, "employment": [ { "organization-name": "geomedia", "start-date": date("2010-06-17"), "end-date": date("2010-01-26") } ] }
+ { "id": 9, "alias": "Woodrow", "name": "WoodrowNehling", "user-since": datetime("2005-09-20T10:10:00.000Z"), "friend-ids": {{ 3, 10 }}, "employment": [ { "organization-name": "Zuncan", "start-date": date("2003-04-22"), "end-date": date("2009-12-13") } ] }
+ { "id": 10, "alias": "Bram", "name": "BramHatch", "user-since": datetime("2010-10-16T10:10:00.000Z"), "friend-ids": {{ 1, 5, 9 }}, "employment": [ { "organization-name": "physcane", "start-date": date("2007-06-05"), "end-date": date("2011-11-05") } ] }
+
+
+### Query 8 - Simple Aggregation ###
+Like SQL, the AQL language of AsterixDB provides support for computing aggregates over large amounts of data.
+As a very simple example, the following AQL query computes the total number of Facebook users:
+
+ use dataverse TinySocial;
+
+ count(for $fbu in dataset FacebookUsers return $fbu);
+
+In AQL, aggregate functions can be applied to arbitrary subquery results; in this case, the count function
+is applied to the result of a query that enumerates the Facebook users. The expected result here is:
+
+ 10
+
+
+
+### Query 9-A - Grouping and Aggregation ###
+Also like SQL, AQL supports grouped aggregation.
+For every Twitter user, the following group-by/aggregate query counts the number of tweets sent by that user:
+
+ use dataverse TinySocial;
+
+ for $t in dataset TweetMessages
+ group by $uid := $t.user.screen-name with $t
+ return {
+ "user": $uid,
+ "count": count($t)
+ };
+
+The _for_ clause incrementally binds $t to tweets, and the _group by_ clause groups the tweets by its
+issuer's Twitter screen-name.
+Unlike SQL, where data is tabular---flat---the data model underlying AQL allows for nesting.
+Thus, following the _group by_ clause, the _return_ clause in this query sees a sequence of $t groups,
+with each such group having an associated $uid variable value (i.e., the tweeting user's screen name).
+In the context of the return clause, due to "... with $t ...", $uid is bound to the tweeter's id and $t
+is bound to the _set_ of tweets issued by that tweeter.
+The return clause constructs a result record containing the tweeter's user id and the count of the items
+in the associated tweet set.
+The query result will contain one such record per screen name.
+This query also illustrates another feature of AQL; notice that each user's screen name is accessed via a
+path syntax that traverses each tweet's nested record structure.
+
+Here is the expected result for this query over the sample data:
+
+ { "user": "ChangEwing_573", "count": 1 }
+ { "user": "ColineGeyer@63", "count": 3 }
+ { "user": "NathanGiesen@211", "count": 6 }
+ { "user": "NilaMilliron_tw", "count": 1 }
+ { "user": "OliJackson_512", "count": 1 }
+
+
+
+### Query 9-B - (Hash-Based) Grouping and Aggregation ###
+As for joins, AsterixDB has multiple evaluation strategies available for processing grouped aggregate queries.
+For grouped aggregation, the system knows how to employ both sort-based and hash-based aggregation methods,
+with sort-based methods being used by default and a hint being available to suggest that a different approach
+be used in processing a particular AQL query.
+
+The following query is similar to Query 9-A, but adds a hash-based aggregation hint:
+
+ use dataverse TinySocial;
+
+ for $t in dataset TweetMessages
+ /*+ hash*/
+ group by $uid := $t.user.screen-name with $t
+ return {
+ "user": $uid,
+ "count": count($t)
+ };
+
+Here is the expected result:
+
+ { "user": "OliJackson_512", "count": 1 }
+ { "user": "ColineGeyer@63", "count": 3 }
+ { "user": "NathanGiesen@211", "count": 6 }
+ { "user": "NilaMilliron_tw", "count": 1 }
+ { "user": "ChangEwing_573", "count": 1 }
+
+
+
+### Query 10 - Grouping and Limits ###
+In some use cases it is not necessary to compute the entire answer to a query.
+In some cases, just having the first _N_ or top _N_ results is sufficient.
+This is expressible in AQL using the _limit_ clause combined with the _order by_ clause.
+
+The following AQL query returns the top 3 Twitter users based on who has issued the most tweets:
+
+ use dataverse TinySocial;
+
+ for $t in dataset TweetMessages
+ group by $uid := $t.user.screen-name with $t
+ let $c := count($t)
+ order by $c desc
+ limit 3
+ return {
+ "user": $uid,
+ "count": $c
+ };
+
+The expected result for this query is:
+
+ { "user": "NathanGiesen@211", "count": 6 }
+ { "user": "ColineGeyer@63", "count": 3 }
+ { "user": "NilaMilliron_tw", "count": 1 }
+
+
+### Query 11 - Left Outer Fuzzy Join ###
+As a last example of AQL and its query power, the following query, for each tweet,
+finds all of the tweets that are similar based on the topics that they refer to:
+
+ use dataverse TinySocial;
+
+ set simfunction "jaccard";
+ set simthreshold "0.3";
+
+ for $t in dataset TweetMessages
+ return {
+ "tweet": $t,
+ "similar-tweets": for $t2 in dataset TweetMessages
+ where $t2.referred-topics ~= $t.referred-topics
+ and $t2.tweetid != $t.tweetid
+ return $t2.referred-topics
+ };
+
+This query illustrates several things worth knowing in order to write fuzzy queries in AQL.
+First, as mentioned earlier, AQL offers an operator-based syntax for seeing whether two values are "similar" to one another or not.
+Second, recall that the referred-topics field of records of datatype TweetMessageType is a bag of strings.
+This query sets the context for its similarity join by requesting that Jaccard-based similarity semantics
+([http://en.wikipedia.org/wiki/Jaccard_index](http://en.wikipedia.org/wiki/Jaccard_index))
+be used for the query's similarity operator and that a similarity index of 0.3 be used as its similarity threshold.
+
+The expected result for this fuzzy join query is:
+
+ { "tweet": { "tweetid": "1", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("47.44,80.65"), "send-time": datetime("2008-04-26T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "customization" }}, "message-text": " love t-mobile its customization is good:)" }, "similar-tweets": [ {{ "t-mobile", "shortcut-menu" }} ] }
+ { "tweet": { "tweetid": "10", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("29.15,76.53"), "send-time": datetime("2008-01-26T10:10:00.000Z"), "referred-topics": {{ "verizon", "voice-clarity" }}, "message-text": " hate verizon its voice-clarity is OMG:(" }, "similar-tweets": [ {{ "iphone", "voice-clarity" }}, {{ "verizon", "voicemail-service" }}, {{ "verizon", "shortcut-menu" }} ] }
+ { "tweet": { "tweetid": "11", "user": { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }, "sender-location": point("37.59,68.42"), "send-time": datetime("2008-03-09T10:10:00.000Z"), "referred-topics": {{ "iphone", "platform" }}, "message-text": " can't stand iphone its platform is terrible" }, "similar-tweets": [ {{ "iphone", "voice-clarity" }}, {{ "samsung", "platform" }} ] }
+ { "tweet": { "tweetid": "12", "user": { "screen-name": "OliJackson_512", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Oli Jackson", "followers_count": 22649 }, "sender-location": point("24.82,94.63"), "send-time": datetime("2010-02-13T10:10:00.000Z"), "referred-topics": {{ "samsung", "voice-command" }}, "message-text": " like samsung the voice-command is amazing:)" }, "similar-tweets": [ {{ "samsung", "platform" }}, {{ "sprint", "voice-command" }} ] }
+ { "tweet": { "tweetid": "2", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("32.84,67.14"), "send-time": datetime("2010-05-13T10:10:00.000Z"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" }, "similar-tweets": [ {{ "verizon", "voicemail-service" }}, {{ "verizon", "voice-clarity" }}, {{ "t-mobile", "shortcut-menu" }} ] }
+ { "tweet": { "tweetid": "3", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("29.72,75.8"), "send-time": datetime("2006-11-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " like motorola the speed is good:)" }, "similar-tweets": [ {{ "motorola", "speed" }} ] }
+ { "tweet": { "tweetid": "4", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("39.28,70.48"), "send-time": datetime("2011-12-26T10:10:00.000Z"), "referred-topics": {{ "sprint", "voice-command" }}, "message-text": " like sprint the voice-command is mind-blowing:)" }, "similar-tweets": [ {{ "samsung", "voice-command" }} ] }
+ { "tweet": { "tweetid": "5", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("40.09,92.69"), "send-time": datetime("2006-08-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " can't stand motorola its speed is terrible:(" }, "similar-tweets": [ {{ "motorola", "speed" }} ] }
+ { "tweet": { "tweetid": "6", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("47.51,83.99"), "send-time": datetime("2010-05-07T10:10:00.000Z"), "referred-topics": {{ "iphone", "voice-clarity" }}, "message-text": " like iphone the voice-clarity is good:)" }, "similar-tweets": [ {{ "verizon", "voice-clarity" }}, {{ "iphone", "platform" }} ] }
+ { "tweet": { "tweetid": "7", "user": { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }, "sender-location": point("36.21,72.6"), "send-time": datetime("2011-08-25T10:10:00.000Z"), "referred-topics": {{ "samsung", "platform" }}, "message-text": " like samsung the platform is good" }, "similar-tweets": [ {{ "iphone", "platform" }}, {{ "samsung", "voice-command" }} ] }
+ { "tweet": { "tweetid": "8", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("46.05,93.34"), "send-time": datetime("2005-10-14T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "shortcut-menu" }}, "message-text": " like t-mobile the shortcut-menu is awesome:)" }, "similar-tweets": [ {{ "t-mobile", "customization" }}, {{ "verizon", "shortcut-menu" }} ] }
+ { "tweet": { "tweetid": "9", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("36.86,74.62"), "send-time": datetime("2012-07-21T10:10:00.000Z"), "referred-topics": {{ "verizon", "voicemail-service" }}, "message-text": " love verizon its voicemail-service is awesome" }, "similar-tweets": [ {{ "verizon", "voice-clarity" }}, {{ "verizon", "shortcut-menu" }} ] }
+
+
+### Inserting New Data ###
+In addition to loading and querying data, AsterixDB supports incremental additions to datasets via the AQL _insert_ statement.
+
+The following example adds a new tweet by user "NathanGiesen@211" to the TweetMessages dataset.
+(An astute reader may notice that this tweet was issued a half an hour after his last tweet, so his counts
+have all gone up in the interim, although he appears not to have moved in the last half hour.)
+
+ use dataverse TinySocial;
+
+ insert into dataset TweetMessages
+ (
+ {"tweetid":"13",
+ "user":
+ {"screen-name":"NathanGiesen@211",
+ "lang":"en",
+ "friends_count":39345,
+ "statuses_count":479,
+ "name":"Nathan Giesen",
+ "followers_count":49420
+ },
+ "sender-location":point("47.44,80.65"),
+ "send-time":datetime("2008-04-26T10:10:35"),
+ "referred-topics":{{"tweeting"}},
+ "message-text":"tweety tweet, my fellow tweeters!"
+ }
+ );
+
+In general, the data to be inserted may be specified using any valid AQL query expression.
+The insertion of a single object instance, as in this example, is just a special case where
+the query expression happens to be a record constructor involving only constants.
+
+### Deleting Existing Data ###
+In addition to inserting new data, AsterixDB supports deletion from datasets via the AQL _delete_ statement.
+The statement supports "searched delete" semantics, and its
+_where_ clause can involve any valid XQuery expression.
+
+The following example deletes the tweet that we just added from user "NathanGiesen@211". (Easy come, easy go. :-))
+
+ use dataverse TinySocial;
+
+ delete $tm from dataset TweetMessages where $tm.tweetid = "13";
+
+It should be noted that one form of data change not yet supported by AsterixDB is in-place data modification (_update_).
+Currently, only insert and delete operations are supported; update is not.
+To achieve the effect of an update, two statements are currently needed---one to delete the old record from the
+dataset where it resides, and another to insert the new replacement record (with the same primary key but with
+different field values for some of the associated data content).
+
+## Further Help ##
+That's it You are now armed and dangerous with respect to semistructured data management using AsterixDB.
+
+AsterixDB is a powerful new BDMS---Big Data Management System---that we hope may usher in a new era of much
+more declarative Big Data management.
+AsterixDB is powerful, so use it wisely, and remember: "With great power comes great responsibility..." :-)
+
+Please e-mail the AsterixDB user group
+(asterixdb-users (at) googlegroups.com)
+if you run into any problems or simply have further questions about the AsterixDB system, its features, or their proper use.
diff --git a/asterix-doc/src/site/markdown/AsterixAlphaRelease.md b/asterix-doc/src/site/markdown/AsterixAlphaRelease.md
new file mode 100644
index 0000000..ff9efb2
--- /dev/null
+++ b/asterix-doc/src/site/markdown/AsterixAlphaRelease.md
@@ -0,0 +1,57 @@
+# AsterixDB: A Big Data Management System _(Alpha Release)_ #
+
+## What Is AsterixDB? ##
+
+Welcome to the new home of the AsterixDB Big Data Management System (BDMS).
+The AsterixDB BDMS is the result of about 3.5 years of R&D involving researchers at UC Irvine, UC Riverside, and UC San Diego.
+The AsterixDB code base now consists of roughly 250K lines of Java code that has been co-developed at UC Irvine and UC Riverside.
+
+Initiated in 2009, the NSF-sponsored ASTERIX project has been developing new technologies for ingesting, storing, managing, indexing, querying, and analyzing vast quantities of semi-structured information.
+The project has been combining ideas from three distinct areas---semi-structured data, parallel databases, and data-intensive computing (a.k.a. today's Big Data platforms)---in order to create a next-generation, open-source software platform that scales by running on large, shared-nothing commodity computing clusters.
+The ASTERIX effort has been targeting a wide range of semi-structured information, ranging from "data" use cases---where information is well-typed and highly regular---to "content" use cases---where data tends to be irregular, much of each datum may be textual, and the ultimate schema for the various data types involved may be hard to anticipate up front.
+The ASTERIX project has been addressing technical issues including highly scalable data storage and indexing, semi-structured query processing on very large clusters, and merging time-tested parallel database techniques with modern data-intensive computing techniques to support performant yet declarative solutions to the problem of storing and analyzing semi-structured information effectively.
+The first fruits of this labor have been captured in the AsterixDB system that is now being released in preliminary or "Alpha" release form.
+We are hoping that the arrival of AsterixDB will mark the beginning of the "BDMS era", and we hope that both the Big Data community and the database community will find the AsterixDB system to be interesting and useful for a much broader class of problems than can be addressed with any one of today's current Big Data platforms and related technologies (e.g., Hadoop, Pig, Hive, HBase, MongoDB, and so on). One of our project mottos has been "one size fits a bunch"---at least that has been our aim. For more information about the research effort that led to the birth of AsterixDB, please refer to our NSF project web site: [http://asterix.ics.uci.edu/](http://asterix.ics.uci.edu/).
+
+In a nutshell, AsterixDB is a full-function BDMS with a rich feature set that distinguishes it from pretty much any other Big Data platform that's out and available today. We believe that its feature set makes it well-suited to modern needs such as web data warehousing and social data storage and analysis. AsterixDB has:
+
+ * A semistructured NoSQL style data model (ADM) resulting from extending JSON with object database ideas
+ * An expressive and declarative query language (AQL) that supports a broad range of queries and analysis over semistructured data
+ * A parallel runtime query execution engine, Hyracks, that has been scale-tested on up to 1000+ cores and 500+ disks
+ * Partitioned LSM-based data storage and indexing to support efficient ingestion and management of semistructured data
+ * Support for query access to externally stored data (e.g., data in HDFS) as well as to data stored natively by AsterixDB
+ * A rich set of primitive data types, including spatial and temporal data in addition to integer, floating point, and textual data
+ * Secondary indexing options that include B+ trees, R trees, and inverted keyword (exact and fuzzy) index types
+ * Support for fuzzy and spatial queries as well as for more traditional parametric queries
+ * Basic transactional (concurrency and recovery) capabilities akin to those of a NoSQL store
+
+## Getting and Using AsterixDB ##
+
+You are most likely here because you are interested in getting your hands on AsterixDB---so you would like to know how to get it, how to set it up, and how to use it.
+Someday our plan is to have comprehensive documentation for AsterixDB and its data model (ADM) and query language (AQL) here on this wiki.
+For the Alpha release, we've got a start; for the Beta release a month or so from now, we will hopefully have much more.
+The following is a list of the wiki pages and supporting documents that we have available today:
+
+1. [InstallingAsterixUsingManagix](InstallingAsterixUsingManagix.html) :
+This is our installation guide, and it is where you should start.
+This document will tell you how to obtain, install, and manage instances of [AsterixDB](https://asterixdb.googlecode.com/files/asterix-installer-0.0.4-binary-assembly.zip), including both single-machine setup (for developers) as well as cluster installations (for deployment in its intended form).
+
+2. [AdmAql101](AdmAql101.html) :
+This is a first-timers introduction to the user model of the AsterixDB BDMS, by which we mean the view of AsterixDB as seen from the perspective of an "average user" or Big Data application developer.
+The AsterixDB user model consists of its data modeling features (ADM) and its query capabilities (AQL).
+This document presents a tiny "social data warehousing" example and uses it as a backdrop for describing, by example, the key features of AsterixDB.
+By working through this document, you will learn how to define the artifacts needed to manage data in AsterixDB, how to load data into the system, how to use most of the basic features of its query language, and how to insert and delete data dynamically.
+
+3. [AsterixDataTypesAndFunctions](AsterixDataTypesAndFunctions.html) :
+This is a reference document that catalogs the primitive data types and built-in functions available for use in AsterixDB schemas (in ADM) and queries (in AQL).
+
+4. [AQL Reference](AsterixQueryLanguageReference.html) :
+This is the AQL language reference manual.
+
+5. [AsterixDBRestAPI](AsterixDBRestAPI.html) :
+Access to data in an AsterixDB instance is provided via a REST-based API.
+This is a short document that describes the REST API entry points and their URL syntax.
+
+To all who have now come this far: Thanks for your interest in AsterixDB, and for kicking its tires in its Alpha form
+In addition to getting the system and trying it out, please sign up as a member of the AsterixDB user mailing list (asterixdb-users (at) googlegroups.com) so that you can contact us easily with your questions, issues, and other feedback.
+We want AsterixDB to be a "big hit" some day, and we are anxious to see what users do with it and to learn from that feedback what we should be working on most urgently in the next phase of the project.
diff --git a/asterix-doc/src/site/markdown/AsterixDBDataModel.md b/asterix-doc/src/site/markdown/AsterixDBDataModel.md
new file mode 100644
index 0000000..ffefd09
--- /dev/null
+++ b/asterix-doc/src/site/markdown/AsterixDBDataModel.md
@@ -0,0 +1,291 @@
+# Asterix Data Model (ADM) #
+
+# Basic data types #
+
+An instance of Asterix data model (ADM) can be a _primitive type_ (`Int32`, `Int64`, `String`, `Float`, `Double`, `Date`, `Time`, `Datetime`, etc. or `NULL`) or a _derived type_.
+
+## Primitive Types ##
+
+### Boolean ###
+`Boolean` data type can have one of the two values: _*true*_ or _*false*_.
+
+ * Example:
+
+ let $t := true
+ let $f := false
+ return { "true": $t, "false": $f }
+
+
+ * The expected result is:
+
+ { "true": true, "false": false }
+
+
+
+### Int8 / Int16 / Int32 / Int64 ###
+Integer types using 8, 16, 32, or 64 bits. The ranges of these types are:
+
+- `Int8`: -127 to 127
+- `Int16`: -32767 to 32767
+- `Int32`: -2147483647 to 2147483647
+- `Int64`: -9223372036854775808 to 9223372036854775807
+
+ * Example:
+
+ let $v8 := int8("125")
+ let $v16 := int16("32765")
+ let $v32 := 294967295
+ let $v64 := int64("1700000000000000000")
+ return { "int8": $v8, "int16": $v16, "int32": $v32, "int64": $v64}
+
+
+ * The expected result is:
+
+ { "int8": 125i8, "int16": 32765i16, "int32": 294967295, "int64": 1700000000000000000i64 }
+
+
+### Float ###
+`Float` represents approximate numeric data values using 4 bytes. The range of a float value can be from 2^(-149) to (2-2^(-23)·2^(127) for both positive and negative. Beyond these ranges will get `INF` or `-INF`.
+
+ * Example:
+
+ let $v1 := float("NaN")
+ let $v2 := float("INF")
+ let $v3 := float("-INF")
+ let $v4 := float("-2013.5")
+ return { "v1": $v1, "v2": $v2, "v3": $v3, "v4": $v4 }
+
+
+ * The expected result is:
+
+ { "v1": NaNf, "v2": Infinityf, "v3": -Infinityf, "v4": -2013.5f }
+
+
+### Double ###
+`Double` represents approximate numeric data values using 8 bytes. The range of a double value can be from (2^(-1022)) to (2-2^(-52))·2^(1023) for both positive and negative. Beyond these ranges will get `INF` or `-INF`.
+
+ * Example:
+
+ let $v1 := double("NaN")
+ let $v2 := double("INF")
+ let $v3 := double("-INF")
+ let $v4 := double("-2013.593823748327284")
+ return { "v1": $v1, "v2": $v2, "v3": $v3, "v4": $v4 }
+
+
+ * The expected result is:
+
+ { "v1": NaNd, "v2": Infinityd, "v3": -Infinityd, "v4": -2013.5938237483274d }
+
+
+### String ###
+`String` represents a sequence of characters.
+
+ * Example:
+
+ let $v1 := string("This is a string.")
+ let $v2 := string("\"This is a quoted string\"")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": "This is a string.", "v2": "\"This is a quoted string\"" }
+
+
+### Point ###
+`Point` is the fundamental two-dimensional building block for spatial types. It consists of two `double` coordinates x and y.
+
+ * Example:
+
+ let $v1 := point("80.10d, -10E5")
+ let $v2 := point("5.10E-10d, -10E5")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": point("80.1,-1000000.0"), "v2": point("5.1E-10,-1000000.0") }
+
+
+### Line ###
+`Line` consists of two points that represent the start and the end points of a line segment.
+
+ * Example:
+
+ let $v1 := line("10.1234,11.1e-1 +10.2E-2,-11.22")
+ let $v2 := line("0.1234,-1.00e-10 +10.5E-2,-01.02")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": line("10.1234,1.11 0.102,-11.22"), "v2": line("0.1234,-1.0E-10 0.105,-1.02") }
+
+
+### Rectangle ###
+`Rectangle` consists of two points that represent the _*bottom left*_ and _*upper right*_ corners of a rectangle.
+
+ * Example:
+
+ let $v1 := rectangle("5.1,11.8 87.6,15.6548")
+ let $v2 := rectangle("0.1234,-1.00e-10 5.5487,0.48765")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": rectangle("5.1,11.8 87.6,15.6548"), "v2": rectangle("0.1234,-1.0E-10 5.5487,0.48765") }
+
+
+### Circle ###
+`Circle` consists of one `point` that represents the center of the circle and a radius of type `double`.
+
+ * Example:
+
+ let $v1 := circle("10.1234,11.1e-1 +10.2E-2")
+ let $v2 := circle("0.1234,-1.00e-10 +10.5E-2")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": circle("10.1234,1.11 0.102"), "v2": circle("0.1234,-1.0E-10 0.105") }
+
+
+### Polygon ###
+`Polygon` consists of _*n*_ points that represent the vertices of a _*simple closed*_ polygon.
+
+ * Example:
+
+ let $v1 := polygon("-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81")
+ let $v2 := polygon("-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": polygon("-1.2,130.0 -214000.0,2.15 -350.0,3.6 -0.0046,4.81"), "v2": polygon("-1.0,1050.0 -2.15E50,2.5 -1.0,3300.0 -250000.0,20.15 350.0,3.6 -0.0046,4.75 -2.0,100.0 -200000.0,20.1 30.5,3.25 -0.00433,4.75") }
+
+
+### Date ###
+`Date` represents a time point along the Gregorian calendar system specified by the year, month and day. ASTERIX supports the date from `-9999-01-01` to `9999-12-31`.
+
+A date value can be represented in two formats, extended format and basic format.
+
+ * Extended format is represented as `[-]yyyy-mm-dd` for `year-month-day`. Each field should be padded if there are less digits than the format specified.
+ * Basic format is in the format of `[-]yyyymmdd`.
+
+ * Example:
+
+ let $v1 := date("2013-01-01")
+ let $v2 := date("-19700101")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": date("2013-01-01"), "v2": date("-1970-01-01") }
+
+
+### Time ###
+`Time` type describes the time within the range of a day. It is represented by three fields: hour, minute and second. Millisecond field is optional as the fraction of the second field. Its extended format is as `hh:mm:ss[.mmm]` and the basic format is `hhmmss[mmm]`. The value domain is from `00:00:00.000` to `23:59:59.999`.
+
+Timezone field is optional for a time value. Timezone is represented as `[+|-]hh:mm` for extended format or `[+|-]hhmm` for basic format. Note that the sign designators cannot be omitted. `Z` can also be used to represent the UTC local time. If no timezone information is given, it is UTC by default.
+
+ * Example:
+
+ let $v1 := time("12:12:12.039Z")
+ let $v2 := time("000000000-0800")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": time("12:12:12.039Z"), "v2": time("08:00:00.000Z") }
+
+
+### Datetime ###
+A `Datetime` value is a combination of an `Date` and `Time`, representing a fixed time point along the Gregorian calendar system. The value is among `-9999-01-01 00:00:00.000` and `9999-12-31 23:59:59.999`.
+
+A `Datetime` value is represented as a combination of the representation of its `Date` part and `Time` part, separated by a separator `T`. Either extended or basic format can be used, and the two parts should be the same format.
+
+Millisecond field and timezone field are optional, as specified in the `Time` type.
+
+ * Example:
+
+ let $v1 := datetime("2013-01-01T12:12:12.039Z")
+ let $v2 := datetime("-19700101T000000000-0800")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": datetime("2013-01-01T12:12:12.039Z"), "v2": datetime("-1970-01-01T08:00:00.000Z") }
+
+
+### Duration ###
+`Duration` represents a duration of time. A duration value is specified by integers on at least one of the following fields: year, month, day, hour, minute, second, and millisecond.
+
+A duration value is in the format of `[-]PnYnMnDTnHnMn.mmmS`. The millisecond part (as the fraction of the second field) is optional, and when no millisecond field is used, the decimal point should also be absent.
+
+Negative durations are also supported for the arithmetic operations between time instance types (`Date`, `Time` and `Datetime`), and is used to roll the time back for the given duration. For example `date("2012-01-01") + duration("-P3D")` will return `date("2011-12-29")`.
+
+Note that a canonical representation of the duration is always returned, regardless whether the duration is in the canonical representation or not from the user's input. More information about canonical representation can be found from [XPath dayTimeDuration Canonical Representation](http://www.w3.org/TR/xpath-functions/#canonical-dayTimeDuration) and [yearMonthDuration Canonical Representation](http://www.w3.org/TR/xpath-functions/#canonical-yearMonthDuration).
+
+ * Example:
+
+ let $v1 := duration("P100Y12MT12M")
+ let $v2 := duration("-PT20.943S")
+ return { "v1": $v1, "v2": $v2 }
+
+
+ * The expected result is:
+
+ { "v1": duration("P101YT12M"), "v2": duration("-PT20.943S") }
+
+
+### Interval ###
+`Interval` represents inclusive-exclusive ranges of time. It is defined by two time point values with the same temporal type(`Date`, `Time` or `Datetime`).
+
+ * Example:
+
+ let $v1 := interval-from-date(date("2013-01-01"), date("20130505"))
+ let $v2 := interval-from-time(time("00:01:01"), time("213901049+0800"))
+ let $v3 := interval-from-datetime(datetime("2013-01-01T00:01:01"), datetime("20130505T213901049+0800"))
+ return { "v1": $v1, "v2": $v2, "v3": $v3 }
+
+
+ * The expected result is:
+
+ { "v1": interval-date("2013-01-01, 2013-05-05"), "v2": interval-time("00:01:01.000Z, 13:39:01.049Z"), "v3": interval-datetime("2013-01-01T00:01:01.000Z, 2013-05-05T13:39:01.049Z") }
+
+
+## Derived Types ##
+
+### Record ###
+A `Record` contains a set of fields, where each field is described by its name and type. A record type is either open or closed. Open records can contain fields that are not part of the type definition, while closed records cannot. Syntactically, record constructors are surrounded by curly braces "{...}".
+
+An example would be
+
+
+ { "id": 213508, "name": "Alice Bob" }
+
+
+### OrderedList ###
+An `OrderedList` is a sequence of values for which the order is determined by creation or insertion. OrderedList constructors are denoted by brackets: "[...]".
+
+An example would be
+
+
+ ["alice", 123, "bob", null]
+
+
+### UnorderedList ###
+An `UnorderedList` is an unordered sequence of values, similar to bags in SQL. UnorderedList constructors are denoted by two opening flower braces followed by data and two closing flower braces, like "{{...}}".
+
+An example would be
+
+
+ {{"hello", 9328, "world", [1, 2, null]}}
+
diff --git a/asterix-doc/src/site/markdown/AsterixDBFunctions.md b/asterix-doc/src/site/markdown/AsterixDBFunctions.md
new file mode 100644
index 0000000..d47752c
--- /dev/null
+++ b/asterix-doc/src/site/markdown/AsterixDBFunctions.md
@@ -0,0 +1,1910 @@
+# Asterix: Using Functions #
+Asterix provides rich support of various classes of functions to support operations on string, spatial, and temporal data. This document explains how to use these functions.
+
+## String Functions ##
+### string-to-codepoint ###
+ * Syntax:
+
+ string-to-codepoint(string_expression)
+
+ * Converts the string `string_expression` to its code-based representation.
+ * Arguments:
+ * `string_expression` : A `String` that will be converted.
+ * Return Value:
+ * An `OrderedList` of the code points for the string `string_expression`.
+
+### codepoint-to-string ###
+ * Syntax:
+
+ codepoint-to-string(list_expression)
+
+ * Converts the ordered code-based representation `list_expression` to the corresponding string.
+ * Arguments:
+ * `list_expression` : An `OrderedList` of code-points.
+ * Return Value:
+ * A `String` representation of `list_expression`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $s := "Hello ASTERIX!"
+ let $l := string-to-codepoint($s)
+ let $ss := codepoint-to-string($l)
+ return {"codes": $l, "string": $ss}
+
+
+ * The expected result is:
+
+ { "codes": [ 72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33 ], "string": "Hello ASTERIX!" }
+
+
+### contains ###
+ * Syntax:
+
+ contains(string_expression, string_pattern)
+
+ * Checks whether the string `string_expression` contains the string `string_pattern`
+ * Arguments:
+ * `string_expression` : A `String` that might contain the pattern.
+ * `string_pattern` : A target `String` that might be contained.
+ * Return Value:
+ * A `Boolean`, returns `true` if `string_expression` contains `string_pattern`, otherwise returns `false`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ where contains($i.message, "phone")
+ return {"mid": $i.message-id, "message": $i.message}
+
+
+ * The expected result is:
+
+ { "mid": 2, "message": " dislike iphone its touch-screen is horrible" }
+ { "mid": 13, "message": " dislike iphone the voice-command is bad:(" }
+ { "mid": 15, "message": " like iphone the voicemail-service is awesome" }
+
+
+### len ###
+ * Syntax:
+
+ len(list_expression)
+
+ * Returns the length of the list `list_expression`.
+ * Arguments:
+ * `list_expression` : An `OrderedList`, `UnorderedList` or `NULL`, represents the list need to be checked.
+ * Return Value:
+ * An `Int32` that represents the length of `list_expression`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $l := ["ASTERIX", "Hyracks"]
+ return len($l)
+
+
+ * The expected result is:
+
+ 2
+
+
+### like ###
+ * Syntax:
+
+ like(string_expression, string_pattern)
+
+ * Checks whether the string `string_expression` contains the string `string_pattern`.
+ * Arguments:
+ * `string_expression` : A `String` that might contain the pattern or `NULL`.
+ * `string_pattern` : A pattern `String` that might be contained or `NULL`.
+ * Return Value:
+ * A `Boolean`, returns `true` if `string_expression` contains the pattern `string_pattern`, otherwise returns `false`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ where like($i.message, "%at&t%")
+ return $i.message
+
+
+ * The expected result is:
+
+ " can't stand at&t the network is horrible:("
+ " can't stand at&t its plan is terrible"
+ " love at&t its 3G is good:)"
+
+
+### starts-with ###
+ * Syntax:
+
+ starts-with(string_expression, string_pattern)
+
+ * Checks whether the string `string_expression` starts with the string `string_pattern`.
+ * Arguments:
+ * `string_expression` : A `String` that might start with the given string.
+ * `string_pattern` : A `String` that might be contained as the starting substring.
+ * Return Value:
+ * A `Boolean`, returns `true` if `string_expression` starts with the string `string_pattern`, otherwise returns `false`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ where starts-with($i.message, " like")
+ return $i.message
+
+
+ * The expected result is:
+
+ " like samsung the plan is amazing"
+ " like t-mobile its platform is mind-blowing"
+ " like verizon the 3G is awesome:)"
+ " like iphone the voicemail-service is awesome"
+
+
+### ends-with ###
+ * Syntax:
+
+ ends-with(string_expression, string_pattern)
+
+ * Checks whether the string `string_expression` ends with the string `string_pattern`.
+ * Arguments:
+ * `string_expression` : A `String` that might end with the given string.
+ * `string_pattern` : A `String` that might be contained as the ending substring.
+ * Return Value:
+ * A `Boolean`, returns `true` if `string_expression` ends with the string `string_pattern`, otherwise returns `false`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ where ends-with($i.message, ":)")
+ return $i.message
+
+
+ * The expected result is:
+
+ " love sprint its shortcut-menu is awesome:)"
+ " like verizon the 3G is awesome:)"
+ " love at&t its 3G is good:)"
+
+
+### string-concat ###
+ * Syntax:
+
+ string-concat(list_expression)
+
+ * Concatenates a list of strings `list_expression` into a single string.
+ * Arguments:
+ * `list_expression` : An `OrderedList` or `UnorderedList` of `String`s (could be `NULL`) to be concatenated.
+ * Return Value:
+ * Returns the concatenated `String` value.
+
+ * Example:
+
+ let $i := "ASTERIX"
+ let $j := " "
+ let $k := "ROCKS!"
+ return string-concat([$i, $j, $k])
+
+
+ * The expected result is:
+
+ "ASTERIX ROCKS!"
+
+
+### string-equal ###
+ * Syntax:
+
+ string-equal(string_expression1, string_expression2)
+
+ * Checks whether the strings `string_expression1` and `string_expression2` are equal.
+ * Arguments:
+ * `string_expression1` : A `String` to be compared.
+ * `string_expression2` : A `String` to be compared with.
+ * Return Value:
+ * A `Boolean`, returns `true` if `string_expression1` and `string_expression2` are equal, otherwise returns `false`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $i := "Android"
+ return {"Equal": string-equal($i, "Android"), "NotEqual": string-equal($i, "iphone")}
+
+
+ * The expected result is:
+
+ { "Equal": true, "NotEqual": false }
+
+
+### string-join ###
+ * Syntax:
+
+ string-join(list_expression, string_expression)
+
+ * Joins a list of strings `list_expression` with the given separator `string_expression` into a single string.
+ * Arguments:
+ * `list_expression` : An `OrderedList` or `UnorderedList` of `String`s (could be NULL) to be joined.
+ * `string_expression` : A separator `String` value.
+ * Return Value:
+ * Returns the joined `String`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $i := ["ASTERIX", "ROCKS~"]
+ return string-join($i, "!! ")
+
+
+ * The expected result is:
+
+ "ASTERIX!! ROCKS~"
+
+
+### lowercase ###
+ * Syntax:
+
+ lowercase(string_expression)
+
+ * Returns the lowercase of a given string `string_expression`.
+ * Arguments:
+ * `string_expression` : A `String` to be lowercased.
+ * Return Value:
+ * Returns the lowercased `String`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $i := "ASTERIX"
+ return lowercase($i)
+
+
+ * The expected result is:
+
+ asterix
+
+
+### matches ###
+ * Syntax:
+
+ matches(string_expression, string_pattern)
+
+ * Checks whether the strings `string_expression` matches the given pattern `string_pattern`.
+ * Arguments:
+ * `string_expression` : A `String` that might contain the pattern.
+ * `string_pattern` : A pattern `String` to be matched.
+ * Return Value:
+ * A `Boolean`, returns `true` if `string_expression` matches the pattern `string_pattern`, otherwise returns `false`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ where matches($i.message, "dislike iphone")
+ return $i.message
+
+
+ * The expected result is:
+
+ " dislike iphone its touch-screen is horrible"
+ " dislike iphone the voice-command is bad:("
+
+
+### replace ###
+ * Syntax:
+
+ replace(string_expression, string_pattern, string_replacement)
+
+ * Checks whether the strings `string_expression` matches the given pattern `string_pattern`, and replace the matched pattern `string_pattern` with the new pattern `string_replacement`.
+ * Arguments:
+ * `string_expression` : A `String` that might contain the pattern.
+ * `string_pattern` : A pattern `String` to be matched.
+ * `string_replacement` : A pattern `String` to be used as the replacement.
+ * Return Value:
+ * Returns a `String` that is obtained after the replacements.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ where matches($i.message, " like iphone")
+ return replace($i.message, " like iphone", "like android")
+
+
+ * The expected result is:
+
+ "like android the voicemail-service is awesome"
+
+
+### string-length ###
+ * Syntax:
+
+ string-length(string_expression)
+
+ * Returns the length of the string `string_expression`.
+ * Arguments:
+ * `string_expression` : A `String` or `NULL`, represents the string to be checked.
+ * Return Value:
+ * An `Int32` that represents the length of `string_expression`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ return {"mid": $i.message-id, "message-len": string-length($i.message)}
+
+
+ * The expected result is:
+
+ { "mid": 1, "message-len": 43 }
+ { "mid": 2, "message-len": 44 }
+ { "mid": 3, "message-len": 33 }
+ { "mid": 4, "message-len": 43 }
+ { "mid": 5, "message-len": 46 }
+ { "mid": 6, "message-len": 43 }
+ { "mid": 7, "message-len": 37 }
+ { "mid": 8, "message-len": 33 }
+ { "mid": 9, "message-len": 34 }
+ { "mid": 10, "message-len": 50 }
+ { "mid": 11, "message-len": 38 }
+ { "mid": 12, "message-len": 52 }
+ { "mid": 13, "message-len": 42 }
+ { "mid": 14, "message-len": 27 }
+ { "mid": 15, "message-len": 45 }
+
+
+### substring ###
+ * Syntax:
+
+ substring(string_expression, offset, length)
+
+ * Returns the substring from the given string `string_expression` based on the given start offset `offset`.
+ * Arguments:
+ * `string_expression` : A `String` as the string to be extracted.
+ * `offset` : An `Int32` as the starting offset of the substring in `string_expression`.
+ * `length` : (Optional) An `Int32` as the length of the substring.
+ * Return Value:
+ * A `String` that represents the substring.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ where string-length($i.message) > 50
+ return substring($i.message, 50)
+
+
+ * The expected result is:
+
+ "G:("
+
+
+### substring-before ###
+ * Syntax:
+
+ substring-before(string_expression, string_pattern)
+
+ * Returns the substring from the given string `string_expression` before the given pattern `string_pattern`.
+ * Arguments:
+ * `string_expression` : A `String` as the string to be extracted.
+ * `string_pattern` : A `String` as the string pattern to be searched.
+ * Return Value:
+ * A `String` that represents the substring.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ where contains($i.message, "iphone")
+ return substring-before($i.message, "iphone")
+
+
+ * The expected result is:
+
+ " dislike "
+ " dislike "
+ " like "
+
+
+### substring-after ###
+ * Syntax:
+
+ substring-after(string_expression, string_pattern)
+
+ * Returns the substring from the given string `string_expression` after the given pattern `string_pattern`.
+ * Arguments:
+ * `string_expression` : A `String` as the string to be extracted.
+ * `string_pattern` : A `String` as the string pattern to be searched.
+ * Return Value:
+ * A `String` that represents the substring.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookMessages')
+ where contains($i.message, "iphone")
+ return substring-after($i.message, "iphone")
+
+
+ * The expected result is:
+
+ " its touch-screen is horrible"
+ " the voice-command is bad:("
+ " the voicemail-service is awesome"
+
+
+## Spatial Functions ##
+### create-point ###
+ * Syntax:
+
+ create-point(latitude, longitude)
+
+ * Creates the primitive type `Point` using `latitude` and `longitude`.
+ * Arguments:
+ * `latitude` : A `Double` that represents the latitude.
+ * `longitude` : A `Double` that represents the longitude.
+ * Return Value:
+ * A `Point`, represents a spatial point created using the latitude and longitude provided in `latitude` and `longitude`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $c := create-point(30.0,70.0)
+ return {"point": $c}
+
+
+ * The expected result is:
+
+ { "point": point("30.0,70.0") }
+
+
+### create-line ###
+ * Syntax:
+
+ create-line(point_expression1, point_expression2)
+
+ * Creates the primitive type `Line` using `point_expression1` and `point_expression2`.
+ * Arguments:
+ * `point_expression1` : A `Point` that represents the start point of the line.
+ * `point_expression2` : A `Point` that represents the end point of the line.
+ * Return Value:
+ * A `Line`, represents a spatial line created using the points provided in `point_expression1` and `point_expression2`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $c := create-line(create-point(30.0,70.0), create-point(50.0,90.0))
+ return {"line": $c}
+
+
+ * The expected result is:
+
+ { "line": line("30.0,70.0 50.0,90.0") }
+
+
+### create-rectangle ###
+ * Syntax:
+
+ create-rectangle(point_expression1, point_expression2)
+
+ * Creates the primitive type Rectangle using `point_expression1` and `point_expression2`.
+ * Arguments:
+ * `point_expression1` : A `Point` that represents the lower-left point of the rectangle.
+ * `point_expression2` : A `Point` that represents the upper-right point of the rectangle.
+ * Return Value:
+ * A `Rectangle`, represents a spatial rectangle created using the points provided in `point_expression1` and `point_expression2`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $c := create-rectangle(create-point(30.0,70.0), create-point(50.0,90.0))
+ return {"rectangle": $c}
+
+
+ * The expected result is:
+
+ { "rectangle": rectangle("30.0,70.0 50.0,90.0") }
+
+
+### create-circle ###
+ * Syntax:
+
+ create-circle(point_expression, radius)
+
+ * Creates the primitive type `Circle` using `point_expression` and `radius`.
+ * Arguments:
+ * `point_expression` : A `Point` that represents the center of the circle.
+ * `radius` : A `Double` that represents the radius of the circle.
+ * Return Value:
+ * A `Circle`, represents a spatial circle created using the center point and the radius provided in `point_expression` and `radius`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $c := create-circle(create-point(30.0,70.0), 5.0)
+ return {"circle": $c}
+
+
+ * The expected result is:
+
+ { "circle": circle("30.0,70.0 5.0") }
+
+
+### create-polygon ###
+ * Syntax:
+
+ create-polygon(point_expression1, point_expression2, ..., point_expressionn)
+
+ * Creates the primitive type `Polygon` using unlimited number of arguments `point_expression1`, `point_expression2`, ..., `point_expressionn`.
+ * Arguments:
+ * `point_expression1`/.../`point_expressionn` : A `Point` that represents a vertex of the polygon.
+ * Return Value:
+ * A `Polygon`, represents a spatial simple polygon created using the points provided in `point_expression1`, `point_expression2`, ..., `point_expressionn`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $c := create-polygon(create-point(1.0,1.0), create-point(2.0,2.0), create-point(3.0,3.0), create-point(4.0,4.0))
+ return {"polygon": $c}
+
+
+ * The expected result is:
+
+ { "polygon": polygon("1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0") }
+
+
+### point ###
+ * Syntax:
+
+ point(string_expression)
+
+ * Constructor function for `Point` type by parsing a point string `string_expression`
+ * Arguments:
+ * `string_expression` : The `String` value representing a point value.
+ * Return Value:
+ * A `Point` value represented by the given string.
+
+ * Example:
+
+
+ use dataverse TinySocial;
+
+ let $c := point("55.05,-138.04")
+ return {"point": $c}
+
+
+ * The expected result is:
+
+ { "point": point("55.05,-138.04") }
+
+
+### line ###
+ * Syntax:
+
+ line(string_expression)
+
+ * Constructor function for `Line` type by parsing a line string `string_expression`
+ * Arguments:
+ * `string_expression` : The `String` value representing a line value.
+ * Return Value:
+ * A `Line` value represented by the given string.
+
+ * Example:
+
+
+ use dataverse TinySocial;
+
+ let $c := line("55.05,-138.04 13.54,-138.04")
+ return {"line": $c}
+
+
+ * The expected result is:
+
+ { "line": line("55.05,-138.04 13.54,-138.04") }
+
+
+### rectangle ###
+ * Syntax:
+
+ rectangle(string_expression)
+
+ * Constructor function for `Rectangle` type by parsing a rectangle string `string_expression`
+ * Arguments:
+ * `string_expression` : The `String` value representing a rectangle value.
+ * Return Value:
+ * A `Rectangle` value represented by the given string.
+
+ * Example:
+
+
+ use dataverse TinySocial;
+
+ let $c := rectangle("20.05,-125.0 40.67,-100.87")
+ return {"rectangle": $c}
+
+
+ * The expected result is:
+
+ { "rectangle": rectangle("20.05,-125.0 40.67,-100.87") }
+
+
+### circle ###
+ * Syntax:
+
+ circle(string_expression)
+
+ * Constructor function for `Circle` type by parsing a circle string `string_expression`
+ * Arguments:
+ * `string_expression` : The `String` value representing a circle value.
+ * Return Value:
+ * A `Circle` value represented by the given string.
+
+ * Example:
+
+
+ use dataverse TinySocial;
+
+ let $c := circle("55.05,-138.04 10.0")
+ return {"circle": $c}
+
+
+ * The expected result is:
+
+ { "circle": circle("55.05,-138.04 10.0") }
+
+
+### polygon ###
+ * Syntax:
+
+ polygon(string_expression)
+
+ * Constructor function for `Polygon` type by parsing a polygon string `string_expression`
+ * Arguments:
+ * `string_expression` : The `String` value representing a polygon value.
+ * Return Value:
+ * A `Polygon` value represented by the given string.
+
+ * Example:
+
+
+ use dataverse TinySocial;
+
+ let $c := polygon("55.05,-138.04 13.54,-138.04 13.54,-53.31 55.05,-53.31")
+ return {"polygon": $c}
+
+
+ * The expected result is:
+
+ { "polygon": polygon("55.05,-138.04 13.54,-138.04 13.54,-53.31 55.05,-53.31") }
+
+
+### get-x/get-y ###
+ * Syntax:
+
+ get-x(point_expression) or get-y(point_expression)
+
+ * Returns the x or y coordinates of a point `point_expression`.
+ * Arguments:
+ * `point_expression` : A `Point`.
+ * Return Value:
+ * A `Double`, represents the x or y coordinates of the point `point_expression`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $point := create-point(2.3,5.0)
+ return {"x-coordinate": get-x($point), "y-coordinate": get-y($point)}
+
+
+ * The expected result is:
+
+ { "x-coordinate": 2.3d, "y-coordinate": 5.0d }
+
+
+### get-points ###
+ * Syntax:
+
+ get-points(spatial_expression)
+
+ * Returns an ordered list of the points forming the spatial object `spatial_expression`.
+ * Arguments:
+ * `spatial_expression` : A `Point`, `Line`, `Rectangle`, `Circle`, or `Polygon`.
+ * Return Value:
+ * An `OrderedList` of the points forming the spatial object `spatial_expression`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $line := create-line(create-point(100.6,99.4), create-point(-72.0,-76.9))
+ let $rectangle := create-rectangle(create-point(9.2,49.0), create-point(77.8,111.1))
+ let $polygon := create-polygon(create-point(1.0,1.0), create-point(2.0,2.0), create-point(3.0,3.0), create-point(4.0,4.0))
+ let $line_list := get-points($line)
+ let $rectangle_list := get-points($rectangle)
+ let $polygon_list := get-points($polygon)
+ return {"line-first-point": $line_list[0], "line-second-point": $line_list[1], "rectangle-left-bottom-point": $rectangle_list[0], "rectangle-top-upper-point": $rectangle_list[1], "polygon-first-point": $polygon_list[0], "polygon-second-point": $polygon_list[1], "polygon-third-point": $polygon_list[2], "polygon-forth-point": $polygon_list[3]}
+
+
+ * The expected result is:
+
+ { "line-first-point": point("100.6,99.4"), "line-second-point": point("-72.0,-76.9"), "rectangle-left-bottom-point": point("9.2,49.0"), "rectangle-top-upper-point": point("77.8,111.1"), "polygon-first-point": point("1.0,1.0"), "polygon-second-point": point("2.0,2.0"), "polygon-third-point": point("3.0,3.0"), "polygon-forth-point": point("4.0,4.0") }
+
+
+### get-center/get-radius ###
+ * Syntax:
+
+ get-center(circle_expression) or get-radius(circle_expression)
+
+ * Returns the center and the radius of a circle `circle_expression`.
+ * Arguments:
+ * `circle_expression` : A `Circle`.
+ * Return Value:
+ * A `Point` or `Double`, represent the center or radius of the circle `circle_expression`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $circle := create-circle(create-point(6.0,3.0), 1.0)
+ return {"circle-radius": get-radius($circle), "circle-center": get-center($circle)}
+
+
+
+ * The expected result is:
+
+ { "circle-radius": 1.0d, "circle-center": point("6.0,3.0") }
+
+
+
+### spatial-distance ###
+ * Syntax:
+
+ spatial-distance(point_expression1, point_expression2)
+
+ * Returns the euclidean distance between `point_expression1` and `point_expression2`.
+ * Arguments:
+ * `point_expression1` : A `Point`.
+ * `point_expression2` : A `Point`.
+ * Return Value:
+ * A `Double`, represents the euclidean distance between `point_expression1` and `point_expression2`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $t in dataset('TweetMessages')
+ let $d := spatial-distance($t.sender-location, create-point(30.0,70.0))
+ return {"point": $t.sender-location, "distance": $d}
+
+
+
+ * The expected result is:
+
+ { "point": point("47.44,80.65"), "distance": 20.434678857275934d }
+ { "point": point("29.15,76.53"), "distance": 6.585089217315132d }
+ { "point": point("37.59,68.42"), "distance": 7.752709203884797d }
+ { "point": point("24.82,94.63"), "distance": 25.168816023007512d }
+ { "point": point("32.84,67.14"), "distance": 4.030533463451212d }
+ { "point": point("29.72,75.8"), "distance": 5.806754687430835d }
+ { "point": point("39.28,70.48"), "distance": 9.292405501268227d }
+ { "point": point("40.09,92.69"), "distance": 24.832321679617472d }
+ { "point": point("47.51,83.99"), "distance": 22.41250097601782d }
+ { "point": point("36.21,72.6"), "distance": 6.73231758015024d }
+ { "point": point("46.05,93.34"), "distance": 28.325926286707734d }
+ { "point": point("36.86,74.62"), "distance": 8.270671073135482d }
+
+
+### spatial-area ###
+ * Syntax:
+
+ spatial-distance(spatial_2d_expression)
+
+ * Returns the spatial area of `spatial_2d_expression`.
+ * Arguments:
+ * `spatial_2d_expression` : A `Rectangle`, `Circle`, or `Polygon`.
+ * Return Value:
+ * A `Double`, represents the area of `spatial_2d_expression`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $circleArea := spatial-area(create-circle(create-point(0.0,0.0), 5.0))
+ return {"Area":$circleArea}
+
+
+
+ * The expected result is:
+
+ { "Area": 78.53981625d }
+
+
+### spatial-intersect ###
+ * Syntax:
+
+ spatial-intersect(spatial_expression1, spatial_expression2)
+
+ * Checks whether `@arg1` and `@arg2` spatially intersect each other.
+ * Arguments:
+ * `spatial_expression1` : A `Point`, `Line`, `Rectangle`, `Circle`, or `Polygon`.
+ * `spatial_expression2` : A `Point`, `Line`, `Rectangle`, `Circle`, or `Polygon`.
+ * Return Value:
+ * A `Boolean`, represents whether `spatial_expression1` and `spatial_expression2` spatially intersect each other.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $t in dataset('TweetMessages')
+ where spatial-intersect($t.sender-location, create-rectangle(create-point(30.0,70.0), create-point(40.0,80.0)))
+ return $t
+
+
+ * The expected result is:
+
+ { "tweetid": "4", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("39.28,70.48"), "send-time": datetime("2011-12-26T10:10:00.000Z"), "referred-topics": {{ "sprint", "voice-command" }}, "message-text": " like sprint the voice-command is mind-blowing:)" }
+ { "tweetid": "7", "user": { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }, "sender-location": point("36.21,72.6"), "send-time": datetime("2011-08-25T10:10:00.000Z"), "referred-topics": {{ "samsung", "platform" }}, "message-text": " like samsung the platform is good" }
+ { "tweetid": "9", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "sender-location": point("36.86,74.62"), "send-time": datetime("2012-07-21T10:10:00.000Z"), "referred-topics": {{ "verizon", "voicemail-service" }}, "message-text": " love verizon its voicemail-service is awesome" }
+
+
+### spatial-cell ###
+ * Syntax:
+
+ spatial-cell(point_expression1, point_expression2, x_increment, y_increment)
+
+ * Returns the grid cell that `point_expression1` belongs to.
+ * Arguments:
+ * `point_expression1` : A `Point`, represents the point of interest that its grid cell will be returned.
+ * `point_expression2` : A `Point`, represents the origin of the grid.
+ * `x_increment` : A `Double`, represents X increments.
+ * `y_increment` : A `Double`, represents Y increments.
+ * Return Value:
+ * A `Rectangle`, represents the grid cell that `point_expression1` belongs to.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $t in dataset('TweetMessages')
+ group by $c := spatial-cell($t.sender-location, create-point(20.0,50.0), 5.5, 6.0) with $t
+ let $num := count($t)
+ return { "cell": $c, "count": $num}
+
+
+ * The expected result is:
+
+ { "cell": rectangle("20.0,92.0 25.5,98.0"), "count": 1 }
+ { "cell": rectangle("25.5,74.0 31.0,80.0"), "count": 2 }
+ { "cell": rectangle("31.0,62.0 36.5,68.0"), "count": 1 }
+ { "cell": rectangle("31.0,68.0 36.5,74.0"), "count": 1 }
+ { "cell": rectangle("36.5,68.0 42.0,74.0"), "count": 2 }
+ { "cell": rectangle("36.5,74.0 42.0,80.0"), "count": 1 }
+ { "cell": rectangle("36.5,92.0 42.0,98.0"), "count": 1 }
+ { "cell": rectangle("42.0,80.0 47.5,86.0"), "count": 1 }
+ { "cell": rectangle("42.0,92.0 47.5,98.0"), "count": 1 }
+ { "cell": rectangle("47.5,80.0 53.0,86.0"), "count": 1 }
+
+
+
+
+## Similarity Functions ##
+
+AsterixDB supports queries with different similarity functions, including edit distance and Jaccard.
+
+### edit-distance ###
+ * Syntax:
+
+ edit-distance(expression1, expression2)
+
+ * Returns the [edit distance](http://en.wikipedia.org/wiki/Levenshtein_distance) of `expression1` and `expression2`.
+ * Arguments:
+ * `expression1` : A `String` or a homogeneous `OrderedList` of a comparable item type.
+ * `expression2` : The same type as `expression1`.
+ * Return Value:
+ * An `Int32` that represents the edit-distance similarity of `expression1` and `expression2`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $user in dataset('FacebookUsers')
+ let $ed := edit-distance($user.name, "Suzanna Tilson")
+ where $ed <= 2
+ return $user
+
+
+ * The expected result is:
+
+ {
+ "id": 7, "alias": "Suzanna", "name": "SuzannaTillson", "user-since": datetime("2012-08-07T10:10:00.000Z"), "friend-ids": {{ 6 }},
+ "employment": [ { "organization-name": "Labzatron", "start-date": date("2011-04-19"), "end-date": null } ]
+ }
+
+
+### edit-distance-check ###
+ * Syntax:
+
+ edit-distance-check(expression1, expression2, threshold)
+
+ * Checks whether `expression1` and `expression2` have a [edit distance](http://en.wikipedia.org/wiki/Levenshtein_distance) `<= threshold`. The “check” version of edit distance is faster than the "non-check" version because the former can detect whether two items satisfy a given similarity threshold using early-termination techniques, as opposed to computing their real distance. Although possible, it is not necessary for the user to write queries using the “check” versions explicitly, since a rewrite rule can perform an appropriate transformation from a “non-check” version to a “check” version.
+
+ * Arguments:
+ * `expression1` : A `String` or a homogeneous `OrderedList` of a comparable item type.
+ * `expression2` : The same type as `expression1`.
+ * `threshold` : An `Int32` that represents the distance threshold.
+ * Return Value:
+ * An `OrderedList` with two items:
+ * The first item contains a `Boolean` value representing whether `expression1` and `expression2` are similar.
+ * The second item contains an `Int32` that represents the edit distance of `expression1` and `expression2` if it is `<= `threshold`, or 0 otherwise.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $user in dataset('FacebookUsers')
+ let $ed := edit-distance-check($user.name, "Suzanna Tilson", 2)
+ where $ed[0]
+ return $ed[1]
+
+
+ * The expected result is:
+
+ 2
+
+
+### similarity-jaccard ###
+ * Syntax:
+
+ similarity-jaccard(list_expression1, list_expression2)
+
+ * Returns the [Jaccard similarity](http://en.wikipedia.org/wiki/Jaccard_index) of `list_expression1` and `list_expression2`.
+ * Arguments:
+ * `list_expression1` : An `UnorderedList` or `OrderedList`.
+ * `list_expression2` : An `UnorderedList` or `OrderedList`.
+ * Return Value:
+ * A `Float` that represents the Jaccard similarity of `list_expression1` and `list_expression2`.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $user in dataset('FacebookUsers')
+ let $sim := similarity-jaccard($user.friend-ids, [1,5,9])
+ where $sim >= 0.6f
+ return $user
+
+
+ * The expected result is:
+
+ {
+ "id": 3, "alias": "Emory", "name": "EmoryUnk", "user-since": datetime("2012-07-10T10:10:00.000Z"), "friend-ids": {{ 1, 5, 8, 9 }},
+ "employment": [ { "organization-name": "geomedia", "start-date": date("2010-06-17"), "end-date": date("2010-01-26") } ]
+ }
+ {
+ "id": 10, "alias": "Bram", "name": "BramHatch", "user-since": datetime("2010-10-16T10:10:00.000Z"), "friend-ids": {{ 1, 5, 9 }},
+ "employment": [ { "organization-name": "physcane", "start-date": date("2007-06-05"), "end-date": date("2011-11-05") } ]
+ }
+
+
+### similarity-jaccard-check ###
+ * Syntax:
+
+ similarity-jaccard-check(list_expression1, list_expression2, threshold)
+
+ * Checks whether `list_expression1` and `list_expression2` have a [Jaccard similarity](http://en.wikipedia.org/wiki/Jaccard_index) `>= threshold`. Again, the “check” version of Jaccard is faster than the "non-check" version.
+
+ * Arguments:
+ * `list_expression1` : An `UnorderedList` or `OrderedList`.
+ * `list_expression2` : An `UnorderedList` or `OrderedList`.
+ * `threshold` : A Float that represents the similarity threshold.
+ * Return Value:
+ * An `OrderedList` with two items:
+ * The first item contains a `Boolean` value representing whether `list_expression1` and `list_expression2` are similar.
+ * The second item contains a `Float` that represents the Jaccard similarity of `list_expression1` and `list_expression2` if it is >`= `threshold`, or 0 otherwise.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $user in dataset('FacebookUsers')
+ let $sim := similarity-jaccard-check($user.friend-ids, [1,5,9], 0.6f)
+ where $sim[0]
+ return $sim[1]
+
+
+ * The expected result is:
+
+ 0.75f
+ 1.0f
+
+
+### Similarity Operator ~# ###
+ * "`~=`" is syntactic sugar for expressing a similarity condition with a given similarity threshold.
+ * The similarity function and threshold for "`~=`" are controlled via "set" directives.
+ * The "`~=`" operator returns a Boolean that represents whether the operands are similar.
+
+ * Example for Jaccard similarity:
+
+ use dataverse TinySocial;
+
+ set simfunction "jaccard";
+ set simthreshold "0.6f";
+
+ for $user in dataset('FacebookUsers')
+ where $user.friend-ids ~= [1,5,9]
+ return $user
+
+
+ * The expected result is:
+
+ {
+ "id": 3, "alias": "Emory", "name": "EmoryUnk", "user-since": datetime("2012-07-10T10:10:00.000Z"), "friend-ids": {{ 1, 5, 8, 9 }},
+ "employment": [ { "organization-name": "geomedia", "start-date": date("2010-06-17"), "end-date": date("2010-01-26") } ]
+ }
+ {
+ "id": 10, "alias": "Bram", "name": "BramHatch", "user-since": datetime("2010-10-16T10:10:00.000Z"), "friend-ids": {{ 1, 5, 9 }},
+ "employment": [ { "organization-name": "physcane", "start-date": date("2007-06-05"), "end-date": date("2011-11-05") } ]
+ }
+
+
+ * Example for edit-distance similarity:
+
+ use dataverse TinySocial;
+
+ set simfunction "edit-distance";
+ set simthreshold "2";
+
+ for $user in dataset('FacebookUsers')
+ where $user.name ~= "Suzanna Tilson"
+ return $user
+
+
+ * The expected output is:
+
+ {
+ "id": 7, "alias": "Suzanna", "name": "SuzannaTillson", "user-since": datetime("2012-08-07T10:10:00.000Z"), "friend-ids": {{ 6 }},
+ "employment": [ { "organization-name": "Labzatron", "start-date": date("2011-04-19"), "end-date": null } ]
+ }
+
+
+## Tokenizing Functions ##
+### word-tokens ###
+ * Syntax:
+
+ word-tokens(string_expression)
+
+ * Returns a list of word tokens of `string_expression`.
+ * Arguments:
+ * `string_expression` : A `String` that will be tokenized.
+ * Return Value:
+ * An `OrderedList` of `String` word tokens.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $t in dataset('TweetMessages')
+ let $tokens := word-tokens($t.message-text)
+ where $t.send-time >= datetime('2012-01-01T00:00:00')
+ return {
+ "tweetid": $t.tweetid,
+ "word-tokens": $tokens
+ }
+
+
+ * The expected result is:
+
+ { "tweetid": "9", "word-tokens": [ "love", "verizon", "its", "voicemail", "service", "is", "awesome" ] }
+
+
+### hashed-word-tokens ###
+ * Syntax:
+
+ hashed-word-tokens(string_expression)
+
+ * Returns a list of hashed word tokens of `string_expression`.
+ * Arguments:
+ * `string_expression` : A `String` that will be tokenized.
+ * Return Value:
+ * An `OrderedList` of Int32 hashed tokens.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $t in dataset('TweetMessages')
+ let $tokens := hashed-word-tokens($t.message-text)
+ where $t.send-time >= datetime('2012-01-01T00:00:00')
+ return {
+ "tweetid": $t.tweetid,
+ "hashed-word-tokens": $tokens
+ }
+
+
+ * The expected result is:
+
+ { "tweetid": "9", "hashed-word-tokens": [ -1217719622, -447857469, -1884722688, -325178649, 210976949, 285049676, 1916743959 ] }
+
+
+### counthashed-word-tokens ###
+ * Syntax:
+
+ counthashed-word-tokens(string_expression)
+
+ * Returns a list of hashed word tokens of `string_expression`. The hashing mechanism gives duplicate tokens different hash values, based on the occurrence count of that token.
+ * Arguments:
+ * `string_expression` : A `String` that will be tokenized.
+ * Return Value:
+ * An `OrderedList` of `Int32` hashed tokens.
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $t in dataset('TweetMessages')
+ let $tokens := counthashed-word-tokens($t.message-text)
+ where $t.send-time >= datetime('2012-01-01T00:00:00')
+ return {
+ "tweetid": $t.tweetid,
+ "counthashed-word-tokens": $tokens
+ }
+
+
+ * The expected result is:
+
+ { "tweetid": "9", "counthashed-word-tokens": [ -1217719622, -447857469, -1884722688, -325178649, 210976949, 285049676, 1916743959 ] }
+
+
+### gram-tokens ###
+ * Syntax:
+
+ gram-tokens(string_expression, gram_length, boolean_expression)
+
+ * Returns a list of gram tokens of `string_expression`, which can be obtained by scanning the characters using a sliding window of a fixed length.
+ * Arguments:
+ * `string_expression` : A `String` that will be tokenized.
+ * `gram_length` : An `Int32` as the length of grams.
+ * `boolean_expression` : A `Boolean` value to indicate whether to generate additional grams by pre- and postfixing `string_expression` with special characters.
+ * Return Value:
+ * An `OrderedList` of String gram tokens.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $t in dataset('TweetMessages')
+ let $tokens := gram-tokens($t.message-text, 3, true)
+ where $t.send-time >= datetime('2012-01-01T00:00:00')
+ return {
+ "tweetid": $t.tweetid,
+ "gram-tokens": $tokens
+ }
+
+
+ * The expected result is:
+
+ {
+ "tweetid": "9",
+ "gram-tokens": [ "## ", "# l", " lo", "lov", "ove", "ve ", "e v", " ve", "ver", "eri", "riz", "izo", "zon", "on ", "n i", " it", "its", "ts ", "s v", " vo", "voi", "oic", "ice",
+ "cem", "ema", "mai", "ail", "il-", "l-s", "-se", "ser", "erv", "rvi", "vic", "ice", "ce ", "e i", " is", "is ", "s a", " aw", "awe", "wes", "eso", "som", "ome", "me$", "e$$" ]
+ }
+
+
+### hashed-gram-tokens ###
+ * Syntax:
+
+ hashed-gram-tokens(string_expression, gram_length, boolean_expression)
+
+ * Returns a list of hashed gram tokens of `string_expression`.
+ * Arguments:
+ * `string_expression` : A `String` that will be tokenized.
+ * `gram_length` : An `Int32` as the length of grams.
+ * `boolean_expression` : A `Boolean` to indicate whether to generate additional grams by pre- and postfixing `string_expression` with special characters.
+ * Return Value:
+ * An `OrderedList` of `Int32` hashed gram tokens.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $t in dataset('TweetMessages')
+ let $tokens := hashed-gram-tokens($t.message-text, 3, true)
+ where $t.send-time >= datetime('2012-01-01T00:00:00')
+ return {
+ "tweetid": $t.tweetid,
+ "hashed-gram-tokens": $tokens
+ }
+
+
+ * The expected result is:
+
+ {
+ "tweetid": "9",
+ "hashed-gram-tokens": [ 40557178, -2002241593, 161665899, -856104603, -500544946, 693410611, 395674299, -1015235909, 1115608337, 1187999872, -31006095, -219180466, -1676061637,
+ 1040194153, -1339307841, -1527110163, -1884722688, -179148713, -431014627, -1789789823, -1209719926, 684519765, -486734513, 1734740619, -1971673751, -932421915, -2064668066,
+ -937135958, -790946468, -69070309, 1561601454, 26169001, -160734571, 1330043462, -486734513, -18796768, -470303314, 113421364, 1615760212, 1688217556, 1223719184, 536568131,
+ 1682609873, 2935161, -414769471, -1027490137, 1602276102, 1050490461 ]
+ }
+
+
+### counthashed-gram-tokens ###
+ * Syntax:
+
+ counthashed-gram-tokens(string_expression, gram_length, boolean_expression)
+
+ * Returns a list of hashed gram tokens of `string_expression`. The hashing mechanism gives duplicate tokens different hash values, based on the occurrence count of that token.
+ * Arguments:
+ * `string_expression` : A `String` that will be tokenized.
+ * `gram_length` : An `Int32`, length of grams to generate.
+ * `boolean_expression` : A `Boolean`, whether to generate additional grams by pre- and postfixing `string_expression` with special characters.
+ * Return Value:
+ * An `OrderedList` of `Int32` hashed gram tokens.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $t in dataset('TweetMessages')
+ let $tokens := counthashed-gram-tokens($t.message-text, 3, true)
+ where $t.send-time >= datetime('2012-01-01T00:00:00')
+ return {
+ "tweetid": $t.tweetid,
+ "counthashed-gram-tokens": $tokens
+ }
+
+
+ * The expected result is:
+
+ {
+ "tweetid": "9",
+ "counthashed-gram-tokens": [ 40557178, -2002241593, 161665899, -856104603, -500544946, 693410611, 395674299, -1015235909, 1115608337, 1187999872, -31006095, -219180466, -1676061637,
+ 1040194153, -1339307841, -1527110163, -1884722688, -179148713, -431014627, -1789789823, -1209719926, 684519765, -486734513, 1734740619, -1971673751, -932421915, -2064668066, -937135958,
+ -790946468, -69070309, 1561601454, 26169001, -160734571, 1330043462, -486734512, -18796768, -470303314, 113421364, 1615760212, 1688217556, 1223719184, 536568131, 1682609873, 2935161,
+ -414769471, -1027490137, 1602276102, 1050490461 ]
+ }
+
+
+## Temporal Functions ##
+
+### date ###
+ * Syntax:
+
+ date(string_expression)
+
+ * Constructor function for `Date` type by parsing a date string `string_expression`
+ * Arguments:
+ * `string_expression` : The `String` value representing a date value.
+ * Return Value:
+ * A `Date` value represented by the given string.
+
+ * Example:
+
+ {
+ "date-extended": date("2013-04-01"),
+ "date-basic": date("20130401")
+ }
+
+
+ * The expected result is:
+
+ {
+ "date-extended": date("2013-04-01"),
+ "date-basic": date("2013-04-01")
+ }
+
+
+### time ###
+ * Syntax:
+
+ time(string_expression)
+
+ * Constructor function for `Time` type by parsing a time string `string_expression`
+ * Arguments:
+ * `string_expression` : The `String` value representing a time value.
+ * Return Value:
+ * A `Time` value represented by the given string.
+
+ * Example:
+
+ {
+ "time-extended": time("12:30:45.678+08:00"),
+ "time-basic": time("123045678+0800")
+ }
+
+
+ * The expected result is:
+
+ {
+ "time-extended": time("04:30:45.678Z"),
+ "time-basic": time("04:30:45.678Z")
+ }
+
+
+### datetime ###
+ * Syntax:
+
+ datetime(string_expression)
+
+ * Constructor function for `Datetime` type by parsing a datetime string `string_expression`
+ * Arguments:
+ * `string_expression` : The `String` value representing a datetime value.
+ * Return Value:
+ * A `Datetime` value represented by the given string.
+
+ * Example:
+
+ {
+ "datetime-extended": datetime("2013-04-01T12:30:45.678+08:00"),
+ "datetime-basic": datetime("20130401T123045678+0800")
+ }
+
+
+ * The expected result is:
+
+ {
+ "datetime-extended": datetime("2013-04-01T04:30:45.678Z"),
+ "datetime-basic": datetime("2013-04-01T04:30:45.678Z")
+ }
+
+
+### interval-from-date ###
+ * Syntax:
+
+ interval-from-date(string_expression1, string_expression2)
+
+ * Constructor function for `Interval` type by parsing two date strings.
+ * Arguments:
+ * `string_expression1` : The `String` value representing the starting date.
+ * `string_expression2` : The `String` value representing the ending date.
+ * Return Value:
+ * An `Interval` value between the two dates.
+
+ * Example:
+
+ {"date-interval": interval-from-date("2012-01-01", "2013-04-01")}
+
+
+ * The expected result is:
+
+ { "date-interval": interval-date("2012-01-01, 2013-04-01") }
+
+
+### interval-from-time ###
+ * Syntax:
+
+ interval-from-time(string_expression1, string_expression2)
+
+ * Constructor function for `Interval` type by parsing two time strings.
+ * Arguments:
+ * `string_expression1` : The `String` value representing the starting time.
+ * `string_expression2` : The `String` value representing the ending time.
+ * Return Value:
+ * An `Interval` value between the two times.
+
+ * Example:
+
+ {"time-interval": interval-from-time("12:23:34.456Z", "233445567+0800")}
+
+
+ * The expected result is:
+
+ { "time-interval": interval-time("12:23:34.456Z, 15:34:45.567Z") }
+
+
+### interval-from-datetime ###
+ * Syntax:
+
+ interval-from-datetime(string_expression1, string_expression2)
+
+ * Constructor function for `Interval` type by parsing two datetime strings.
+ * Arguments:
+ * `string_expression1` : The `String` value representing the starting datetime.
+ * `string_expression2` : The `String` value representing the ending datetime.
+ * Return Value:
+ * An `Interval` value between the two datetimes.
+
+ * Example:
+
+ {"datetime-interval": interval-from-datetime("2012-01-01T12:23:34.456+08:00", "20130401T153445567Z")}
+
+
+ * The expected result is:
+
+ { "datetime-interval": interval-datetime("2012-01-01T04:23:34.456Z, 2013-04-01T15:34:45.567Z") }
+
+
+### year/month/day/hour/minute/second/millisecond ###
+ * Syntax:
+
+ year/month/day/hour/minute/second/millisecond(temporal_expression)
+
+ * Accessors for accessing fields in a temporal value
+ * Arguments:
+ * `temporal_expression` : a temporal value represented as one of the following types: `Date`, `Datetime`, `Time`, `Duration`.
+ * Return Value:
+ * An `Int32` value representing the field to be extracted.
+
+ * Example:
+
+ let $c1 := date("2010-10-30")
+ let $c2 := datetime("1987-11-19T23:49:23.938")
+ let $c3 := time("12:23:34.930+07:00")
+ let $c4 := duration("P3Y73M632DT49H743M3948.94S")
+
+ return {"year": year($c1), "month": month($c2), "day": day($c1), "hour": hour($c3), "min": minute($c4), "second": second($c2), "ms": millisecond($c4)}
+
+
+ * The expected result is:
+
+ { "year": 2010, "month": 11, "day": 30, "hour": 5, "min": 28, "second": 23, "ms": 94 }
+
+
+
+### add-date-duration ###
+ * Syntax:
+
+ add-date-duration(date_expression, duration_expression)
+
+ * Create a new date by adding the duration `duration_expression` to the given date `date_expression`.
+ * Arguments:
+ * `date_expression` : The `Date` value to be added onto.
+ * `duration_expression` : The `Duration` to be added.
+ * Return Value:
+ * A `Date` value represents the new date after being adjusted by the duration.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $startdate := date('2011-03-01')
+ for $i in dataset('TweetMessage')
+ where date-from-datetime($i.send-time) > $startdate
+ and date-from-datetime($i.send-time) < add-date-duration($startdate, duration('P2Y'))
+ return {"send-time": $i.send-time, "message": $i.message-text}
+
+
+ * The expected result is:
+
+ { "send-time": datetime("2011-12-26T10:10:00.000Z"), "message": " like sprint the voice-command is mind-blowing:)" }
+ { "send-time": datetime("2011-08-25T10:10:00.000Z"), "message": " like samsung the platform is good" }
+ { "send-time": datetime("2012-07-21T10:10:00.000Z"), "message": " love verizon its voicemail-service is awesome" }
+
+
+### add-datetime-duration ###
+ * Syntax:
+
+ add-date-duration(datetime_expression, duration_expression)
+
+ * Create a new datetime by adding the duration `duration_expression` to the given datetime `datetime_expression`.
+ * Arguments:
+ * `datetime_expression` : The `Datetime` value to be added onto.
+ * `duration_expression` : The `Duration` to be added.
+ * Return Value:
+ * A `Datetime` value represents the new datetime after being adjusted by the duration.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $startdt := datetime('2011-03-01T00:00:00')
+ for $i in dataset('TweetMessage')
+ where $i.send-time > $startdt and $i.send-time < add-datetime-duration($startdt, duration('P2Y'))
+ return {"send-time": $i.send-time, "message": $i.message-text}
+
+
+ * The expected result is:
+
+ { "send-time": datetime("2011-12-26T10:10:00.000Z"), "message": " like sprint the voice-command is mind-blowing:)" }
+ { "send-time": datetime("2011-08-25T10:10:00.000Z"), "message": " like samsung the platform is good" }
+ { "send-time": datetime("2012-07-21T10:10:00.000Z"), "message": " love verizon its voicemail-service is awesome" }
+
+
+### add-time-duration ###
+ * Syntax:
+
+ add-time-duration(time_expression, duration_expression)
+
+ * Create a new time by adding the duration `duration_expression` to the given time `time_expression`.
+ * Arguments:
+ * `time_expression` : The `Time` value to be added onto.
+ * `duration_expression` : The `Duration` to be added.
+ * Return Value:
+ * A `Time` value represents the new time after being adjusted by the duration.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $starttime := time('08:00:00')
+ for $i in dataset('TweetMessage')
+ where time-from-datetime($i.send-time) > $starttime and time-from-datetime($i.send-time) < add-time-duration($starttime, duration('PT5H'))
+ return {"send-time": $i.send-time, "message": $i.message-text}
+
+
+ * The expected result is:
+
+ { "send-time": datetime("2008-04-26T10:10:00.000Z"), "message": " love t-mobile its customization is good:)" }
+ { "send-time": datetime("2010-05-13T10:10:00.000Z"), "message": " like verizon its shortcut-menu is awesome:)" }
+ { "send-time": datetime("2006-11-04T10:10:00.000Z"), "message": " like motorola the speed is good:)" }
+ { "send-time": datetime("2011-12-26T10:10:00.000Z"), "message": " like sprint the voice-command is mind-blowing:)" }
+ { "send-time": datetime("2006-08-04T10:10:00.000Z"), "message": " can't stand motorola its speed is terrible:(" }
+ { "send-time": datetime("2010-05-07T10:10:00.000Z"), "message": " like iphone the voice-clarity is good:)" }
+ { "send-time": datetime("2011-08-25T10:10:00.000Z"), "message": " like samsung the platform is good" }
+ { "send-time": datetime("2005-10-14T10:10:00.000Z"), "message": " like t-mobile the shortcut-menu is awesome:)" }
+ { "send-time": datetime("2012-07-21T10:10:00.000Z"), "message": " love verizon its voicemail-service is awesome" }
+ { "send-time": datetime("2008-01-26T10:10:00.000Z"), "message": " hate verizon its voice-clarity is OMG:(" }
+ { "send-time": datetime("2008-03-09T10:10:00.000Z"), "message": " can't stand iphone its platform is terrible" }
+ { "send-time": datetime("2010-02-13T10:10:00.000Z"), "message": " like samsung the voice-command is amazing:)" }
+
+
+### adjust-datetime-for-timezone ###
+ * Syntax:
+
+ adjust-datetime-for-timezone(datetime_expression, string_expression)
+
+ * Adjust the given datetime `datetime_expression` by applying the timezone information `string_expression`
+ * Arguments:
+ * `datetime_expression` : A `Datetime` value to be adjusted.
+ * `string_expression` : A `String` representing the timezone information.
+ * Return Value:
+ * A `String` value represents the new datetime after being adjusted by the timezone information.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('TweetMessage')
+ return {"adjusted-send-time": adjust-datetime-for-timezone($i.send-time, "+08:00"), "message": $i.message-text}
+
+
+ * The expected result is:
+
+ { "adjusted-send-time": "2008-04-26T18:10:00.000+08:00", "message": " love t-mobile its customization is good:)" }
+ { "adjusted-send-time": "2010-05-13T18:10:00.000+08:00", "message": " like verizon its shortcut-menu is awesome:)" }
+ { "adjusted-send-time": "2006-11-04T18:10:00.000+08:00", "message": " like motorola the speed is good:)" }
+ { "adjusted-send-time": "2011-12-26T18:10:00.000+08:00", "message": " like sprint the voice-command is mind-blowing:)" }
+ { "adjusted-send-time": "2006-08-04T18:10:00.000+08:00", "message": " can't stand motorola its speed is terrible:(" }
+ { "adjusted-send-time": "2010-05-07T18:10:00.000+08:00", "message": " like iphone the voice-clarity is good:)" }
+ { "adjusted-send-time": "2011-08-25T18:10:00.000+08:00", "message": " like samsung the platform is good" }
+ { "adjusted-send-time": "2005-10-14T18:10:00.000+08:00", "message": " like t-mobile the shortcut-menu is awesome:)" }
+ { "adjusted-send-time": "2012-07-21T18:10:00.000+08:00", "message": " love verizon its voicemail-service is awesome" }
+ { "adjusted-send-time": "2008-01-26T18:10:00.000+08:00", "message": " hate verizon its voice-clarity is OMG:(" }
+ { "adjusted-send-time": "2008-03-09T18:10:00.000+08:00", "message": " can't stand iphone its platform is terrible" }
+ { "adjusted-send-time": "2010-02-13T18:10:00.000+08:00", "message": " like samsung the voice-command is amazing:)" }
+
+
+### adjust-time-for-timezone ###
+ * Syntax:
+
+ adjust-time-for-timezone(time_expression, string_expression)
+
+ * Adjust the given time `time_expression` by applying the timezone information `string_expression`
+ * Arguments:
+ * `time_expression` : A `Time` value to be adjusted.
+ * `string_expression` : A `String` representing the timezone information.
+ * Return Value:
+ * A `String` value represents the new time after being adjusted by the timezone information.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('TweetMessage')
+ return {"adjusted-send-time": adjust-time-for-timezone(time-from-datetime($i.send-time), "+08:00"), "message": $i.message-text}
+
+
+ * The expected result is:
+
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " love t-mobile its customization is good:)" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " like verizon its shortcut-menu is awesome:)" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " like motorola the speed is good:)" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " like sprint the voice-command is mind-blowing:)" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " can't stand motorola its speed is terrible:(" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " like iphone the voice-clarity is good:)" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " like samsung the platform is good" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " like t-mobile the shortcut-menu is awesome:)" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " love verizon its voicemail-service is awesome" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " hate verizon its voice-clarity is OMG:(" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " can't stand iphone its platform is terrible" }
+ { "adjusted-send-time": "18:10:00.000+08:00", "message": " like samsung the voice-command is amazing:)" }
+
+
+### calendar-duration-from-datetime ###
+ * Syntax:
+
+ calendar-duration-from-datetime(datetime_expression, duration_expression)
+
+ * Get a user-friendly representation of the duration `duration_expression` based on the given datetime `datetime_expression`
+ * Arguments:
+ * `datetime_expression` : A `Datetime` value to be used as the reference time point.
+ * `duration_expression` : A `Duration` value to be converted
+ * Return Value:
+ * A `Duration` value with the duration as `duration_expression` but with a user-friendly representation.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('TweetMessage')
+ where $i.send-time > datetime("2011-01-01T00:00:00")
+ return {"since-2011": subtract-datetime($i.send-time, datetime("2011-01-01T00:00:00")), "since-2011-user-friendly": calendar-duration-from-datetime($i.send-time, subtract-datetime($i.send-time, datetime("2011-01-01T00:00:00")))}
+
+
+ * The expected result is:
+
+ { "since-2011": duration("P359DT10H10M"), "since-2011-user-friendly": duration("P11M23DT10H10M") }
+ { "since-2011": duration("P236DT10H10M"), "since-2011-user-friendly": duration("P7M23DT10H10M") }
+ { "since-2011": duration("P567DT10H10M"), "since-2011-user-friendly": duration("P1Y6M18DT10H10M") }
+
+
+### calendar-duration-from-date ###
+ * Syntax:
+
+ calendar-duration-from-date(date_expression, duration_expression)
+
+ * Get a user-friendly representation of the duration `duration_expression` based on the given date `date_expression`
+ * Arguments:
+ * `date_expression` : A `Date` value to be used as the reference time point.
+ * `duration_expression` : A `Duration` value to be converted
+ * Return Value:
+ * A `Duration` value with the duration as `duration_expression` but with a user-friendly representation.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('TweetMessage')
+ where $i.send-time > datetime("2011-01-01T00:00:00")
+ return {"since-2011": subtract-datetime($i.send-time, datetime("2011-01-01T00:00:00")),
+ "since-2011-user-friendly": calendar-duration-from-date(date-from-datetime($i.send-time), subtract-datetime($i.send-time, datetime("2011-01-01T00:00:00")))}
+
+
+ * The expected result is:
+
+ { "since-2011": duration("P359DT10H10M"), "since-2011-user-friendly": duration("P11M23DT10H10M") }
+ { "since-2011": duration("P236DT10H10M"), "since-2011-user-friendly": duration("P7M23DT10H10M") }
+ { "since-2011": duration("P567DT10H10M"), "since-2011-user-friendly": duration("P1Y6M18DT10H10M") }
+
+
+### current-date ###
+ * Syntax:
+
+ current-date()
+
+ * Get the current date
+ * Arguments:None
+ * Return Value:
+ * A `Date` value of the date when the function is called.
+
+### current-time ###
+ * Syntax:
+
+ current-time()
+
+ * Get the current time
+ * Arguments:None
+ * Return Value:
+ * A `Time` value of the time when the function is called.
+
+### current-datetime ###
+ * Syntax:
+
+ current-datetime()
+
+ * Get the current datetime
+ * Arguments:None
+ * Return Value:
+ * A `Datetime` value of the datetime when the function is called.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ {"current-date": current-date(),
+ "current-time": current-time(),
+ "current-datetime": current-datetime()}
+
+
+ * The expected result is:
+
+ { "current-date": date("2013-04-06"),
+ "current-time": time("00:48:44.093Z"),
+ "current-datetime": datetime("2013-04-06T00:48:44.093Z") }
+
+
+### date-from-datetime ###
+ * Syntax:
+
+ date-from-datetime(datetime_expression)
+
+ * Get the date value from the given datetime value `datetime_expression`
+ * Arguments:
+ * `datetime_expression`: A `Datetime` value to be extracted from
+ * Return Value:
+ * A `Date` value from the datetime.
+
+### time-from-datetime ###
+ * Syntax:
+
+ time-from-datetime(datetime_expression)
+
+ * Get the time value from the given datetime value `datetime_expression`
+ * Arguments:
+ * `datetime_expression`: A `Datetime` value to be extracted from
+ * Return Value:
+ * A `Time` value from the datetime.
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('TweetMessage')
+ where $i.send-time > datetime("2011-01-01T00:00:00")
+ return {"send-date": date-from-datetime($i.send-time), "send-time": time-from-datetime($i.send-time)}
+
+
+ * The expected result is:
+
+ { "send-date": date("2011-12-26"), "send-time": time("10:10:00.000Z") }
+ { "send-date": date("2011-08-25"), "send-time": time("10:10:00.000Z") }
+ { "send-date": date("2012-07-21"), "send-time": time("10:10:00.000Z") }
+
+
+### date-from-unix-time-in-days ###
+ * Syntax:
+
+ date-from-unix-time-in-days(numeric_expression)
+
+ * Get date representing the time after `numeric_expression` days since 1970-01-01
+ * Arguments:
+ * `numeric_expression`: A `Int8`/`Int16`/`Int32` value representing the number of days
+ * Return Value:
+ * A `Date` value as the time after `numeric_expression` days since 1970-01-01
+
+### datetime-from-unix-time-in-ms ###
+ * Syntax:
+
+ datetime-from-unix-time-in-ms(numeric_expression)
+
+ * Get datetime representing the time after `numeric_expression` milliseconds since 1970-01-01T00:00:00Z
+ * Arguments:
+ * `numeric_expression`: A `Int8`/`Int16`/`Int32`/`Int64` value representing the number of milliseconds
+ * Return Value:
+ * A `Datetime` value as the time after `numeric_expression` milliseconds since 1970-01-01T00:00:00Z
+
+### time-from-unix-time-in-ms ###
+ * Syntax:
+
+ time-from-unix-time-in-ms(numeric_expression)
+
+ * Get time representing the time after `numeric_expression` milliseconds since 00:00:00.000Z
+ * Arguments:
+ * `numeric_expression`: A `Int8`/`Int16`/`Int32` value representing the number of milliseconds
+ * Return Value:
+ * A `Time` value as the time after `numeric_expression` milliseconds since 00:00:00.000Z
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ let $d := date-from-unix-time-in-days(15800)
+ let $dt := datetime-from-unix-time-in-ms(1365139700000)
+ let $t := time-from-unix-time-in-ms(3748)
+ return {"date": $d, "datetime": $dt, "time": $t}
+
+
+ * The expected result is:
+
+ { "date": date("2013-04-05"), "datetime": datetime("2013-04-05T05:28:20.000Z"), "time": time("00:00:03.748Z") }
+
+
+### subtract-date ###
+ * Syntax:
+
+ subtract-date(date_start, date_end)
+
+ * Get the duration between two dates `date_start` and `date_end`
+ * Arguments:
+ * `date_start`: the starting `Date`
+ * `date_end`: the ending `Date`
+ * Return Value:
+ * A `Duration` value between `date_start` and `date_end`
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookUser')
+ for $j in dataset('FacebookUser')
+ where $i.user-since < $j.user-since and $i.user-since > datetime("2012-01-01T00:00:00")
+ return {"id1": $i.id, "id2": $j.id, "diff": subtract-date(date-from-datetime($j.user-since), date-from-datetime($i.user-since))}
+
+
+ * The expected result is:
+
+ { "id1": 3, "id2": 1, "diff": duration("P41D") }
+ { "id1": 3, "id2": 7, "diff": duration("P28D") }
+ { "id1": 7, "id2": 1, "diff": duration("P13D") }
+
+
+### subtract-time ###
+ * Syntax:
+
+ subtract-time(time_start, time_end)
+
+ * Get the duration between two times `time_start` and `time_end`
+ * Arguments:
+ * `time_start`: the starting `Time`
+ * `time_end`: the ending `Time`
+ * Return Value:
+ * A `Duration` value between `time_start` and `time_end`
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookUser')
+ for $j in dataset('FacebookUser')
+ where $i.user-since < $j.user-since and $i.user-since > datetime("2012-01-01T00:00:00")
+ return {"id1": $i.id, "id2": $j.id, "diff": subtract-time(time-from-datetime($j.user-since), time("02:50:48.938"))}
+
+
+ * The expected result is:
+
+ { "id1": 3, "id2": 1, "diff": duration("PT7H19M11.62S") }
+ { "id1": 3, "id2": 7, "diff": duration("PT7H19M11.62S") }
+ { "id1": 7, "id2": 1, "diff": duration("PT7H19M11.62S") }
+
+
+### subtract-datetime ###
+ * Syntax:
+
+ subtract-datetime(datetime_start, datetime_end)
+
+ * Get the duration between two datetimes `datetime_start` and `datetime_end`
+ * Arguments:
+ * `datetime_start`: the starting `Datetime`
+ * `datetime_end`: the ending `Datetime`
+ * Return Value:
+ * A `Duration` value between `datetime_start` and `datetime_end`
+
+ * Example:
+
+ use dataverse TinySocial;
+
+ for $i in dataset('FacebookUser')
+ for $j in dataset('FacebookUser')
+ where $i.user-since < $j.user-since and $i.user-since > datetime("2011-01-01T00:00:00")
+ return {"id1": $i.id, "id2": $j.id, "diff": subtract-datetime($j.user-since, $i.user-since)}
+
+
+ * The expected result is:
+
+ { "id1": 2, "id2": 1, "diff": duration("P576D") }
+ { "id1": 2, "id2": 3, "diff": duration("P535D") }
+ { "id1": 2, "id2": 7, "diff": duration("P563D") }
+ { "id1": 3, "id2": 1, "diff": duration("P41D") }
+ { "id1": 3, "id2": 7, "diff": duration("P28D") }
+ { "id1": 7, "id2": 1, "diff": duration("P13D") }
+
diff --git a/asterix-doc/src/site/markdown/AsterixDBRestAPI.md b/asterix-doc/src/site/markdown/AsterixDBRestAPI.md
new file mode 100644
index 0000000..80fbb11
--- /dev/null
+++ b/asterix-doc/src/site/markdown/AsterixDBRestAPI.md
@@ -0,0 +1,285 @@
+# REST API to AsterixDB #
+
+## DDL API ##
+
+*End point for the data definition statements*
+
+Endpoint: _/ddl_
+
+Parameters:
+
+<table>
+<tr>
+ <td>Parameter</td>
+ <td>Description</td>
+ <td>Required?</td>
+</tr>
+<tr>
+ <td>ddl</td>
+ <td>String containing DDL statements to modify Metadata</td>
+ <td>Yes</td>
+</tr>
+</table>
+
+This call does not return any result. If the operations were successful, HTTP OK status code is returned.
+
+### Example ###
+
+#### DDL Statements ####
+
+
+ drop dataverse company if exists;
+ create dataverse company;
+ use dataverse company;
+
+ create type Emp as open {
+ id : int32,
+ name : string
+ };
+
+ create dataset Employee(Emp) primary key id;
+
+
+API call for the above DDL statements in the URL-encoded form.
+
+[http://localhost:19101/ddl?ddl=drop%20dataverse%20company%20if%20exists;create%20dataverse%20company;use%20dataverse%20company;create%20type%20Emp%20as%20open%20{id%20:%20int32,name%20:%20string};create%20dataset%20Employee(Emp)%20primary%20key%20id;](http://localhost:19101/ddl?ddl=drop%20dataverse%20company%20if%20exists;create%20dataverse%20company;use%20dataverse%20company;create%20type%20Emp%20as%20open%20{id%20:%20int32,name%20:%20string};create%20dataset%20Employee(Emp)%20primary%20key%20id;)
+
+#### Response ####
+*HTTP OK 200*
+`<NO PAYLOAD>`
+
+## Update API ##
+
+*End point for update statements (INSERT, DELETE and LOAD)*
+
+Endpoint: _/update_
+
+Parameters:
+
+<table>
+<tr>
+ <td>Parameter</td>
+ <td>Description</td>
+ <td>Required?</td>
+</tr>
+<tr>
+ <td>statements</td>
+ <td>String containing update (insert/delete) statements to execute</td>
+ <td>Yes</td>
+</tr>
+</table>
+
+This call does not return any result. If the operations were successful, HTTP OK status code is returned.
+
+### Example ###
+
+#### Update Statements ####
+
+
+ use dataverse company;
+
+ insert into dataset Employee({ "id":123,"name":"John Doe"});
+
+
+API call for the above update statement in the URL-encoded form.
+
+[http://localhost:19101/update?statements=use%20dataverse%20company;insert%20into%20dataset%20Employee({%20%22id%22:123,%22name%22:%22John%20Doe%22});](http://localhost:19101/update?statements=use%20dataverse%20company;insert%20into%20dataset%20Employee({%20%22id%22:123,%22name%22:%22John%20Doe%22});)
+
+#### Response ####
+*HTTP OK 200*
+`<NO PAYLOAD>`
+
+## Query API ##
+
+*End point for query statements*
+
+Endpoint: _/query_
+
+Parameters:
+
+<table>
+<tr>
+ <td>Parameter</td>
+ <td>Description</td>
+ <td>Required?</td>
+</tr>
+<tr>
+ <td>query</td>
+ <td>Query string to pass to ASTERIX for execution</td>
+ <td>Yes</td>
+</tr>
+<tr>
+ <td>mode</td>
+ <td>Indicate if call should be synchronous or asynchronous. mode = synchronous blocks the call until results are available; mode = asynchronous returns immediately with a handle that can be used later to check the query’s status and to fetch results when available</td>
+ <td>No. default mode = synchronous</td>
+</tr>
+</table>
+
+Result: The result is returned as a JSON object as follows
+
+
+ {
+ results: <result as a string, if mode = synchronous>
+ error-code: [<code>, <message>] (if an error occurs)
+ handle: <opaque result handle, if mode = asynchronous>
+ }
+
+
+### Example ###
+
+#### Select query with synchronous result delivery ####
+
+
+ use dataverse company;
+
+ for $l in dataset('Employee') return $l;
+
+
+API call for the above query statement in the URL-encoded form.
+
+[http://localhost:19101/query?query=use%20dataverse%20company;for%20$l%20in%20dataset('Employee')%20return%20$l;](http://localhost:19101/query?query=use%20dataverse%20company;for%20$l%20in%20dataset('Employee')%20return%20$l;)
+
+#### Response ####
+*HTTP OK 200*
+Payload
+
+
+ {
+ "results": [
+ [
+ "{ "id": 123, "name": "John Doe" }"
+ ]
+ ]
+ }
+
+
+#### Same select query with asynchronous result delivery ####
+
+API call for the above query statement in the URL-encoded form with mode=asynchronous
+
+[http://localhost:19101/query?query=use%20dataverse%20company;for%20$l%20in%20dataset('Employee')%20return%20$l;&mode=asynchronous](http://localhost:19101/query?query=use%20dataverse%20company;for%20$l%20in%20dataset('Employee')%20return%20$l;&mode=asynchronous)
+
+#### Response ####
+*HTTP OK 200*
+Payload
+
+
+ {
+ "handle": [45,0]
+ }
+
+
+## Asynchronous Result API ##
+
+*End point to fetch the results of an asynchronous query*
+
+Endpoint: _/query/result_
+
+Parameters:
+
+<table>
+<tr>
+ <td>Parameter</td>
+ <td>Description</td>
+ <td>Required?</td>
+</tr>
+<tr>
+ <td>handle</td>
+ <td>Result handle that was returned by a previous call to a /query call with mode = asynchronous</td>
+ <td>Yes</td>
+</tr>
+</table>
+
+Result: The result is returned as a JSON object as follows:
+
+
+ {
+ results: <result as a string, if mode = synchronous, or mode = asynchronous and results are available>
+ error-code: [<code>, <message>] (if an error occurs)
+ }
+
+
+If mode = asynchronous and results are not available, the returned JSON object is empty: { }
+
+### Example ###
+
+#### Fetching results for asynchronous query ####
+
+We use the handle returned by the asynchronous query to get the results for the query. The handle returned was:
+
+
+ {
+ "handle": [45,0]
+ }
+
+
+API call for reading results from the previous asynchronous query in the URL-encoded form.
+
+[http://localhost:19101/query/result?handle=%7B%22handle%22%3A+%5B45%2C+0%5D%7D](http://localhost:19101/query/result?handle=%7B%22handle%22%3A+%5B45%2C+0%5D%7D)
+
+#### Response ####
+*HTTP OK 200*
+Payload
+
+
+ {
+ "results": [
+ [
+ "{ "id": 123, "name": "John Doe" }"
+ ]
+ ]
+ }
+
+
+## Query Status API ##
+
+*End point to check the status of the query asynchronous*
+
+Endpoint: _/query/status_
+
+Parameters:
+
+<table>
+<tr>
+ <td>Parameter</td>
+ <td>Description</td>
+ <td>Required?</td>
+</tr>
+<tr>
+ <td>handle</td>
+ <td>Result handle that was returned by a previous call to a /query call with mode = asynchronous</td>
+ <td>Yes</td>
+</tr>
+</table>
+
+Result: The result is returned as a JSON object as follows:
+
+
+ {
+ status: ("RUNNING" | "SUCCESS" | "ERROR")
+ }
+
+
+
+## Error Codes ##
+
+Table of error codes and their types:
+
+<table>
+<tr>
+ <td>Code</td>
+ <td>Type</td>
+</tr>
+<tr>
+ <td>1</td>
+ <td>Invalid statement</td>
+</tr>
+<tr>
+ <td>2</td>
+ <td>Parse failures</td>
+</tr>
+<tr>
+ <td>99</td>
+ <td>Uncategorized error</td>
+</tr>
+</table>
diff --git a/asterix-doc/src/site/markdown/AsterixQueryLanguage.md b/asterix-doc/src/site/markdown/AsterixQueryLanguage.md
new file mode 100644
index 0000000..af25cda
--- /dev/null
+++ b/asterix-doc/src/site/markdown/AsterixQueryLanguage.md
@@ -0,0 +1,195 @@
+`<wiki:toc max_depth="2" />`
+
+# The Asterix Query Language, Version 1.0 #
+
+# Introduction #
+
+This wiki page provides an overview of the Asterix Query language and the Asterix Data model.
+
+*WARNING:* _THIS IS AN INCOMPLETE SUSPENDED WORK IN PROGRESS...
+_ It will hopefully be resumed shortly in order to produce a legit AQL spec to go out with the Beta Release of AsterixDB. What's here is very likely inconsistent with what's in the system as of today, as this was from an older snapshot of the world.
+
+# Asterix Data Model #
+
+Data in Asterix is represented using the Asterix Data Model (ADM). The ADM derives inspiration from prior standards such as JSON, XQuery, and the Object Data Model from ODMG.
+
+## Asterix Types ##
+
+### Primitive Types ##
+
+|| *Primitive Type* || *Description* ||
+|| int8 || Signed 8-bit integer. Valid range -128 thru 127 ||
+|| int16 || Signed 16-bit integer. Valid range -32768 thru 32767 ||
+|| int32 || Signed 32-bit integer. Valid range -2147483648 thru 2147483647 ||
+|| int64 || Signed 64-bit integer. Valid range -9223372036854775807 thru 9223372036854775808 ||
+|| uint8 || Unsigned 8-bit integer. Valid range 0 thru 255 ||
+|| uint16 || Unsigned 16-bit integer. Valid range 0 thru 65535 ||
+|| uint32 || Unsigned 32-bit integer. Valid range 0 thru 4294967295 ||
+|| uint64 || Unsigned 64-bit integer. Valid range 0 thru 18446744073709551615 ||
+|| string || String of characters ||
+|| null || null type (Type of the null value) ||
+|| date || Date ||
+|| time || Time of day ||
+|| boolean || Boolean ||
+|| datetime || Date and time ||
+|| point2d || A point in 2-D space ||
+|| point3d || A point in 3-D space ||
+|| binary || Binary data ||
+|| yminterval || Year-Month interval ||
+|| dtinterval || Day-Time interval ||
+|| interval || Year-Month and Day-Time interval ||
+
+### Collection Types ###
+
+|| *Collection Type* || *Description* ||
+|| Record || A record type describes the record data item. A record contains a set of fields which can have values of any ADM type. Fields of a record must be unique. ||
+|| Union || A union type is an abstract type (A value never has a union type) that describes a set of type choices. ||
+|| Ordered List || An orderedlist instance represents a sequence of values where the order of the instances is determined by creation/insertion ||
+|| UnorderedList || An unorderedlist instance represents a collection of values where the order of the instances where the order is irrelevant ||
+|| Enumeration || An enumeration type represents a choice of string values ||
+
+# AQL Expressions #
+
+## Primary Expressions ##
+
+Primary expressions are the basic expressions that form the core of AQL.
+
+### Literals ###
+
+A Literal is a syntactic representation of a constant value. The various literals allowed in AQL are described in the table below.
+
+|| *Literal type* || *Syntax* ||
+|| StringLiteral || ` STRING_LITERAL : ("\"" ("\\\"" | ~["\""])* "\"") | ("\'"("\\\'" | ~["\'"])* "\'") ` ||
+|| IntegerLiteral || ` INTEGER_LITERAL : (["0" - "9"])+ ` ||
+|| FloatLiteral || ` FLOAT_LITERAL: ((["0" - "9"])* "." (["0" - "9"])+ ("f" | "F")) ` ||
+|| DoubleLiteral || ` DOUBLE_LITERAL: ((["0" - "9"])* "." (["0" - "9"])+) ` ||
+|| NullLiteral || ` NULL_LITERAL: "null" ` ||
+|| BooleanLiteral || ` BOOLEAN_LITERAL: "true" | "false" ` ||
+
+### Function Call ###
+
+Function Calls in AQL can be used to invoke builtin functions as well as user defined functions.
+Function Calls have the following syntax.
+
+
+ IDENTIFIER "(" ( Expression ( "," Expression )* )? ")"
+
+
+### Variable Reference ###
+
+Variables in AQL are used to bind to values. Variables can be bound to values by the For, Let, Group by clauses of the FLWOR expressions. Variables can also be bound by
+the Quantified Expressions.
+
+### Ordered List Constructor ###
+
+Constructs an ordered list. An ordered list represents a collection of values. The order of values is relevant. The collection may contain duplicate values.
+
+### Unordered List Constructor ###
+
+Constructs an unordered list. An unordered list represents a collection of values. The order of values is not relevant. The collection may contain duplicate values.
+
+### Record Constructor ###
+
+Constructs an AQL Record. A record contains fields. Each field has a name and a value. The name of the field is of type string. The value of a field may be any legal ADM data type. A record may not contain duplicate fields.
+
+## Arithmetic Expressions ##
+
+AQL allows all the standard arithmetic operators on numeric data types. The specific operators allowed are:
+
+|| *Operator* || *Description* ||
+|| + || Add ||
+|| - || Subtract ||
+|| * || Multiply ||
+|| / || Divide ||
+|| mod || Modulo ||
+
+## Comparison Expressions ##
+
+AQL provides the six standard comparison expressions listed below. In addition, AQL supports fuzzy comparisons.
+
+|| *Operator* || *Description* ||
+|| = || Equal ||
+|| = || Not Equal ||
+|| `< || Less Than ||
+|| `<= || Less Than or Equal ||
+|| >` || Greater Than ||
+|| >`= || Greater Than or Equal ||
+|| >`= || Greater Than or Equal ||
+|| ~= || Fuzzy Equals ||
+
+## Logical Expressions ##
+
+AQL provides two logical connectors:
+
+|| *Operator* || *Description* ||
+|| and || Logical AND ||
+|| or || Logical OR ||
+
+## Field Access Expressions ##
+
+The "." operator is used to access fields of a record. For example,
+
+
+ $x.name
+
+
+accesses the name field of the record bound to $x.
+
+## Indexed Expressions ##
+
+Indexed expressions are used to access values in an ordered list. For example,
+
+
+ $x[5]
+
+
+accesses the 6th item in the list bound to $x. Indexes start at 0.
+
+## FLWOR Expression ##
+
+The FLWOR expression is the most elaborate expression in AQL. It is made up of two parts -- Clauses and the Return Expression.
+
+The syntax of the FLWOR expression is:
+
+
+
+ ( ForClause | LetClause )
+ ( ForClause | LetClause | WhereClause | OrderClause | GroupClause | LimitClause | DistinctClause )*
+ "return" ReturnExpression
+
+
+
+* For Clause
+
+ "for" Variable "in" Expression
+
+* Let Clause
+
+ "let" Variable ":=" Expression
+
+* Where Clause
+
+ "where" Expression
+
+* Order Clause
+
+ "order" "by" Expression ("asc" | "desc") ("," Expression ("asc" | "desc"))*
+
+* Group Clause
+
+ "group" "by" ((Variable ":=")? Expression) ("," ((Variable ":=")? Expression))* "with" Variable
+
+* Limit Clause
+
+ "limit" Expression ("," Expression)?
+
+
+* If Then Else Expressions *
+
+ "if" "(" Expression ")" "then" Expression "else" Expression
+
+
+* Quantified Expressions *
+
+ ("some" | "every") Variable "in" Expression "satisfies" Expression
+
diff --git a/asterix-doc/src/site/markdown/AsterixQueryLanguageReference.md b/asterix-doc/src/site/markdown/AsterixQueryLanguageReference.md
new file mode 100644
index 0000000..1ed876e
--- /dev/null
+++ b/asterix-doc/src/site/markdown/AsterixQueryLanguageReference.md
@@ -0,0 +1,462 @@
+# The Asterix Query Language, Version 1.0
+## 1. Introduction
+
+This document provides an overview of the Asterix Query language.
+
+
+## 2. Expressions
+
+ Expression ::= ( OperatorExpr | IfThenElse | FLWOGR | QuantifiedExpression )
+
+
+### Primary Expressions
+
+ PrimaryExpr ::= Literal
+ | VariableRef
+ | ParenthesizedExpression
+ | FunctionCallExpr
+ | DatasetAccessExpression
+ | ListConstructor
+ | RecordConstructor
+
+
+#### Literals
+
+ Literal ::= StringLiteral
+ | <INTEGER_LITERAL>
+ | <FLOAT_LITERAL>
+ | <DOUBLE_LITERAL>
+ | "null"
+ | "true"
+ | "false"
+ StringLiteral ::= <STRING_LITERAL>
+
+##### Examples
+
+ "a string"
+ 42
+
+
+#### Variable References
+
+ VariableRef ::= <VARIABLE>
+
+##### Example
+
+ $id
+
+
+#### Parenthesized Expressions
+
+ ParenthesizedExpression ::= "(" Expression ")"
+
+##### Example
+
+ ( 1 + 1 )
+
+
+#### Function Calls
+
+ FunctionCallExpr ::= FunctionOrTypeName "(" ( Expression ( "," Expression )* )? ")"
+
+##### Example
+
+ string-length("a string")
+
+
+#### Dataset Access
+
+ DatasetAccessExpression ::= "dataset" ( ( Identifier ( "." Identifier )? )
+ | ( "(" Expression ")" ) )
+ Identifier ::= <IDENTIFIER> | StringLiteral
+
+##### Examples
+
+ dataset customers
+ dataset (string-join("customers", $country))
+
+
+#### Constructors
+
+ ListConstructor ::= ( OrderedListConstructor | UnorderedListConstructor )
+ OrderedListConstructor ::= "[" ( Expression ( "," Expression )* )? "]"
+ UnorderedListConstructor ::= "{{" ( Expression ( "," Expression )* )? "}}"
+ RecordConstructor ::= "{" ( FieldBinding ( "," FieldBinding )* )? "}"
+ FieldBinding ::= Expression ":" Expression
+
+##### Examples
+
+ [ "a", "b", "c" ]
+
+ {{ 42, "forty-two", "AsterixDB!" }}
+
+ {
+ "project name" : "AsterixDB"
+ "project members" : {{ "vinayakb", "dtabass", "chenli" }}
+ }
+
+
+### Path Expressions
+
+ ValueExpr ::= PrimaryExpr ( Field | Index )*
+ Field ::= "." Identifier
+ Index ::= "[" ( Expression | "?" ) "]"
+
+##### Examples
+
+ { "list" : [ "a", "b", "c"] }.list
+
+ [ "a", "b", "c"][2]
+
+ { "list" : [ "a", "b", "c"] }.list[2]
+
+
+### Logical Expressions
+
+ OperatorExpr ::= AndExpr ( "or" AndExpr )*
+ AndExpr ::= RelExpr ( "and" RelExpr )*
+
+##### Example
+
+ $a > 3 and $a < 5
+
+
+### Comparison Expressions
+
+ RelExpr ::= AddExpr ( ( "<" | ">" | "<=" | ">=" | "=" | "!=" | "~=" ) AddExpr )?
+
+##### Example
+
+ 5 > 3
+
+
+### Arithmetic Expressions
+
+ AddExpr ::= MultExpr ( ( "+" | "-" ) MultExpr )*
+ MultExpr ::= UnaryExpr ( ( "*" | "/" | "%" | <CARET> | "idiv" ) UnaryExpr )*
+ UnaryExpr ::= ( ( "+" | "-" ) )? ValueExpr
+
+##### Example
+
+ 3 ^ 2 + 4 ^ 2
+
+
+### FLWOGR Expression
+
+ FLWOGR ::= ( ForClause | LetClause ) ( Clause )* "return" Expression
+ Clause ::= ForClause | LetClause | WhereClause | OrderbyClause
+ | GroupClause | LimitClause | DistinctClause
+ ForClause ::= "for" Variable ( "at" Variable )? "in" ( Expression )
+ LetClause ::= "let" Variable ":=" Expression
+ WhereClause ::= "where" Expression
+ OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )?
+ ( "," Expression ( ( "asc" ) | ( "desc" ) )? )*
+ GroupClause ::= "group" "by" ( Variable ":=" )? Expression ( "," ( Variable ":=" )? Expression )*
+ "with" VariableRef ( "," VariableRef )*
+ LimitClause ::= "limit" Expression ( "offset" Expression )?
+ DistinctClause ::= "distinct" "by" Expression ( "," Expression )*
+ Variable ::= <VARIABLE>
+
+
+##### Example
+
+ for $user in dataset FacebookUsers
+ where $user.id = 8
+ return $user
+
+##### Example
+
+ for $user in dataset FacebookUsers
+ for $message in dataset FacebookMessages
+ where $message.author-id = $user.id
+ return
+ {
+ "uname": $user.name,
+ "message": $message.message
+ };
+
+##### Example
+
+ for $user in dataset FacebookUsers
+ let $messages :=
+ for $message in dataset FacebookMessages
+ where $message.author-id = $user.id
+ return $message.message
+ return
+ {
+ "uname": $user.name,
+ "messages": $messages
+ };
+
+##### Example
+
+ for $user in dataset TwitterUsers
+ order by $user.followers_count desc, $user.lang asc
+ return $user
+
+* null is smaller than any other value
+
+##### Example
+
+ for $x in dataset FacebookMessages
+ let $messages := $x.message
+ group by $loc := $x.sender-location with $messages
+ return
+ {
+ "location" : $loc,
+ "message" : $messages
+ }
+
+* after group by only variables that are either in the group-by-list or in the with-list are in scope
+* the variables in the with-clause contain a collection of items after the group by clause (all the values that the variable was bound to in the tuples that make up the group)
+* null is handled as a single value for grouping
+
+##### Example
+
+ for $user in dataset TwitterUsers
+ order by $user.followers_count desc
+ limit 2
+ return $user
+
+##### Example (currently not working)
+
+ for $x in dataset FacebookMessages
+ distinct by $x.sender-location
+ return
+ {
+ "location" : $x.sender-location,
+ "message" : $x.message
+ }
+
+* every variable that is in-scope before the distinct clause is also in scope after the distinct clause
+* works a lot like group by, but for every variable that contains more than one value after the distinct-by clause, one value is picked non-deterministically
+* if the variable is in the disctict-by list, then value is deterministic
+* null is a single value
+
+### Conditional Expression
+
+ IfThenElse ::= "if" "(" Expression ")" "then" Expression "else" Expression
+
+##### Example
+
+ if (2 < 3) then "yes" else "no"
+
+
+### Quantified Expressions
+
+ QuantifiedExpression ::= ( ( "some" ) | ( "every" ) ) Variable "in" Expression
+ ( "," Variable "in" Expression )* "satisfies" Expression
+
+##### Examples
+
+ every $x in [ 1, 2, 3] satisfies $x < 3
+ some $x in [ 1, 2, 3] satisfies $x < 3
+
+## 3. Statements
+
+ Statement ::= ( SingleStatement ( ";" )? )* <EOF>
+ SingleStatement ::= DataverseDeclaration
+ | FunctionDeclaration
+ | CreateStatement
+ | DropStatement
+ | LoadStatement
+ | SetStatement
+ | InsertStatement
+ | DeleteStatement
+ | Query
+
+### Declarations
+
+ DataverseDeclaration ::= "use" "dataverse" Identifier
+ SetStatement ::= "set" Identifier StringLiteral
+ FunctionDeclaration ::= "declare" "function" Identifier ParameterList "{" Expression "}"
+ ParameterList ::= "(" ( <VARIABLE> ( "," <VARIABLE> )* )? ")"
+
+##### Example
+
+ use dataverse TinySocial;
+
+##### Example
+
+ set simfunction "jaccard";
+ set simthreshold "0.6f";
+
+##### Example
+
+ set simfunction "jaccard";
+ set simthreshold "0.6f";
+
+##### Example
+
+ declare function add($a, $b) {
+ $a + $b
+ };
+
+### Lifecycle Management Statements
+
+ CreateStatement ::= "create" ( DataverseSpecification
+ | TypeSpecification
+ | DatasetSpecification
+ | IndexSpecification
+ | FunctionSpecification )
+
+ QualifiedName ::= Identifier ( "." Identifier )?
+ DoubleQualifiedName ::= Identifier "." Identifier ( "." Identifier )?
+
+#### Dataverses
+
+ DataverseSpecification ::= "dataverse" Identifier IfNotExists ( "with format" StringLiteral )?
+
+
+##### Example
+
+ create dataverse TinySocial;
+
+#### Types
+
+ TypeSpecification ::= "type" FunctionOrTypeName IfNotExists "as" TypeExpr
+ FunctionOrTypeName ::= QualifiedName
+ IfNotExists ::= ( "if not exists" )?
+ TypeExpr ::= RecordTypeDef | TypeReference | OrderedListTypeDef | UnorderedListTypeDef
+ RecordTypeDef ::= ( "closed" | "open" )? "{" ( RecordField ( "," RecordField )* )? "}"
+ RecordField ::= Identifier ":" ( TypeExpr ) ( "?" )?
+ TypeReference ::= Identifier
+ OrderedListTypeDef ::= "[" ( TypeExpr ) "]"
+ UnorderedListTypeDef ::= "{{" ( TypeExpr ) "}}"
+
+##### Example
+
+ create type FacebookUserType as closed {
+ id: int32,
+ alias: string,
+ name: string,
+ user-since: datetime,
+ friend-ids: {{ int32 }},
+ employment: [EmploymentType]
+ }
+
+
+#### Datasets
+
+ DatasetSpecification ::= "internal"? "dataset" QualifiedName "(" Identifier ")" IfNotExists
+ PrimaryKey ( "on" Identifier )? ( "hints" Properties )?
+ | "external" "dataset" QualifiedName "(" Identifier ")" IfNotExists
+ "using" AdapterName Configuration ( "hints" Properties )?
+ AdapterName ::= Identifier
+ Configuration ::= "(" ( KeyValuePair ( "," KeyValuePair )* )? ")"
+ KeyValuePair ::= "(" StringLiteral "=" StringLiteral ")"
+ Properties ::= ( "(" Property ( "," Property )* ")" )?
+ Property ::= Identifier "=" ( StringLiteral | <INTEGER_LITERAL> )
+ ApplyFunction ::= "apply" "function" FunctionSignature
+ FunctionSignature ::= FunctionOrTypeName "@" <INTEGER_LITERAL>
+ PrimaryKey ::= "primary" "key" Identifier ( "," Identifier )*
+
+
+##### Example
+ create internal dataset FacebookUsers(FacebookUserType) primary key id;
+
+##### Example
+
+ create external dataset Lineitem(LineitemType) using localfs (
+ ("path"="127.0.0.1://SOURCE_PATH"),
+ ("format"="delimited-text"),
+ ("delimiter"="|"));
+
+#### Indices
+
+ IndexSpecification ::= "index" Identifier IfNotExists "on" QualifiedName
+ "(" ( Identifier ) ( "," Identifier )* ")" ( "type" IndexType )?
+ IndexType ::= "btree"
+ | "rtree"
+ | "keyword"
+ | "fuzzy keyword"
+ | "ngram" "(" <INTEGER_LITERAL> ")"
+ | "fuzzy ngram" "(" <INTEGER_LITERAL> ")"
+
+##### Example
+
+ create index fbAuthorIdx on FacebookMessages(author-id) type btree;
+
+##### Example
+
+ create index fbSenderLocIndex on FacebookMessages(sender-location) type rtree;
+
+##### Example
+
+ create index fbMessageIdx on FacebookMessages(message) type keyword;
+
+
+#### Functions
+
+ FunctionSpecification ::= "function" FunctionOrTypeName IfNotExists ParameterList "{" Expression "}"
+
+##### Example
+
+ create function add($a, $b) {
+ $a + $b
+ };
+
+
+#### Removal
+
+ DropStatement ::= "drop" ( "dataverse" Identifier IfExists
+ | "type" FunctionOrTypeName IfExists
+ | "dataset" QualifiedName IfExists
+ | "index" DoubleQualifiedName IfExists
+ | "function" FunctionSignature IfExists )
+ IfExists ::= ( "if" "exists" )?
+
+##### Example
+
+ drop dataset FacebookUsers if exists;
+
+##### Example
+
+ drop index fbSenderLocIndex;
+
+##### Example
+
+ drop type FacebookUserType;
+
+##### Example
+
+ drop dataverse TinySocial;
+
+##### Example
+
+ drop function add;
+
+
+### Import/Export Statements
+
+ LoadStatement ::= "load" "dataset" QualifiedName "using" AdapterName Configuration ( "pre-sorted" )?
+
+##### Example
+
+ load dataset FacebookUsers using localfs
+ (("path"="localhost:///Users/zuck/AsterixDB/load/fbu.adm"),("format"="adm"));
+
+
+### Modification Statements
+
+ InsertStatement ::= "insert" "into" "dataset" QualifiedName Query
+ DeleteStatement ::= "delete" Variable "from" "dataset" QualifiedName ( "where" Expression )?
+
+##### Example
+
+ insert into dataset UsersCopy (for $user in dataset FacebookUsers return $user)
+
+##### Example
+
+ delete $user from dataset FacebookUsers where $user.id = 8;
+
+
+### Queries
+
+ Query ::= Expression
+
+##### Example
+
+ for $praise in {{ "great", "brilliant", "awesome" }}
+ return
+ string-concat(["AsterixDB is ", $praise])
diff --git a/asterix-doc/src/site/markdown/AsterixSimilarityQueries.md b/asterix-doc/src/site/markdown/AsterixSimilarityQueries.md
new file mode 100644
index 0000000..4f22fef
--- /dev/null
+++ b/asterix-doc/src/site/markdown/AsterixSimilarityQueries.md
@@ -0,0 +1,83 @@
+# AsterixDB Support of Similarity Queries #
+
+## Motivation ##
+
+Similarity queries are widely used in applications where users need to find records that satisfy a similarity predicate, while exact matching is not sufficient. These queries are especially important for social and Web applications, where errors, abbreviations, and inconsistencies are common. As an example, we may want to find all the movies starring Schwarzenegger, while we don't know the exact spelling of his last name (despite his popularity in both the movie industry and politics :-)). As another example, we want to find all the Facebook users who have similar friends. To meet this type of needs, AsterixDB supports similarity queries using efficient indexes and algorithms.
+
+## Data Types and Similarity Functions ##
+
+AsterixDB supports various similarity functions, including [edit distance](http://en.wikipedia.org/wiki/Levenshtein_distance) (on strings) and [Jaccard](http://en.wikipedia.org/wiki/Jaccard_index) (on sets). For instance, in our [TinySocial](AdmAql101.html#ADM:_Modeling_Semistructed_Data_in_AsterixDB) example, the `friend-ids` of a Facebook user forms a set of friends, and we can define a similarity between two sets. We can also convert a string to a set of "q-grams" and define the Jaccard similarity between the two sets of two strings. The "q-grams" of a string are its substrings of length "q". For instance, the 3-grams of the string `schwarzenegger` are `sch`, `chw`, `hwa`, ..., `ger`.
+
+AsterixDB provides [tokenization functions](AsterixDataTypesAndFunctions.html#Tokenizing_Functions) to convert strings to sets, and the [similarity functions](AsterixDataTypesAndFunctions.html#Similarity_Functions).
+
+## Selection Queries ##
+
+The following [query](AsterixDataTypesAndFunctions.html#edit-distance) asks for all the Facebook users whose name is similar to `Suzanna Tilson`, i.e., their edit distance is at most 2.
+
+
+ use dataverse TinySocial;
+
+ for $user in dataset('FacebookUsers')
+ let $ed := edit-distance($user.name, "Suzanna Tilson")
+ where $ed <= 2
+ return $user
+
+
+The following [query](AsterixDataTypesAndFunctions.html#similarity-jaccard) asks for all the Facebook users whose set of friend ids is similar to `[1,5,9]`, i.e., their Jaccard similarity is at least 0.6.
+
+
+ use dataverse TinySocial;
+
+ for $user in dataset('FacebookUsers')
+ let $sim := similarity-jaccard($user.friend-ids, [1,5,9])
+ where $sim >= 0.6f
+ return $user
+
+
+AsterixDB allows a user to use a similarity operator `~=` to express a similarity condition by defining the similiarty function and threshold using "set" statements earlier. For instance, the above query can be equivalently written as:
+
+
+ use dataverse TinySocial;
+
+ set simfunction "jaccard";
+ set simthreshold "0.6f";
+
+ for $user in dataset('FacebookUsers')
+ where $user.friend-ids ~= [1,5,9]
+ return $user
+
+
+
+## Fuzzy Join Queries ##
+
+AsterixDB supports fuzzy joins between two data sets. The following [query](AdmAql101.html#Query_5_-_Fuzzy_Join) finds, for each Facebook user, all Twitter users with names "similar" to their name based on the edit distance.
+
+
+ use dataverse TinySocial;
+
+ set simfunction "edit-distance";
+ set simthreshold "3";
+
+ for $fbu in dataset FacebookUsers
+ return {
+ "id": $fbu.id,
+ "name": $fbu.name,
+ "similar-users": for $t in dataset TweetMessages
+ let $tu := $t.user
+ where $tu.name ~= $fbu.name
+ return {
+ "twitter-screenname": $tu.screen-name,
+ "twitter-name": $tu.name
+ }
+ };
+
+
+## Using Indexes ##
+
+AsterixDB uses inverted index to support similarity queries efficiently. For instance, the following query creates such an index on the `FacebookUser.name` attribute using an inverted index of 3-grams. After the index is created, similarity queries with an edit distance condition on this attribute can be answered more efficiently.
+
+
+ use dataverse TinySocial;
+
+ create index fbUserFuzzyIdx on FacebookUsers(name) type ngram(3);
+
diff --git a/asterix-doc/src/site/markdown/InstallingAsterixUsingManagix.md b/asterix-doc/src/site/markdown/InstallingAsterixUsingManagix.md
new file mode 100644
index 0000000..65aebdf
--- /dev/null
+++ b/asterix-doc/src/site/markdown/InstallingAsterixUsingManagix.md
@@ -0,0 +1,808 @@
+# Introduction #
+This is a quickstart guide for getting ASTERIX running in a distributed environment. This guide also introduces the ASTERIX installer (nicknamed _*Managix*_) and describes how it can be used to create/manage an ASTERIX instance. By following the simple steps described in this guide, you will get a running instance of ASTERIX. You shall be able to use ASTERIX from its Web interface and manage its lifecycle using Managix. This document assumes that you are running some version of _*Linux*_ or _*MacOS X*_.
+
+## Prerequisites for Installing ASTERIX ##
+Prerequisite:
+
+ * [JDK7](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (Otherwise known as JDK 1.7).
+
+To know the version of Java installed on your system, execute the following:
+
+ $ java -version
+
+If you have version as 1.7.0_x, similar to the output shown below, you are good to proceed.
+
+
+ java version "1.7.0_13"
+ Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
+ Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
+
+If you need to upgrade or install java, please follow the instructions below.
+
+ * For Linux: [JDK 7 Linux Install](http://docs.oracle.com/javase/7/docs/webnotes/install/linux/linux-jdk.html)
+JDK would be installed at a path under /usr/lib/jvm/jdk-version .
+
+ * For Mac: [JDK 7 Mac Install](http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html)
+JDK would be installed at /Library/Java/JavaVirtualMachines/jdk-version/Contents/Home .
+
+The java installation directory is referred as JAVA_HOME. Since we upgraded/installed Java, we need to ensure JAVA_HOME points to the installation directory of JDK 7. Modify your ~/.bash_profile (or ~/.bashrc) and define JAVA_HOME accordingly. After modifying, execute the following:
+
+
+ $ java -version
+
+If the version information you obtain does not show 1.7, you need to update the PATH variable. To do so, execute the following:
+
+
+ $ echo "PATH=$JAVA_HOME/bin:$PATH" >> ~/.bash_profile (or ~/.bashrc)
+ $ source ~/.bash_profile (or ~/.bashrc)
+
+We also need to ensure that $JAVA_HOME/bin is in the PATH. $JAVA_HOME/bin should be included in the PATH value. We need to change the if $JAVA_HOME/bin is already in the PATH, we shall simply execute the following:
+
+
+ $ java
+
+If you get the following message, you need to alter the PATH variable in your ~/.bash_profile or ~/.bashrc (whichever you use).
+
+
+ -bash: java: command not found
+
+## Section 1: Single-Machine ASTERIX installation ##
+We assume a user Joe with a home directory as /home/joe. Please note that on Mac, the home directory for user Joe would be /Users/joe.
+
+### Configuring Environment ###
+Ensure that JAVA_HOME variable is defined and points to the the java installation directory on your machine. To verify, execute the following.
+
+
+ $ echo $JAVA_HOME
+
+If you do not see any output, JAVA_HOME is not defined. We need to add the following line to your profile located at /home/joe/.bash_profile or /home/joe/.bashrc, whichever you are using. If you do not any of these files, create a ~/.bash_profile.
+
+
+ export JAVA_HOME=<Path to Java installation directory>
+
+After you have edited ~/.bash_profile (or ~/.bashrc), execute the following to make the changes effective in current shell.
+
+
+ $ source /home/joe/.bash_profile (or /home/joe/.bashrc)
+
+Before proceeding, verify that JAVA_HOME is defined by executing the following.
+
+
+ $ echo $JAVA_HOME
+
+### Configuring SSH ###
+If SSH is not enabled on your system, please follow the instruction below to enable/install it or else skip to the section [Configuring Password-less SSH](#Configuring_Password-less_SSH).
+
+#### Enabling SSH on Mac ####
+The Apple Mac OS X operating system has SSH installed by default but the SSH daemon is not enabled. This means you can’t login remotely or do remote copies until you enable it. To enable it, go to ‘System Preferences’. Under ‘Internet & Networking’ there is a ‘Sharing’ icon. Run that. In the list that appears, check the ‘Remote Login’ option. Also check the "All users" radio button for "Allow access for". This starts the SSH daemon immediately and you can remotely login using your username. The ‘Sharing’ window shows at the bottom the name and IP address to use. You can also find this out using ‘whoami’ and ‘ifconfig’ from the Terminal application.
+
+#### Enabling SSH on Linux ####
+
+ sudo apt-get install openssh-server
+
+Assumming that you have enabled SSH on your system, let us proceed.
+
+#### Configuring Password-less SSH ####
+
+For our single-machine setup of ASTERIX, we need to configure password-less SSH access to localhost. We assume that you are on the machine where you want to install ASTERIX. To verify if you already have password-less SSH configured, execute the following.
+
+
+ $ ssh 127.0.0.1
+
+If you get an output similar to one shown below, type "yes" and press enter.
+
+
+ The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
+ RSA key fingerprint is aa:7b:51:90:74:39:c4:f6:28:a2:9d:47:c2:8d:33:31.
+ Are you sure you want to continue connecting (yes/no)?
+
+If you are not prompted for a password, that is if you get an output similar to one shown below, skip to the next section [Configuring Managix](#Configuring_Managix).
+
+
+ $ ssh 127.0.0.1
+ Last login: Sat Mar 23 22:52:49 2013
+
+You are here because you were prompted for a password. You need to configure password less SSH. Follow the instructions below.
+
+
+ $ ssh-keygen -t rsa -P ""
+ Generating public/private rsa key pair.
+ Enter file in which to save the key (/home/joe/.ssh/id_rsa): [We shall use the default value, so simply press enter]
+
+If a key already exists, you should get an output similar to what is shown below. Press 'y' to overwrite the existing key.
+
+
+ /home/joe/.ssh/id_rsa already exists.
+ Overwrite (y/n)?
+
+You should see an output similar to one shown below.
+
+
+ The key fingerprint is:
+ 4d:b0:30:14:45:cc:99:86:15:48:17:0b:39:a0:05:ca joe@joe-machine
+ The key's randomart image is:
+ +--[ RSA 2048]----+
+ | ..o+B@O= |
+ |.. o ==*+ |
+ |.E. oo . |
+ | o |
+ | S . |
+ | |
+ | |
+ | |
+ | |
+ +-----------------+
+
+Note: for Linux users, you may not get an image representation of the key, but this is not an error. Next, execute the following:
+
+
+ $ cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
+
+We shall now retry SSH without password.
+
+
+ $ ssh 127.0.0.1
+
+You may see an output similar to one shown below.
+
+
+ The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
+ RSA key fingerprint is aa:7b:51:90:74:39:c4:f6:28:a2:9d:47:c2:8d:33:31.
+ Are you sure you want to continue connecting (yes/no)?
+
+Type 'yes' and press the enter key. You should see an output similar to one shown below.
+
+
+ Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
+ Last login: Thu Mar 28 12:27:10 2013
+
+You should now be able to log in without being prompted for a password or a response.
+
+
+ ssh 127.0.0.1
+ Last login: Sat Mar 23 22:54:40 2013
+
+Execute 'exit' to close the session.
+
+
+ $ exit
+ logout
+ Connection to 127.0.0.1 closed.
+
+### Configuring Managix ###
+You will need the ASTERIX installer (a.k.a Managix). Download Managix from [here](https://asterixdb.googlecode.com/files/asterix-installer-0.0.5-binary-assembly.zip); this includes the bits for Managix as well as ASTERIX.
+
+Unzip the Managix zip bundle to an appropriate location. You may create a sub-directory: asterix-mgmt (short for asterix-management) under your home directory. We shall refer to this location as MANAGIX_HOME.
+
+
+ $ cd ~
+ /home/joe> $ mkdir asterix-mgmt
+ /home/joe> $ cd asterix-mgmt
+ /home/joe/asterix-mgmt> $ unzip <path to the Managix zip bundle>
+ /home/joe/asterix-mgmt> $ export MANAGIX_HOME=`pwd`
+ /home/joe/asterix-mgmt> $ export PATH=$PATH:$MANAGIX_HOME/bin
+
+It is recommended that you add $MANAGIX_HOME/bin to your PATH variable in your bash profile . This can be done by executing the following.
+
+
+ currentDir=`pwd`
+ echo "export MANAGIX_HOME=$currentDir" >> ~/.bash_profile
+ echo "export PATH=$PATH:$MANAGIX_HOME/bin" >> ~/.bash_profile
+
+Above, use ~/.bashrc instead of ~/.bash_profile if you are using ~/.bashrc .
+
+To be able to create an ASTERIX instance and manage its lifecycle, the Managix requires you to configure a set of configuration files namely:
+
+ * `conf/managix-conf.xml`: A configuration XML file that contains configuration settings for Managix.
+ * A configuration XML file that describes the nodes in the cluster, e.g., `$MANAGIX_HOME/clusters/local/local.xml`.
+
+Since we intend to run ASTERIX on a single node, Managix can auto-configure itself and populate the above mentioned configuration files. To auto-configure Managix, execute the following in the MANAGIX_HOME directory:
+
+
+ /home/joe/asterix-mgmt> $ managix configure
+
+Let us do a sample run to validate the set of configuration files auto-generated by Managix.
+
+
+ /home/joe/asterix-mgmt> $ managix validate
+ INFO: Environment [OK]
+ INFO: Managix Configuration [OK]
+
+
+ /home/joe/asterix-mgmt> $ managix validate -c $MANAGIX_HOME/clusters/local/local.xml
+ INFO: Environment [OK]
+ INFO: Cluster configuration [OK]
+
+### Creating an ASTERIX instance ###
+Now that we have configured Managix, we shall next create an ASTERIX instance. An ASTERIX instance is identified by a unique name and is created using the `create` command. The usage description for the `create` command can be obtained by executing the following.
+
+
+ $ managix help -cmd create
+ Creates an ASTERIX instance with a specified name. Post creation, the instance is in ACTIVE state,
+ indicating its availability for executing statements/queries.
+ Usage arguments/options:
+ -n Name of the ASTERIX instance.
+ -c Path to the cluster configuration file
+
+We shall now use the create command to create an ASTERIX instance by the name "my_asterix". In doing so, we shall use the cluster configuration file that was auto-generated by managix.
+
+
+ $ managix create -n my_asterix -c $MANAGIX_HOME/clusters/local/local.xml
+
+A sample output of the above command is shown below:
+
+
+ INFO: Name:my_asterix
+ Created:Thu Mar 07 11:14:13 PST 2013
+ Web-Url:http://127.0.0.1:19001
+ State:ACTIVE
+
+The third line above shows the web-url http://127.0.0.1:19001 for ASTERIX's web-interface. The ASTERIX instance is in the 'ACTIVE' state indicating that you may access the web-interface by navigating to the web-url.
+
+Type in the following "Hello World" query in the box:
+
+
+ let $message := 'Hello World!'
+ return $message
+
+Press the "Execute" button. If the query result shows on the output box, then Congratulations! You have successfully created an ASTERIX instance!
+
+## Section 2: Single-Machine ASTERIX installation (Advanced) ##
+We assume that you have successfully completed the single-machine ASTERIX installation by following the instructions above in section [ASTERIX installation](#Section_1:_Single-Machine_ASTERIX_installation Single Machine). In this section, we shall cover advanced topics related to ASTERIX configuration. Before we proceed, it is imperative to go through some preliminary concepts related to ASTERIX runtime.
+
+### ASTERIX Runtime ###
+An ASTERIX runtime comprises of a ''master node'' and a set of ''worker nodes'', each identified by a unique id. The master node runs a ''Cluster Controller'' service (a.k.a. ''CC''), while each worker node runs a ''Node Controller'' service (a.k.a. ''NC''). Please note that a node in an ASTERIX cluster is a logical concept in the sense that multiple nodes may map to a single physical machine, which is the case for a single-machine ASTERIX installation. This association or mapping between an ASTERIX node and a physical machine is captured in a cluster configuration XML file. In addition, the XML file contains properties and parameters associated with each node.
+
+#### ASTERIX Runtime Configuration ####
+As observed earlier, Managix can auto-configure itself for a single-machine setup. As part of auto-configuration, Managix generated the cluster XML file. Let us understand the components of the generated cluster XML file. If you have configured Managix (via the "configure" command), you can find a similar cluster XML file as $MANAGIX_HOME/clusters/local/local.xml. The following is a sample XML file generated on a Ubuntu (Linux) setup:
+
+
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+ <cluster xmlns="cluster">
+ <name>local</name>
+ <java_home>/usr/lib/jvm/jdk1.7.0</java_home>
+ <java_opts>-Xmx1048m</java_opts>
+ <logdir>/home/joe/asterix-mgmt/clusters/local/working_dir/logs</logdir>
+ <iodevices>/home/joe/asterix-mgmt/clusters/local/working_dir</iodevices>
+ <store>storage</store>
+ <workingDir>
+ <dir>/home/joe/asterix-mgmt/clusters/local/working_dir</dir>
+ <NFS>true</NFS>
+ </workingDir>
+ <master-node>
+ <id>master</id>
+ <client-ip>127.0.0.1</client-ip>
+ <cluster-ip>127.0.0.1</cluster-ip>
+ </master-node>
+ <node>
+ <id>node1</id>
+ <cluster-ip>127.0.0.1</cluster-ip>
+ </node>
+ </cluster>
+
+We shall next explain the components of the cluster configuration XML file.
+
+#### (1) Defining nodes in ASTERIX runtime ####
+The single-machine ASTERIX instance configuration that is auto-generated by Managix (using the "configure" command) involves a master node (CC) and a worker node (NC). Each node is assigned a unique id and provided with an ip address (called ''cluster-ip'') that maps a node to a physical machine. The following snippet from the above XML file captures the master/worker nodes in our ASTERIX installation.
+
+
+ <master-node>
+ <id>master</id>
+ <client-ip>127.0.0.1</client-ip>
+ <cluster-ip>127.0.0.1</cluster-ip>
+ </master-node>
+ <node>
+ <id>node1</id>
+ <cluster-ip>127.0.0.1</cluster-ip>
+ </node>
+
+
+The following is a description of the different elements in the cluster configuration xml file.
+
+<table>
+<tr>
+ <td>Property</td>
+ <td>Description</td>
+</tr>
+<tr>
+ <td>id</td>
+ <td>A unique id for a node.</td>
+</tr>
+<tr>
+ <td>cluster-ip</td>
+ <td>IP address of the machine to which a node maps to. This address is used for all internal communication between the nodes.</td>
+</tr>
+<tr>
+ <td>client-ip</td>
+ <td>Provided for the master node. This IP should be reachable from clients that want to connect with ASTERIX via its web interface.</td>
+</tr>
+</table>
+
+#### (2) Properties associated with a worker node (NC) in ASTERIX ####
+The following is a list of properties associated with each worker node in an ASTERIX configuration.
+
+<table>
+<tr>
+ <td>Property</td>
+ <td>Description</td>
+</tr>
+<tr>
+ <td>java_home</td>
+ <td>Java installation directory at each node.</td>
+</tr>
+<tr>
+ <td>java_opts</td>
+ <td>JVM arguments passed on to the JVM that represents a node.</td>
+</tr>
+<tr>
+ <td>logdir</td>
+ <td>A directory where worker node may write logs.</td>
+</tr>
+<tr>
+ <td>io_devices</td>
+ <td>Comma separated list of IO Device mount points.</td>
+</tr>
+<tr>
+ <td>store</td>
+ <td>A data directory that ASTERIX uses to store data belonging to dataset(s).</td>
+</tr>
+</table>
+
+All the above properties can be defined at the global level or a local level. In the former case, these properties apply to all the nodes in an ASTERIX configuration. In the latter case, these properties apply only to the node(s) under which they are defined. A property defined at the local level overrides the definition at the global level.
+
+#### (3) Working directory of an ASTERIX instance ####
+
+Next we explain the following setting in the file $MANAGIX_HOME/clusters/local/local.xml.
+
+ <workingDir>
+ <dir>/Users/joe/asterix-mgmt/clusters/local/working_dir</dir>
+ <NFS>true</NFS>
+ </workingDir>
+
+
+Managix associates a working directory with an ASTERIX instance and uses this directory for transferring binaries to each node. If there exists a directory that is readable by each node, Managix can use it to place binaries that can be accessed and used by all the nodes in the ASTERIX set up. A network file system (NFS) provides such a functionality for a cluster of physical machines such that a path on NFS is accessible from each machine in the cluster. In the single-machine set up described above, all nodes correspond to a single physical machine. Each path on the local file system is accessible to all the nodes in the ASTERIX setup and the boolean value for NFS above is thus set to `true`.
+
+### Managix Configuration ###
+Managix allows creation and management of multiple ASTERIX instances and uses Zookeeper as its back-end database to keep track of information related to each instance. We need to provide a set of one or more hosts that Managix can use to run a Zookeeper instance. Zookeeper runs as a daemon process on each of the specified hosts. At each host, Zookeeper stores data under the Zookeeper home directory specified as part of the configuration. The following is an example configuration `$MANAGIX_HOME/conf/managix-conf.xml` that has Zookeeper running on the localhost (127.0.0.1) :
+
+
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+ <configuration xmlns="installer">
+ <zookeeper>
+ <homeDir>/home/joe/asterix/.installer/zookeeper</homeDir>
+ <clientPort>2900</clientPort>
+ <servers>
+ <server>127.0.0.1</server>
+ </servers>
+ </zookeeper>
+ </configuration>
+
+It is possible to have a single host for Zookeeper. A larger number of hosts would use Zookeeper's replication and fault-tolerance feature such that a failure of a host running Zookeeper would not result in loss of information about existing ASTERIX instances.
+
+## Section 3: Installing ASTERIX on a Cluster of Multiple Machines ##
+We assume that you have read the two sections above on single-machine ASTERIX setup. Next we explain how to install ASTERIX in a cluster of multiple machines. As an example, we assume we want to setup ASTERIX on a cluster of three machines, in which we use one machine (called machine A) as the master node and two other machines (called machine B and machine C) as the worker nodes, as shown in the following diagram:
+
+
+
+Notice that each machine has a ''cluster-ip'' address, which is used by these machines for their intra-cluster communication. Meanwhile, the master machine also has a ''client-ip'' address, using which an end-user outside the cluster can communicate with this machine. The reason we differentiate between these two types of IP addresses is that we can have a cluster of machines using a private network. In this case they have internal ip addresses that cannot be used outside the network. In the case all the machines are on a public network, the "client-ip" and "cluster-ip" of the master machine can share the same address.
+
+Next we describe how to set up ASTERIX in this cluster, assuming no Managix has been installed on these machines.
+
+### Step (1): Define the ASTERIX cluster ###
+
+We first log into the master machine as the user "joe". On this machine, download Managix from [here](https://asterixdb.googlecode.com/files/asterix-installer-0.0.5-binary-assembly.zip) (save as above), then do the following steps similar to the single-machine case described above:
+
+
+ machineA> cd ~
+ machineA> mkdir asterix-mgmt
+ machineA> cd asterix-mgmt
+ machineA> unzip <path to the Managix zip bundle>
+ machineA> export MANAGIX_HOME=`pwd`
+ machineA> export PATH=$PATH:$MANAGIX_HOME/bin
+
+
+We also need an ASTERIX configuration XML file for the cluster. We give the name to the cluster, say, "rainbow". We create a folder for the configuration of this cluster:
+
+
+ machineA> mkdir $MANAGIX_HOME/rainbow_cluster
+
+
+For this cluster we create a configuration file `$MANAGIX_HOME/rainbow_cluster/rainbow.xml`. The following is a sample file with explanation of the properties:
+
+ <cluster xmlns="cluster">
+
+ <!-- Name of the cluster -->
+ <name>rainbow</name>
+
+ <!-- username, which should be valid for all the three machines -->
+ <username>joe</username>
+
+ <!-- The working directory of Managix. It should be on a network file system (NFS) that
+ can accessed by all the machine. Need to create it before running Managix. -->
+ <workingDir>
+ <dir>/home/joe/managix-workingDir</dir>
+ <NFS>true</NFS>
+ </workingDir>
+
+ <!-- Directory for Asterix to store log information for each machine. Needs
+ to be a local file system. Needs to create it before running Managix. -->
+ <logdir>/mnt/joe/logs</logdir>
+
+ <!-- Directory used by each worker node to store data files. Needs
+ to be a local file system. Needs to create it before running Managix. -->
+ <iodevices>/mnt/joe</iodevices>
+ <store>storage</store>
+
+ <!-- Java home for each machine with its JVM options -->
+ <java_home>/usr/lib/jvm/jdk1.7.0</java_home>
+ <java_opts>-Xmx1024m</java_opts>
+
+ <!-- IP addresses of the master machine A -->
+ <master-node>
+ <id>master</id>
+ <client-ip>128.195.52.177</client-ip>
+ <cluster-ip>192.168.100.0</cluster-ip>
+ </master-node>
+
+ <!-- IP address(es) of machine B -->
+ <node>
+ <id>nodeB</id>
+ <cluster-ip>192.168.100.1</cluster-ip>
+ </node>
+
+ <!-- IP address(es) of machine C -->
+ <node>
+ <id>nodeC</id>
+ <cluster-ip>192.168.100.2</cluster-ip>
+ </node>
+ </cluster>
+
+
+As stated before, each of the above properties can be defined at the cluster level, in which case it applies to all the nodes in the system. Each property can also be defined at a node level.
+
+Once we have formed the cluster XML file, we can validate the configuration by doing the following:
+
+ managix validate -c $MANAGIX_HOME/rainbow_cluster/rainbow.xml
+
+
+If the return message says "OK", it means that the XML configuration file is set properly.
+
+### Step (2): Configure SSH ###
+
+The next steps of setting up SSH are similar to those in the single-machine setup case. We assume we have a common user account called "joe" on each machine in the cluster.
+
+On the master machine, do the following:
+
+
+ machineA> ssh localhost
+
+
+If you are prompted for a password, execute the following
+
+
+ machineA> ssh-keygen -t rsa -P ""
+ machineA> cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
+
+
+If $HOME is not on the NFS, copy the id_rsa.pub to the directory ~/.ssh (login with the same account) on each machine, and then do the following on each machine. (Notice that this step is not needed if the folder ".ssh" is on the NFS and can be accessed by all the nodes.)
+
+
+ cd ~/.ssh
+ cat id_rsa.pub >> authorized_keys
+
+
+Then run the following step again and type "Yes" if promoted:
+
+
+ machineA> ssh localhost
+
+### Step (3): Configuring Managix ###
+
+Managix is using a configuration XML file at `$MANAGIX_HOME/conf/managix-conf.xml` to configure its own properties, such as its Zookeeper service. We can use the `configure` command to auto-generate this configuration file:
+
+
+ machineA> managix configure
+
+
+We use the validate command to validate managix configuration. To do so, execute the following.
+
+ machineA> managix validate
+ INFO: Environment [OK]
+ INFO: Managix Configuration [OK]
+
+
+Note that the `configure` command also generates a cluster configuration XML file at $MANAGIX_HOME/conf/clusters/local.xml. This file is not needed in the case of a cluster of machines.
+
+### Step (4): Creating an ASTERIX instance ###
+
+Now that we have configured Managix, we shall next create an ASTERIX instance. An ASTERIX instance is identified by a unique name and is created using the create command. The usage description for the create command can be obtained by executing the following:
+
+
+ machineA> managix help -cmd create
+
+ Creates an ASTERIX instance with a specified name. Post creation, the instance is in ACTIVE state,
+ indicating its availability for executing statements/queries.
+ Usage arguments/options:
+ -n Name of the ASTERIX instance.
+ -c Path to the cluster configuration file
+
+
+We shall now use the `create` command to create an ASTERIX instance called "rainbow_asterix". In doing so, we shall use the cluster configuration file that was auto-generated by Managix.
+
+
+ machineA> managix create -n rainbow_asterix -c $MANAGIX_HOME/clusters/rainbow/rainbow.xml
+
+
+If the response message does not have warning, then Congratulations! You have successfully installed Asterix on this cluster of machines!
+
+Please refer to the section [Managing the Lifecycle of an ASTERIX Instance](#Section_4:_Managing_the_Lifecycle_of_an_ASTERIX_Instance) for a detailed description on the set of available commands/operations that let you manage the lifecycle of an ASTERIX instance. Note that the output of the commands varies with the cluster definition and may not apply to the cluster specification you built above.
+
+## Section 4: Managing the Lifecycle of an ASTERIX Instance ##
+
+Now that we have an ASTERIX instance running, let us use Managix to manage the instance's lifecycle. Managix provides the following set of commands/operations:
+
+#### Managix Commands ####
+
+<table>
+<tr><td>Command</td> <td>Description</td></tr>
+<tr><td><a href="#Creating_an_ASTERIX_instance">create</a></td> <td>Creates a new asterix instance.</td></tr>
+<tr><td><a href="#Describe_Command" >describe</a></td> <td>Describes an existing asterix instance.</td></tr>
+<tr><td><a href="#Stop_Command" >stop</a></td> <td>Stops an asterix instance that is in the ACTIVE state.</td></tr>
+<tr><td><a href="#Start_Command" >start</a></td> <td>Starts an Asterix instance.</td></tr>
+<tr><td><a href="#Backup_Command" >backup</a></td> <td>Creates a backup for an existing Asterix instance.</td></tr>
+<tr><td><a href="#Restore_Command" >restore</a></td> <td>Restores an Asterix instance.</td></tr>
+<tr><td><a href="#Delete_Command" >delete</a></td> <td>Deletes an Asterix instance.</td></tr>
+<tr><td><a href="#Configuring_Managix" >validate</a></td> <td>Validates the installer/cluster configuration.</td></tr>
+<tr><td><a href="#Configuring_Managix" >configure</a></td><td>Auto generate configuration for an Asterix instance.</td></tr>
+<tr><td><a href="#Shutdown_Command" >shutdown</a></td> <td>Shutdown the installer service.</td></tr>
+</table>
+
+You may obtain the above listing by simply executing 'managix' :
+
+
+ $ managix
+
+We already talked about create and validate commands. We shall next explain the rest of the commands listed above. We also provide sample output messages of these commands assuming we are running an ASTERIX instance on a single machine.
+
+##### Describe Command #####
+The `describe` command provides information about an ASTERIX instance. The usage can be looked up by executing the following:
+
+
+ $ managix help -cmd describe
+
+ Provides information about an ASTERIX instance.
+ The following options are available:
+ [-n] Name of the ASTERIX instance.
+ [-admin] Provides a detailed description
+
+The brackets indicate optional flags.
+
+The output of the `describe` command when used without the `admin` flag contains minimal information and is similar to the output of the create command. Let us try running the describe command in "admin" mode.
+
+
+ $ managix describe -n my_asterix -admin
+ INFO: Name:my_asterix
+ Created:Thu Mar 07 19:07:00 PST 2013
+ Web-Url:http://127.0.0.1:19001
+ State:ACTIVE
+ Master node:master:127.0.0.1
+ node1:127.0.0.1
+
+ Asterix version:0.0.5
+ Asterix Configuration
+ output_dir = /tmp/asterix_output/
+ Metadata Node:node1
+ Processes
+ NC at 127.0.0.1 [ 22195 ]
+ CC at 127.0.0.1 [ 22161 ]
+
+As seen above, the instance 'my_asterix' is configured such that all processes running at the localhost (127.0.0.1). The process id for each process (JVM) is shown next to it.
+
+##### Stop Command #####
+The `stop` command can be used for shutting down an ASTERIX instance. After that, the instance is unavailable for executing queries. The usage can be looked up by executing the following:
+
+
+ $ managix help -cmd stop
+
+ Shuts an ASTERIX instance that is in ACTIVE state. After executing the stop command, the ASTERIX instance transits
+ to the INACTIVE state, indicating that it is no longer available for executing queries.
+
+ Available arguments/options
+ -n name of the ASTERIX instance.
+
+To stop the ASTERIX instance.
+
+
+ $ managix stop -n my_asterix
+ INFO: Stopped Asterix instance: my_asterix
+
+
+ $ managix describe -n my_asterix
+ INFO: Name: my_asterix
+ Created:Thu Mar 07 19:07:00 PST 2013
+ Web-Url:http://127.0.0.1:19001
+ State:INACTIVE (Fri Mar 08 09:49:00 PST 2013)
+
+
+##### Start Command #####
+The `start` command starts an ASTERIX instance that is in the INACTIVE state. The usage can be looked up by executing the following:
+
+
+ $ managix help -cmd start
+
+ Starts an ASTERIX instance that is in INACTIVE state. After executing the start command, the ASTERIX instance transits to the ACTIVE state, indicating that it is now available for executing statements/queries.
+
+ Available arguments/options
+ -n name of the ASTERIX instance.
+
+Let us now start the ASTERIX instance.
+
+
+ $ managix start -n my_asterix
+ INFO: Name:my_asterix
+ Created:Thu Mar 07 19:07:00 PST 2013
+ Web-Url:http://127.0.0.1:19001
+ State:ACTIVE (Fri Mar 08 09:49:00 PST 2013)
+
+
+##### Backup Command #####
+
+In an undesirable event of data loss either due to a disk/system failure or accidental execution of a DDL statement (drop dataverse/dataset), you may need to recover the lost data. The backup command allows you to take a backup of the data stored with an ASTERIX instance. The backup can be taken on the local file system or on an HDFS instance. In either case, the snapshots are stored under a backup directory. You need to make sure the backup directory has appropriate read/write permissions. Configuring settings for backup can be found inside the Managix's configuration file located at `$MANAGIX_HOME/conf/managix-conf.xml`.
+
+*Configuring backup on the local file system*
+
+We need to provide path to a backup directory on the local file system. The backup directory can be configured be editing the Managix configuration XML, found at `$MANAGIX_HOME/conf/managix-conf.xml`.
+
+
+ <backup>
+ <backupDir>Provide path to the backup directory here</backupDir>
+ </backup>
+
+Prior to taking a backup of an ASTERIX instance, it is required for the instance to be in the INACTIVE state. We do so by using the `stop` command, as shown below:
+
+
+ $ managix stop -n my_asterix
+ INFO: Stopped Asterix instance: my_asterix
+
+We can now take the backup by executing the following:
+
+
+ $ managix backup -n my_asterix
+ INFO: my_asterix backed up 0_Fri Mar 08 16:16:34 PST 2013 (LOCAL)
+
+
+*Configuring backup on an HDFS instance*
+
+To configure a backups to be taken on an HDFS instance, we need to provide required information about the running HDFS instance. This information includes the HDFS version and the HDFS url. Simply edit the Managix configuration file and provide the required information.
+
+
+ <backup>
+ <backupDir>Provide path to the backup directory here</backupDir>
+ <hdfs>
+ <version>0.20.2</version>
+ <url></url>
+ </hdfs>
+ </backup>
+
+A sample output when a backup is taken on an HDFS is shown below:
+
+
+ $ managix backup -n my_asterix
+ INFO: my_asterix backed up 1_Fri Mar 08 17:10:38 PST 2013 (HDFS)
+
+
+Each time we take a backup, we are provided with a unique id (a monotonically increasing value starting with 0). This id is required when we need to restore from a previously taken backup. Information about all available backup snapshots can be obtained by using the `describe` command in the admin mode, as shown below:
+
+
+ $ managix describe -n my_asterix -admin
+ INFO: Name:my_asterix
+ Created:Fri Mar 08 15:11:12 PST 2013
+ Web-Url:http://127.0.0.1:19001
+ State:INACTIVE (Fri Mar 08 16:14:20 PST 2013)
+ Master node:master:127.0.0.1
+ node1:127.0.0.1
+
+ Backup:0 created at Fri Mar 08 16:16:34 PST 2013 (LOCAL)
+ Backup:1 created at Fri Mar 08 17:10:38 PST 2013 (HDFS)
+
+ Asterix version:0.0.5
+ Asterix Configuration
+ Metadata Node:node1
+ Processes
+
+
+The above output shows the available backup identified by it's id (0). We shall next describe the method for restoring an ASTERIX instance from a backup snapshot.
+
+##### Restore Command #####
+
+The `restore` command allows you to restore an ASTERIX instance's data from a previously taken backup. The usage description can be obtained as follows:
+
+
+ $ managix help -cmd restore
+
+ Restores an ASTERIX instance's data from a previously taken backup.
+ Available arguments/options
+
+ -n name of the ASTERIX instance
+ -b id of the backup snapshot
+
+
+The following command restores our ASTERIX instance from the backup snapshot identified by the id (0). Prior to restoring an instance from a backup, it is required that the instance is in the INACTIVE state.
+
+
+ $ managix restore -n my_asterix -b 0
+ INFO: Asterix instance: my_asterix has been restored from backup
+
+You can start the ASTERIX instance by using the start command.
+
+##### Delete Command #####
+As the name suggests, the `delete` command permanently removes an ASTERIX instance by cleaning up all associated data/artifacts. The usage can be looked up by executing the following:
+
+
+ $ managix help -cmd delete
+ Permanently deletes an ASTERIX instance. The instance must be in the INACTIVE state.
+
+ Available arguments/options
+ -n name of the ASTERIX instance.
+
+
+ $ managix delete -n my_asterix
+ INFO: Asterix instance my_asterix deleted.
+
+
+##### Shutdown Command #####
+Managix uses Zookeeper service for storing all information about created ASTERIX instances. The Zookeeper service runs in the background and can be shut down using the `shutdown` command.
+
+
+ $ managix shutdown
+
+
+##### Help Command #####
+The `help` command provides a usage description of a Managix command.
+
+
+ $ managix help -cmd <command name>
+
+As an example, for looking up the help for the `configure` command, execute the following
+
+
+ $ managix help -cmd configure
+
+ Auto-generates the ASTERIX installer configruation settings and ASTERIX cluster
+ configuration settings for a single node setup.
+
+
+## Section 5: Frequently Asked Questions ##
+
+
+*Question*
+What is meant by the "UNUSABLE" state in the lifecycle of an ASTERIX instance ?
+
+
+*Answer*
+When Managix fails to start a required process (CC/NC), the instance transits to an UNUSABLE state.
+The reason for the failure needs to be looked up in the logs.
+Before we attempt to start the instance again, any processes that got launched
+as part of failed attempt must be stopped. No other operation except "stop" is supported in the UNUSABLE state.
+
+Get rid of the started processes:-
+
+ $MANAGIX_HOME/bin/managix stop -n my_asterix
+
+
+Any processes associated with the instance are killed and the instance moves to the INACTIVE state.
+You may now delete the instance by executing the following
+
+
+ $MANAGIX_HOME/bin/managix delete -n <name of your ASTERIX instance>
+
+
+Note that above would remove all traces of the instance including the logs and thus the reason for the failed attempt.
+
+OR
+
+make a subsequent attempt to start the instance if you realized a mistake in the cluster configuration XML and have corrected it. To start the instance, we execute the following.
+
+
+ $MANAGIX_HOME/bin/managix start -n <name of your ASTERIX instance>
+
diff --git a/asterix-doc/src/site/markdown/aql.md b/asterix-doc/src/site/markdown/aql.md
deleted file mode 100644
index c03d7e5..0000000
--- a/asterix-doc/src/site/markdown/aql.md
+++ /dev/null
@@ -1,191 +0,0 @@
-# The Asterix Query Language, Version 1.0
-## 1. Introduction
-
-This document provides an overview of the Asterix Query language.
-
-## 2. Expressions
-
- Expression ::= ( OperatorExpr | IfThenElse | FLWOGR | QuantifiedExpression )
-
-### Primary Expressions
-
- PrimaryExpr ::= Literal | VariableRef | ParenthesizedExpression | FunctionCallExpr
- | DatasetAccessExpression | ListConstructor | RecordConstructor
-
-#### Literals
-
- Literal ::= StringLiteral | <INTEGER_LITERAL> | <FLOAT_LITERAL> | <DOUBLE_LITERAL> | <NULL> | <TRUE> | <FALSE>
- StringLiteral ::= <STRING_LITERAL>
-
-#### Variable References
-
- VariableRef ::= <VARIABLE>
-
-#### Parenthesized Expressions
-
- ParenthesizedExpression ::= <LEFTPAREN> Expression <RIGHTPAREN>
-
-#### Function Calls
-
- FunctionCallExpr ::= FunctionOrTypeName <LEFTPAREN> ( Expression ( "," Expression )* )? <RIGHTPAREN>
-
-#### Dataset Access
-
- DatasetAccessExpression ::= <DATASET> ( ( Identifier ( "." Identifier )? )
- | ( <LEFTPAREN> Expression ( "," Expression )* <RIGHTPAREN> ) )
- Identifier ::= <IDENTIFIER> | StringLiteral
-
-#### Constructors
-
- ListConstructor ::= ( OrderedListConstructor | UnorderedListConstructor )
- OrderedListConstructor ::= "[" ( Expression ( "," Expression )* )? "]"
- UnorderedListConstructor ::= "{{" ( Expression ( "," Expression )* )? "}}"
- RecordConstructor ::= "{" ( FieldBinding ( "," FieldBinding )* )? "}"
- FieldBinding ::= Expression ":" Expression
-
-### Path Expressions
-
- ValueExpr ::= PrimaryExpr ( Field | Index )*
- Field ::= "." Identifier
- Index ::= "[" ( Expression | "?" ) "]"
-
-### Logical Expressions
-
- OperatorExpr ::= AndExpr ( "or" AndExpr )*
- AndExpr ::= RelExpr ( "and" RelExpr )*
-
-### Comparison Expressions
-
- RelExpr ::= AddExpr ( ( "<" | ">" | "<=" | ">=" | "=" | "!=" | "~=" ) AddExpr )?
-
-### Arithmetic Expressions
-
- AddExpr ::= MultExpr ( ( "+" | "-" ) MultExpr )*
- MultExpr ::= UnaryExpr ( ( "*" | "/" | "%" | <CARET> | "idiv" ) UnaryExpr )*
- UnaryExpr ::= ( ( "+" | "-" ) )? ValueExpr
-
-### FLWOGR Expression
-
- FLWOGR ::= ( ForClause | LetClause ) ( Clause )* "return" Expression
- Clause ::= ForClause | LetClause | WhereClause | OrderbyClause
- | GroupClause | LimitClause | DistinctClause
- ForClause ::= "for" Variable ( "at" Variable )? "in" ( Expression )
- LetClause ::= "let" Variable ":=" Expression
- WhereClause ::= "where" Expression
- OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )?
- ( "," Expression ( ( "asc" ) | ( "desc" ) )? )*
- GroupClause ::= "group" "by" ( Variable ":=" )? Expression ( "," ( Variable ":=" )? Expression )*
- "with" VariableRef ( "," VariableRef )*
- LimitClause ::= "limit" Expression ( "offset" Expression )?
- DistinctClause ::= "distinct" "by" Expression ( "," Expression )*
- Variable ::= <VARIABLE>
-
-
-### Conditional Expression
-
- IfThenElse ::= "if" <LEFTPAREN> Expression <RIGHTPAREN> "then" Expression "else" Expression
-
-
-### Quantified Expressions
-
- QuantifiedExpression ::= ( ( "some" ) | ( "every" ) ) Variable "in" Expression
- ( "," Variable "in" Expression )* "satisfies" Expression
-
-
-## 3. Statements
-
- Statement ::= ( SingleStatement ( ";" )? )* <EOF>
- SingleStatement ::= DataverseDeclaration
- | FunctionDeclaration
- | CreateStatement
- | DropStatement
- | LoadStatement
- | SetStatement
- | InsertStatement
- | DeleteStatement
- | FeedStatement
- | Query
-
-### Declarations
-
- DataverseDeclaration ::= "use" "dataverse" Identifier
- SetStatement ::= "set" Identifier StringLiteral
- FunctionDeclaration ::= "declare" "function" Identifier <LEFTPAREN> ( <VARIABLE> ( "," <VARIABLE> )* )? <RIGHTPAREN> "{" Expression "}"
-
-### Lifecycle Management Statements
-
- CreateStatement ::= "create" ( TypeSpecification | DatasetSpecification | IndexSpecification | DataverseSpecification | FunctionSpecification )
-
- DropStatement ::= "drop" ( <DATASET> QualifiedName IfExists
- | "index" DoubleQualifiedName IfExists
- | "type" FunctionOrTypeName IfExists
- | "dataverse" Identifier IfExists
- | "function" FunctionSignature IfExists )
- IfExists ::= ( "if" "exists" )?
- QualifiedName ::= Identifier ( "." Identifier )?
- DoubleQualifiedName ::= Identifier "." Identifier ( "." Identifier )?
-
-#### Types
-
- TypeSpecification ::= "type" FunctionOrTypeName IfNotExists "as" TypeExpr
- FunctionOrTypeName ::= QualifiedName
- IfNotExists ::= ( "if not exists" )?
- TypeExpr ::= RecordTypeDef | TypeReference | OrderedListTypeDef | UnorderedListTypeDef
- RecordTypeDef ::= ( "closed" | "open" )? "{" ( RecordField ( "," RecordField )* )? "}"
- RecordField ::= Identifier ":" ( TypeExpr ) ( "?" )?
- TypeReference ::= Identifier
- OrderedListTypeDef ::= "[" ( TypeExpr ) "]"
- UnorderedListTypeDef ::= "{{" ( TypeExpr ) "}}"
-
-#### Datasets
-
- DatasetSpecification ::= "external" <DATASET> QualifiedName <LEFTPAREN> Identifier <RIGHTPAREN> IfNotExists
- "using" AdapterName Configuration ( "hints" Properties )?
- | "feed" <DATASET> QualifiedName <LEFTPAREN> Identifier <RIGHTPAREN> IfNotExists
- "using" AdapterName Configuration ( ApplyFunction )? PrimaryKey ( "on" Identifier )? ( "hints" Properties )?
- | <DATASET> QualifiedName <LEFTPAREN> Identifier <RIGHTPAREN> IfNotExists
- PrimaryKey ( "on" Identifier )? ( "hints" Properties )?
- AdapterName ::= Identifier
- Configuration ::= <LEFTPAREN> ( KeyValuePair ( "," KeyValuePair )* )? <RIGHTPAREN>
- KeyValuePair ::= <LEFTPAREN> StringLiteral "=" StringLiteral <RIGHTPAREN>
- Properties ::= ( <LEFTPAREN> Property ( "," Property )* <RIGHTPAREN> )?
- Property ::= Identifier "=" ( StringLiteral | <INTEGER_LITERAL> )
- ApplyFunction ::= "apply" "function" FunctionSignature
- FunctionSignature ::= FunctionOrTypeName "@" <INTEGER_LITERAL>
- PrimaryKey ::= "primary" "key" Identifier ( "," Identifier )*
-
-#### Indices
-
- IndexSpecification ::= "index" Identifier IfNotExists "on" QualifiedName <LEFTPAREN> ( Identifier ) ( "," Identifier )* <RIGHTPAREN> ( "type" IndexType )?
- IndexType ::= "btree" | "rtree" | "keyword" | "fuzzy keyword" | "ngram" <LEFTPAREN> <INTEGER_LITERAL> <RIGHTPAREN> | "fuzzy ngram" <LEFTPAREN> <INTEGER_LITERAL> <RIGHTPAREN>
-
-#### Dataverses
-
- DataverseSpecification ::= "dataverse" Identifier IfNotExists ( "with format" StringLiteral )?
-
-#### Functions
-
- FunctionSpecification ::= "function" FunctionOrTypeName IfNotExists <LEFTPAREN> ( <VARIABLE> ( "," <VARIABLE> )* )? <RIGHTPAREN> "{" Expression "}"
-
-
-### Import/Export Statements
-
- LoadStatement ::= "load" <DATASET> QualifiedName "using" AdapterName Configuration ( "pre-sorted" )?
-
-### Modification Statements
-
- InsertStatement ::= "insert" "into" <DATASET> QualifiedName Query
- DeleteStatement ::= "delete" Variable "from" <DATASET> QualifiedName ( "where" Expression )?
-
-### Feed Management Statements
-
- FeedStatement ::= "begin" "feed" QualifiedName
- | "suspend" "feed" QualifiedName
- | "resume" "feed" QualifiedName
- | "end" "feed" QualifiedName
- | "alter" "feed" QualifiedName "set" Configuration
-
-### Queries
-
- Query ::= Expression
-
diff --git a/asterix-doc/src/site/markdown/index.md b/asterix-doc/src/site/markdown/index.md
new file mode 100644
index 0000000..cba2fdc
--- /dev/null
+++ b/asterix-doc/src/site/markdown/index.md
@@ -0,0 +1 @@
+# AsterixDB
diff --git a/asterix-doc/src/site/site.xml b/asterix-doc/src/site/site.xml
new file mode 100644
index 0000000..6724153
--- /dev/null
+++ b/asterix-doc/src/site/site.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project name="AsterixDB" xmlns="http://maven.apache.org/DECORATION/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+ <!--
+ <bannerLeft>
+ <name>Asterix</name>
+ <src>http://asterix.ics.uci.edu/pic/img9.jpg</src>
+ <href>http://asterix.ics.uci.edu/</href>
+ </bannerLeft>
+ -->
+
+ <skin>
+ <groupId>org.apache.maven.skins</groupId>
+ <artifactId>maven-fluido-skin</artifactId>
+ <version>1.2.1</version>
+ </skin>
+ <custom>
+ <fluidoSkin>
+ <sideBarEnabled>true</sideBarEnabled>
+ <!-- <googlePlusOne /> -->
+ </fluidoSkin>
+ </custom>
+
+ <body>
+ <links>
+ <item name="Home" href="index.html"/>
+ </links>
+
+ <menu name="Documentation">
+ <item name="AsterixDB: A Big Data Management System" href="AsterixAlphaRelease.html"/>
+ <item name="Installing Asterix using Managix" href="InstallingAsterixUsingManagix.html"/>
+ <item name="AsterixDB 101: An ADM and AQL Primer" href="AdmAql101.html"/>
+ <item name="Asterix Data Model (ADM)" href="AsterixDBDataModel.html"/>
+ <item name="AsterixDB Functions" href="AsterixDBFunctions.html"/>
+ <item name="The Asterix Query Language" href="AsterixQueryLanguageReference.html"/>
+ <item name="AsterixDB Support of Similarity Queries" href="AsterixSimilarityQueries.html"/>
+ <item name="Accessing External Data in AsterixDB" href="AccessingExternalDataInAsterixDB.html"/>
+ <item name="REST API to AsterixDB" href="AsterixDBRestAPI.html"/>
+ <item name="(old AQL doc)" href="AsterixQueryLanguage.html"/>
+ </menu>
+
+ <menu ref="reports"/>
+ </body>
+</project>
diff --git a/asterix-events/pom.xml b/asterix-events/pom.xml
index 94042e1..108bde2 100644
--- a/asterix-events/pom.xml
+++ b/asterix-events/pom.xml
@@ -173,5 +173,10 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.9</version>
+ </dependency>
</dependencies>
</project>
diff --git a/asterix-external-data/pom.xml b/asterix-external-data/pom.xml
index 2e99b7c..842cd67 100644
--- a/asterix-external-data/pom.xml
+++ b/asterix-external-data/pom.xml
@@ -71,9 +71,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.5</version>
<type>jar</type>
- <scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -119,6 +117,12 @@
<version>1.0.0</version>
<type>jar</type>
<scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>rome</artifactId>
+ <groupId>net.java.dev.rome</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>rome</groupId>
diff --git a/asterix-installer/src/main/resources/conf/asterix-configuration.xml b/asterix-installer/src/main/resources/conf/asterix-configuration.xml
index b6958c5..bfec2db 100644
--- a/asterix-installer/src/main/resources/conf/asterix-configuration.xml
+++ b/asterix-installer/src/main/resources/conf/asterix-configuration.xml
@@ -55,7 +55,7 @@
<property>
<name>storage.memorycomponent.globalbudget</name>
- <value>1073741824</value>
+ <value>263435456</value>
<description>The total size of memory in bytes that the sum of all
open memory
components cannot exceed. (Default = "1073741824" // 1GB)
diff --git a/asterix-metadata/pom.xml b/asterix-metadata/pom.xml
index 425e8ff..6f70568 100644
--- a/asterix-metadata/pom.xml
+++ b/asterix-metadata/pom.xml
@@ -42,6 +42,12 @@
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>edu.uci.ics.asterix</groupId>
+ <artifactId>asterix-runtime</artifactId>
+ <version>0.0.6-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.20.2</version>
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataCache.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataCache.java
index 0382315..1496208 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataCache.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataCache.java
@@ -22,8 +22,8 @@
import edu.uci.ics.asterix.common.functions.FunctionSignature;
import edu.uci.ics.asterix.metadata.api.IMetadataEntity;
-import edu.uci.ics.asterix.metadata.entities.DatasourceAdapter;
import edu.uci.ics.asterix.metadata.entities.Dataset;
+import edu.uci.ics.asterix.metadata.entities.DatasourceAdapter;
import edu.uci.ics.asterix.metadata.entities.Datatype;
import edu.uci.ics.asterix.metadata.entities.Dataverse;
import edu.uci.ics.asterix.metadata.entities.Function;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java
index 09ec2f7..f9f5260 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java
@@ -21,7 +21,9 @@
import java.util.concurrent.locks.ReentrantReadWriteLock;
import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
import edu.uci.ics.asterix.common.functions.FunctionSignature;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.metadata.api.IAsterixStateProxy;
import edu.uci.ics.asterix.metadata.api.IMetadataManager;
import edu.uci.ics.asterix.metadata.api.IMetadataNode;
@@ -33,8 +35,6 @@
import edu.uci.ics.asterix.metadata.entities.Index;
import edu.uci.ics.asterix.metadata.entities.Node;
import edu.uci.ics.asterix.metadata.entities.NodeGroup;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.asterix.transaction.management.service.transaction.JobIdFactory;
/**
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataNode.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataNode.java
index 5bdf086..5aca7c4 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataNode.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataNode.java
@@ -19,11 +19,18 @@
import java.util.ArrayList;
import java.util.List;
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
-import edu.uci.ics.asterix.common.context.AsterixAppRuntimeContext;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.common.functions.FunctionSignature;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.IResourceManager.ResourceType;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext.TransactionType;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.metadata.api.IMetadataIndex;
import edu.uci.ics.asterix.metadata.api.IMetadataNode;
@@ -55,16 +62,9 @@
import edu.uci.ics.asterix.om.base.AMutableString;
import edu.uci.ics.asterix.om.base.AString;
import edu.uci.ics.asterix.om.types.BuiltinType;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
import edu.uci.ics.asterix.transaction.management.opcallbacks.PrimaryIndexModificationOperationCallback;
import edu.uci.ics.asterix.transaction.management.opcallbacks.SecondaryIndexModificationOperationCallback;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetIdFactory;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager.ResourceType;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext.TransactionType;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -93,7 +93,7 @@
private static final DatasetId METADATA_DATASET_ID = new DatasetId(MetadataPrimaryIndexes.METADATA_DATASET_ID);
private IIndexLifecycleManager indexLifecycleManager;
- private TransactionSubsystem transactionSubsystem;
+ private ITransactionSubsystem transactionSubsystem;
public static final MetadataNode INSTANCE = new MetadataNode();
@@ -101,7 +101,7 @@
super();
}
- public void initialize(AsterixAppRuntimeContext runtimeContext) {
+ public void initialize(IAsterixAppRuntimeContext runtimeContext) {
this.transactionSubsystem = runtimeContext.getTransactionSubsystem();
this.indexLifecycleManager = runtimeContext.getIndexLifecycleManager();
}
@@ -113,14 +113,14 @@
@Override
public void commitTransaction(JobId jobId) throws RemoteException, ACIDException {
- TransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
transactionSubsystem.getTransactionManager().commitTransaction(txnCtx, new DatasetId(-1), -1);
}
@Override
public void abortTransaction(JobId jobId) throws RemoteException, ACIDException {
try {
- TransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
transactionSubsystem.getTransactionManager().abortTransaction(txnCtx, new DatasetId(-1), -1);
} catch (ACIDException e) {
e.printStackTrace();
@@ -130,13 +130,13 @@
@Override
public void lock(JobId jobId, byte lockMode) throws ACIDException, RemoteException {
- TransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
transactionSubsystem.getLockManager().lock(METADATA_DATASET_ID, -1, lockMode, txnCtx);
}
@Override
public void unlock(JobId jobId) throws ACIDException, RemoteException {
- TransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
transactionSubsystem.getLockManager().unlock(METADATA_DATASET_ID, -1, txnCtx);
}
@@ -271,7 +271,7 @@
IIndexAccessor indexAccessor = lsmIndex.createAccessor(modCallback, NoOpOperationCallback.INSTANCE);
- TransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
txnCtx.setTransactionType(TransactionType.READ_WRITE);
// TODO: fix exceptions once new BTree exception model is in hyracks.
@@ -282,7 +282,7 @@
private IModificationOperationCallback createIndexModificationCallback(JobId jobId, long resourceId,
IMetadataIndex metadataIndex, ILSMIndex lsmIndex, IndexOperation indexOp) throws Exception {
- TransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
if (metadataIndex.isPrimaryIndex()) {
return new PrimaryIndexModificationOperationCallback(metadataIndex.getDatasetId().getId(),
@@ -573,7 +573,7 @@
lsmIndex, IndexOperation.DELETE);
IIndexAccessor indexAccessor = lsmIndex.createAccessor(modCallback, NoOpOperationCallback.INSTANCE);
- TransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId);
txnCtx.setTransactionType(TransactionType.READ_WRITE);
indexAccessor.delete(tuple);
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataTransactionContext.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataTransactionContext.java
index cbd37d6..c76fb16 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataTransactionContext.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataTransactionContext.java
@@ -18,6 +18,7 @@
import java.util.ArrayList;
import edu.uci.ics.asterix.common.functions.FunctionSignature;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.external.dataset.adapter.AdapterIdentifier;
import edu.uci.ics.asterix.metadata.api.IMetadataEntity;
import edu.uci.ics.asterix.metadata.entities.Dataset;
@@ -27,7 +28,6 @@
import edu.uci.ics.asterix.metadata.entities.Function;
import edu.uci.ics.asterix.metadata.entities.Index;
import edu.uci.ics.asterix.metadata.entities.NodeGroup;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
/**
* Used to implement serializable transactions against the MetadataCache.
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataIndex.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataIndex.java
index ca6ab08..efd8ecb 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataIndex.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataIndex.java
@@ -17,16 +17,13 @@
import java.util.List;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.logging.IndexLogger;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
import edu.uci.ics.hyracks.api.io.FileReference;
-import edu.uci.ics.hyracks.storage.am.common.api.IIndex;
/**
* Descriptor interface for a primary or secondary index on metadata datasets.
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataManager.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataManager.java
index f11144e..527ee91 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataManager.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataManager.java
@@ -18,19 +18,18 @@
import java.rmi.RemoteException;
import java.util.List;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
import edu.uci.ics.asterix.common.functions.FunctionSignature;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.MetadataTransactionContext;
-import edu.uci.ics.asterix.metadata.entities.DatasourceAdapter;
import edu.uci.ics.asterix.metadata.entities.Dataset;
+import edu.uci.ics.asterix.metadata.entities.DatasourceAdapter;
import edu.uci.ics.asterix.metadata.entities.Datatype;
import edu.uci.ics.asterix.metadata.entities.Dataverse;
import edu.uci.ics.asterix.metadata.entities.Function;
import edu.uci.ics.asterix.metadata.entities.Index;
import edu.uci.ics.asterix.metadata.entities.Node;
import edu.uci.ics.asterix.metadata.entities.NodeGroup;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
/**
* A metadata manager provides user access to Asterix metadata (e.g., types,
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataNode.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataNode.java
index e0b5e96..9ec233b 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataNode.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IMetadataNode.java
@@ -20,18 +20,18 @@
import java.rmi.RemoteException;
import java.util.List;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
import edu.uci.ics.asterix.common.functions.FunctionSignature;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.metadata.MetadataException;
-import edu.uci.ics.asterix.metadata.entities.DatasourceAdapter;
import edu.uci.ics.asterix.metadata.entities.Dataset;
+import edu.uci.ics.asterix.metadata.entities.DatasourceAdapter;
import edu.uci.ics.asterix.metadata.entities.Datatype;
import edu.uci.ics.asterix.metadata.entities.Dataverse;
import edu.uci.ics.asterix.metadata.entities.Function;
import edu.uci.ics.asterix.metadata.entities.Index;
import edu.uci.ics.asterix.metadata.entities.Node;
import edu.uci.ics.asterix.metadata.entities.NodeGroup;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
/**
* A metadata node stores metadata in its local storage structures (currently
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IValueExtractor.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IValueExtractor.java
index d8958dd..6994bdc 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IValueExtractor.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IValueExtractor.java
@@ -17,8 +17,8 @@
import java.io.IOException;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.metadata.MetadataException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
index f3ccc9c..422fdfd 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -26,13 +26,15 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
-import edu.uci.ics.asterix.common.context.AsterixAppRuntimeContext;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.IResourceManager.ResourceType;
+import edu.uci.ics.asterix.common.transactions.TransactionalResourceManagerRepository;
import edu.uci.ics.asterix.external.adapter.factory.IAdapterFactory;
import edu.uci.ics.asterix.external.dataset.adapter.AdapterIdentifier;
import edu.uci.ics.asterix.metadata.IDatasetDetails;
@@ -55,13 +57,11 @@
import edu.uci.ics.asterix.om.types.BuiltinType;
import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.asterix.runtime.formats.NonTaggedDataFormat;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
import edu.uci.ics.asterix.transaction.management.resource.ILocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.LSMBTreeLocalResourceMetadata;
import edu.uci.ics.asterix.transaction.management.resource.PersistentLocalResourceFactoryProvider;
-import edu.uci.ics.asterix.transaction.management.resource.TransactionalResourceManagerRepository;
import edu.uci.ics.asterix.transaction.management.service.logging.IndexResourceManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager.ResourceType;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
import edu.uci.ics.hyracks.api.application.INCApplicationContext;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
@@ -73,6 +73,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.frames.LIFOMetaDataFrameFactory;
+import edu.uci.ics.hyracks.storage.am.common.util.IndexFileNameUtil;
import edu.uci.ics.hyracks.storage.am.lsm.btree.impls.LSMBTree;
import edu.uci.ics.hyracks.storage.am.lsm.btree.util.LSMBTreeUtils;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.IInMemoryBufferCache;
@@ -101,7 +102,7 @@
private static final int DEFAULT_MEM_PAGE_SIZE = 32768;
private static final int DEFAULT_MEM_NUM_PAGES = 100;
- private static AsterixAppRuntimeContext runtimeContext;
+ private static IAsterixAppRuntimeContext runtimeContext;
private static IBufferCache bufferCache;
private static IFileMapProvider fileMapProvider;
@@ -132,7 +133,7 @@
public static void startUniverse(IAsterixPropertiesProvider asterixPropertiesProvider,
INCApplicationContext ncApplicationContext, boolean isNewUniverse) throws Exception {
- runtimeContext = (AsterixAppRuntimeContext) ncApplicationContext.getApplicationObject();
+ runtimeContext = (IAsterixAppRuntimeContext) ncApplicationContext.getApplicationObject();
propertiesProvider = asterixPropertiesProvider;
// Initialize static metadata objects, such as record types and metadata
@@ -333,7 +334,9 @@
}
private static void enlistMetadataDataset(IMetadataIndex index, boolean create) throws Exception {
- String filePath = metadataStore + File.separator + index.getFileNameRelativePath();
+ String filePath = IndexFileNameUtil.prepareFileName(
+ metadataStore + File.separator + index.getFileNameRelativePath(),
+ runtimeContext.getMetaDataIODeviceId());
FileReference file = new FileReference(new File(filePath));
IInMemoryBufferCache memBufferCache = new InMemoryBufferCache(new HeapBufferAllocator(), DEFAULT_MEM_PAGE_SIZE,
DEFAULT_MEM_NUM_PAGES, new TransientFileMapManager());
@@ -350,7 +353,7 @@
fileMapProvider, typeTraits, comparatorFactories, bloomFilterKeyFields,
runtimeContext.getBloomFilterFalsePositiveRate(), runtimeContext.getLSMMergePolicy(),
runtimeContext.getLSMBTreeOperationTrackerFactory(), runtimeContext.getLSMIOScheduler(),
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER);
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, runtimeContext.getMetaDataIODeviceId());
lsmBtree.create();
resourceID = runtimeContext.getResourceIdFactory().createId();
indexLifecycleManager.register(resourceID, lsmBtree);
@@ -358,12 +361,14 @@
AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
ILocalResourceMetadata localResourceMetadata = new LSMBTreeLocalResourceMetadata(typeTraits,
comparatorFactories, bloomFilterKeyFields, index.isPrimaryIndex(),
- storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages());
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages(),
+ runtimeContext.getMetaDataIODeviceId());
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMBTreeResource);
ILocalResourceFactory localResourceFactory = localResourceFactoryProvider.getLocalResourceFactory();
- localResourceRepository.insert(localResourceFactory.createLocalResource(resourceID, file.getFile()
- .getPath(), 0));
+ localResourceRepository.insert(
+ localResourceFactory.createLocalResource(resourceID, file.getFile().getPath(), 0),
+ runtimeContext.getMetaDataIODeviceId());
} else {
resourceID = localResourceRepository.getResourceByName(file.getFile().getPath()).getResourceId();
lsmBtree = (LSMBTree) indexLifecycleManager.getIndex(resourceID);
@@ -372,7 +377,7 @@
bufferCache, fileMapProvider, typeTraits, comparatorFactories, bloomFilterKeyFields,
runtimeContext.getBloomFilterFalsePositiveRate(), runtimeContext.getLSMMergePolicy(),
runtimeContext.getLSMBTreeOperationTrackerFactory(), runtimeContext.getLSMIOScheduler(),
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER);
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, runtimeContext.getMetaDataIODeviceId());
indexLifecycleManager.register(resourceID, lsmBtree);
}
}
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataIndex.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataIndex.java
index c0ce030..8036cfb 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataIndex.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataIndex.java
@@ -20,6 +20,7 @@
import java.util.List;
import edu.uci.ics.asterix.common.exceptions.AsterixRuntimeException;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryHashFunctionFactoryProvider;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -27,17 +28,12 @@
import edu.uci.ics.asterix.metadata.api.IMetadataIndex;
import edu.uci.ics.asterix.om.types.ARecordType;
import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.logging.IndexLogger;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager.ResourceType;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
import edu.uci.ics.hyracks.api.io.FileReference;
-import edu.uci.ics.hyracks.storage.am.common.api.IIndex;
/**
* Descriptor for a primary or secondary index on metadata datasets.
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataPrimaryIndexes.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataPrimaryIndexes.java
index 2fc3e59..5bd7960 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataPrimaryIndexes.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataPrimaryIndexes.java
@@ -32,7 +32,6 @@
public static IMetadataIndex NODE_DATASET;
public static IMetadataIndex NODEGROUP_DATASET;
public static IMetadataIndex FUNCTION_DATASET;
-
public static final int METADATA_DATASET_ID = 0;
public static final int DATAVERSE_DATASET_ID = 1;
public static final int DATASET_DATASET_ID = 2;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledMetadataDeclarations.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledMetadataDeclarations.java
index f79b9b7..5444ac2 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledMetadataDeclarations.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledMetadataDeclarations.java
@@ -22,7 +22,6 @@
import java.util.logging.Logger;
import edu.uci.ics.asterix.common.annotations.TypeDataGen;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
@@ -38,6 +37,7 @@
import edu.uci.ics.asterix.metadata.entities.InternalDatasetDetails;
import edu.uci.ics.asterix.metadata.entities.NodeGroup;
import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.AsterixAppContextInfo;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlDataSource.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlDataSource.java
index e4c7ba2..0ed3c78 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlDataSource.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlDataSource.java
@@ -17,7 +17,6 @@
import java.io.IOException;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -28,6 +27,7 @@
import edu.uci.ics.asterix.om.types.ARecordType;
import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.common.utils.ListSet;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSource;
import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSourcePropertiesProvider;
@@ -219,7 +219,7 @@
if (n < 2) {
pp = new RandomPartitioningProperty(domain);
} else {
- Set<LogicalVariable> pvars = new HashSet<LogicalVariable>();
+ Set<LogicalVariable> pvars = new ListSet<LogicalVariable>();
int i = 0;
for (LogicalVariable v : scanVariables) {
pvars.add(v);
@@ -239,7 +239,7 @@
if (n < 2) {
pp = new RandomPartitioningProperty(domain);
} else {
- Set<LogicalVariable> pvars = new HashSet<LogicalVariable>();
+ Set<LogicalVariable> pvars = new ListSet<LogicalVariable>();
int i = 0;
for (LogicalVariable v : scanVariables) {
pvars.add(v);
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
index 2e45802..117f492 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
@@ -23,15 +23,16 @@
import java.util.Map;
import java.util.logging.Logger;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
import edu.uci.ics.asterix.common.config.GlobalConfig;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
+import edu.uci.ics.asterix.common.context.ITransactionSubsystemProvider;
import edu.uci.ics.asterix.common.context.TransactionSubsystemProvider;
import edu.uci.ics.asterix.common.dataflow.IAsterixApplicationContextInfo;
import edu.uci.ics.asterix.common.parse.IParseFileSplitsDecl;
+import edu.uci.ics.asterix.common.transactions.IResourceManager.ResourceType;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.dataflow.data.nontagged.valueproviders.AqlPrimitiveValueProviderFactory;
import edu.uci.ics.asterix.external.adapter.factory.IAdapterFactory;
import edu.uci.ics.asterix.external.adapter.factory.IGenericDatasetAdapterFactory;
@@ -64,6 +65,8 @@
import edu.uci.ics.asterix.om.types.ARecordType;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.AsterixAppContextInfo;
+import edu.uci.ics.asterix.om.util.AsterixClusterProperties;
import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
import edu.uci.ics.asterix.runtime.base.AsterixTupleFilterFactory;
import edu.uci.ics.asterix.runtime.formats.FormatUtils;
@@ -74,8 +77,7 @@
import edu.uci.ics.asterix.transaction.management.opcallbacks.PrimaryIndexSearchOperationCallbackFactory;
import edu.uci.ics.asterix.transaction.management.opcallbacks.SecondaryIndexModificationOperationCallbackFactory;
import edu.uci.ics.asterix.transaction.management.opcallbacks.SecondaryIndexSearchOperationCallbackFactory;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager.ResourceType;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -417,7 +419,8 @@
adapterFactoryClassname = adapterFactoryMapping.get(adapterName);
if (adapterFactoryClassname != null) {
} else {
- // adapterName has been provided as a fully qualified classname
+ // adapterName has been provided as a fully qualified
+ // classname
adapterFactoryClassname = adapterName;
}
adapterFactory = (IAdapterFactory) Class.forName(adapterFactoryClassname).newInstance();
@@ -530,7 +533,7 @@
}
AqlMetadataImplConfig aqlMetadataImplConfig = (AqlMetadataImplConfig) implConfig;
- TransactionSubsystemProvider txnSubsystemProvider = new TransactionSubsystemProvider();
+ ITransactionSubsystemProvider txnSubsystemProvider = new TransactionSubsystemProvider();
if (aqlMetadataImplConfig != null && aqlMetadataImplConfig.isInstantLock()) {
searchCallbackFactory = new PrimaryIndexInstantSearchOperationCallbackFactory(jobId, datasetId,
primaryKeyFields, txnSubsystemProvider, ResourceType.LSM_BTREE);
@@ -550,6 +553,7 @@
storageProperties.getMemoryComponentPageSize(),
storageProperties.getMemoryComponentNumPages(),
storageProperties.getBloomFilterFalsePositiveRate()), retainInput, searchCallbackFactory);
+
return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(btreeSearchOp, spPc.second);
} catch (MetadataException me) {
@@ -767,9 +771,11 @@
numElementsHint = Long.parseLong(dataset.getHints().get("CARDINALITY"));
}
- //TODO
- //figure out the right behavior of the bulkload and then give the right callback
- //(ex. what's the expected behavior when there is an error during bulkload?)
+ // TODO
+ // figure out the right behavior of the bulkload and then give the
+ // right callback
+ // (ex. what's the expected behavior when there is an error during
+ // bulkload?)
TreeIndexBulkLoadOperatorDescriptor btreeBulkLoad = new TreeIndexBulkLoadOperatorDescriptor(spec,
appContext.getStorageManagerInterface(), appContext.getIndexLifecycleManagerProvider(),
splitsAndConstraint.first, typeTraits, comparatorFactories, bloomFilterKeyFields, fieldPermutation,
@@ -828,7 +834,7 @@
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint = splitProviderAndPartitionConstraintsForInternalOrFeedDataset(
dataSource.getId().getDataverseName(), datasetName, indexName);
- //prepare callback
+ // prepare callback
JobId jobId = ((JobEventListenerFactory) spec.getJobletEventListenerFactory()).getJobId();
int datasetId = dataset.getDatasetId();
int[] primaryKeyFields = new int[numKeys];
@@ -1021,7 +1027,7 @@
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint = splitProviderAndPartitionConstraintsForInternalOrFeedDataset(
dataverseName, datasetName, indexName);
- //prepare callback
+ // prepare callback
JobId jobId = ((JobEventListenerFactory) spec.getJobletEventListenerFactory()).getJobId();
int datasetId = dataset.getDatasetId();
int[] primaryKeyFields = new int[primaryKeys.size()];
@@ -1136,7 +1142,8 @@
tokenComparatorFactories[0] = NonTaggedFormatUtil.getTokenBinaryComparatorFactory(secondaryKeyType);
tokenTypeTraits[0] = NonTaggedFormatUtil.getTokenTypeTrait(secondaryKeyType);
if (isPartitioned) {
- // The partitioning field is hardcoded to be a short *without* an Asterix type tag.
+ // The partitioning field is hardcoded to be a short *without*
+ // an Asterix type tag.
tokenComparatorFactories[1] = PointableBinaryComparatorFactory.of(ShortPointable.FACTORY);
tokenTypeTraits[1] = ShortPointable.TYPE_TRAITS;
}
@@ -1147,7 +1154,7 @@
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint = splitProviderAndPartitionConstraintsForInternalOrFeedDataset(
dataverseName, datasetName, indexName);
- //prepare callback
+ // prepare callback
JobId jobId = ((JobEventListenerFactory) spec.getJobletEventListenerFactory()).getJobId();
int datasetId = dataset.getDatasetId();
int[] primaryKeyFields = new int[primaryKeys.size()];
@@ -1242,7 +1249,7 @@
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint = splitProviderAndPartitionConstraintsForInternalOrFeedDataset(
dataverseName, datasetName, indexName);
- //prepare callback
+ // prepare callback
JobId jobId = ((JobEventListenerFactory) spec.getJobletEventListenerFactory()).getJobId();
int datasetId = dataset.getDatasetId();
int[] primaryKeyFields = new int[numPrimaryKeys];
@@ -1336,8 +1343,13 @@
continue;
}
for (int i = 0; i < nodeStores.length; i++) {
- File f = new File(nodeStores[i] + File.separator + relPathFile);
- splits.add(new FileSplit(node, new FileReference(f)));
+ int numIODevices = AsterixClusterProperties.INSTANCE.getNumberOfIODevices(node);
+ for (int j = 0; j < nodeStores.length; j++) {
+ for (int k = 0; k < numIODevices; k++) {
+ File f = new File(nodeStores[j] + File.separator + relPathFile);
+ splits.add(new FileSplit(node, new FileReference(f), k));
+ }
+ }
}
}
return splits.toArray(new FileSplit[] {});
@@ -1366,9 +1378,17 @@
LOGGER.warning("Node " + nd + " has no stores.");
throw new AlgebricksException("Node " + nd + " has no stores.");
} else {
+ int numIODevices;
+ if (datasetDetails.getNodeGroupName().compareTo(MetadataConstants.METADATA_NODEGROUP_NAME) == 0) {
+ numIODevices = 1;
+ } else {
+ numIODevices = AsterixClusterProperties.INSTANCE.getNumberOfIODevices(nd);
+ }
for (int j = 0; j < nodeStores.length; j++) {
- File f = new File(nodeStores[j] + File.separator + relPathFile);
- splitArray.add(new FileSplit(nd, new FileReference(f)));
+ for (int k = 0; k < numIODevices; k++) {
+ File f = new File(nodeStores[j] + File.separator + relPathFile);
+ splitArray.add(new FileSplit(nd, new FileReference(f), k));
+ }
}
}
}
@@ -1415,21 +1435,6 @@
return dataverseName + File.separator + fileName;
}
- public Pair<IFileSplitProvider, IFileSplitProvider> getInvertedIndexFileSplitProviders(
- IFileSplitProvider splitProvider) {
- int numSplits = splitProvider.getFileSplits().length;
- FileSplit[] btreeSplits = new FileSplit[numSplits];
- FileSplit[] invListsSplits = new FileSplit[numSplits];
- for (int i = 0; i < numSplits; i++) {
- String nodeName = splitProvider.getFileSplits()[i].getNodeName();
- String path = splitProvider.getFileSplits()[i].getLocalFile().getFile().getPath();
- btreeSplits[i] = new FileSplit(nodeName, path + "_$btree");
- invListsSplits[i] = new FileSplit(nodeName, path + "_$invlists");
- }
- return new Pair<IFileSplitProvider, IFileSplitProvider>(new ConstantFileSplitProvider(btreeSplits),
- new ConstantFileSplitProvider(invListsSplits));
- }
-
public Dataset findDataset(String dataverse, String dataset) throws AlgebricksException {
try {
return MetadataManager.INSTANCE.getDataset(mdTxnCtx, dataverse, dataset);
@@ -1461,10 +1466,13 @@
public AlgebricksPartitionConstraint getClusterLocations() {
ArrayList<String> locs = new ArrayList<String>();
- for (String k : stores.keySet()) {
- String[] nodeStores = stores.get(k);
+ for (String i : stores.keySet()) {
+ String[] nodeStores = stores.get(i);
+ int numIODevices = AsterixClusterProperties.INSTANCE.getNumberOfIODevices(i);
for (int j = 0; j < nodeStores.length; j++) {
- locs.add(k);
+ for (int k = 0; k < numIODevices; k++) {
+ locs.add(i);
+ }
}
}
String[] cluster = new String[locs.size()];
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
index 7cfa6d0..6c55f12 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
@@ -29,6 +29,7 @@
import edu.uci.ics.asterix.builders.OrderedListBuilder;
import edu.uci.ics.asterix.builders.RecordBuilder;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.MetadataNode;
@@ -49,7 +50,6 @@
import edu.uci.ics.asterix.om.types.AbstractCollectionType;
import edu.uci.ics.asterix.om.types.BuiltinType;
import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/functions/MetadataBuiltinFunctions.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/functions/MetadataBuiltinFunctions.java
index 60f2e6d..406b835 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/functions/MetadataBuiltinFunctions.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/functions/MetadataBuiltinFunctions.java
@@ -30,7 +30,7 @@
public static void addMetadataBuiltinFunctions() {
- AsterixBuiltinFunctions.add(AsterixBuiltinFunctions.DATASET, new IResultTypeComputer() {
+ AsterixBuiltinFunctions.addFunction(AsterixBuiltinFunctions.DATASET, new IResultTypeComputer() {
@Override
public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
@@ -73,7 +73,7 @@
}
});
- AsterixBuiltinFunctions.add(AsterixBuiltinFunctions.FEED_INGEST, new IResultTypeComputer() {
+ AsterixBuiltinFunctions.addPrivateFunction(AsterixBuiltinFunctions.FEED_INGEST, new IResultTypeComputer() {
@Override
public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/DatasetNameValueExtractor.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
index e554643..68ff549 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
@@ -19,11 +19,11 @@
import java.io.DataInput;
import java.io.DataInputStream;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AObjectSerializerDeserializer;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.api.IValueExtractor;
import edu.uci.ics.asterix.om.base.AString;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
index 2e4dbe4..62e7a28 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
@@ -20,12 +20,12 @@
import java.io.DataInputStream;
import java.rmi.RemoteException;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AObjectSerializerDeserializer;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.MetadataNode;
import edu.uci.ics.asterix.metadata.api.IValueExtractor;
import edu.uci.ics.asterix.om.base.AString;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/MetadataEntityValueExtractor.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/MetadataEntityValueExtractor.java
index 7ae334e..9593783 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/MetadataEntityValueExtractor.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/MetadataEntityValueExtractor.java
@@ -17,10 +17,10 @@
import java.io.IOException;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.api.IMetadataEntityTupleTranslator;
import edu.uci.ics.asterix.metadata.api.IValueExtractor;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
index d4109cd..81da41b 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
@@ -19,11 +19,11 @@
import java.io.DataInput;
import java.io.DataInputStream;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AObjectSerializerDeserializer;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.api.IValueExtractor;
import edu.uci.ics.asterix.om.base.AString;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/TupleCopyValueExtractor.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/TupleCopyValueExtractor.java
index 03bc963..fbf8cc8 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/TupleCopyValueExtractor.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/valueextractors/TupleCopyValueExtractor.java
@@ -18,9 +18,9 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.api.IValueExtractor;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
diff --git a/asterix-om/pom.xml b/asterix-om/pom.xml
index f7ef8d3..ac1aa7f 100644
--- a/asterix-om/pom.xml
+++ b/asterix-om/pom.xml
@@ -30,6 +30,12 @@
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>edu.uci.ics.asterix</groupId>
+ <artifactId>asterix-transactions</artifactId>
+ <version>0.0.6-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
<groupId>edu.uci.ics.hyracks</groupId>
<artifactId>hyracks-storage-am-lsm-invertedindex</artifactId>
</dependency>
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/RecordBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/RecordBuilder.java
index f5d07ae..10b6071 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/RecordBuilder.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/RecordBuilder.java
@@ -150,7 +150,7 @@
// +1 because we do not store the value tag.
closedPartOutputStream.write(value.getByteArray(), value.getStartOffset() + 1, len);
numberOfClosedFields++;
- if (isNullable && value.getByteArray()[0] != SER_NULL_TYPE_TAG) {
+ if (isNullable && value.getByteArray()[value.getStartOffset()] != SER_NULL_TYPE_TAG) {
nullBitMap[id / 8] |= (byte) (1 << (7 - (id % 8)));
}
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
index 865ab94..f795b17 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
@@ -62,8 +62,13 @@
return 1;
}
- ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b1[s1]);
- switch (tag) {
+ ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b1[s1]);
+ ATypeTag tag2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b2[s2]);
+ if (tag1 != tag2) {
+ throw new IllegalStateException("The values of two inconsistent types (" + tag1 + " and " + tag2
+ + ") cannot be compared!");
+ }
+ switch (tag1) {
case BOOLEAN: {
return ascBoolComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
new file mode 100644
index 0000000..6e80fe6
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.comparators;
+
+import edu.uci.ics.asterix.formats.nontagged.UTF8StringLowercasePointable;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+import edu.uci.ics.hyracks.data.std.accessors.PointableBinaryComparatorFactory;
+import edu.uci.ics.hyracks.data.std.primitive.DoublePointable;
+import edu.uci.ics.hyracks.data.std.primitive.FloatPointable;
+import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
+
+public class ListItemBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ListItemBinaryComparatorFactory INSTANCE = new ListItemBinaryComparatorFactory();
+
+ private ListItemBinaryComparatorFactory() {
+ }
+
+ @Override
+ public IBinaryComparator createBinaryComparator() {
+ return createBinaryComparator(ATypeTag.NULL, ATypeTag.NULL, false);
+ }
+
+ public IBinaryComparator createBinaryComparator(final ATypeTag firstItemTypeTag, final ATypeTag secondItemTypeTag,
+ final boolean ignoreCase) {
+ return new IBinaryComparator() {
+ final IBinaryComparator ascBoolComp = BooleanBinaryComparatorFactory.INSTANCE.createBinaryComparator();
+ final IBinaryComparator ascIntComp = new PointableBinaryComparatorFactory(IntegerPointable.FACTORY)
+ .createBinaryComparator();
+ final IBinaryComparator ascLongComp = LongBinaryComparatorFactory.INSTANCE.createBinaryComparator();
+ final IBinaryComparator ascStrComp = new PointableBinaryComparatorFactory(UTF8StringPointable.FACTORY)
+ .createBinaryComparator();
+ final IBinaryComparator ascLowerCaseStrComp = new PointableBinaryComparatorFactory(
+ UTF8StringLowercasePointable.FACTORY).createBinaryComparator();
+ final IBinaryComparator ascFloatComp = new PointableBinaryComparatorFactory(FloatPointable.FACTORY)
+ .createBinaryComparator();
+ final IBinaryComparator ascDoubleComp = new PointableBinaryComparatorFactory(DoublePointable.FACTORY)
+ .createBinaryComparator();
+ final IBinaryComparator ascRectangleComp = ARectanglePartialBinaryComparatorFactory.INSTANCE
+ .createBinaryComparator();
+ final IBinaryComparator ascCircleComp = ACirclePartialBinaryComparatorFactory.INSTANCE
+ .createBinaryComparator();
+ final IBinaryComparator ascDurationComp = ADurationPartialBinaryComparatorFactory.INSTANCE
+ .createBinaryComparator();
+ final IBinaryComparator ascIntervalComp = AIntervalPartialBinaryComparatorFactory.INSTANCE
+ .createBinaryComparator();
+ final IBinaryComparator ascLineComp = ALinePartialBinaryComparatorFactory.INSTANCE.createBinaryComparator();
+ final IBinaryComparator ascPointComp = APointPartialBinaryComparatorFactory.INSTANCE
+ .createBinaryComparator();
+ final IBinaryComparator ascPoint3DComp = APoint3DPartialBinaryComparatorFactory.INSTANCE
+ .createBinaryComparator();
+ final IBinaryComparator ascPolygonComp = APolygonPartialBinaryComparatorFactory.INSTANCE
+ .createBinaryComparator();
+ final IBinaryComparator rawComp = RawBinaryComparatorFactory.INSTANCE.createBinaryComparator();
+
+ @Override
+ public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+
+ if (b1[s1] == ATypeTag.NULL.serialize()) {
+ if (b2[s2] == ATypeTag.NULL.serialize())
+ return 0;
+ else
+ return -1;
+ } else {
+ if (b2[s2] == ATypeTag.NULL.serialize())
+ return 1;
+ }
+
+ ATypeTag tag1 = firstItemTypeTag;
+ int skip1 = 0;
+ if (firstItemTypeTag == ATypeTag.ANY) {
+ tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b1[s1]);
+ skip1 = 1;
+ }
+
+ ATypeTag tag2 = secondItemTypeTag;
+ int skip2 = 0;
+ if (secondItemTypeTag == ATypeTag.ANY) {
+ tag2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b2[s2]);
+ skip2 = 1;
+ }
+
+ if (tag1 != tag2) {
+ return rawComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+
+ switch (tag1) {
+ case BOOLEAN: {
+ return ascBoolComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case TIME:
+ case DATE:
+ case YEARMONTHDURATION:
+ case INT32: {
+ return ascIntComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case DATETIME:
+ case DAYTIMEDURATION:
+ case INT64: {
+ return ascLongComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case FLOAT: {
+ return ascFloatComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case DOUBLE: {
+ return ascDoubleComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case STRING: {
+ if (ignoreCase) {
+ return ascLowerCaseStrComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ } else {
+ return ascStrComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ }
+ case RECTANGLE: {
+ return ascRectangleComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case CIRCLE: {
+ return ascCircleComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case POINT: {
+ return ascPointComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case POINT3D: {
+ return ascPoint3DComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case LINE: {
+ return ascLineComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case POLYGON: {
+ return ascPolygonComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case DURATION: {
+ return ascDurationComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ case INTERVAL: {
+ return ascIntervalComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ default: {
+ return rawComp.compare(b1, s1 + skip1, l1 - skip1, b2, s2 + skip2, l2 - skip2);
+ }
+ }
+ }
+ };
+ }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java
index 495b41f..0946f1b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java
@@ -1,14 +1,8 @@
package edu.uci.ics.asterix.dataflow.data.nontagged.hash;
-import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
import edu.uci.ics.hyracks.data.std.accessors.MurmurHash3BinaryHashFunctionFamily;
-import edu.uci.ics.hyracks.data.std.accessors.PointableBinaryHashFunctionFactory;
-import edu.uci.ics.hyracks.data.std.primitive.FloatPointable;
-import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
-import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
public class AObjectBinaryHashFunctionFactory implements IBinaryHashFunctionFactory {
@@ -22,56 +16,12 @@
@Override
public IBinaryHashFunction createBinaryHashFunction() {
return new IBinaryHashFunction() {
-
- private IBinaryHashFunction boolHash = BooleanBinaryHashFunctionFactory.INSTANCE.createBinaryHashFunction();
- private IBinaryHashFunction intHash = new PointableBinaryHashFunctionFactory(IntegerPointable.FACTORY)
- .createBinaryHashFunction();
- private IBinaryHashFunction longHash = LongBinaryHashFunctionFactory.INSTANCE.createBinaryHashFunction();
- private IBinaryHashFunction floatHash = new PointableBinaryHashFunctionFactory(FloatPointable.FACTORY)
- .createBinaryHashFunction();
- private IBinaryHashFunction stringHash = new PointableBinaryHashFunctionFactory(UTF8StringPointable.FACTORY)
- .createBinaryHashFunction();
-
- private IBinaryHashFunction doubleHash = DoubleBinaryHashFunctionFactory.INSTANCE
- .createBinaryHashFunction();
-
private IBinaryHashFunction genericBinaryHash = MurmurHash3BinaryHashFunctionFamily.INSTANCE
.createBinaryHashFunction(0);
@Override
public int hash(byte[] bytes, int offset, int length) {
- ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
- switch (tag) {
- case BOOLEAN: {
- return boolHash.hash(bytes, offset + 1, length - 1);
- }
- case TIME:
- case DATE:
- case YEARMONTHDURATION:
- case INT32: {
- return intHash.hash(bytes, offset + 1, length - 1);
- }
- case DATETIME:
- case DAYTIMEDURATION:
- case INT64: {
- return longHash.hash(bytes, offset + 1, length - 1);
- }
- case FLOAT: {
- return floatHash.hash(bytes, offset + 1, length - 1);
- }
- case DOUBLE: {
- return doubleHash.hash(bytes, offset + 1, length - 1);
- }
- case STRING: {
- return stringHash.hash(bytes, offset + 1, length - 1);
- }
- case NULL: {
- return 0;
- }
- default: {
- return genericBinaryHash.hash(bytes, offset + 1, length - 1);
- }
- }
+ return genericBinaryHash.hash(bytes, offset, length);
}
};
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/ListItemBinaryHashFunctionFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/ListItemBinaryHashFunctionFactory.java
new file mode 100644
index 0000000..0fab7de
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/ListItemBinaryHashFunctionFactory.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.hash;
+
+import java.io.IOException;
+
+import edu.uci.ics.asterix.formats.nontagged.UTF8StringLowercasePointable;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
+import edu.uci.ics.hyracks.data.std.accessors.MurmurHash3BinaryHashFunctionFamily;
+import edu.uci.ics.hyracks.data.std.accessors.PointableBinaryHashFunctionFactory;
+import edu.uci.ics.hyracks.data.std.util.GrowableArray;
+
+/**
+ * This hash function factory is introduced to be able to hash heterogeneous list items.
+ * The item type tag is also included in the hash computation to distinguish the different
+ * types with the same raw bytes.
+ */
+public class ListItemBinaryHashFunctionFactory implements IBinaryHashFunctionFactory {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ListItemBinaryHashFunctionFactory INSTANCE = new ListItemBinaryHashFunctionFactory();
+
+ private ListItemBinaryHashFunctionFactory() {
+ }
+
+ @Override
+ public IBinaryHashFunction createBinaryHashFunction() {
+ return createBinaryHashFunction(ATypeTag.ANY, false);
+ }
+
+ public IBinaryHashFunction createBinaryHashFunction(final ATypeTag itemTypeTag, final boolean ignoreCase) {
+ return new IBinaryHashFunction() {
+
+ private IBinaryHashFunction lowerCaseStringHash = new PointableBinaryHashFunctionFactory(
+ UTF8StringLowercasePointable.FACTORY).createBinaryHashFunction();
+ private IBinaryHashFunction genericBinaryHash = MurmurHash3BinaryHashFunctionFamily.INSTANCE
+ .createBinaryHashFunction(0);
+ private GrowableArray taggedBytes = new GrowableArray();
+
+ @Override
+ public int hash(byte[] bytes, int offset, int length) {
+ ATypeTag tag = itemTypeTag;
+ int skip = 0;
+ if (itemTypeTag == ATypeTag.ANY) {
+ tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
+ skip = 1;
+ }
+ switch (tag) {
+ case STRING: {
+ if (ignoreCase) {
+ return lowerCaseStringHash.hash(bytes, offset + skip, length - skip);
+ }
+ }
+ default: {
+ if (itemTypeTag != ATypeTag.ANY) {
+ // add the itemTypeTag in front of the data
+ try {
+ resetTaggedBytes(bytes, offset, length);
+ return genericBinaryHash.hash(taggedBytes.getByteArray(), 0, length + 1);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ return genericBinaryHash.hash(bytes, offset, length);
+ }
+ }
+ }
+ }
+
+ private void resetTaggedBytes(byte[] data, int offset, int length) throws IOException {
+ taggedBytes.reset();
+ taggedBytes.getDataOutput().writeByte(itemTypeTag.serialize());
+ taggedBytes.getDataOutput().write(data, offset, length);
+ }
+ };
+ }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java
index 97a0c13..4d85537 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java
@@ -1,6 +1,7 @@
package edu.uci.ics.asterix.formats.nontagged;
import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.hyracks.algebricks.data.IBinaryBooleanInspector;
import edu.uci.ics.hyracks.algebricks.data.IBinaryBooleanInspectorFactory;
import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
@@ -24,6 +25,11 @@
public boolean getBooleanValue(byte[] bytes, int offset, int length) {
if (bytes[offset] == SER_NULL_TYPE_TAG)
return false;
+ /** check if the runtime type is boolean */
+ ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
+ if (typeTag != ATypeTag.BOOLEAN) {
+ throw new IllegalStateException("Runtime error: the select condition should be of the boolean type!");
+ }
return bytes[offset + 1] == 1;
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
index 33698bd..76dd07d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
@@ -2,11 +2,6 @@
import java.io.Serializable;
-import edu.uci.ics.asterix.dataflow.data.nontagged.hash.AObjectBinaryHashFunctionFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.hash.BooleanBinaryHashFunctionFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.hash.DoubleBinaryHashFunctionFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.hash.LongBinaryHashFunctionFactory;
-import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.hyracks.algebricks.data.IBinaryHashFunctionFactoryProvider;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
@@ -16,7 +11,6 @@
import edu.uci.ics.hyracks.data.std.primitive.FloatPointable;
import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
import edu.uci.ics.hyracks.data.std.primitive.RawUTF8StringPointable;
-import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
public class AqlBinaryHashFunctionFactoryProvider implements IBinaryHashFunctionFactoryProvider, Serializable {
@@ -39,81 +33,6 @@
@Override
public IBinaryHashFunctionFactory getBinaryHashFunctionFactory(Object type) {
- if (type == null) {
- return AObjectBinaryHashFunctionFactory.INSTANCE;
- }
- IAType aqlType = (IAType) type;
- switch (aqlType.getTypeTag()) {
- case ANY:
- case UNION: { // we could do smth better for nullable fields
- return AObjectBinaryHashFunctionFactory.INSTANCE;
- }
- case NULL: {
- return new IBinaryHashFunctionFactory() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public IBinaryHashFunction createBinaryHashFunction() {
- return new IBinaryHashFunction() {
-
- @Override
- public int hash(byte[] bytes, int offset, int length) {
- return 0;
- }
- };
- }
- };
- }
- case BOOLEAN: {
- return addOffset(BooleanBinaryHashFunctionFactory.INSTANCE);
- }
- case DATE:
- case TIME:
- case YEARMONTHDURATION:
- case INT32: {
- return addOffset(new PointableBinaryHashFunctionFactory(IntegerPointable.FACTORY));
- }
- case DAYTIMEDURATION:
- case DATETIME:
- case INT64: {
- return addOffset(LongBinaryHashFunctionFactory.INSTANCE);
- }
- case FLOAT: {
- return addOffset(new PointableBinaryHashFunctionFactory(FloatPointable.FACTORY));
- }
- case DOUBLE: {
- return addOffset(DoubleBinaryHashFunctionFactory.INSTANCE);
- }
- case STRING: {
- return addOffset(new PointableBinaryHashFunctionFactory(UTF8StringPointable.FACTORY));
- }
- default: {
- return addOffsetForGenericBinaryHash();
- }
- }
- }
-
- private IBinaryHashFunctionFactory addOffset(final IBinaryHashFunctionFactory inst) {
- return new IBinaryHashFunctionFactory() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public IBinaryHashFunction createBinaryHashFunction() {
- final IBinaryHashFunction bhf = inst.createBinaryHashFunction();
- return new IBinaryHashFunction() {
-
- @Override
- public int hash(byte[] bytes, int offset, int length) {
- return bhf.hash(bytes, offset + 1, length);
- }
- };
- }
- };
- }
-
- private IBinaryHashFunctionFactory addOffsetForGenericBinaryHash() {
return new IBinaryHashFunctionFactory() {
private static final long serialVersionUID = 1L;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
index 38af5e1..2a732ac 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -8,6 +8,8 @@
import org.apache.commons.lang3.mutable.Mutable;
+import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.common.functions.FunctionSignature;
import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
import edu.uci.ics.asterix.om.typecomputer.impl.ABooleanTypeComputer;
import edu.uci.ics.asterix.om.typecomputer.impl.ACircleTypeComputer;
@@ -29,6 +31,7 @@
import edu.uci.ics.asterix.om.typecomputer.impl.CastListResultTypeComputer;
import edu.uci.ics.asterix.om.typecomputer.impl.CastRecordResultTypeComputer;
import edu.uci.ics.asterix.om.typecomputer.impl.ClosedRecordConstructorResultType;
+import edu.uci.ics.asterix.om.typecomputer.impl.ConcatNonNullTypeComputer;
import edu.uci.ics.asterix.om.typecomputer.impl.FieldAccessByIndexResultType;
import edu.uci.ics.asterix.om.typecomputer.impl.InjectFailureTypeComputer;
import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedCollectionMemberResultType;
@@ -86,7 +89,6 @@
import edu.uci.ics.asterix.om.types.AbstractCollectionType;
import edu.uci.ics.asterix.om.types.BuiltinType;
import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.om.types.TypeHelper;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
@@ -103,18 +105,12 @@
SI
}
- /*
- * A function is categorized as public or private depending upon whether it can be used by the end-user in AQL queries.
- */
- public enum FunctionNamespace {
- ASTERIX_PUBLIC,
- ASTERIX_PRIVATE
- }
-
private static final FunctionInfoRepository registeredFunctions = new FunctionInfoRepository();
// it is supposed to be an identity mapping
- private final static Map<IFunctionInfo, IFunctionInfo> builtinFunctionsSet = new HashMap<IFunctionInfo, IFunctionInfo>();
+ private final static Map<IFunctionInfo, IFunctionInfo> builtinPublicFunctionsSet = new HashMap<IFunctionInfo, IFunctionInfo>();
+ private final static Map<IFunctionInfo, IFunctionInfo> builtinPrivateFunctionsSet = new HashMap<IFunctionInfo, IFunctionInfo>();
+
private final static Map<IFunctionInfo, IResultTypeComputer> funTypeComputer = new HashMap<IFunctionInfo, IResultTypeComputer>();
private final static Set<IFunctionInfo> builtinAggregateFunctions = new HashSet<IFunctionInfo>();
@@ -126,449 +122,430 @@
private final static Map<IFunctionInfo, IFunctionInfo> scalarToAggregateFunctionMap = new HashMap<IFunctionInfo, IFunctionInfo>();
private static final Map<IFunctionInfo, SpatialFilterKind> spatialFilterFunctions = new HashMap<IFunctionInfo, SpatialFilterKind>();
- public final static FunctionIdentifier TYPE_OF = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "type-of", 1);
- public final static FunctionIdentifier GET_HANDLE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "get-handle", 2);
- public final static FunctionIdentifier GET_DATA = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "get-data", 2);
- public final static FunctionIdentifier EMBED_TYPE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "embed-type", 1);
+ public final static FunctionIdentifier TYPE_OF = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "type-of", 1);
+ public final static FunctionIdentifier GET_HANDLE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "get-handle", 2);
+ public final static FunctionIdentifier GET_DATA = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "get-data",
+ 2);
+ public final static FunctionIdentifier EMBED_TYPE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "embed-type", 1);
- public final static FunctionIdentifier GET_ITEM = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "get-item", 2);
- public final static FunctionIdentifier ANY_COLLECTION_MEMBER = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "any-collection-member", 1);
- public final static FunctionIdentifier LISTIFY = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "listify", 1);
+ public final static FunctionIdentifier GET_ITEM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "get-item",
+ 2);
+ public final static FunctionIdentifier ANY_COLLECTION_MEMBER = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "any-collection-member", 1);
+ public final static FunctionIdentifier LISTIFY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "listify", 1);
// public final static FunctionIdentifier BAGIFY = new
// FunctionIdentifier(ASTERIX_NS, "bagify", 1, true);
- public final static FunctionIdentifier LEN = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(), "len",
- 1);
+ public final static FunctionIdentifier LEN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "len", 1);
- public final static FunctionIdentifier CONCAT_NON_NULL = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "concat-non-null", FunctionIdentifier.VARARGS);
- public final static FunctionIdentifier EMPTY_STREAM = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "empty-stream", 0);
- public final static FunctionIdentifier NON_EMPTY_STREAM = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "non-empty-stream", 0);
+ public final static FunctionIdentifier CONCAT_NON_NULL = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "concat-non-null", FunctionIdentifier.VARARGS);
+ public final static FunctionIdentifier EMPTY_STREAM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "empty-stream", 0);
+ public final static FunctionIdentifier NON_EMPTY_STREAM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "non-empty-stream", 0);
public final static FunctionIdentifier ORDERED_LIST_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "ordered-list-constructor", FunctionIdentifier.VARARGS);
+ FunctionConstants.ASTERIX_NS, "ordered-list-constructor", FunctionIdentifier.VARARGS);
public final static FunctionIdentifier UNORDERED_LIST_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "unordered-list-constructor", FunctionIdentifier.VARARGS);
+ FunctionConstants.ASTERIX_NS, "unordered-list-constructor", FunctionIdentifier.VARARGS);
// records
public final static FunctionIdentifier CLOSED_RECORD_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "closed-record-constructor", FunctionIdentifier.VARARGS);
+ FunctionConstants.ASTERIX_NS, "closed-record-constructor", FunctionIdentifier.VARARGS);
public final static FunctionIdentifier OPEN_RECORD_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "open-record-constructor", FunctionIdentifier.VARARGS);
+ FunctionConstants.ASTERIX_NS, "open-record-constructor", FunctionIdentifier.VARARGS);
public final static FunctionIdentifier RECORD_TYPE_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "record-type-constructor", FunctionIdentifier.VARARGS);
- public final static FunctionIdentifier FIELD_ACCESS_BY_INDEX = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "field-access-by-index", 2);
- public final static FunctionIdentifier FIELD_ACCESS_BY_NAME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "field-access-by-name", 2);
+ FunctionConstants.ASTERIX_NS, "record-type-constructor", FunctionIdentifier.VARARGS);
+ public final static FunctionIdentifier FIELD_ACCESS_BY_INDEX = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "field-access-by-index", 2);
+ public final static FunctionIdentifier FIELD_ACCESS_BY_NAME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "field-access-by-name", 2);
- public final static FunctionIdentifier NUMERIC_UNARY_MINUS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-unary-minus", 1);
+ public final static FunctionIdentifier NUMERIC_UNARY_MINUS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-unary-minus", 1);
- public final static FunctionIdentifier NUMERIC_SUBTRACT = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-subtract", 2);
- public final static FunctionIdentifier NUMERIC_MULTIPLY = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-multiply", 2);
- public final static FunctionIdentifier NUMERIC_DIVIDE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-divide", 2);
- public final static FunctionIdentifier NUMERIC_MOD = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-mod", 2);
- public final static FunctionIdentifier NUMERIC_IDIV = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-idiv", 2);
- public final static FunctionIdentifier CARET = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "caret", 2);
+ public final static FunctionIdentifier NUMERIC_SUBTRACT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-subtract", 2);
+ public final static FunctionIdentifier NUMERIC_MULTIPLY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-multiply", 2);
+ public final static FunctionIdentifier NUMERIC_DIVIDE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-divide", 2);
+ public final static FunctionIdentifier NUMERIC_MOD = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-mod", 2);
+ public final static FunctionIdentifier NUMERIC_IDIV = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-idiv", 2);
+ public final static FunctionIdentifier CARET = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "caret", 2);
- public final static FunctionIdentifier NUMERIC_ABS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-abs", 1);
- public final static FunctionIdentifier NUMERIC_CEILING = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-ceiling", 1);
- public final static FunctionIdentifier NUMERIC_FLOOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-floor", 1);
- public final static FunctionIdentifier NUMERIC_ROUND = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-round", 1);
+ public final static FunctionIdentifier NUMERIC_ABS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-abs", 1);
+ public final static FunctionIdentifier NUMERIC_CEILING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-ceiling", 1);
+ public final static FunctionIdentifier NUMERIC_FLOOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-floor", 1);
+ public final static FunctionIdentifier NUMERIC_ROUND = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "numeric-round", 1);
public final static FunctionIdentifier NUMERIC_ROUND_HALF_TO_EVEN = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-round-half-to-even", 1);
+ FunctionConstants.ASTERIX_NS, "numeric-round-half-to-even", 1);
public final static FunctionIdentifier NUMERIC_ROUND_HALF_TO_EVEN2 = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "numeric-round-half-to-even", 2);
+ FunctionConstants.ASTERIX_NS, "numeric-round-half-to-even", 2);
// String funcitons
- public final static FunctionIdentifier STRING_EQUAL = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "string-equal", 2);
- public final static FunctionIdentifier STRING_START_WITH = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "start-with", 2);
- public final static FunctionIdentifier STRING_END_WITH = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "end-with", 2);
- public final static FunctionIdentifier STRING_MATCHES = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "matches", 2);
+ public final static FunctionIdentifier STRING_EQUAL = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "string-equal", 2);
+ public final static FunctionIdentifier STRING_START_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "start-with", 2);
+ public final static FunctionIdentifier STRING_END_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "end-with", 2);
+ public final static FunctionIdentifier STRING_MATCHES = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "matches", 2);
public final static FunctionIdentifier STRING_MATCHES_WITH_FLAG = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "matches", 3);
- public final static FunctionIdentifier STRING_LOWERCASE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "lowercase", 1);
- public final static FunctionIdentifier STRING_REPLACE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "replace", 3);
+ FunctionConstants.ASTERIX_NS, "matches", 3);
+ public final static FunctionIdentifier STRING_LOWERCASE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "lowercase", 1);
+ public final static FunctionIdentifier STRING_REPLACE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "replace", 3);
public final static FunctionIdentifier STRING_REPLACE_WITH_FLAG = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "replace", 4);
- public final static FunctionIdentifier STRING_LENGTH = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "string-length", 1);
- public final static FunctionIdentifier SUBSTRING2 = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
+ FunctionConstants.ASTERIX_NS, "replace", 4);
+ public final static FunctionIdentifier STRING_LENGTH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "string-length", 1);
+ public final static FunctionIdentifier SUBSTRING2 = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
"substring", 2);
- public final static FunctionIdentifier SUBSTRING_BEFORE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "substring-before", 2);
- public final static FunctionIdentifier SUBSTRING_AFTER = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "substring-after", 2);
- public final static FunctionIdentifier STRING_TO_CODEPOINT = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "string-to-codepoint", 1);
- public final static FunctionIdentifier CODEPOINT_TO_STRING = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "codepoint-to-string", 1);
- public final static FunctionIdentifier STRING_CONCAT = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "string-concat", 1);
- public final static FunctionIdentifier STRING_JOIN = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "string-join", 2);
+ public final static FunctionIdentifier SUBSTRING_BEFORE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "substring-before", 2);
+ public final static FunctionIdentifier SUBSTRING_AFTER = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "substring-after", 2);
+ public final static FunctionIdentifier STRING_TO_CODEPOINT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "string-to-codepoint", 1);
+ public final static FunctionIdentifier CODEPOINT_TO_STRING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "codepoint-to-string", 1);
+ public final static FunctionIdentifier STRING_CONCAT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "string-concat", 1);
+ public final static FunctionIdentifier STRING_JOIN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "string-join", 2);
- public final static FunctionIdentifier DATASET = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "dataset", 1);
- public final static FunctionIdentifier FEED_INGEST = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "feed-ingest", 1);
+ public final static FunctionIdentifier DATASET = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "dataset", 1);
+ public final static FunctionIdentifier FEED_INGEST = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "feed-ingest", 1);
- public final static FunctionIdentifier INDEX_SEARCH = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "index-search", FunctionIdentifier.VARARGS);
+ public final static FunctionIdentifier INDEX_SEARCH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "index-search", FunctionIdentifier.VARARGS);
public final static FunctionIdentifier MAKE_FIELD_INDEX_HANDLE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "make-field-index-handle", 2);
+ FunctionConstants.ASTERIX_NS, "make-field-index-handle", 2);
public final static FunctionIdentifier MAKE_FIELD_NAME_HANDLE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "make-field-name-handle", 1);
+ FunctionConstants.ASTERIX_NS, "make-field-name-handle", 1);
- public final static FunctionIdentifier SUBSTRING = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
+ public final static FunctionIdentifier SUBSTRING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
"substring", 3);
- public final static FunctionIdentifier LIKE = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "like", 2);
- public final static FunctionIdentifier CONTAINS = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "contains", 2);
- public final static FunctionIdentifier STARTS_WITH = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "starts-with", 2);
- public final static FunctionIdentifier ENDS_WITH = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
+ public final static FunctionIdentifier LIKE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "like", 2);
+ public final static FunctionIdentifier CONTAINS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "contains",
+ 2);
+ public final static FunctionIdentifier STARTS_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "starts-with", 2);
+ public final static FunctionIdentifier ENDS_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
"ends-with", 2);
- public final static FunctionIdentifier AVG = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "agg-avg", 1);
- public final static FunctionIdentifier COUNT = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "agg-count", 1);
- public final static FunctionIdentifier SUM = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "agg-sum", 1);
- public final static FunctionIdentifier LOCAL_SUM = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
+ public final static FunctionIdentifier AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-avg", 1);
+ public final static FunctionIdentifier COUNT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-count", 1);
+ public final static FunctionIdentifier SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-sum", 1);
+ public final static FunctionIdentifier LOCAL_SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
"agg-local-sum", 1);
- public final static FunctionIdentifier MAX = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "agg-max", 1);
- public final static FunctionIdentifier LOCAL_MAX = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
+ public final static FunctionIdentifier MAX = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-max", 1);
+ public final static FunctionIdentifier LOCAL_MAX = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
"agg-local-max", 1);
- public final static FunctionIdentifier MIN = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "agg-min", 1);
- public final static FunctionIdentifier LOCAL_MIN = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
+ public final static FunctionIdentifier MIN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-min", 1);
+ public final static FunctionIdentifier LOCAL_MIN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
"agg-local-min", 1);
- public final static FunctionIdentifier GLOBAL_AVG = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "agg-global-avg", 1);
- public final static FunctionIdentifier LOCAL_AVG = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
+ public final static FunctionIdentifier GLOBAL_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "agg-global-avg", 1);
+ public final static FunctionIdentifier LOCAL_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
"agg-local-avg", 1);
- public final static FunctionIdentifier SCALAR_AVG = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "avg", 1);
- public final static FunctionIdentifier SCALAR_COUNT = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "count", 1);
- public final static FunctionIdentifier SCALAR_SUM = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "sum", 1);
- public final static FunctionIdentifier SCALAR_MAX = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "max", 1);
- public final static FunctionIdentifier SCALAR_MIN = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "min", 1);
- public final static FunctionIdentifier SCALAR_GLOBAL_AVG = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "global-avg", 1);
- public final static FunctionIdentifier SCALAR_LOCAL_AVG = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "local-avg", 1);
+ public final static FunctionIdentifier SCALAR_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "avg", 1);
+ public final static FunctionIdentifier SCALAR_COUNT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "count",
+ 1);
+ public final static FunctionIdentifier SCALAR_SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sum", 1);
+ public final static FunctionIdentifier SCALAR_MAX = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "max", 1);
+ public final static FunctionIdentifier SCALAR_MIN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "min", 1);
+ public final static FunctionIdentifier SCALAR_GLOBAL_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "global-avg", 1);
+ public final static FunctionIdentifier SCALAR_LOCAL_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "local-avg", 1);
// serializable aggregate functions
- public final static FunctionIdentifier SERIAL_AVG = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "avg-serial", 1);
- public final static FunctionIdentifier SERIAL_COUNT = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "count-serial", 1);
- public final static FunctionIdentifier SERIAL_SUM = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "sum-serial", 1);
- public final static FunctionIdentifier SERIAL_LOCAL_SUM = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "local-sum-serial", 1);
- public final static FunctionIdentifier SERIAL_GLOBAL_AVG = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "global-avg-serial", 1);
- public final static FunctionIdentifier SERIAL_LOCAL_AVG = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "local-avg-serial", 1);
+ public final static FunctionIdentifier SERIAL_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "avg-serial", 1);
+ public final static FunctionIdentifier SERIAL_COUNT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "count-serial", 1);
+ public final static FunctionIdentifier SERIAL_SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "sum-serial", 1);
+ public final static FunctionIdentifier SERIAL_LOCAL_SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "local-sum-serial", 1);
+ public final static FunctionIdentifier SERIAL_GLOBAL_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "global-avg-serial", 1);
+ public final static FunctionIdentifier SERIAL_LOCAL_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "local-avg-serial", 1);
- public final static FunctionIdentifier SCAN_COLLECTION = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "scan-collection", 1);
- public final static FunctionIdentifier SUBSET_COLLECTION = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "subset-collection", 3);
+ public final static FunctionIdentifier SCAN_COLLECTION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "scan-collection", 1);
+ public final static FunctionIdentifier SUBSET_COLLECTION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "subset-collection", 3);
- public final static FunctionIdentifier RANGE = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "range", 2);
+ public final static FunctionIdentifier RANGE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "range", 2);
// fuzzy functions:
- public final static FunctionIdentifier FUZZY_EQ = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "fuzzy-eq", 2);
+ public final static FunctionIdentifier FUZZY_EQ = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "fuzzy-eq",
+ 2);
- public final static FunctionIdentifier PREFIX_LEN_JACCARD = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "prefix-len-jaccard", 2);
+ public final static FunctionIdentifier PREFIX_LEN_JACCARD = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "prefix-len-jaccard", 2);
- public final static FunctionIdentifier SIMILARITY_JACCARD = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "similarity-jaccard", 2);
+ public final static FunctionIdentifier SIMILARITY_JACCARD = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "similarity-jaccard", 2);
public final static FunctionIdentifier SIMILARITY_JACCARD_CHECK = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "similarity-jaccard-check", 3);
+ FunctionConstants.ASTERIX_NS, "similarity-jaccard-check", 3);
public final static FunctionIdentifier SIMILARITY_JACCARD_SORTED = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "similarity-jaccard-sorted", 2);
+ FunctionConstants.ASTERIX_NS, "similarity-jaccard-sorted", 2);
public final static FunctionIdentifier SIMILARITY_JACCARD_SORTED_CHECK = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "similarity-jaccard-sorted-check", 3);
+ FunctionConstants.ASTERIX_NS, "similarity-jaccard-sorted-check", 3);
public final static FunctionIdentifier SIMILARITY_JACCARD_PREFIX = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "similarity-jaccard-prefix", 6);
+ FunctionConstants.ASTERIX_NS, "similarity-jaccard-prefix", 6);
public final static FunctionIdentifier SIMILARITY_JACCARD_PREFIX_CHECK = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "similarity-jaccard-prefix-check", 6);
+ FunctionConstants.ASTERIX_NS, "similarity-jaccard-prefix-check", 6);
- public final static FunctionIdentifier EDIT_DISTANCE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "edit-distance", 2);
- public final static FunctionIdentifier EDIT_DISTANCE_CHECK = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "edit-distance-check", 3);
+ public final static FunctionIdentifier EDIT_DISTANCE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "edit-distance", 2);
+ public final static FunctionIdentifier EDIT_DISTANCE_CHECK = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "edit-distance-check", 3);
public final static FunctionIdentifier EDIT_DISTANCE_LIST_IS_FILTERABLE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "edit-distance-list-is-filterable", 2);
+ FunctionConstants.ASTERIX_NS, "edit-distance-list-is-filterable", 2);
public final static FunctionIdentifier EDIT_DISTANCE_STRING_IS_FILTERABLE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "edit-distance-string-is-filterable", 4);
+ FunctionConstants.ASTERIX_NS, "edit-distance-string-is-filterable", 4);
// tokenizers:
- public final static FunctionIdentifier WORD_TOKENS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "word-tokens", 1);
- public final static FunctionIdentifier HASHED_WORD_TOKENS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "hashed-word-tokens", 1);
+ public final static FunctionIdentifier WORD_TOKENS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "word-tokens", 1);
+ public final static FunctionIdentifier HASHED_WORD_TOKENS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "hashed-word-tokens", 1);
public final static FunctionIdentifier COUNTHASHED_WORD_TOKENS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "counthashed-word-tokens", 1);
- public final static FunctionIdentifier GRAM_TOKENS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "gram-tokens", 3);
- public final static FunctionIdentifier HASHED_GRAM_TOKENS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "hashed-gram-tokens", 3);
+ FunctionConstants.ASTERIX_NS, "counthashed-word-tokens", 1);
+ public final static FunctionIdentifier GRAM_TOKENS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "gram-tokens", 3);
+ public final static FunctionIdentifier HASHED_GRAM_TOKENS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "hashed-gram-tokens", 3);
public final static FunctionIdentifier COUNTHASHED_GRAM_TOKENS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "counthashed-gram-tokens", 3);
+ FunctionConstants.ASTERIX_NS, "counthashed-gram-tokens", 3);
- public final static FunctionIdentifier TID = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "tid", 0);
+ public final static FunctionIdentifier TID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "tid", 0);
// constructors:
- public final static FunctionIdentifier BOOLEAN_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "boolean", 1);
- public final static FunctionIdentifier NULL_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "null", 1);
- public final static FunctionIdentifier STRING_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "string", 1);
- public final static FunctionIdentifier INT8_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "int8", 1);
- public final static FunctionIdentifier INT16_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "int16", 1);
- public final static FunctionIdentifier INT32_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "int32", 1);
- public final static FunctionIdentifier INT64_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "int64", 1);
- public final static FunctionIdentifier FLOAT_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "float", 1);
- public final static FunctionIdentifier DOUBLE_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "double", 1);
- public final static FunctionIdentifier POINT_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "point", 1);
- public final static FunctionIdentifier POINT3D_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "point3d", 1);
- public final static FunctionIdentifier LINE_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "line", 1);
- public final static FunctionIdentifier CIRCLE_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "circle", 1);
- public final static FunctionIdentifier RECTANGLE_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "rectangle", 1);
- public final static FunctionIdentifier POLYGON_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "polygon", 1);
- public final static FunctionIdentifier TIME_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "time", 1);
- public final static FunctionIdentifier DATE_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "date", 1);
- public final static FunctionIdentifier DATETIME_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "datetime", 1);
- public final static FunctionIdentifier DURATION_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "duration", 1);
+ public final static FunctionIdentifier BOOLEAN_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "boolean", 1);
+ public final static FunctionIdentifier NULL_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "null", 1);
+ public final static FunctionIdentifier STRING_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "string", 1);
+ public final static FunctionIdentifier INT8_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "int8", 1);
+ public final static FunctionIdentifier INT16_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "int16", 1);
+ public final static FunctionIdentifier INT32_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "int32", 1);
+ public final static FunctionIdentifier INT64_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "int64", 1);
+ public final static FunctionIdentifier FLOAT_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "float", 1);
+ public final static FunctionIdentifier DOUBLE_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "double", 1);
+ public final static FunctionIdentifier POINT_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "point", 1);
+ public final static FunctionIdentifier POINT3D_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "point3d", 1);
+ public final static FunctionIdentifier LINE_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "line", 1);
+ public final static FunctionIdentifier CIRCLE_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "circle", 1);
+ public final static FunctionIdentifier RECTANGLE_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "rectangle", 1);
+ public final static FunctionIdentifier POLYGON_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "polygon", 1);
+ public final static FunctionIdentifier TIME_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "time", 1);
+ public final static FunctionIdentifier DATE_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "date", 1);
+ public final static FunctionIdentifier DATETIME_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "datetime", 1);
+ public final static FunctionIdentifier DURATION_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "duration", 1);
public final static FunctionIdentifier YEAR_MONTH_DURATION_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "year-month-duration", 1);
+ FunctionConstants.ASTERIX_NS, "year-month-duration", 1);
public final static FunctionIdentifier DAY_TIME_DURATION_CONSTRUCTOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "day-time-duration", 1);
+ FunctionConstants.ASTERIX_NS, "day-time-duration", 1);
public final static FunctionIdentifier INTERVAL_CONSTRUCTOR_DATE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-from-date", 2);
+ FunctionConstants.ASTERIX_NS, "interval-from-date", 2);
public final static FunctionIdentifier INTERVAL_CONSTRUCTOR_TIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-from-time", 2);
+ FunctionConstants.ASTERIX_NS, "interval-from-time", 2);
public final static FunctionIdentifier INTERVAL_CONSTRUCTOR_DATETIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-from-datetime", 2);
+ FunctionConstants.ASTERIX_NS, "interval-from-datetime", 2);
public final static FunctionIdentifier INTERVAL_CONSTRUCTOR_START_FROM_DATE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-start-from-date", 2);
+ FunctionConstants.ASTERIX_NS, "interval-start-from-date", 2);
public final static FunctionIdentifier INTERVAL_CONSTRUCTOR_START_FROM_TIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-start-from-time", 2);
+ FunctionConstants.ASTERIX_NS, "interval-start-from-time", 2);
public final static FunctionIdentifier INTERVAL_CONSTRUCTOR_START_FROM_DATETIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-start-from-datetime", 2);
- public final static FunctionIdentifier INTERVAL_BEFORE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-before", 2);
- public final static FunctionIdentifier INTERVAL_AFTER = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-after", 2);
- public final static FunctionIdentifier INTERVAL_MEETS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-meets", 2);
- public final static FunctionIdentifier INTERVAL_MET_BY = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-met-by", 2);
- public final static FunctionIdentifier INTERVAL_OVERLAPS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-overlaps", 2);
+ FunctionConstants.ASTERIX_NS, "interval-start-from-datetime", 2);
+ public final static FunctionIdentifier INTERVAL_BEFORE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-before", 2);
+ public final static FunctionIdentifier INTERVAL_AFTER = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-after", 2);
+ public final static FunctionIdentifier INTERVAL_MEETS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-meets", 2);
+ public final static FunctionIdentifier INTERVAL_MET_BY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-met-by", 2);
+ public final static FunctionIdentifier INTERVAL_OVERLAPS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-overlaps", 2);
public final static FunctionIdentifier INTERVAL_OVERLAPPED_BY = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-overlapped-by", 2);
- public final static FunctionIdentifier OVERLAP = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
- "overlap", 2);
- public final static FunctionIdentifier INTERVAL_STARTS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-starts", 2);
- public final static FunctionIdentifier INTERVAL_STARTED_BY = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-started-by", 2);
- public final static FunctionIdentifier INTERVAL_COVERS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-covers", 2);
- public final static FunctionIdentifier INTERVAL_COVERED_BY = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-covered-by", 2);
- public final static FunctionIdentifier INTERVAL_ENDS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-ends", 2);
- public final static FunctionIdentifier INTERVAL_ENDED_BY = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "interval-ended-by", 2);
- public final static FunctionIdentifier CURRENT_TIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "current-time", 0);
- public final static FunctionIdentifier CURRENT_DATE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "current-date", 0);
- public final static FunctionIdentifier CURRENT_DATETIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "current-datetime", 0);
- public final static FunctionIdentifier DURATION_EQUAL = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "duration-equal", 2);
+ FunctionConstants.ASTERIX_NS, "interval-overlapped-by", 2);
+ public final static FunctionIdentifier OVERLAP = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "overlap", 2);
+ public final static FunctionIdentifier INTERVAL_STARTS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-starts", 2);
+ public final static FunctionIdentifier INTERVAL_STARTED_BY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-started-by", 2);
+ public final static FunctionIdentifier INTERVAL_COVERS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-covers", 2);
+ public final static FunctionIdentifier INTERVAL_COVERED_BY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-covered-by", 2);
+ public final static FunctionIdentifier INTERVAL_ENDS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-ends", 2);
+ public final static FunctionIdentifier INTERVAL_ENDED_BY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "interval-ended-by", 2);
+ public final static FunctionIdentifier CURRENT_TIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "current-time", 0);
+ public final static FunctionIdentifier CURRENT_DATE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "current-date", 0);
+ public final static FunctionIdentifier CURRENT_DATETIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "current-datetime", 0);
+ public final static FunctionIdentifier DURATION_EQUAL = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "duration-equal", 2);
public final static FunctionIdentifier YEAR_MONTH_DURATION_GREATER_THAN = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "year-month-duration-greater-than", 2);
+ FunctionConstants.ASTERIX_NS, "year-month-duration-greater-than", 2);
public final static FunctionIdentifier YEAR_MONTH_DURATION_LESS_THAN = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "year-month-duration-less-than", 2);
+ FunctionConstants.ASTERIX_NS, "year-month-duration-less-than", 2);
public final static FunctionIdentifier DAY_TIME_DURATION_GREATER_THAN = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "day-time-duration-greater-than", 2);
+ FunctionConstants.ASTERIX_NS, "day-time-duration-greater-than", 2);
public final static FunctionIdentifier DAY_TIME_DURATION_LESS_THAN = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "day-time-duration-less-than", 2);
- public final static FunctionIdentifier DURATION_FROM_MONTHS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "duration-from-months", 1);
+ FunctionConstants.ASTERIX_NS, "day-time-duration-less-than", 2);
+ public final static FunctionIdentifier DURATION_FROM_MONTHS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "duration-from-months", 1);
public final static FunctionIdentifier MONTHS_FROM_YEAR_MONTH_DURATION = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "months-from-year-month-duration", 1);
+ FunctionConstants.ASTERIX_NS, "months-from-year-month-duration", 1);
public final static FunctionIdentifier DURATION_FROM_MILLISECONDS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "duration-from-ms", 1);
+ FunctionConstants.ASTERIX_NS, "duration-from-ms", 1);
public final static FunctionIdentifier MILLISECONDS_FROM_DAY_TIME_DURATION = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "ms-from-day-time-duration", 1);
+ FunctionConstants.ASTERIX_NS, "ms-from-day-time-duration", 1);
public final static FunctionIdentifier GET_YEAR_MONTH_DURATION = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "get-year-month-duration", 1);
- public final static FunctionIdentifier GET_DAY_TIME_DURATION = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "get-day-time-duration", 1);
+ FunctionConstants.ASTERIX_NS, "get-year-month-duration", 1);
+ public final static FunctionIdentifier GET_DAY_TIME_DURATION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "get-day-time-duration", 1);
// spatial
- public final static FunctionIdentifier CREATE_POINT = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "create-point", 2);
- public final static FunctionIdentifier CREATE_LINE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "create-line", 2);
- public final static FunctionIdentifier CREATE_POLYGON = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "create-polygon", FunctionIdentifier.VARARGS);
- public final static FunctionIdentifier CREATE_CIRCLE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "create-circle", 2);
- public final static FunctionIdentifier CREATE_RECTANGLE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "create-rectangle", 2);
- public final static FunctionIdentifier SPATIAL_INTERSECT = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "spatial-intersect", 2);
- public final static FunctionIdentifier SPATIAL_AREA = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "spatial-area", 1);
- public final static FunctionIdentifier SPATIAL_DISTANCE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "spatial-distance", 2);
- public final static FunctionIdentifier CREATE_MBR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "create-mbr", 3);
- public final static FunctionIdentifier SPATIAL_CELL = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "spatial-cell", 4);
- public final static FunctionIdentifier SWITCH_CASE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "switch-case", FunctionIdentifier.VARARGS);
- public final static FunctionIdentifier REG_EXP = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "reg-exp", 2);
+ public final static FunctionIdentifier CREATE_POINT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "create-point", 2);
+ public final static FunctionIdentifier CREATE_LINE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "create-line", 2);
+ public final static FunctionIdentifier CREATE_POLYGON = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "create-polygon", FunctionIdentifier.VARARGS);
+ public final static FunctionIdentifier CREATE_CIRCLE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "create-circle", 2);
+ public final static FunctionIdentifier CREATE_RECTANGLE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "create-rectangle", 2);
+ public final static FunctionIdentifier SPATIAL_INTERSECT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "spatial-intersect", 2);
+ public final static FunctionIdentifier SPATIAL_AREA = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "spatial-area", 1);
+ public final static FunctionIdentifier SPATIAL_DISTANCE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "spatial-distance", 2);
+ public final static FunctionIdentifier CREATE_MBR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "create-mbr", 3);
+ public final static FunctionIdentifier SPATIAL_CELL = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "spatial-cell", 4);
+ public final static FunctionIdentifier SWITCH_CASE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "switch-case", FunctionIdentifier.VARARGS);
+ public final static FunctionIdentifier REG_EXP = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "reg-exp", 2);
- public final static FunctionIdentifier INJECT_FAILURE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "inject-failure", 2);
- public final static FunctionIdentifier CAST_RECORD = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PRIVATE.name(), "cast-record", 1);
- public final static FunctionIdentifier CAST_LIST = new FunctionIdentifier(FunctionNamespace.ASTERIX_PUBLIC.name(),
+ public final static FunctionIdentifier INJECT_FAILURE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "inject-failure", 2);
+ public final static FunctionIdentifier CAST_RECORD = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "cast-record", 1);
+ public final static FunctionIdentifier CAST_LIST = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
"cast-list", 1);
// Spatial and temporal type accessors
public static final FunctionIdentifier ACCESSOR_TEMPORAL_YEAR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "year", 1);
+ FunctionConstants.ASTERIX_NS, "year", 1);
public static final FunctionIdentifier ACCESSOR_TEMPORAL_MONTH = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "month", 1);
- public static final FunctionIdentifier ACCESSOR_TEMPORAL_DAY = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "day", 1);
+ FunctionConstants.ASTERIX_NS, "month", 1);
+ public static final FunctionIdentifier ACCESSOR_TEMPORAL_DAY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "day", 1);
public static final FunctionIdentifier ACCESSOR_TEMPORAL_HOUR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "hour", 1);
- public static final FunctionIdentifier ACCESSOR_TEMPORAL_MIN = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "minute", 1);
- public static final FunctionIdentifier ACCESSOR_TEMPORAL_SEC = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "second", 1);
+ FunctionConstants.ASTERIX_NS, "hour", 1);
+ public static final FunctionIdentifier ACCESSOR_TEMPORAL_MIN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "minute", 1);
+ public static final FunctionIdentifier ACCESSOR_TEMPORAL_SEC = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "second", 1);
public static final FunctionIdentifier ACCESSOR_TEMPORAL_MILLISEC = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "millisecond", 1);
+ FunctionConstants.ASTERIX_NS, "millisecond", 1);
public static final FunctionIdentifier ACCESSOR_TEMPORAL_INTERVAL_START = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "get-interval-start", 1);
+ FunctionConstants.ASTERIX_NS, "get-interval-start", 1);
public static final FunctionIdentifier ACCESSOR_TEMPORAL_INTERVAL_END = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "get-interval-end", 1);
+ FunctionConstants.ASTERIX_NS, "get-interval-end", 1);
// Temporal functions
public static final FunctionIdentifier DATE_FROM_UNIX_TIME_IN_DAYS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "date-from-unix-time-in-days", 1);
- public static final FunctionIdentifier DATE_FROM_DATETIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "date-from-datetime", 1);
- public final static FunctionIdentifier ADD_DATE_DURATION = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "add-date-duration", 2);
- public final static FunctionIdentifier SUBTRACT_DATE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "subtract-date", 2);
+ FunctionConstants.ASTERIX_NS, "date-from-unix-time-in-days", 1);
+ public static final FunctionIdentifier DATE_FROM_DATETIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "date-from-datetime", 1);
+ public final static FunctionIdentifier ADD_DATE_DURATION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "add-date-duration", 2);
+ public final static FunctionIdentifier SUBTRACT_DATE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "subtract-date", 2);
public final static FunctionIdentifier TIME_FROM_UNIX_TIME_IN_MS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "time-from-unix-time-in-ms", 1);
- public final static FunctionIdentifier TIME_FROM_DATETIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "time-from-datetime", 1);
- public final static FunctionIdentifier SUBTRACT_TIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "subtract-time", 2);
- public final static FunctionIdentifier ADD_TIME_DURATION = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "add-time-duration", 2);
+ FunctionConstants.ASTERIX_NS, "time-from-unix-time-in-ms", 1);
+ public final static FunctionIdentifier TIME_FROM_DATETIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "time-from-datetime", 1);
+ public final static FunctionIdentifier SUBTRACT_TIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "subtract-time", 2);
+ public final static FunctionIdentifier ADD_TIME_DURATION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "add-time-duration", 2);
public final static FunctionIdentifier DATETIME_FROM_UNIX_TIME_IN_MS = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "datetime-from-unix-time-in-ms", 1);
+ FunctionConstants.ASTERIX_NS, "datetime-from-unix-time-in-ms", 1);
public final static FunctionIdentifier DATETIME_FROM_DATE_TIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "datetime-from-date-time", 2);
- public final static FunctionIdentifier SUBTRACT_DATETIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "subtract-datetime", 2);
- public final static FunctionIdentifier ADD_DATETIME_DURATION = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "add-datetime-duration", 2);
+ FunctionConstants.ASTERIX_NS, "datetime-from-date-time", 2);
+ public final static FunctionIdentifier SUBTRACT_DATETIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "subtract-datetime", 2);
+ public final static FunctionIdentifier ADD_DATETIME_DURATION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ "add-datetime-duration", 2);
public final static FunctionIdentifier CALENDAR_DURATION_FROM_DATETIME = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "calendar-duration-from-datetime", 2);
+ FunctionConstants.ASTERIX_NS, "calendar-duration-from-datetime", 2);
public final static FunctionIdentifier CALENDAR_DURATION_FROM_DATE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "calendar-duration-from-date", 2);
+ FunctionConstants.ASTERIX_NS, "calendar-duration-from-date", 2);
public final static FunctionIdentifier ADJUST_TIME_FOR_TIMEZONE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "adjust-time-for-timezone", 2);
+ FunctionConstants.ASTERIX_NS, "adjust-time-for-timezone", 2);
public final static FunctionIdentifier ADJUST_DATETIME_FOR_TIMEZONE = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "adjust-datetime-for-timezone", 2);
+ FunctionConstants.ASTERIX_NS, "adjust-datetime-for-timezone", 2);
public final static FunctionIdentifier GET_POINT_X_COORDINATE_ACCESSOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "get-x", 1);
+ FunctionConstants.ASTERIX_NS, "get-x", 1);
public final static FunctionIdentifier GET_POINT_Y_COORDINATE_ACCESSOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "get-y", 1);
+ FunctionConstants.ASTERIX_NS, "get-y", 1);
public final static FunctionIdentifier GET_CIRCLE_RADIUS_ACCESSOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "get-radius", 1);
+ FunctionConstants.ASTERIX_NS, "get-radius", 1);
public final static FunctionIdentifier GET_CIRCLE_CENTER_ACCESSOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "get-center", 1);
+ FunctionConstants.ASTERIX_NS, "get-center", 1);
public final static FunctionIdentifier GET_POINTS_LINE_RECTANGLE_POLYGON_ACCESSOR = new FunctionIdentifier(
- FunctionNamespace.ASTERIX_PUBLIC.name(), "get-points", 1);
+ FunctionConstants.ASTERIX_NS, "get-points", 1);
public static final FunctionIdentifier EQ = AlgebricksBuiltinFunctions.EQ;
public static final FunctionIdentifier LE = AlgebricksBuiltinFunctions.LE;
@@ -582,8 +559,8 @@
public static final FunctionIdentifier NUMERIC_ADD = AlgebricksBuiltinFunctions.NUMERIC_ADD;
public static final FunctionIdentifier IS_NULL = AlgebricksBuiltinFunctions.IS_NULL;
- public static final FunctionIdentifier NOT_NULL = new FunctionIdentifier(FunctionNamespace.ASTERIX_PRIVATE.name(),
- "not-null", 1);
+ public static final FunctionIdentifier NOT_NULL = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "not-null",
+ 1);
public static IFunctionInfo getAsterixFunctionInfo(FunctionIdentifier fid) {
IFunctionInfo finfo = registeredFunctions.get(fid);
@@ -600,86 +577,73 @@
static {
// first, take care of Algebricks builtin functions
- add(EQ, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(LE, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(GE, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(LT, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(GT, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(IS_NULL, ABooleanTypeComputer.INSTANCE);
- add(AND, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(NEQ, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(NOT, UnaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(OR, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(NUMERIC_ADD, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+ addFunction(IS_NULL, ABooleanTypeComputer.INSTANCE);
+ addFunction(NOT, UnaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+
+ addPrivateFunction(EQ, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addPrivateFunction(LE, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addPrivateFunction(GE, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addPrivateFunction(LT, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addPrivateFunction(GT, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addPrivateFunction(AND, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addPrivateFunction(NEQ, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addPrivateFunction(OR, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addPrivateFunction(NUMERIC_ADD, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
// and then, Asterix builtin functions
- add(NOT_NULL, NotNullTypeComputer.INSTANCE);
- add(ANY_COLLECTION_MEMBER, NonTaggedCollectionMemberResultType.INSTANCE);
- add(AVG, OptionalADoubleTypeComputer.INSTANCE);
- add(BOOLEAN_CONSTRUCTOR, UnaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(CARET, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
- add(CIRCLE_CONSTRUCTOR, OptionalACircleTypeComputer.INSTANCE);
- add(CLOSED_RECORD_CONSTRUCTOR, ClosedRecordConstructorResultType.INSTANCE);
- add(CONCAT_NON_NULL, new IResultTypeComputer() {
- @Override
- public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
- IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
- AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) expression;
- if (f.getArguments().size() < 1) {
- return BuiltinType.ANULL;
- }
- ILogicalExpression a0 = f.getArguments().get(0).getValue();
- IAType t0 = (IAType) env.getType(a0);
- if (TypeHelper.canBeNull(t0)) {
- return t0;
- }
- return AUnionType.createNullableType(t0);
- }
- });
- add(CONTAINS, ABooleanTypeComputer.INSTANCE);
- add(COUNT, AInt32TypeComputer.INSTANCE);
- add(COUNTHASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
- add(COUNTHASHED_WORD_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
- add(CREATE_CIRCLE, ACircleTypeComputer.INSTANCE);
- add(CREATE_LINE, ALineTypeComputer.INSTANCE);
- add(CREATE_MBR, ADoubleTypeComputer.INSTANCE);
- add(CREATE_POINT, APointTypeComputer.INSTANCE);
- add(CREATE_POLYGON, APolygonTypeComputer.INSTANCE);
- add(CREATE_RECTANGLE, ARectangleTypeComputer.INSTANCE);
+ addPrivateFunction(NOT_NULL, NotNullTypeComputer.INSTANCE);
+ addPrivateFunction(ANY_COLLECTION_MEMBER, NonTaggedCollectionMemberResultType.INSTANCE);
+ addPrivateFunction(AVG, OptionalADoubleTypeComputer.INSTANCE);
+ addFunction(BOOLEAN_CONSTRUCTOR, UnaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addFunction(CARET, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+ addFunction(CIRCLE_CONSTRUCTOR, OptionalACircleTypeComputer.INSTANCE);
+ addPrivateFunction(CLOSED_RECORD_CONSTRUCTOR, ClosedRecordConstructorResultType.INSTANCE);
+ addPrivateFunction(CONCAT_NON_NULL, ConcatNonNullTypeComputer.INSTANCE);
- add(DATE_CONSTRUCTOR, OptionalADateTypeComputer.INSTANCE);
- add(DATETIME_CONSTRUCTOR, OptionalADateTimeTypeComputer.INSTANCE);
- add(DOUBLE_CONSTRUCTOR, OptionalADoubleTypeComputer.INSTANCE);
- add(DURATION_CONSTRUCTOR, OptionalADurationTypeComputer.INSTANCE);
- add(YEAR_MONTH_DURATION_CONSTRUCTOR, OptionalAYearMonthDurationTypeComputer.INSTANCE);
- add(DAY_TIME_DURATION_CONSTRUCTOR, OptionalADayTimeDurationTypeComputer.INSTANCE);
- add(EDIT_DISTANCE, AInt32TypeComputer.INSTANCE);
- add(EDIT_DISTANCE_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
- add(EDIT_DISTANCE_STRING_IS_FILTERABLE, ABooleanTypeComputer.INSTANCE);
- add(EDIT_DISTANCE_LIST_IS_FILTERABLE, ABooleanTypeComputer.INSTANCE);
- add(EMBED_TYPE, new IResultTypeComputer() {
+ addFunction(CONTAINS, ABooleanTypeComputer.INSTANCE);
+ addPrivateFunction(COUNT, AInt32TypeComputer.INSTANCE);
+ addFunction(COUNTHASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
+ addPrivateFunction(COUNTHASHED_WORD_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
+ addFunction(CREATE_CIRCLE, ACircleTypeComputer.INSTANCE);
+ addFunction(CREATE_LINE, ALineTypeComputer.INSTANCE);
+ addFunction(CREATE_MBR, ADoubleTypeComputer.INSTANCE);
+ addFunction(CREATE_POINT, APointTypeComputer.INSTANCE);
+ addFunction(CREATE_POLYGON, APolygonTypeComputer.INSTANCE);
+ addFunction(CREATE_RECTANGLE, ARectangleTypeComputer.INSTANCE);
+
+ addFunction(DATE_CONSTRUCTOR, OptionalADateTypeComputer.INSTANCE);
+ addFunction(DATETIME_CONSTRUCTOR, OptionalADateTimeTypeComputer.INSTANCE);
+ addFunction(DOUBLE_CONSTRUCTOR, OptionalADoubleTypeComputer.INSTANCE);
+ addFunction(DURATION_CONSTRUCTOR, OptionalADurationTypeComputer.INSTANCE);
+ addFunction(YEAR_MONTH_DURATION_CONSTRUCTOR, OptionalAYearMonthDurationTypeComputer.INSTANCE);
+ addFunction(DAY_TIME_DURATION_CONSTRUCTOR, OptionalADayTimeDurationTypeComputer.INSTANCE);
+ addFunction(EDIT_DISTANCE, AInt32TypeComputer.INSTANCE);
+ addFunction(EDIT_DISTANCE_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
+ addPrivateFunction(EDIT_DISTANCE_STRING_IS_FILTERABLE, ABooleanTypeComputer.INSTANCE);
+ addPrivateFunction(EDIT_DISTANCE_LIST_IS_FILTERABLE, ABooleanTypeComputer.INSTANCE);
+ addPrivateFunction(EMBED_TYPE, new IResultTypeComputer() {
@Override
public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
IMetadataProvider<?, ?> mp) throws AlgebricksException {
return (IAType) BuiltinType.ANY;
}
});
- add(EMPTY_STREAM, ABooleanTypeComputer.INSTANCE);
- add(ENDS_WITH, ABooleanTypeComputer.INSTANCE);
+ addPrivateFunction(EMPTY_STREAM, ABooleanTypeComputer.INSTANCE);
+ addFunction(ENDS_WITH, ABooleanTypeComputer.INSTANCE);
// add(FIELD_ACCESS, NonTaggedFieldAccessByNameResultType.INSTANCE);
- add(FIELD_ACCESS_BY_INDEX, FieldAccessByIndexResultType.INSTANCE);
- add(FIELD_ACCESS_BY_NAME, NonTaggedFieldAccessByNameResultType.INSTANCE);
- add(FLOAT_CONSTRUCTOR, OptionalAFloatTypeComputer.INSTANCE);
- add(FUZZY_EQ, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(GET_HANDLE, null); // TODO
- add(GET_ITEM, NonTaggedGetItemResultType.INSTANCE);
- add(GET_DATA, null); // TODO
- add(GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
- add(GRAM_TOKENS, OrderedListOfAStringTypeComputer.INSTANCE);
- add(GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
- add(HASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
- add(HASHED_WORD_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
- add(INDEX_SEARCH, new IResultTypeComputer() {
+ addPrivateFunction(FIELD_ACCESS_BY_INDEX, FieldAccessByIndexResultType.INSTANCE);
+ addPrivateFunction(FIELD_ACCESS_BY_NAME, NonTaggedFieldAccessByNameResultType.INSTANCE);
+ addFunction(FLOAT_CONSTRUCTOR, OptionalAFloatTypeComputer.INSTANCE);
+ addPrivateFunction(FUZZY_EQ, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addPrivateFunction(GET_HANDLE, null); // TODO
+ addPrivateFunction(GET_ITEM, NonTaggedGetItemResultType.INSTANCE);
+ addPrivateFunction(GET_DATA, null); // TODO
+ addPrivateFunction(GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
+ addPrivateFunction(GRAM_TOKENS, OrderedListOfAStringTypeComputer.INSTANCE);
+ addFunction(GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
+ addFunction(HASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
+ addPrivateFunction(HASHED_WORD_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
+ addPrivateFunction(INDEX_SEARCH, new IResultTypeComputer() {
@Override
public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
@@ -687,95 +651,95 @@
return BuiltinType.ANY; // TODO
}
});
- add(INT8_CONSTRUCTOR, OptionalAInt8TypeComputer.INSTANCE);
- add(INT16_CONSTRUCTOR, OptionalAInt16TypeComputer.INSTANCE);
- add(INT32_CONSTRUCTOR, OptionalAInt32TypeComputer.INSTANCE);
- add(INT64_CONSTRUCTOR, OptionalAInt64TypeComputer.INSTANCE);
- add(LEN, OptionalAInt32TypeComputer.INSTANCE);
- add(LIKE, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
- add(LINE_CONSTRUCTOR, OptionalALineTypeComputer.INSTANCE);
- add(LISTIFY, OrderedListConstructorResultType.INSTANCE);
- add(LOCAL_AVG, NonTaggedLocalAvgTypeComputer.INSTANCE);
- add(MAKE_FIELD_INDEX_HANDLE, null); // TODO
- add(MAKE_FIELD_NAME_HANDLE, null); // TODO
- add(MAX, NonTaggedSumTypeComputer.INSTANCE);
- add(LOCAL_MAX, NonTaggedSumTypeComputer.INSTANCE);
- add(MIN, NonTaggedSumTypeComputer.INSTANCE);
- add(LOCAL_MIN, NonTaggedSumTypeComputer.INSTANCE);
- add(NON_EMPTY_STREAM, ABooleanTypeComputer.INSTANCE);
- add(NULL_CONSTRUCTOR, ANullTypeComputer.INSTANCE);
- add(NUMERIC_UNARY_MINUS, NonTaggedUnaryMinusTypeComputer.INSTANCE);
- add(NUMERIC_SUBTRACT, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
- add(NUMERIC_MULTIPLY, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
- add(NUMERIC_DIVIDE, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
- add(NUMERIC_MOD, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
- add(NUMERIC_IDIV, AInt32TypeComputer.INSTANCE);
+ addFunction(INT8_CONSTRUCTOR, OptionalAInt8TypeComputer.INSTANCE);
+ addFunction(INT16_CONSTRUCTOR, OptionalAInt16TypeComputer.INSTANCE);
+ addFunction(INT32_CONSTRUCTOR, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(INT64_CONSTRUCTOR, OptionalAInt64TypeComputer.INSTANCE);
+ addFunction(LEN, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(LIKE, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
+ addFunction(LINE_CONSTRUCTOR, OptionalALineTypeComputer.INSTANCE);
+ addPrivateFunction(LISTIFY, OrderedListConstructorResultType.INSTANCE);
+ addPrivateFunction(LOCAL_AVG, NonTaggedLocalAvgTypeComputer.INSTANCE);
+ addPrivateFunction(MAKE_FIELD_INDEX_HANDLE, null); // TODO
+ addPrivateFunction(MAKE_FIELD_NAME_HANDLE, null); // TODO
+ addPrivateFunction(MAX, NonTaggedSumTypeComputer.INSTANCE);
+ addPrivateFunction(LOCAL_MAX, NonTaggedSumTypeComputer.INSTANCE);
+ addPrivateFunction(MIN, NonTaggedSumTypeComputer.INSTANCE);
+ addPrivateFunction(LOCAL_MIN, NonTaggedSumTypeComputer.INSTANCE);
+ addPrivateFunction(NON_EMPTY_STREAM, ABooleanTypeComputer.INSTANCE);
+ addFunction(NULL_CONSTRUCTOR, ANullTypeComputer.INSTANCE);
+ addFunction(NUMERIC_UNARY_MINUS, NonTaggedUnaryMinusTypeComputer.INSTANCE);
+ addFunction(NUMERIC_SUBTRACT, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+ addFunction(NUMERIC_MULTIPLY, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+ addFunction(NUMERIC_DIVIDE, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+ addFunction(NUMERIC_MOD, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+ addFunction(NUMERIC_IDIV, AInt32TypeComputer.INSTANCE);
- add(NUMERIC_ABS, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
- add(NUMERIC_CEILING, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
- add(NUMERIC_FLOOR, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
- add(NUMERIC_ROUND, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
- add(NUMERIC_ROUND_HALF_TO_EVEN, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
- add(NUMERIC_ROUND_HALF_TO_EVEN2, NonTaggedNumericRoundHalfToEven2TypeComputer.INSTANCE);
+ addFunction(NUMERIC_ABS, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
+ addFunction(NUMERIC_CEILING, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
+ addFunction(NUMERIC_FLOOR, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
+ addFunction(NUMERIC_ROUND, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
+ addFunction(NUMERIC_ROUND_HALF_TO_EVEN, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
+ addFunction(NUMERIC_ROUND_HALF_TO_EVEN2, NonTaggedNumericRoundHalfToEven2TypeComputer.INSTANCE);
- add(STRING_TO_CODEPOINT, OrderedListOfAInt32TypeComputer.INSTANCE);
- add(CODEPOINT_TO_STRING, AStringTypeComputer.INSTANCE);
- add(STRING_CONCAT, OptionalAStringTypeComputer.INSTANCE);
- add(SUBSTRING2, Substring2TypeComputer.INSTANCE);
- add(STRING_LENGTH, UnaryStringInt32OrNullTypeComputer.INSTANCE);
- add(STRING_LOWERCASE, UnaryStringOrNullTypeComputer.INSTANCE);
- add(STRING_START_WITH, BinaryStringBoolOrNullTypeComputer.INSTANCE);
- add(STRING_END_WITH, BinaryStringBoolOrNullTypeComputer.INSTANCE);
- add(STRING_MATCHES, BinaryStringBoolOrNullTypeComputer.INSTANCE);
- add(STRING_MATCHES_WITH_FLAG, TripleStringBoolOrNullTypeComputer.INSTANCE);
- add(STRING_REPLACE, TripleStringStringOrNullTypeComputer.INSTANCE);
- add(STRING_REPLACE_WITH_FLAG, QuadStringStringOrNullTypeComputer.INSTANCE);
- add(SUBSTRING_BEFORE, BinaryStringStringOrNullTypeComputer.INSTANCE);
- add(SUBSTRING_AFTER, BinaryStringStringOrNullTypeComputer.INSTANCE);
- add(STRING_EQUAL, BinaryStringBoolOrNullTypeComputer.INSTANCE);
- add(STRING_JOIN, AStringTypeComputer.INSTANCE);
+ addFunction(STRING_TO_CODEPOINT, OrderedListOfAInt32TypeComputer.INSTANCE);
+ addFunction(CODEPOINT_TO_STRING, AStringTypeComputer.INSTANCE);
+ addFunction(STRING_CONCAT, OptionalAStringTypeComputer.INSTANCE);
+ addFunction(SUBSTRING2, Substring2TypeComputer.INSTANCE);
+ addFunction(STRING_LENGTH, UnaryStringInt32OrNullTypeComputer.INSTANCE);
+ addFunction(STRING_LOWERCASE, UnaryStringOrNullTypeComputer.INSTANCE);
+ addFunction(STRING_START_WITH, BinaryStringBoolOrNullTypeComputer.INSTANCE);
+ addFunction(STRING_END_WITH, BinaryStringBoolOrNullTypeComputer.INSTANCE);
+ addFunction(STRING_MATCHES, BinaryStringBoolOrNullTypeComputer.INSTANCE);
+ addFunction(STRING_MATCHES_WITH_FLAG, TripleStringBoolOrNullTypeComputer.INSTANCE);
+ addFunction(STRING_REPLACE, TripleStringStringOrNullTypeComputer.INSTANCE);
+ addFunction(STRING_REPLACE_WITH_FLAG, QuadStringStringOrNullTypeComputer.INSTANCE);
+ addFunction(SUBSTRING_BEFORE, BinaryStringStringOrNullTypeComputer.INSTANCE);
+ addFunction(SUBSTRING_AFTER, BinaryStringStringOrNullTypeComputer.INSTANCE);
+ addPrivateFunction(STRING_EQUAL, BinaryStringBoolOrNullTypeComputer.INSTANCE);
+ addFunction(STRING_JOIN, AStringTypeComputer.INSTANCE);
- add(OPEN_RECORD_CONSTRUCTOR, OpenRecordConstructorResultType.INSTANCE);
- add(ORDERED_LIST_CONSTRUCTOR, OrderedListConstructorResultType.INSTANCE);
- add(POINT_CONSTRUCTOR, OptionalAPointTypeComputer.INSTANCE);
- add(POINT3D_CONSTRUCTOR, OptionalAPoint3DTypeComputer.INSTANCE);
- add(POLYGON_CONSTRUCTOR, OptionalAPolygonTypeComputer.INSTANCE);
- add(PREFIX_LEN_JACCARD, AInt32TypeComputer.INSTANCE);
- add(RANGE, AInt32TypeComputer.INSTANCE);
- add(RECTANGLE_CONSTRUCTOR, OptionalARectangleTypeComputer.INSTANCE);
+ addPrivateFunction(OPEN_RECORD_CONSTRUCTOR, OpenRecordConstructorResultType.INSTANCE);
+ addPrivateFunction(ORDERED_LIST_CONSTRUCTOR, OrderedListConstructorResultType.INSTANCE);
+ addFunction(POINT_CONSTRUCTOR, OptionalAPointTypeComputer.INSTANCE);
+ addFunction(POINT3D_CONSTRUCTOR, OptionalAPoint3DTypeComputer.INSTANCE);
+ addFunction(POLYGON_CONSTRUCTOR, OptionalAPolygonTypeComputer.INSTANCE);
+ addPrivateFunction(PREFIX_LEN_JACCARD, AInt32TypeComputer.INSTANCE);
+ addFunction(RANGE, AInt32TypeComputer.INSTANCE);
+ addFunction(RECTANGLE_CONSTRUCTOR, OptionalARectangleTypeComputer.INSTANCE);
// add(RECORD_TYPE_CONSTRUCTOR, null);
- add(SCALAR_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
- add(SCALAR_COUNT, AInt32TypeComputer.INSTANCE);
- add(SCALAR_GLOBAL_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
- add(SCALAR_LOCAL_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
- add(SCALAR_MAX, ScalarVersionOfAggregateResultType.INSTANCE);
- add(SCALAR_MIN, ScalarVersionOfAggregateResultType.INSTANCE);
- add(SCALAR_SUM, ScalarVersionOfAggregateResultType.INSTANCE);
- add(SCAN_COLLECTION, NonTaggedCollectionMemberResultType.INSTANCE);
- add(SERIAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
- add(SERIAL_COUNT, AInt32TypeComputer.INSTANCE);
- add(SERIAL_GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
- add(SERIAL_LOCAL_AVG, NonTaggedLocalAvgTypeComputer.INSTANCE);
- add(SERIAL_SUM, NonTaggedSumTypeComputer.INSTANCE);
- add(SERIAL_LOCAL_SUM, NonTaggedSumTypeComputer.INSTANCE);
- add(SIMILARITY_JACCARD, AFloatTypeComputer.INSTANCE);
- add(SIMILARITY_JACCARD_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
- add(SIMILARITY_JACCARD_SORTED, AFloatTypeComputer.INSTANCE);
- add(SIMILARITY_JACCARD_SORTED_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
- add(SIMILARITY_JACCARD_PREFIX, AFloatTypeComputer.INSTANCE);
- add(SIMILARITY_JACCARD_PREFIX_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
- add(SPATIAL_AREA, ADoubleTypeComputer.INSTANCE);
- add(SPATIAL_CELL, ARectangleTypeComputer.INSTANCE);
- add(SPATIAL_DISTANCE, ADoubleTypeComputer.INSTANCE);
- add(SPATIAL_INTERSECT, ABooleanTypeComputer.INSTANCE);
- add(GET_POINT_X_COORDINATE_ACCESSOR, ADoubleTypeComputer.INSTANCE);
- add(GET_POINT_Y_COORDINATE_ACCESSOR, ADoubleTypeComputer.INSTANCE);
- add(GET_CIRCLE_RADIUS_ACCESSOR, ADoubleTypeComputer.INSTANCE);
- add(GET_CIRCLE_CENTER_ACCESSOR, APointTypeComputer.INSTANCE);
- add(GET_POINTS_LINE_RECTANGLE_POLYGON_ACCESSOR, OrderedListOfAPointTypeComputer.INSTANCE);
- add(STARTS_WITH, ABooleanTypeComputer.INSTANCE);
- add(STRING_CONSTRUCTOR, OptionalAStringTypeComputer.INSTANCE);
- add(SUBSET_COLLECTION, new IResultTypeComputer() {
+ addFunction(SCALAR_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
+ addFunction(SCALAR_COUNT, AInt32TypeComputer.INSTANCE);
+ addPrivateFunction(SCALAR_GLOBAL_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
+ addPrivateFunction(SCALAR_LOCAL_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
+ addFunction(SCALAR_MAX, ScalarVersionOfAggregateResultType.INSTANCE);
+ addFunction(SCALAR_MIN, ScalarVersionOfAggregateResultType.INSTANCE);
+ addFunction(SCALAR_SUM, ScalarVersionOfAggregateResultType.INSTANCE);
+ addPrivateFunction(SCAN_COLLECTION, NonTaggedCollectionMemberResultType.INSTANCE);
+ addPrivateFunction(SERIAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
+ addPrivateFunction(SERIAL_COUNT, AInt32TypeComputer.INSTANCE);
+ addPrivateFunction(SERIAL_GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
+ addPrivateFunction(SERIAL_LOCAL_AVG, NonTaggedLocalAvgTypeComputer.INSTANCE);
+ addPrivateFunction(SERIAL_SUM, NonTaggedSumTypeComputer.INSTANCE);
+ addPrivateFunction(SERIAL_LOCAL_SUM, NonTaggedSumTypeComputer.INSTANCE);
+ addFunction(SIMILARITY_JACCARD, AFloatTypeComputer.INSTANCE);
+ addFunction(SIMILARITY_JACCARD_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
+ addPrivateFunction(SIMILARITY_JACCARD_SORTED, AFloatTypeComputer.INSTANCE);
+ addPrivateFunction(SIMILARITY_JACCARD_SORTED_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
+ addPrivateFunction(SIMILARITY_JACCARD_PREFIX, AFloatTypeComputer.INSTANCE);
+ addPrivateFunction(SIMILARITY_JACCARD_PREFIX_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
+ addFunction(SPATIAL_AREA, ADoubleTypeComputer.INSTANCE);
+ addFunction(SPATIAL_CELL, ARectangleTypeComputer.INSTANCE);
+ addFunction(SPATIAL_DISTANCE, ADoubleTypeComputer.INSTANCE);
+ addFunction(SPATIAL_INTERSECT, ABooleanTypeComputer.INSTANCE);
+ addFunction(GET_POINT_X_COORDINATE_ACCESSOR, ADoubleTypeComputer.INSTANCE);
+ addFunction(GET_POINT_Y_COORDINATE_ACCESSOR, ADoubleTypeComputer.INSTANCE);
+ addFunction(GET_CIRCLE_RADIUS_ACCESSOR, ADoubleTypeComputer.INSTANCE);
+ addFunction(GET_CIRCLE_CENTER_ACCESSOR, APointTypeComputer.INSTANCE);
+ addFunction(GET_POINTS_LINE_RECTANGLE_POLYGON_ACCESSOR, OrderedListOfAPointTypeComputer.INSTANCE);
+ addFunction(STARTS_WITH, ABooleanTypeComputer.INSTANCE);
+ addFunction(STRING_CONSTRUCTOR, OptionalAStringTypeComputer.INSTANCE);
+ addPrivateFunction(SUBSET_COLLECTION, new IResultTypeComputer() {
@Override
public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
@@ -812,20 +776,20 @@
}
}
});
- add(SUBSTRING, SubstringTypeComputer.INSTANCE);
- add(SUM, NonTaggedSumTypeComputer.INSTANCE);
- add(LOCAL_SUM, NonTaggedSumTypeComputer.INSTANCE);
- add(SWITCH_CASE, NonTaggedSwitchCaseComputer.INSTANCE);
- add(REG_EXP, ABooleanTypeComputer.INSTANCE);
- add(INJECT_FAILURE, InjectFailureTypeComputer.INSTANCE);
- add(CAST_RECORD, CastRecordResultTypeComputer.INSTANCE);
- add(CAST_LIST, CastListResultTypeComputer.INSTANCE);
+ addFunction(SUBSTRING, SubstringTypeComputer.INSTANCE);
+ addPrivateFunction(SUM, NonTaggedSumTypeComputer.INSTANCE);
+ addPrivateFunction(LOCAL_SUM, NonTaggedSumTypeComputer.INSTANCE);
+ addFunction(SWITCH_CASE, NonTaggedSwitchCaseComputer.INSTANCE);
+ addPrivateFunction(REG_EXP, ABooleanTypeComputer.INSTANCE);
+ addFunction(INJECT_FAILURE, InjectFailureTypeComputer.INSTANCE);
+ addPrivateFunction(CAST_RECORD, CastRecordResultTypeComputer.INSTANCE);
+ addFunction(CAST_LIST, CastListResultTypeComputer.INSTANCE);
- add(TID, AInt32TypeComputer.INSTANCE);
- add(TIME_CONSTRUCTOR, OptionalATimeTypeComputer.INSTANCE);
- add(TYPE_OF, null); // TODO
- add(UNORDERED_LIST_CONSTRUCTOR, UnorderedListConstructorResultType.INSTANCE);
- add(WORD_TOKENS, new IResultTypeComputer() {
+ addFunction(TID, AInt32TypeComputer.INSTANCE);
+ addFunction(TIME_CONSTRUCTOR, OptionalATimeTypeComputer.INSTANCE);
+ addFunction(TYPE_OF, null); // TODO
+ addPrivateFunction(UNORDERED_LIST_CONSTRUCTOR, UnorderedListConstructorResultType.INSTANCE);
+ addFunction(WORD_TOKENS, new IResultTypeComputer() {
@Override
public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
@@ -835,68 +799,68 @@
});
// temporal type accessors
- add(ACCESSOR_TEMPORAL_YEAR, OptionalAInt32TypeComputer.INSTANCE);
- add(ACCESSOR_TEMPORAL_MONTH, OptionalAInt32TypeComputer.INSTANCE);
- add(ACCESSOR_TEMPORAL_DAY, OptionalAInt32TypeComputer.INSTANCE);
- add(ACCESSOR_TEMPORAL_HOUR, OptionalAInt32TypeComputer.INSTANCE);
- add(ACCESSOR_TEMPORAL_MIN, OptionalAInt32TypeComputer.INSTANCE);
- add(ACCESSOR_TEMPORAL_SEC, OptionalAInt32TypeComputer.INSTANCE);
- add(ACCESSOR_TEMPORAL_MILLISEC, OptionalAInt32TypeComputer.INSTANCE);
- add(ACCESSOR_TEMPORAL_INTERVAL_START, OptionalATemporalInstanceTypeComputer.INSTANCE);
- add(ACCESSOR_TEMPORAL_INTERVAL_END, OptionalATemporalInstanceTypeComputer.INSTANCE);
+ addFunction(ACCESSOR_TEMPORAL_YEAR, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(ACCESSOR_TEMPORAL_MONTH, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(ACCESSOR_TEMPORAL_DAY, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(ACCESSOR_TEMPORAL_HOUR, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(ACCESSOR_TEMPORAL_MIN, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(ACCESSOR_TEMPORAL_SEC, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(ACCESSOR_TEMPORAL_MILLISEC, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(ACCESSOR_TEMPORAL_INTERVAL_START, OptionalATemporalInstanceTypeComputer.INSTANCE);
+ addFunction(ACCESSOR_TEMPORAL_INTERVAL_END, OptionalATemporalInstanceTypeComputer.INSTANCE);
// temporal functions
- add(DATE_FROM_UNIX_TIME_IN_DAYS, OptionalADateTypeComputer.INSTANCE);
- add(DATE_FROM_DATETIME, OptionalADateTypeComputer.INSTANCE);
- add(ADD_DATE_DURATION, OptionalADateTypeComputer.INSTANCE);
- add(SUBTRACT_DATE, OptionalADurationTypeComputer.INSTANCE);
- add(TIME_FROM_UNIX_TIME_IN_MS, OptionalATimeTypeComputer.INSTANCE);
- add(TIME_FROM_DATETIME, OptionalATimeTypeComputer.INSTANCE);
- add(SUBTRACT_TIME, OptionalADurationTypeComputer.INSTANCE);
- add(ADD_TIME_DURATION, OptionalATimeTypeComputer.INSTANCE);
- add(DATETIME_FROM_DATE_TIME, OptionalADateTimeTypeComputer.INSTANCE);
- add(DATETIME_FROM_UNIX_TIME_IN_MS, OptionalADateTimeTypeComputer.INSTANCE);
- add(SUBTRACT_DATETIME, OptionalADurationTypeComputer.INSTANCE);
- add(ADD_DATETIME_DURATION, OptionalADateTimeTypeComputer.INSTANCE);
- add(CALENDAR_DURATION_FROM_DATETIME, OptionalADurationTypeComputer.INSTANCE);
- add(CALENDAR_DURATION_FROM_DATE, OptionalADurationTypeComputer.INSTANCE);
- add(ADJUST_DATETIME_FOR_TIMEZONE, OptionalAStringTypeComputer.INSTANCE);
- add(ADJUST_TIME_FOR_TIMEZONE, OptionalAStringTypeComputer.INSTANCE);
- add(INTERVAL_BEFORE, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_AFTER, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_MEETS, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_MET_BY, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_OVERLAPS, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_OVERLAPPED_BY, OptionalABooleanTypeComputer.INSTANCE);
- add(OVERLAP, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_STARTS, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_STARTED_BY, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_COVERS, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_COVERED_BY, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_ENDS, OptionalABooleanTypeComputer.INSTANCE);
- add(INTERVAL_ENDED_BY, OptionalABooleanTypeComputer.INSTANCE);
- add(CURRENT_DATE, ADateTypeComputer.INSTANCE);
- add(CURRENT_TIME, ATimeTypeComputer.INSTANCE);
- add(CURRENT_DATETIME, ADateTimeTypeComputer.INSTANCE);
- add(DAY_TIME_DURATION_GREATER_THAN, OptionalABooleanTypeComputer.INSTANCE);
- add(DAY_TIME_DURATION_LESS_THAN, OptionalABooleanTypeComputer.INSTANCE);
- add(YEAR_MONTH_DURATION_GREATER_THAN, OptionalABooleanTypeComputer.INSTANCE);
- add(YEAR_MONTH_DURATION_LESS_THAN, OptionalABooleanTypeComputer.INSTANCE);
- add(DURATION_EQUAL, OptionalABooleanTypeComputer.INSTANCE);
- add(DURATION_FROM_MONTHS, OptionalADurationTypeComputer.INSTANCE);
- add(DURATION_FROM_MILLISECONDS, OptionalADurationTypeComputer.INSTANCE);
- add(MONTHS_FROM_YEAR_MONTH_DURATION, OptionalAInt32TypeComputer.INSTANCE);
- add(MILLISECONDS_FROM_DAY_TIME_DURATION, OptionalAInt64TypeComputer.INSTANCE);
- add(GET_DAY_TIME_DURATION, OptionalADayTimeDurationTypeComputer.INSTANCE);
- add(GET_YEAR_MONTH_DURATION, OptionalAYearMonthDurationTypeComputer.INSTANCE);
+ addFunction(DATE_FROM_UNIX_TIME_IN_DAYS, OptionalADateTypeComputer.INSTANCE);
+ addFunction(DATE_FROM_DATETIME, OptionalADateTypeComputer.INSTANCE);
+ addFunction(ADD_DATE_DURATION, OptionalADateTypeComputer.INSTANCE);
+ addFunction(SUBTRACT_DATE, OptionalADurationTypeComputer.INSTANCE);
+ addFunction(TIME_FROM_UNIX_TIME_IN_MS, OptionalATimeTypeComputer.INSTANCE);
+ addFunction(TIME_FROM_DATETIME, OptionalATimeTypeComputer.INSTANCE);
+ addFunction(SUBTRACT_TIME, OptionalADurationTypeComputer.INSTANCE);
+ addFunction(ADD_TIME_DURATION, OptionalATimeTypeComputer.INSTANCE);
+ addFunction(DATETIME_FROM_DATE_TIME, OptionalADateTimeTypeComputer.INSTANCE);
+ addFunction(DATETIME_FROM_UNIX_TIME_IN_MS, OptionalADateTimeTypeComputer.INSTANCE);
+ addFunction(SUBTRACT_DATETIME, OptionalADurationTypeComputer.INSTANCE);
+ addFunction(ADD_DATETIME_DURATION, OptionalADateTimeTypeComputer.INSTANCE);
+ addFunction(CALENDAR_DURATION_FROM_DATETIME, OptionalADurationTypeComputer.INSTANCE);
+ addFunction(CALENDAR_DURATION_FROM_DATE, OptionalADurationTypeComputer.INSTANCE);
+ addFunction(ADJUST_DATETIME_FOR_TIMEZONE, OptionalAStringTypeComputer.INSTANCE);
+ addFunction(ADJUST_TIME_FOR_TIMEZONE, OptionalAStringTypeComputer.INSTANCE);
+ addFunction(INTERVAL_BEFORE, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_AFTER, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_MEETS, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_MET_BY, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_OVERLAPS, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_OVERLAPPED_BY, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(OVERLAP, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_STARTS, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_STARTED_BY, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_COVERS, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_COVERED_BY, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_ENDS, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(INTERVAL_ENDED_BY, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(CURRENT_DATE, ADateTypeComputer.INSTANCE);
+ addFunction(CURRENT_TIME, ATimeTypeComputer.INSTANCE);
+ addFunction(CURRENT_DATETIME, ADateTimeTypeComputer.INSTANCE);
+ addFunction(DAY_TIME_DURATION_GREATER_THAN, OptionalABooleanTypeComputer.INSTANCE);
+ addPrivateFunction(DAY_TIME_DURATION_LESS_THAN, OptionalABooleanTypeComputer.INSTANCE);
+ addPrivateFunction(YEAR_MONTH_DURATION_GREATER_THAN, OptionalABooleanTypeComputer.INSTANCE);
+ addPrivateFunction(YEAR_MONTH_DURATION_LESS_THAN, OptionalABooleanTypeComputer.INSTANCE);
+ addPrivateFunction(DURATION_EQUAL, OptionalABooleanTypeComputer.INSTANCE);
+ addFunction(DURATION_FROM_MONTHS, OptionalADurationTypeComputer.INSTANCE);
+ addFunction(DURATION_FROM_MILLISECONDS, OptionalADurationTypeComputer.INSTANCE);
+ addFunction(MONTHS_FROM_YEAR_MONTH_DURATION, OptionalAInt32TypeComputer.INSTANCE);
+ addFunction(MILLISECONDS_FROM_DAY_TIME_DURATION, OptionalAInt64TypeComputer.INSTANCE);
+ addFunction(GET_DAY_TIME_DURATION, OptionalADayTimeDurationTypeComputer.INSTANCE);
+ addFunction(GET_YEAR_MONTH_DURATION, OptionalAYearMonthDurationTypeComputer.INSTANCE);
// interval constructors
- add(INTERVAL_CONSTRUCTOR_DATE, OptionalAIntervalTypeComputer.INSTANCE);
- add(INTERVAL_CONSTRUCTOR_TIME, OptionalAIntervalTypeComputer.INSTANCE);
- add(INTERVAL_CONSTRUCTOR_DATETIME, OptionalAIntervalTypeComputer.INSTANCE);
- add(INTERVAL_CONSTRUCTOR_START_FROM_DATE, OptionalAIntervalTypeComputer.INSTANCE);
- add(INTERVAL_CONSTRUCTOR_START_FROM_DATETIME, OptionalAIntervalTypeComputer.INSTANCE);
- add(INTERVAL_CONSTRUCTOR_START_FROM_TIME, OptionalAIntervalTypeComputer.INSTANCE);
+ addFunction(INTERVAL_CONSTRUCTOR_DATE, OptionalAIntervalTypeComputer.INSTANCE);
+ addFunction(INTERVAL_CONSTRUCTOR_TIME, OptionalAIntervalTypeComputer.INSTANCE);
+ addFunction(INTERVAL_CONSTRUCTOR_DATETIME, OptionalAIntervalTypeComputer.INSTANCE);
+ addFunction(INTERVAL_CONSTRUCTOR_START_FROM_DATE, OptionalAIntervalTypeComputer.INSTANCE);
+ addFunction(INTERVAL_CONSTRUCTOR_START_FROM_DATETIME, OptionalAIntervalTypeComputer.INSTANCE);
+ addFunction(INTERVAL_CONSTRUCTOR_START_FROM_TIME, OptionalAIntervalTypeComputer.INSTANCE);
String metadataFunctionLoaderClassName = "edu.uci.ics.asterix.metadata.functions.MetadataBuiltinFunctions";
try {
@@ -990,8 +954,27 @@
return datasetFunctions.contains(getAsterixFunctionInfo(fi));
}
- public static boolean isBuiltinCompilerFunction(FunctionIdentifier fi) {
- return builtinFunctionsSet.keySet().contains(getAsterixFunctionInfo(fi));
+ public static boolean isBuiltinCompilerFunction(FunctionIdentifier fi, boolean includePrivateFunctions) {
+ return builtinPublicFunctionsSet.keySet().contains(getAsterixFunctionInfo(fi));
+ }
+
+ public static boolean isBuiltinCompilerFunction(FunctionSignature signature, boolean includePrivateFunctions) {
+
+ FunctionIdentifier fi = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, signature.getName(),
+ signature.getArity());
+ IFunctionInfo finfo = getAsterixFunctionInfo(fi);
+ if (builtinPublicFunctionsSet.keySet().contains(finfo)
+ || (includePrivateFunctions && builtinPrivateFunctionsSet.keySet().contains(finfo))) {
+ return true;
+ }
+ fi = new FunctionIdentifier(AlgebricksBuiltinFunctions.ALGEBRICKS_NS, signature.getName(), signature.getArity());
+ finfo = getAsterixFunctionInfo(fi);
+ if (builtinPublicFunctionsSet.keySet().contains(finfo)
+ || (includePrivateFunctions && builtinPrivateFunctionsSet.keySet().contains(finfo))) {
+ return true;
+ }
+
+ return false;
}
public static boolean isBuiltinAggregateFunction(FunctionIdentifier fi) {
@@ -1076,9 +1059,16 @@
return finfo == null ? null : finfo.getFunctionIdentifier();
}
- public static void add(FunctionIdentifier fi, IResultTypeComputer typeComputer) {
+ public static void addFunction(FunctionIdentifier fi, IResultTypeComputer typeComputer) {
IFunctionInfo functionInfo = getAsterixFunctionInfo(fi);
- builtinFunctionsSet.put(functionInfo, functionInfo);
+ builtinPublicFunctionsSet.put(functionInfo, functionInfo);
+ funTypeComputer.put(functionInfo, typeComputer);
+ registeredFunctions.put(fi);
+ }
+
+ public static void addPrivateFunction(FunctionIdentifier fi, IResultTypeComputer typeComputer) {
+ IFunctionInfo functionInfo = getAsterixFunctionInfo(fi);
+ builtinPrivateFunctionsSet.put(functionInfo, functionInfo);
funTypeComputer.put(functionInfo, typeComputer);
registeredFunctions.put(fi);
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
index 494ea6f..ed9690c 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
@@ -99,7 +99,7 @@
start = bos.size();
dos.write(ATypeTag.NULL.serialize());
end = bos.size();
- nullTypeTag.set(bos.getByteArray(), start, end);
+ nullTypeTag.set(bos.getByteArray(), start, end - start);
} catch (IOException e) {
throw new IllegalStateException(e);
}
@@ -150,7 +150,7 @@
for (int i = 0; i < optionalFields.length; i++)
optionalFields[i] = false;
- bos.reset(nullReference.getStartOffset() + nullReference.getLength());
+ bos.reset(nullTypeTag.getStartOffset() + nullTypeTag.getLength());
for (int i = 0; i < numSchemaFields; i++) {
ATypeTag ftypeTag = fieldTypes[i].getTypeTag();
String fname = fieldNames[i];
@@ -278,8 +278,14 @@
// recursively casting, the result of casting can always be thought
// as flat
if (optionalFields[i]) {
- nestedVisitorArg.second = ((AUnionType) fType).getUnionList().get(
- NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ if (fieldTypeTags.size() <= i || fieldTypeTags.get(i) == null
+ || fieldTypeTags.get(i).equals(nullTypeTag)) {
+ //the field is optional in the input record
+ nestedVisitorArg.second = ((AUnionType) fType).getUnionList().get(0);
+ } else {
+ nestedVisitorArg.second = ((AUnionType) fType).getUnionList().get(
+ NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ }
}
field.accept(visitor, nestedVisitorArg);
recBuilder.addField(i, nestedVisitorArg.first);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/ConcatNonNullTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/ConcatNonNullTypeComputer.java
new file mode 100644
index 0000000..7bf2668
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/ConcatNonNullTypeComputer.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+
+package edu.uci.ics.asterix.om.typecomputer.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+
+/**
+ * The type computer for concat-not-null.
+ * Note that this function is only used for the if-then-else clause.
+ *
+ * @author yingyib
+ */
+public class ConcatNonNullTypeComputer implements IResultTypeComputer {
+
+ public static final ConcatNonNullTypeComputer INSTANCE = new ConcatNonNullTypeComputer();
+
+ @Override
+ public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
+ IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
+ AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) expression;
+ if (f.getArguments().size() < 1) {
+ return BuiltinType.ANULL;
+ }
+ List<IAType> possibleTypes = new ArrayList<IAType>();
+ for (int i = 0; i < f.getArguments().size(); i++) {
+ ILogicalExpression arg = f.getArguments().get(i).getValue();
+ IAType type = (IAType) env.getType(arg);
+ if (type.getTypeTag() == ATypeTag.UNION) {
+ List<IAType> typeList = ((AUnionType) type).getUnionList();
+ for (IAType t : typeList) {
+ if (t.getTypeTag() != ATypeTag.NULL) {
+ //CONCAT_NON_NULL cannot return null because it's only used for if-else construct
+ if (!possibleTypes.contains(t))
+ possibleTypes.add(t);
+ }
+ }
+ } else {
+ if (!possibleTypes.contains(type))
+ possibleTypes.add(type);
+ }
+ }
+ if (possibleTypes.size() == 1) {
+ return possibleTypes.get(0);
+ } else {
+ throw new AlgebricksException("The two branches of the if-else clause should return the same type.");
+ }
+ }
+
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfo.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixAppContextInfo.java
similarity index 96%
rename from asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfo.java
rename to asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixAppContextInfo.java
index 06a1c1f..81100bf 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfo.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixAppContextInfo.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.uci.ics.asterix.common.api;
+package edu.uci.ics.asterix.om.util;
import java.util.logging.Logger;
@@ -23,9 +23,9 @@
import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.AsterixTransactionProperties;
import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
-import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.dataflow.IAsterixApplicationContextInfo;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.transaction.management.service.transaction.AsterixRuntimeComponentsProvider;
import edu.uci.ics.hyracks.api.application.ICCApplicationContext;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
@@ -57,7 +57,6 @@
INSTANCE.metadataProperties = new AsterixMetadataProperties(propertiesAccessor);
INSTANCE.storageProperties = new AsterixStorageProperties(propertiesAccessor);
INSTANCE.txnProperties = new AsterixTransactionProperties(propertiesAccessor);
-
Logger.getLogger("edu.uci.ics").setLevel(INSTANCE.externalProperties.getLogLevel());
}
@@ -70,21 +69,11 @@
}
@Override
- public IStorageManagerInterface getStorageManagerInterface() {
- return AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER;
- }
-
- @Override
public ICCApplicationContext getCCApplicationContext() {
return appCtx;
}
@Override
- public IIndexLifecycleManagerProvider getIndexLifecycleManagerProvider() {
- return AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER;
- }
-
- @Override
public AsterixStorageProperties getStorageProperties() {
return storageProperties;
}
@@ -108,4 +97,14 @@
public AsterixExternalProperties getExternalProperties() {
return externalProperties;
}
+
+ @Override
+ public IIndexLifecycleManagerProvider getIndexLifecycleManagerProvider() {
+ return AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER;
+ }
+
+ @Override
+ public IStorageManagerInterface getStorageManagerInterface() {
+ return AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER;
+ }
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixClusterProperties.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixClusterProperties.java
new file mode 100644
index 0000000..bc2a6af
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixClusterProperties.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+package edu.uci.ics.asterix.om.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A holder class for properties related to the Asterix cluster.
+ */
+
+public class AsterixClusterProperties {
+
+ private static final Logger LOGGER = Logger.getLogger(AsterixClusterProperties.class.getName());
+
+ private static final String IO_DEVICES = "iodevices";
+
+ public static final AsterixClusterProperties INSTANCE = new AsterixClusterProperties();
+
+ private Map<String, Map<String, String>> ncConfiguration = new HashMap<String, Map<String, String>>();
+
+ private AsterixClusterProperties() {
+ }
+
+ public enum State {
+ ACTIVE,
+ UNUSABLE
+ }
+
+ private State state = State.UNUSABLE;
+
+ public void removeNCConfiguration(String nodeId) {
+ state = State.UNUSABLE;
+ ncConfiguration.remove(nodeId);
+ }
+
+ public void addNCConfiguration(String nodeId, Map<String, String> configuration) {
+ ncConfiguration.put(nodeId, configuration);
+ if (ncConfiguration.keySet().size() == AsterixAppContextInfo.getInstance().getMetadataProperties()
+ .getNodeNames().size()) {
+ state = State.ACTIVE;
+ }
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info(" Registering configuration parameters for node id" + nodeId);
+ }
+ }
+
+ /**
+ * Returns the number of IO devices configured for a Node Controller
+ *
+ * @param nodeId
+ * unique identifier of the Node Controller
+ * @return number of IO devices. -1 if the node id is not valid. A node id is not valid
+ * if it does not correspond to the set of registered Node Controllers.
+ */
+ public int getNumberOfIODevices(String nodeId) {
+ Map<String, String> ncConfig = ncConfiguration.get(nodeId);
+ if (ncConfig == null) {
+ if (LOGGER.isLoggable(Level.WARNING)) {
+ LOGGER.warning("Configuration parameters for nodeId" + nodeId
+ + " not found. The node has not joined yet or has left.");
+ }
+ return -1;
+ }
+ return ncConfig.get(IO_DEVICES).split(",").length;
+ }
+
+ public State getState() {
+ return state;
+ }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixRuntimeUtil.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixRuntimeUtil.java
index e280b2e..75fc5a7 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixRuntimeUtil.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixRuntimeUtil.java
@@ -23,46 +23,38 @@
import java.util.Map;
import java.util.Set;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
-
/**
* Utility class for obtaining information on the set of Hyracks NodeController
* processes that are running on a given host.
*/
public class AsterixRuntimeUtil {
- public static Set<String> getNodeControllersOnIP(String ipAddress)
- throws Exception {
- Map<String, Set<String>> nodeControllerInfo = getNodeControllerMap();
- Set<String> nodeControllersAtLocation = nodeControllerInfo
- .get(ipAddress);
- return nodeControllersAtLocation;
- }
+ public static Set<String> getNodeControllersOnIP(String ipAddress) throws Exception {
+ Map<String, Set<String>> nodeControllerInfo = getNodeControllerMap();
+ Set<String> nodeControllersAtLocation = nodeControllerInfo.get(ipAddress);
+ return nodeControllersAtLocation;
+ }
- public static List<String> getAllNodeControllers() throws Exception {
- Collection<Set<String>> nodeControllersCollection = getNodeControllerMap()
- .values();
- List<String> nodeControllers = new ArrayList<String>();
- for (Set<String> ncCollection : nodeControllersCollection) {
- nodeControllers.addAll(ncCollection);
- }
- return nodeControllers;
- }
+ public static List<String> getAllNodeControllers() throws Exception {
+ Collection<Set<String>> nodeControllersCollection = getNodeControllerMap().values();
+ List<String> nodeControllers = new ArrayList<String>();
+ for (Set<String> ncCollection : nodeControllersCollection) {
+ nodeControllers.addAll(ncCollection);
+ }
+ return nodeControllers;
+ }
- public static Map<String, Set<String>> getNodeControllerMap()
- throws Exception {
- Map<String, Set<String>> map = new HashMap<String, Set<String>>();
- AsterixAppContextInfo.getInstance().getCCApplicationContext()
- .getCCContext().getIPAddressNodeMap(map);
- return map;
- }
+ public static Map<String, Set<String>> getNodeControllerMap() throws Exception {
+ Map<String, Set<String>> map = new HashMap<String, Set<String>>();
+ AsterixAppContextInfo.getInstance().getCCApplicationContext().getCCContext().getIPAddressNodeMap(map);
+ return map;
+ }
- public static String getIPAddress(String hostname)
- throws UnknownHostException {
- String address = InetAddress.getByName(hostname).getHostAddress();
- if (address.equals("127.0.1.1")) {
- address = "127.0.0.1";
- }
- return address;
- }
+ public static String getIPAddress(String hostname) throws UnknownHostException {
+ String address = InetAddress.getByName(hostname).getHostAddress();
+ if (address.equals("127.0.1.1")) {
+ address = "127.0.0.1";
+ }
+ return address;
+ }
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AbstractAsterixListIterator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AbstractAsterixListIterator.java
index efae5f9..269d363 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AbstractAsterixListIterator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AbstractAsterixListIterator.java
@@ -13,7 +13,10 @@
protected byte[] data;
protected int count = 0;
protected int pos = -1;
- protected int size = -1;
+ protected int nextPos = -1;
+ protected int itemLen = -1;
+ protected int numberOfItems = -1;
+ protected int listLength = -1;
protected int startOff = -1;
protected IBinaryComparator cmp;
@@ -27,12 +30,12 @@
@Override
public boolean hasNext() {
- return count < size;
+ return count < numberOfItems;
}
@Override
public int size() {
- return size;
+ return numberOfItems;
}
@Override
@@ -45,10 +48,20 @@
return pos;
}
+ public int getItemLen() {
+ return itemLen;
+ }
+
@Override
public void next() {
try {
- pos = getItemOffset(data, startOff, ++count);
+ pos = nextPos;
+ ++count;
+ nextPos = startOff + listLength;
+ if (count + 1 < numberOfItems) {
+ nextPos = getItemOffset(data, startOff, count + 1);
+ }
+ itemLen = nextPos - pos;
} catch (AsterixException e) {
throw new AsterixRuntimeException(e);
}
@@ -59,6 +72,11 @@
count = 0;
try {
pos = getItemOffset(data, startOff, count);
+ nextPos = startOff + listLength;
+ if (count + 1 < numberOfItems) {
+ nextPos = getItemOffset(data, startOff, count + 1);
+ }
+ itemLen = nextPos - pos;
} catch (AsterixException e) {
throw new AsterixRuntimeException(e);
}
@@ -67,7 +85,8 @@
public void reset(byte[] data, int startOff) {
this.data = data;
this.startOff = startOff;
- size = getNumberOfItems(data, startOff);
+ this.numberOfItems = getNumberOfItems(data, startOff);
+ this.listLength = getListLength(data, startOff);
ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[startOff + 1]);
switch (tag) {
case INT32: {
@@ -102,4 +121,6 @@
protected abstract int getItemOffset(byte[] serOrderedList, int offset, int itemIndex) throws AsterixException;
protected abstract int getNumberOfItems(byte[] serOrderedList, int offset);
+
+ protected abstract int getListLength(byte[] serOrderedList, int offset);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixOrderedListIterator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixOrderedListIterator.java
index d3714c1..fc92875 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixOrderedListIterator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixOrderedListIterator.java
@@ -14,4 +14,9 @@
protected int getNumberOfItems(byte[] serOrderedList, int offset) {
return AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList, offset);
}
+
+ @Override
+ protected int getListLength(byte[] serOrderedList, int offset) {
+ return AOrderedListSerializerDeserializer.getOrderedListLength(serOrderedList, offset + 1);
+ }
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixUnorderedListIterator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixUnorderedListIterator.java
index de7742b..5f01581 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixUnorderedListIterator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixUnorderedListIterator.java
@@ -14,4 +14,9 @@
protected int getNumberOfItems(byte[] serOrderedList, int offset) {
return AUnorderedListSerializerDeserializer.getNumberOfItems(serOrderedList, offset);
}
+
+ @Override
+ protected int getListLength(byte[] serOrderedList, int offset) {
+ return AUnorderedListSerializerDeserializer.getUnorderedListLength(serOrderedList, offset + 1);
+ }
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java
index ab73df2..b732f40 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java
@@ -62,8 +62,8 @@
probeListCount++;
byte[] buf = probeIter.getData();
int off = probeIter.getPos();
- int len = getItemLen(buf, off);
- keyEntry.set(buf, off, len);
+ int len = probeIter.getItemLen();
+ keyEntry.set(buf, off, len);
BinaryEntry entry = hashMap.get(keyEntry);
if (entry != null) {
// Increment second value.
@@ -94,7 +94,7 @@
}
return intersectionSize;
}
-
+
@Override
protected void writeResult(float jacc) throws IOException {
listBuilder.reset(listType);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
index 9f5c9c8..391fb30 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
@@ -4,8 +4,6 @@
import java.io.IOException;
import java.util.Arrays;
-import edu.uci.ics.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
-import edu.uci.ics.asterix.formats.nontagged.AqlBinaryHashFunctionFactoryProvider;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.AFloat;
import edu.uci.ics.asterix.om.base.AMutableFloat;
@@ -22,9 +20,10 @@
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
-import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ListItemBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.hash.ListItemBinaryHashFunctionFactory;
public class SimilarityJaccardEvaluator implements ICopyEvaluator {
@@ -58,7 +57,8 @@
protected int firstStart = -1;
protected int secondStart = -1;
protected float jaccSim = 0.0f;
- protected ATypeTag itemTypeTag;
+ protected ATypeTag firstItemTypeTag;
+ protected ATypeTag secondItemTypeTag;
protected BinaryHashMap hashMap;
protected BinaryEntry keyEntry = new BinaryEntry();
@@ -105,6 +105,9 @@
firstTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart]);
secondTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart]);
+
+ firstItemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart + 1]);
+ secondItemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart + 1]);
}
protected boolean prepareLists(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
@@ -116,17 +119,12 @@
if (firstListIter.size() == 0 || secondListIter.size() == 0) {
return false;
}
- if (firstTypeTag == ATypeTag.ANY || secondTypeTag == ATypeTag.ANY) {
- throw new AlgebricksException("\n Jaccard can only be called on homogenous lists");
- }
// TODO: Check item types are compatible.
- itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[firstStart + 1]);
return true;
}
protected float computeResult(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
throws AlgebricksException {
- setHashMap(bytes, firstStart, secondStart);
// We will subtract the intersection size later to get the real union size.
int firstListSize = firstListIter.size();
int secondListSize = secondListIter.size();
@@ -136,7 +134,10 @@
AbstractAsterixListIterator probeList = (buildList == firstListIter) ? secondListIter : firstListIter;
int buildListSize = (buildList == firstListIter) ? firstListSize : secondListSize;
int probeListSize = (probeList == firstListIter) ? firstListSize : secondListSize;
+ ATypeTag buildItemTypeTag = (buildList == firstListIter) ? firstItemTypeTag : secondItemTypeTag;
+ ATypeTag probeItemTypeTag = (probeList == firstListIter) ? firstItemTypeTag : secondItemTypeTag;
+ setHashMap(bytes, buildItemTypeTag, probeItemTypeTag);
buildHashMap(buildList);
int intersectionSize = probeHashMap(probeList, buildListSize, probeListSize);
// Special indicator for the "check" version of jaccard.
@@ -154,7 +155,7 @@
while (buildIter.hasNext()) {
byte[] buf = buildIter.getData();
int off = buildIter.getPos();
- int len = getItemLen(buf, off);
+ int len = buildIter.getItemLen();
keyEntry.set(buf, off, len);
BinaryEntry entry = hashMap.put(keyEntry, valEntry);
if (entry != null) {
@@ -172,7 +173,7 @@
while (probeIter.hasNext()) {
byte[] buf = probeIter.getData();
int off = probeIter.getPos();
- int len = getItemLen(buf, off);
+ int len = probeIter.getItemLen();
keyEntry.set(buf, off, len);
BinaryEntry entry = hashMap.get(keyEntry);
if (entry != null) {
@@ -195,69 +196,19 @@
return intersectionSize;
}
- protected void setHashMap(byte[] bytes, int firstStart, int secondStart) {
+ protected void setHashMap(byte[] bytes, ATypeTag buildItemTypeTag, ATypeTag probeItemTypeTag) {
if (hashMap != null) {
hashMap.clear();
return;
}
- IBinaryHashFunction hashFunc = null;
- IBinaryComparator cmp = null;
- switch (itemTypeTag) {
- case INT32: {
- hashFunc = AqlBinaryHashFunctionFactoryProvider.INTEGER_POINTABLE_INSTANCE.createBinaryHashFunction();
- cmp = AqlBinaryComparatorFactoryProvider.INTEGER_POINTABLE_INSTANCE.createBinaryComparator();
- break;
- }
- case FLOAT: {
- hashFunc = AqlBinaryHashFunctionFactoryProvider.FLOAT_POINTABLE_INSTANCE.createBinaryHashFunction();
- cmp = AqlBinaryComparatorFactoryProvider.FLOAT_POINTABLE_INSTANCE.createBinaryComparator();
- break;
- }
- case DOUBLE: {
- hashFunc = AqlBinaryHashFunctionFactoryProvider.DOUBLE_POINTABLE_INSTANCE.createBinaryHashFunction();
- cmp = AqlBinaryComparatorFactoryProvider.DOUBLE_POINTABLE_INSTANCE.createBinaryComparator();
- break;
- }
- case STRING: {
- if (ignoreCase) {
- // Ignore case in comparisons and hashing.
- hashFunc = AqlBinaryHashFunctionFactoryProvider.UTF8STRING_LOWERCASE_POINTABLE_INSTANCE
- .createBinaryHashFunction();
- cmp = AqlBinaryComparatorFactoryProvider.UTF8STRING_LOWERCASE_POINTABLE_INSTANCE
- .createBinaryComparator();
- } else {
- hashFunc = AqlBinaryHashFunctionFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
- .createBinaryHashFunction();
- cmp = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryComparator();
- }
- break;
- }
- default: {
- break;
- }
- }
- hashMap = new BinaryHashMap(TABLE_SIZE, TABLE_FRAME_SIZE, hashFunc, cmp);
- }
- protected int getItemLen(byte[] bytes, int itemOff) {
- switch (itemTypeTag) {
- case INT32: {
- return 4;
- }
- case FLOAT: {
- return 4;
- }
- case DOUBLE: {
- return 8;
- }
- case STRING: {
- // 2 bytes for the UTF8 len, plus the string data.
- return 2 + UTF8StringPointable.getUTFLength(bytes, itemOff);
- }
- default: {
- return -1;
- }
- }
+ IBinaryHashFunction putHashFunc = ListItemBinaryHashFunctionFactory.INSTANCE.createBinaryHashFunction(
+ buildItemTypeTag, ignoreCase);
+ IBinaryHashFunction getHashFunc = ListItemBinaryHashFunctionFactory.INSTANCE.createBinaryHashFunction(
+ probeItemTypeTag, ignoreCase);
+ IBinaryComparator cmp = ListItemBinaryComparatorFactory.INSTANCE.createBinaryComparator(buildItemTypeTag,
+ probeItemTypeTag, ignoreCase);
+ hashMap = new BinaryHashMap(TABLE_SIZE, TABLE_FRAME_SIZE, putHashFunc, getHashFunc, cmp);
}
protected boolean checkArgTypes(ATypeTag typeTag1, ATypeTag typeTag2) throws AlgebricksException {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/BinaryHashMap.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/BinaryHashMap.java
index 240f8c7..6367996 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/BinaryHashMap.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/BinaryHashMap.java
@@ -20,150 +20,154 @@
* Intended to work with binary data and be able to map arbitrary key types to
* arbitrary value types, given that they have implementations of
* IBinaryHashFunction and IBinaryComparator.
- *
* Uses 2 bytes each to indicate the length of the key and the value.
* Uses 8 byte pointers for the linked list (4 bytes frame index, 4 bytes frame offset).
- *
* This class is NOT thread safe.
- *
*/
public class BinaryHashMap {
- // Special value to indicate an empty "bucket" in the header array.
- private static final long NULL_PTR = -1;
- private static final int PTR_SIZE = 8;
- private static final int SLOT_SIZE = 2;
- private static final int ENTRY_HEADER_SIZE = PTR_SIZE + 2 * SLOT_SIZE;
- private final IBinaryHashFunction hashFunc;
- private final IBinaryComparator cmp;
- private final BinaryEntry returnValue = new BinaryEntry();
-
- private final long[] listHeads;
- private final int frameSize;
- private final List<ByteBuffer> frames = new ArrayList<ByteBuffer>();
- private int currFrameIndex;
- private int nextOff;
- private int size;
-
- // Can be used for key or value.
- public static class BinaryEntry {
- public byte[] buf;
- public int off;
- public int len;
-
- public void set(byte[] buf, int off, int len) {
- this.buf = buf;
- this.off = off;
- this.len = len;
- }
-
- // Inefficient. Just for debugging.
- @SuppressWarnings("rawtypes")
- public String print(ISerializerDeserializer serde) throws HyracksDataException {
- ByteArrayInputStream inStream = new ByteArrayInputStream(buf, off, len);
+ // Special value to indicate an empty "bucket" in the header array.
+ private static final long NULL_PTR = -1;
+ private static final int PTR_SIZE = 8;
+ private static final int SLOT_SIZE = 2;
+ private static final int ENTRY_HEADER_SIZE = PTR_SIZE + 2 * SLOT_SIZE;
+ private final IBinaryHashFunction putHashFunc;
+ private final IBinaryHashFunction getHashFunc;
+ private final IBinaryComparator cmp;
+ private final BinaryEntry returnValue = new BinaryEntry();
+
+ private final long[] listHeads;
+ private final int frameSize;
+ private final List<ByteBuffer> frames = new ArrayList<ByteBuffer>();
+ private int currFrameIndex;
+ private int nextOff;
+ private int size;
+
+ // Can be used for key or value.
+ public static class BinaryEntry {
+ public byte[] buf;
+ public int off;
+ public int len;
+
+ public void set(byte[] buf, int off, int len) {
+ this.buf = buf;
+ this.off = off;
+ this.len = len;
+ }
+
+ // Inefficient. Just for debugging.
+ @SuppressWarnings("rawtypes")
+ public String print(ISerializerDeserializer serde) throws HyracksDataException {
+ ByteArrayInputStream inStream = new ByteArrayInputStream(buf, off, len);
DataInput dataIn = new DataInputStream(inStream);
return serde.deserialize(dataIn).toString();
- }
- }
-
- public BinaryHashMap(int tableSize, int frameSize, IBinaryHashFunction hashFunc, IBinaryComparator cmp) {
- listHeads = new long[tableSize];
- this.frameSize = frameSize;
- this.hashFunc = hashFunc;
- this.cmp = cmp;
- frames.add(ByteBuffer.allocate(frameSize));
- clear();
- }
-
- /**
- * Inserts key, value into the hash map. If key already exists, returns
- * existing entry. Otherwise, returns null.
- *
- * @param key
- * @param value
- * @return
- */
- public BinaryEntry put(BinaryEntry key, BinaryEntry value) {
- return getPutInternal(key, value, true);
- }
-
- /**
- * Retrieves value for given key. Returns null if key doesn't exist.
- *
- * @param key
- * @param value
- * @return
- */
- public BinaryEntry get(BinaryEntry key) {
- return getPutInternal(key, null, false);
- }
-
- private BinaryEntry getPutInternal(BinaryEntry key, BinaryEntry value, boolean put) {
- int bucket = Math.abs(hashFunc.hash(key.buf, key.off, key.len) % listHeads.length);
- long headPtr = listHeads[bucket];
- if (headPtr == NULL_PTR) {
- // Key definitely doesn't exist yet.
- if (put) {
- listHeads[bucket] = appendEntry(key, value);
- }
- return null;
- }
- // Follow the chain until we found an entry matching the given key.
- int frameOff;
- ByteBuffer frame;
- do {
- int frameIndex = getFrameIndex(headPtr);
- frameOff = getFrameOffset(headPtr);
- frame = frames.get(frameIndex);
- int entryKeyOff = frameOff + ENTRY_HEADER_SIZE;
- int entryKeyLen = frame.getShort(frameOff);
- if (cmp.compare(frame.array(), entryKeyOff, entryKeyLen, key.buf,
- key.off, key.len) == 0) {
- // Key found, set values and return.
- int entryValOff = frameOff + ENTRY_HEADER_SIZE + entryKeyLen;
- int entryValLen = frame.getShort(frameOff + SLOT_SIZE);
- returnValue.set(frame.array(), entryValOff, entryValLen);
- return returnValue;
- }
- headPtr = frame.getLong(frameOff + 2 * SLOT_SIZE);
- } while (headPtr != NULL_PTR);
- // We've followed the chain to its end, and didn't find the key.
- if (put) {
- // Append the new entry, and set a pointer to it in the last entry we've checked.
- long newPtr = appendEntry(key, value);
- frame.putLong(frameOff + 2 * SLOT_SIZE, newPtr);
- }
- return null;
- }
-
- public long appendEntry(BinaryEntry key, BinaryEntry value) {
- ByteBuffer frame = frames.get(currFrameIndex);
- int requiredSpace = key.len + value.len + ENTRY_HEADER_SIZE;
- if (nextOff + requiredSpace >= frameSize) {
- // Entry doesn't fit on frame, allocate a new one.
- if (requiredSpace > frameSize) {
- throw new IllegalStateException("Key and value greater than framesize.");
- }
- frames.add(ByteBuffer.allocate(frameSize));
- currFrameIndex++;
- nextOff = 0;
- frame = frames.get(currFrameIndex);
- }
- writeEntryHeader(frame, nextOff, key.len, value.len, NULL_PTR);
- System.arraycopy(key.buf, key.off, frame.array(), nextOff + ENTRY_HEADER_SIZE, key.len);
- System.arraycopy(value.buf, value.off, frame.array(), nextOff + ENTRY_HEADER_SIZE + key.len, value.len);
- long entryPtr = getEntryPtr(currFrameIndex, nextOff);
- nextOff += requiredSpace;
- size++;
- return entryPtr;
- }
-
- private void writeEntryHeader(ByteBuffer frame, int targetOff, int keyLen, int valLen, long ptr) {
- frame.putShort(targetOff, (short) keyLen);
- frame.putShort(targetOff + SLOT_SIZE, (short) valLen);
- frame.putLong(targetOff + 2 * SLOT_SIZE, ptr);
- }
+ }
+ }
- private long getEntryPtr(int frameIndex, int frameOff) {
+ public BinaryHashMap(int tableSize, int frameSize, IBinaryHashFunction putHashFunc,
+ IBinaryHashFunction getHashFunc, IBinaryComparator cmp) {
+ listHeads = new long[tableSize];
+ this.frameSize = frameSize;
+ this.putHashFunc = putHashFunc;
+ this.getHashFunc = getHashFunc;
+ this.cmp = cmp;
+ frames.add(ByteBuffer.allocate(frameSize));
+ clear();
+ }
+
+ /**
+ * Inserts key, value into the hash map. If key already exists, returns
+ * existing entry. Otherwise, returns null.
+ *
+ * @param key
+ * @param value
+ * @return
+ */
+ public BinaryEntry put(BinaryEntry key, BinaryEntry value) {
+ return getPutInternal(key, value, true);
+ }
+
+ /**
+ * Retrieves value for given key. Returns null if key doesn't exist.
+ *
+ * @param key
+ * @param value
+ * @return
+ */
+ public BinaryEntry get(BinaryEntry key) {
+ return getPutInternal(key, null, false);
+ }
+
+ private BinaryEntry getPutInternal(BinaryEntry key, BinaryEntry value, boolean put) {
+ int bucket;
+ if (put) {
+ bucket = Math.abs(putHashFunc.hash(key.buf, key.off, key.len) % listHeads.length);
+ } else {
+ bucket = Math.abs(getHashFunc.hash(key.buf, key.off, key.len) % listHeads.length);
+ }
+ long headPtr = listHeads[bucket];
+ if (headPtr == NULL_PTR) {
+ // Key definitely doesn't exist yet.
+ if (put) {
+ listHeads[bucket] = appendEntry(key, value);
+ }
+ return null;
+ }
+ // Follow the chain until we found an entry matching the given key.
+ int frameOff;
+ ByteBuffer frame;
+ do {
+ int frameIndex = getFrameIndex(headPtr);
+ frameOff = getFrameOffset(headPtr);
+ frame = frames.get(frameIndex);
+ int entryKeyOff = frameOff + ENTRY_HEADER_SIZE;
+ int entryKeyLen = frame.getShort(frameOff);
+ if (cmp.compare(frame.array(), entryKeyOff, entryKeyLen, key.buf, key.off, key.len) == 0) {
+ // Key found, set values and return.
+ int entryValOff = frameOff + ENTRY_HEADER_SIZE + entryKeyLen;
+ int entryValLen = frame.getShort(frameOff + SLOT_SIZE);
+ returnValue.set(frame.array(), entryValOff, entryValLen);
+ return returnValue;
+ }
+ headPtr = frame.getLong(frameOff + 2 * SLOT_SIZE);
+ } while (headPtr != NULL_PTR);
+ // We've followed the chain to its end, and didn't find the key.
+ if (put) {
+ // Append the new entry, and set a pointer to it in the last entry we've checked.
+ long newPtr = appendEntry(key, value);
+ frame.putLong(frameOff + 2 * SLOT_SIZE, newPtr);
+ }
+ return null;
+ }
+
+ public long appendEntry(BinaryEntry key, BinaryEntry value) {
+ ByteBuffer frame = frames.get(currFrameIndex);
+ int requiredSpace = key.len + value.len + ENTRY_HEADER_SIZE;
+ if (nextOff + requiredSpace >= frameSize) {
+ // Entry doesn't fit on frame, allocate a new one.
+ if (requiredSpace > frameSize) {
+ throw new IllegalStateException("Key and value greater than framesize.");
+ }
+ frames.add(ByteBuffer.allocate(frameSize));
+ currFrameIndex++;
+ nextOff = 0;
+ frame = frames.get(currFrameIndex);
+ }
+ writeEntryHeader(frame, nextOff, key.len, value.len, NULL_PTR);
+ System.arraycopy(key.buf, key.off, frame.array(), nextOff + ENTRY_HEADER_SIZE, key.len);
+ System.arraycopy(value.buf, value.off, frame.array(), nextOff + ENTRY_HEADER_SIZE + key.len, value.len);
+ long entryPtr = getEntryPtr(currFrameIndex, nextOff);
+ nextOff += requiredSpace;
+ size++;
+ return entryPtr;
+ }
+
+ private void writeEntryHeader(ByteBuffer frame, int targetOff, int keyLen, int valLen, long ptr) {
+ frame.putShort(targetOff, (short) keyLen);
+ frame.putShort(targetOff + SLOT_SIZE, (short) valLen);
+ frame.putLong(targetOff + 2 * SLOT_SIZE, ptr);
+ }
+
+ private long getEntryPtr(int frameIndex, int frameOff) {
return (((long) frameIndex) << 32) + frameOff;
}
@@ -175,93 +179,94 @@
return (int) (ptr & 0xffffffff);
}
- public int size() {
- return size;
- }
+ public int size() {
+ return size;
+ }
- public boolean isEmpty() {
- return size > 0;
- }
+ public boolean isEmpty() {
+ return size > 0;
+ }
- public void clear() {
- // Initialize all entries to point to nothing.
- Arrays.fill(listHeads, NULL_PTR);
- currFrameIndex = 0;
- nextOff = 0;
- size = 0;
- }
-
- public Iterator<Pair<BinaryEntry, BinaryEntry>> iterator() {
- return new BinaryHashMapIterator();
- }
-
- public class BinaryHashMapIterator implements Iterator<Pair<BinaryEntry, BinaryEntry> > {
- private final Pair<BinaryEntry, BinaryEntry> val = new Pair<BinaryEntry, BinaryEntry>(new BinaryEntry(), new BinaryEntry());
- private int listHeadIndex;
- private ByteBuffer frame;
- private int frameIndex;
- private int frameOff;
-
- public BinaryHashMapIterator() {
- listHeadIndex = 0;
- frame = null;
- frameIndex = -1;
- frameOff = -1;
- }
-
- @Override
- public boolean hasNext() {
- if (frame != null) {
- long nextPtr = frame.getLong(frameOff + 2 * SLOT_SIZE);
- if (nextPtr == NULL_PTR) {
- // End of current list.
- listHeadIndex++;
- return nextListHead();
- } else {
- // Follow pointer.
- setValue(nextPtr);
- return true;
- }
- }
- return nextListHead();
- }
+ public void clear() {
+ // Initialize all entries to point to nothing.
+ Arrays.fill(listHeads, NULL_PTR);
+ currFrameIndex = 0;
+ nextOff = 0;
+ size = 0;
+ }
- private boolean nextListHead() {
- // Position to first non-null list-head pointer.
- while(listHeadIndex < listHeads.length && listHeads[listHeadIndex] == NULL_PTR) {
- listHeadIndex++;
- }
- if (listHeadIndex < listHeads.length) {
- // Positioned to first non-null list head.
- setValue(listHeads[listHeadIndex]);
- return true;
- } else {
- // No more lists.
- frame = null;
- return false;
- }
- }
-
- private void setValue(long ptr) {
- frameIndex = getFrameIndex(ptr);
- frameOff = getFrameOffset(ptr);
- frame = frames.get(frameIndex);
- int entryKeyOff = frameOff + ENTRY_HEADER_SIZE;
- int entryKeyLen = frame.getShort(frameOff);
- int entryValOff = frameOff + ENTRY_HEADER_SIZE + entryKeyLen;
- int entryValLen = frame.getShort(frameOff + SLOT_SIZE);
- val.first.set(frame.array(), entryKeyOff, entryKeyLen);
- val.second.set(frame.array(), entryValOff, entryValLen);
- }
-
- @Override
- public Pair<BinaryEntry, BinaryEntry> next() {
- return val;
- }
+ public Iterator<Pair<BinaryEntry, BinaryEntry>> iterator() {
+ return new BinaryHashMapIterator();
+ }
- @Override
- public void remove() {
- throw new UnsupportedOperationException("Remove not implemented");
- }
- }
+ public class BinaryHashMapIterator implements Iterator<Pair<BinaryEntry, BinaryEntry>> {
+ private final Pair<BinaryEntry, BinaryEntry> val = new Pair<BinaryEntry, BinaryEntry>(new BinaryEntry(),
+ new BinaryEntry());
+ private int listHeadIndex;
+ private ByteBuffer frame;
+ private int frameIndex;
+ private int frameOff;
+
+ public BinaryHashMapIterator() {
+ listHeadIndex = 0;
+ frame = null;
+ frameIndex = -1;
+ frameOff = -1;
+ }
+
+ @Override
+ public boolean hasNext() {
+ if (frame != null) {
+ long nextPtr = frame.getLong(frameOff + 2 * SLOT_SIZE);
+ if (nextPtr == NULL_PTR) {
+ // End of current list.
+ listHeadIndex++;
+ return nextListHead();
+ } else {
+ // Follow pointer.
+ setValue(nextPtr);
+ return true;
+ }
+ }
+ return nextListHead();
+ }
+
+ private boolean nextListHead() {
+ // Position to first non-null list-head pointer.
+ while (listHeadIndex < listHeads.length && listHeads[listHeadIndex] == NULL_PTR) {
+ listHeadIndex++;
+ }
+ if (listHeadIndex < listHeads.length) {
+ // Positioned to first non-null list head.
+ setValue(listHeads[listHeadIndex]);
+ return true;
+ } else {
+ // No more lists.
+ frame = null;
+ return false;
+ }
+ }
+
+ private void setValue(long ptr) {
+ frameIndex = getFrameIndex(ptr);
+ frameOff = getFrameOffset(ptr);
+ frame = frames.get(frameIndex);
+ int entryKeyOff = frameOff + ENTRY_HEADER_SIZE;
+ int entryKeyLen = frame.getShort(frameOff);
+ int entryValOff = frameOff + ENTRY_HEADER_SIZE + entryKeyLen;
+ int entryValLen = frame.getShort(frameOff + SLOT_SIZE);
+ val.first.set(frame.array(), entryKeyOff, entryKeyLen);
+ val.second.set(frame.array(), entryValOff, entryValLen);
+ }
+
+ @Override
+ public Pair<BinaryEntry, BinaryEntry> next() {
+ return val;
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("Remove not implemented");
+ }
+ }
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GetItemDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GetItemDescriptor.java
index b41347d..c30fb6d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GetItemDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GetItemDescriptor.java
@@ -109,7 +109,7 @@
}
if (itemIndex < 0)
throw new AlgebricksException(AsterixBuiltinFunctions.GET_ITEM.getName()
- + ": item index can be negative!");
+ + ": item index cannot be negative!");
itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[1]);
if (itemTag == ATypeTag.ANY)
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCaretDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCaretDescriptor.java
new file mode 100644
index 0000000..208c454
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCaretDescriptor.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions;
+
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class NumericCaretDescriptor extends AbstractNumericArithmeticEval {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+ public IFunctionDescriptor createFunctionDescriptor() {
+ return new NumericCaretDescriptor();
+ }
+ };
+
+ /* (non-Javadoc)
+ * @see edu.uci.ics.asterix.runtime.evaluators.functions.AbstractNumericArithmeticEval#evaluateInteger(long, long)
+ */
+ @Override
+ protected long evaluateInteger(long lhs, long rhs) throws HyracksDataException {
+ double result = Math.pow(lhs, rhs);
+ if (result > Long.MAX_VALUE) {
+ throw new ArithmeticException("Overflow of caret operation: " + lhs + " ^ " + rhs);
+ }
+ if (result < Long.MIN_VALUE) {
+ throw new ArithmeticException("Underflow of caret operation: " + lhs + " ^ " + rhs);
+ }
+ return (long) result;
+ }
+
+ /* (non-Javadoc)
+ * @see edu.uci.ics.asterix.runtime.evaluators.functions.AbstractNumericArithmeticEval#evaluateDouble(double, double)
+ */
+ @Override
+ protected double evaluateDouble(double lhs, double rhs) throws HyracksDataException {
+ return Math.pow(lhs, rhs);
+ }
+
+ /* (non-Javadoc)
+ * @see edu.uci.ics.asterix.om.functions.AbstractFunctionDescriptor#getIdentifier()
+ */
+ @Override
+ public FunctionIdentifier getIdentifier() {
+ return AsterixBuiltinFunctions.CARET;
+ }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
index 2c81b7c..af647e9 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -149,6 +149,7 @@
import edu.uci.ics.asterix.runtime.evaluators.functions.NotNullDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.functions.NumericAbsDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.functions.NumericAddDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.NumericCaretDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.functions.NumericCeilingDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.functions.NumericDivideDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.functions.NumericFloorDescriptor;
@@ -347,6 +348,7 @@
temp.add(NumericMultiplyDescriptor.FACTORY);
temp.add(NumericSubtractDescriptor.FACTORY);
temp.add(NumericModuloDescriptor.FACTORY);
+ temp.add(NumericCaretDescriptor.FACTORY);
temp.add(IsNullDescriptor.FACTORY);
temp.add(NotDescriptor.FACTORY);
temp.add(LenDescriptor.FACTORY);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/job/listener/JobEventListenerFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/job/listener/JobEventListenerFactory.java
index 45e19c6..f0e8ec5 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/job/listener/JobEventListenerFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/job/listener/JobEventListenerFactory.java
@@ -1,12 +1,12 @@
package edu.uci.ics.asterix.runtime.job.listener;
-import edu.uci.ics.asterix.common.context.AsterixAppRuntimeContext;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext.TransactionType;
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext.TransactionType;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.hyracks.api.context.IHyracksJobletContext;
import edu.uci.ics.hyracks.api.job.IJobletEventListener;
import edu.uci.ics.hyracks.api.job.IJobletEventListenerFactory;
@@ -22,7 +22,7 @@
this.jobId = jobId;
this.transactionalWrite = transactionalWrite;
}
-
+
public JobId getJobId() {
return jobId;
}
@@ -34,12 +34,13 @@
@Override
public void jobletFinish(JobStatus jobStatus) {
try {
- ITransactionManager txnManager = ((AsterixAppRuntimeContext) jobletContext.getApplicationContext()
+ ITransactionManager txnManager = ((IAsterixAppRuntimeContext) jobletContext.getApplicationContext()
.getApplicationObject()).getTransactionSubsystem().getTransactionManager();
- TransactionContext txnContext = txnManager.getTransactionContext(jobId);
+ ITransactionContext txnContext = txnManager.getTransactionContext(jobId);
txnContext.setTransactionType(transactionalWrite ? TransactionType.READ_WRITE
: TransactionType.READ);
- txnManager.completedTransaction(txnContext, new DatasetId(-1), -1, !(jobStatus == JobStatus.FAILURE));
+ txnManager.completedTransaction(txnContext, new DatasetId(-1), -1,
+ !(jobStatus == JobStatus.FAILURE));
} catch (ACIDException e) {
throw new Error(e);
}
@@ -48,7 +49,7 @@
@Override
public void jobletStart() {
try {
- ((AsterixAppRuntimeContext) jobletContext.getApplicationContext().getApplicationObject())
+ ((IAsterixAppRuntimeContext) jobletContext.getApplicationContext().getApplicationObject())
.getTransactionSubsystem().getTransactionManager().getTransactionContext(jobId);
} catch (ACIDException e) {
throw new Error(e);
diff --git a/asterix-tools/src/main/java/edu/uci/ics/asterix/tools/datagen/AdmDataGen.java b/asterix-tools/src/main/java/edu/uci/ics/asterix/tools/datagen/AdmDataGen.java
index 3d28851..6b177a7 100644
--- a/asterix-tools/src/main/java/edu/uci/ics/asterix/tools/datagen/AdmDataGen.java
+++ b/asterix-tools/src/main/java/edu/uci/ics/asterix/tools/datagen/AdmDataGen.java
@@ -36,6 +36,7 @@
import edu.uci.ics.asterix.common.annotations.TypeDataGen;
import edu.uci.ics.asterix.common.annotations.UndeclaredFieldsDataGen;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.MetadataTransactionContext;
import edu.uci.ics.asterix.om.types.ARecordType;
@@ -46,8 +47,7 @@
import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.asterix.om.types.TypeSignature;
import edu.uci.ics.asterix.tools.translator.ADGenDmlTranslator;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.data.utils.WriteValueTools;
@@ -1000,4 +1000,4 @@
}
}
-}
+}
\ No newline at end of file
diff --git a/asterix-transactions/pom.xml b/asterix-transactions/pom.xml
index 7d951ce..d09ce8a 100644
--- a/asterix-transactions/pom.xml
+++ b/asterix-transactions/pom.xml
@@ -40,6 +40,13 @@
<groupId>edu.uci.ics.hyracks</groupId>
<artifactId>hyracks-storage-am-lsm-invertedindex</artifactId>
</dependency>
+ <dependency>
+ <groupId>edu.uci.ics.asterix</groupId>
+ <artifactId>asterix-common</artifactId>
+ <version>0.0.6-SNAPSHOT</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java
index 2016d08..9da0a8f 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java
@@ -15,6 +15,7 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallback;
import java.util.concurrent.atomic.AtomicInteger;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallback.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallback.java
index a78f2ff..dedc5df 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallback.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallback.java
@@ -15,9 +15,10 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.locking.ILockManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallback;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
@@ -30,7 +31,7 @@
ISearchOperationCallback {
public PrimaryIndexInstantSearchOperationCallback(int datasetId, int[] entityIdFields, ILockManager lockManager,
- TransactionContext txnCtx) {
+ ITransactionContext txnCtx) {
super(datasetId, entityIdFields, txnCtx, lockManager);
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallbackFactory.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallbackFactory.java
index 3773950..3efd90b 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallbackFactory.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallbackFactory.java
@@ -15,11 +15,12 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionSubsystemProvider;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.context.ITransactionSubsystemProvider;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallbackFactory;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallback;
@@ -38,9 +39,9 @@
@Override
public ISearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx)
throws HyracksDataException {
- TransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
+ ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
try {
- TransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId);
return new PrimaryIndexInstantSearchOperationCallback(datasetId, primaryKeyFields,
txnSubsystem.getLockManager(), txnCtx);
} catch (ACIDException e) {
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallback.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallback.java
index 824a324..15ccde4 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallback.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallback.java
@@ -15,12 +15,14 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.locking.ILockManager;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallback;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ILogger;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
import edu.uci.ics.asterix.transaction.management.service.logging.IndexLogger;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
import edu.uci.ics.hyracks.storage.am.common.api.IModificationOperationCallback;
@@ -37,11 +39,11 @@
protected final long resourceId;
protected final byte resourceType;
protected final IndexOperation indexOp;
- protected final TransactionSubsystem txnSubsystem;
+ protected final ITransactionSubsystem txnSubsystem;
public PrimaryIndexModificationOperationCallback(int datasetId, int[] primaryKeyFields,
- TransactionContext txnCtx, ILockManager lockManager,
- TransactionSubsystem txnSubsystem, long resourceId, byte resourceType, IndexOperation indexOp) {
+ ITransactionContext txnCtx, ILockManager lockManager,
+ ITransactionSubsystem txnSubsystem, long resourceId, byte resourceType, IndexOperation indexOp) {
super(datasetId, primaryKeyFields, txnCtx, lockManager);
this.resourceId = resourceId;
this.resourceType = resourceType;
@@ -61,7 +63,7 @@
@Override
public void found(ITupleReference before, ITupleReference after) throws HyracksDataException {
- IndexLogger logger = txnSubsystem.getTreeLoggerRepository().getIndexLogger(resourceId, resourceType);
+ ILogger logger = txnSubsystem.getTreeLoggerRepository().getIndexLogger(resourceId, resourceType);
int pkHash = computePrimaryKeyHashValue(after, primaryKeyFields);
LSMBTreeTupleReference lsmBTreeTuple = (LSMBTreeTupleReference) before;
IndexOperation oldOp = IndexOperation.INSERT;
@@ -72,7 +74,7 @@
oldOp = IndexOperation.DELETE;
}
try {
- logger.generateLogRecord(txnSubsystem, txnCtx, datasetId.getId(), pkHash, resourceId, indexOp, after,
+ ((IndexLogger)logger).generateLogRecord(txnSubsystem, txnCtx, datasetId.getId(), pkHash, resourceId, indexOp, after,
oldOp, before);
} catch (ACIDException e) {
throw new HyracksDataException(e);
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallbackFactory.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallbackFactory.java
index c75ab6f..038ecee 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallbackFactory.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallbackFactory.java
@@ -15,11 +15,13 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionSubsystemProvider;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.context.ITransactionSubsystemProvider;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallback;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallbackFactory;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
@@ -47,7 +49,7 @@
public IModificationOperationCallback createModificationOperationCallback(long resourceId, Object resource,
IHyracksTaskContext ctx) throws HyracksDataException {
- TransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
+ ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
IIndexLifecycleManager indexLifeCycleManager = txnSubsystem.getAsterixAppRuntimeContextProvider()
.getIndexLifecycleManager();
ILSMIndex index = (ILSMIndex) indexLifeCycleManager.getIndex(resourceId);
@@ -56,7 +58,7 @@
}
try {
- TransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId);
IModificationOperationCallback modCallback = new PrimaryIndexModificationOperationCallback(datasetId,
primaryKeyFields, txnCtx, txnSubsystem.getLockManager(), txnSubsystem, resourceId, resourceType,
indexOp);
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexSearchOperationCallback.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexSearchOperationCallback.java
index 62ec3c9..eee33e9 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexSearchOperationCallback.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexSearchOperationCallback.java
@@ -15,9 +15,10 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.locking.ILockManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallback;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
@@ -29,7 +30,7 @@
public class PrimaryIndexSearchOperationCallback extends AbstractOperationCallback implements ISearchOperationCallback {
public PrimaryIndexSearchOperationCallback(int datasetId, int[] entityIdFields, ILockManager lockManager,
- TransactionContext txnCtx) {
+ ITransactionContext txnCtx) {
super(datasetId, entityIdFields, txnCtx, lockManager);
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexSearchOperationCallbackFactory.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexSearchOperationCallbackFactory.java
index fc62b90..5d837b0 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexSearchOperationCallbackFactory.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexSearchOperationCallbackFactory.java
@@ -15,11 +15,12 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionSubsystemProvider;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.context.ITransactionSubsystemProvider;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallbackFactory;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallback;
@@ -38,9 +39,9 @@
@Override
public ISearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx)
throws HyracksDataException {
- TransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
+ ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
try {
- TransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId);
return new PrimaryIndexSearchOperationCallback(datasetId, primaryKeyFields, txnSubsystem.getLockManager(),
txnCtx);
} catch (ACIDException e) {
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallback.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallback.java
index 5b55e9a..0e66b32 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallback.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallback.java
@@ -15,12 +15,14 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.locking.ILockManager;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallback;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ILogger;
+import edu.uci.ics.asterix.common.transactions.IResourceManager.ResourceType;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
import edu.uci.ics.asterix.transaction.management.service.logging.IndexLogger;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager.ResourceType;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
import edu.uci.ics.hyracks.storage.am.common.api.IModificationOperationCallback;
@@ -39,10 +41,10 @@
protected final byte resourceType;
protected final IndexOperation indexOp;
protected final IndexOperation oldOp;
- protected final TransactionSubsystem txnSubsystem;
+ protected final ITransactionSubsystem txnSubsystem;
public SecondaryIndexModificationOperationCallback(int datasetId, int[] primaryKeyFields,
- TransactionContext txnCtx, ILockManager lockManager, TransactionSubsystem txnSubsystem, long resourceId,
+ ITransactionContext txnCtx, ILockManager lockManager, ITransactionSubsystem txnSubsystem, long resourceId,
byte resourceType, IndexOperation indexOp) {
super(datasetId, primaryKeyFields, txnCtx, lockManager);
this.resourceId = resourceId;
@@ -59,7 +61,7 @@
@Override
public void found(ITupleReference before, ITupleReference after) throws HyracksDataException {
- IndexLogger logger = txnSubsystem.getTreeLoggerRepository().getIndexLogger(resourceId, resourceType);
+ ILogger logger = txnSubsystem.getTreeLoggerRepository().getIndexLogger(resourceId, resourceType);
int pkHash = computePrimaryKeyHashValue(after, primaryKeyFields);
try {
IndexOperation effectiveOldOp;
@@ -75,7 +77,7 @@
} else {
effectiveOldOp = oldOp;
}
- logger.generateLogRecord(txnSubsystem, txnCtx, datasetId.getId(), pkHash, resourceId, indexOp, after,
+ ((IndexLogger)logger).generateLogRecord(txnSubsystem, txnCtx, datasetId.getId(), pkHash, resourceId, indexOp, after,
effectiveOldOp, before);
} catch (ACIDException e) {
throw new HyracksDataException(e);
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallbackFactory.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallbackFactory.java
index 672b434..68a09de 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallbackFactory.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallbackFactory.java
@@ -15,11 +15,12 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionSubsystemProvider;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.context.ITransactionSubsystemProvider;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallbackFactory;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
@@ -44,7 +45,7 @@
public IModificationOperationCallback createModificationOperationCallback(long resourceId, Object resource,
IHyracksTaskContext ctx) throws HyracksDataException {
- TransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
+ ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
IIndexLifecycleManager indexLifeCycleManager = txnSubsystem.getAsterixAppRuntimeContextProvider()
.getIndexLifecycleManager();
ILSMIndex index = (ILSMIndex) indexLifeCycleManager.getIndex(resourceId);
@@ -53,7 +54,7 @@
}
try {
- TransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId);
+ ITransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId);
return new SecondaryIndexModificationOperationCallback(datasetId, primaryKeyFields, txnCtx,
txnSubsystem.getLockManager(), txnSubsystem, resourceId, resourceType, indexOp);
} catch (ACIDException e) {
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallback.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallback.java
index 4c8a583..e6ce589 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallback.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallback.java
@@ -15,6 +15,7 @@
package edu.uci.ics.asterix.transaction.management.opcallbacks;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallback;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallback;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/ILocalResourceMetadata.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/ILocalResourceMetadata.java
index d2aa164..3b32dc2 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/ILocalResourceMetadata.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/ILocalResourceMetadata.java
@@ -2,7 +2,7 @@
import java.io.Serializable;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IAsterixAppRuntimeContextProvider;
+import edu.uci.ics.asterix.common.transactions.IAsterixAppRuntimeContextProvider;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndex;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadata.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadata.java
index 7ab0d10..c3f9747 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadata.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadata.java
@@ -2,10 +2,11 @@
import java.io.File;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IAsterixAppRuntimeContextProvider;
+import edu.uci.ics.asterix.common.transactions.IAsterixAppRuntimeContextProvider;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
import edu.uci.ics.hyracks.api.io.FileReference;
+import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
import edu.uci.ics.hyracks.storage.am.common.api.IInMemoryFreePageManager;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.frames.LIFOMetaDataFrameFactory;
@@ -27,14 +28,27 @@
private final int[] bloomFilterKeyFields;
private final int memPageSize;
private final int memNumPages;
+ private FileSplit[] fileSplits;
+ private int ioDeviceID;
public LSMBTreeLocalResourceMetadata(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] cmpFactories,
- int[] bloomFilterKeyFields, boolean isPrimary, int memPageSize, int memNumPages) {
+ int[] bloomFilterKeyFields, boolean isPrimary, int memPageSize, int memNumPages, FileSplit[] fileSplits) {
this.typeTraits = typeTraits;
this.cmpFactories = cmpFactories;
this.bloomFilterKeyFields = bloomFilterKeyFields;
this.memPageSize = memPageSize;
this.memNumPages = memNumPages;
+ this.fileSplits = fileSplits;
+ }
+
+ public LSMBTreeLocalResourceMetadata(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] cmpFactories,
+ int[] bloomFilterKeyFields, boolean isPrimary, int memPageSize, int memNumPages, int ioDeviceID) {
+ this.typeTraits = typeTraits;
+ this.cmpFactories = cmpFactories;
+ this.bloomFilterKeyFields = bloomFilterKeyFields;
+ this.memPageSize = memPageSize;
+ this.memNumPages = memNumPages;
+ this.ioDeviceID = ioDeviceID;
}
@Override
@@ -45,13 +59,13 @@
memNumPages, new TransientFileMapManager());
ITreeIndexMetaDataFrameFactory metaDataFrameFactory = new LIFOMetaDataFrameFactory();
IInMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(memNumPages, metaDataFrameFactory);
- LSMBTree lsmBTree = LSMBTreeUtils.createLSMTree(memBufferCache, memFreePageManager,
- runtimeContextProvider.getIOManager(), file, runtimeContextProvider.getBufferCache(),
- runtimeContextProvider.getFileMapManager(), typeTraits, cmpFactories, bloomFilterKeyFields,
- runtimeContextProvider.getBloomFilterFalsePositiveRate(), runtimeContextProvider.getLSMMergePolicy(),
- runtimeContextProvider.getLSMBTreeOperationTrackerFactory(),
- runtimeContextProvider.getLSMIOScheduler(),
- runtimeContextProvider.getLSMBTreeIOOperationCallbackProvider(), partition);
+ LSMBTree lsmBTree = LSMBTreeUtils.createLSMTree(memBufferCache, memFreePageManager, runtimeContextProvider
+ .getIOManager(), file, runtimeContextProvider.getBufferCache(), runtimeContextProvider
+ .getFileMapManager(), typeTraits, cmpFactories, bloomFilterKeyFields, runtimeContextProvider
+ .getBloomFilterFalsePositiveRate(), runtimeContextProvider.getLSMMergePolicy(), runtimeContextProvider
+ .getLSMBTreeOperationTrackerFactory(), runtimeContextProvider.getLSMIOScheduler(),
+ runtimeContextProvider.getLSMBTreeIOOperationCallbackProvider(), fileSplits == null ? ioDeviceID
+ : fileSplits[partition].getIODeviceId());
return lsmBTree;
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadata.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadata.java
index 3bcb747..89a32c5 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadata.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadata.java
@@ -1,9 +1,10 @@
package edu.uci.ics.asterix.transaction.management.resource;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IAsterixAppRuntimeContextProvider;
+import edu.uci.ics.asterix.common.transactions.IAsterixAppRuntimeContextProvider;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
import edu.uci.ics.hyracks.storage.am.common.api.IInMemoryFreePageManager;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
@@ -28,11 +29,12 @@
private final int memPageSize;
private final int memNumPages;
private final boolean isPartitioned;
+ private final FileSplit[] fileSplits;
public LSMInvertedIndexLocalResourceMetadata(ITypeTraits[] invListTypeTraits,
IBinaryComparatorFactory[] invListCmpFactories, ITypeTraits[] tokenTypeTraits,
IBinaryComparatorFactory[] tokenCmpFactories, IBinaryTokenizerFactory tokenizerFactory, int memPageSize,
- int memNumPages, boolean isPartitioned) {
+ int memNumPages, boolean isPartitioned, FileSplit[] fileSplits) {
this.invListTypeTraits = invListTypeTraits;
this.invListCmpFactories = invListCmpFactories;
this.tokenTypeTraits = tokenTypeTraits;
@@ -41,6 +43,7 @@
this.memPageSize = memPageSize;
this.memNumPages = memNumPages;
this.isPartitioned = isPartitioned;
+ this.fileSplits = fileSplits;
}
@Override
@@ -62,7 +65,8 @@
runtimeContextProvider.getLSMMergePolicy(),
runtimeContextProvider.getLSMInvertedIndexOperationTrackerFactory(),
runtimeContextProvider.getLSMIOScheduler(),
- runtimeContextProvider.getLSMInvertedIndexIOOperationCallbackProvider(), partition);
+ runtimeContextProvider.getLSMInvertedIndexIOOperationCallbackProvider(),
+ fileSplits[partition].getIODeviceId());
} else {
return InvertedIndexUtils.createLSMInvertedIndex(memBufferCache, memFreePageManager,
runtimeContextProvider.getFileMapManager(), invListTypeTraits, invListCmpFactories,
@@ -72,7 +76,8 @@
runtimeContextProvider.getLSMMergePolicy(),
runtimeContextProvider.getLSMInvertedIndexOperationTrackerFactory(),
runtimeContextProvider.getLSMIOScheduler(),
- runtimeContextProvider.getLSMInvertedIndexIOOperationCallbackProvider(), partition);
+ runtimeContextProvider.getLSMInvertedIndexIOOperationCallbackProvider(),
+ fileSplits[partition].getIODeviceId());
}
} catch (IndexException e) {
throw new HyracksDataException(e);
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadata.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadata.java
index ff26c54..2506697 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadata.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadata.java
@@ -2,12 +2,13 @@
import java.io.File;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IAsterixAppRuntimeContextProvider;
+import edu.uci.ics.asterix.common.transactions.IAsterixAppRuntimeContextProvider;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ILinearizeComparatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.api.io.FileReference;
+import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
import edu.uci.ics.hyracks.storage.am.common.api.IInMemoryFreePageManager;
import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
@@ -33,11 +34,12 @@
private final ILinearizeComparatorFactory linearizeCmpFactory;
private final int memPageSize;
private final int memNumPages;
+ private final FileSplit[] fileSplits;
public LSMRTreeLocalResourceMetadata(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] rtreeCmpFactories,
IBinaryComparatorFactory[] btreeCmpFactories, IPrimitiveValueProviderFactory[] valueProviderFactories,
RTreePolicyType rtreePolicyType, ILinearizeComparatorFactory linearizeCmpFactory, int memPageSize,
- int memNumPages) {
+ int memNumPages, FileSplit[] fileSplits) {
this.typeTraits = typeTraits;
this.rtreeCmpFactories = rtreeCmpFactories;
this.btreeCmpFactories = btreeCmpFactories;
@@ -46,6 +48,7 @@
this.linearizeCmpFactory = linearizeCmpFactory;
this.memPageSize = memPageSize;
this.memNumPages = memNumPages;
+ this.fileSplits = fileSplits;
}
@Override
@@ -66,7 +69,8 @@
runtimeContextProvider.getLSMMergePolicy(),
runtimeContextProvider.getLSMRTreeOperationTrackerFactory(),
runtimeContextProvider.getLSMIOScheduler(),
- runtimeContextProvider.getLSMRTreeIOOperationCallbackProvider(), linearizeCmpFactory, partition);
+ runtimeContextProvider.getLSMRTreeIOOperationCallbackProvider(), linearizeCmpFactory,
+ fileSplits[partition].getIODeviceId());
} catch (TreeIndexException e) {
throw new HyracksDataException(e);
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/PersistentLocalResourceRepository.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
index 01dce6c..2361bac 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
@@ -28,8 +28,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogManager;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.api.io.IODeviceHandle;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
import edu.uci.ics.hyracks.storage.common.file.LocalResource;
import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
@@ -37,26 +37,34 @@
public class PersistentLocalResourceRepository implements ILocalResourceRepository {
private static final Logger LOGGER = Logger.getLogger(PersistentLocalResourceRepository.class.getName());
- private final String mountPoint;
- private static final String ROOT_METADATA_DIRECTORY = "asterix_root_metadata/";
- private static final String ROOT_METADATA_FILE_NAME_PREFIX = ".asterix_root_metadata_";
+ private final String[] mountPoints;
+ private static final String ROOT_METADATA_DIRECTORY = "asterix_root_metadata";
+ private static final String ROOT_METADATA_FILE_NAME_PREFIX = ".asterix_root_metadata";
private static final long ROOT_LOCAL_RESOURCE_ID = -4321;
private static final String METADATA_FILE_NAME = ".metadata";
private Map<String, LocalResource> name2ResourceMap = new HashMap<String, LocalResource>();
private Map<Long, LocalResource> id2ResourceMap = new HashMap<Long, LocalResource>();
- private String rootMetadataFileName;
- private String rootDir;
+ private final int numIODevices;
- public PersistentLocalResourceRepository(String mountPoint) throws HyracksDataException {
- File mountPointDir = new File(mountPoint);
- if (!mountPointDir.exists()) {
- throw new HyracksDataException(mountPointDir.getAbsolutePath() + "doesn't exist.");
+ public PersistentLocalResourceRepository(List<IODeviceHandle> devices) throws HyracksDataException {
+ numIODevices = devices.size();
+ this.mountPoints = new String[numIODevices];
+ for (int i = 0; i < numIODevices; i++) {
+ String mountPoint = devices.get(i).getPath().getPath();
+ File mountPointDir = new File(mountPoint);
+ if (!mountPointDir.exists()) {
+ throw new HyracksDataException(mountPointDir.getAbsolutePath() + "doesn't exist.");
+ }
+ if (!mountPoint.endsWith(System.getProperty("file.separator"))) {
+ mountPoints[i] = new String(mountPoint + System.getProperty("file.separator"));
+ } else {
+ mountPoints[i] = new String(mountPoint);
+ }
}
- if (!mountPoint.endsWith(System.getProperty("file.separator"))) {
- this.mountPoint = new String(mountPoint + System.getProperty("file.separator"));
- } else {
- this.mountPoint = new String(mountPoint);
- }
+ }
+
+ private String prepareRootMetaDataFileName(String mountPoint, String nodeId, int ioDeviceId) {
+ return mountPoint + ROOT_METADATA_DIRECTORY + "_" + nodeId + "_" + "iodevice" + ioDeviceId;
}
public void initialize(String nodeId, String rootDir, boolean isNewUniverse, ResourceIdFactory resourceIdFactory)
@@ -64,53 +72,40 @@
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Initializing local resource repository ... ");
}
- LocalResource rootLocalResource = null;
- //#. if the rootMetadataFile doesn't exist, create it and return.
- rootMetadataFileName = new String(mountPoint + ROOT_METADATA_DIRECTORY + ROOT_METADATA_FILE_NAME_PREFIX
- + nodeId);
- File rootMetadataFile = new File(rootMetadataFileName);
if (isNewUniverse) {
- File rootMetadataDir = new File(mountPoint + ROOT_METADATA_DIRECTORY);
- if (!rootMetadataDir.exists()) {
- rootMetadataDir.mkdir();
- if (LOGGER.isLoggable(Level.INFO)) {
- LOGGER.info("created the root-metadata-file's directory: " + rootMetadataDir.getAbsolutePath());
+ //#. if the rootMetadataFile doesn't exist, create it and return.
+ for (int i = 0; i < numIODevices; i++) {
+ String rootMetadataFileName = prepareRootMetaDataFileName(mountPoints[i], nodeId, i) + File.separator
+ + ROOT_METADATA_FILE_NAME_PREFIX;
+ File rootMetadataFile = new File(rootMetadataFileName);
+
+ File rootMetadataDir = new File(prepareRootMetaDataFileName(mountPoints[i], nodeId, i));
+ if (!rootMetadataDir.exists()) {
+ rootMetadataDir.mkdir();
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("created the root-metadata-file's directory: " + rootMetadataDir.getAbsolutePath());
+ }
}
- }
- rootMetadataFile.delete();
- if (rootDir.startsWith(System.getProperty("file.separator"))) {
- this.rootDir = new String(mountPoint + rootDir.substring(System.getProperty("file.separator").length()));
- } else {
- this.rootDir = new String(mountPoint + rootDir);
- }
- rootLocalResource = new LocalResource(ROOT_LOCAL_RESOURCE_ID, rootMetadataFileName, 0, 0, this.rootDir);
- insert(rootLocalResource);
- if (LOGGER.isLoggable(Level.INFO)) {
- LOGGER.info("created the root-metadata-file: " + rootMetadataFileName);
- }
-
- if (LOGGER.isLoggable(Level.INFO)) {
- LOGGER.info("Completed the initialization of the local resource repository");
- }
- return;
- }
+ rootMetadataFile.delete();
+ String mountedRootDir;
+ if (rootDir.startsWith(System.getProperty("file.separator"))) {
+ mountedRootDir = new String(mountPoints[i]
+ + rootDir.substring(System.getProperty("file.separator").length()));
+ } else {
+ mountedRootDir = new String(mountPoints[i] + rootDir);
+ }
+ LocalResource rootLocalResource = new LocalResource(ROOT_LOCAL_RESOURCE_ID, rootMetadataFileName, 0, 0,
+ mountedRootDir);
+ insert(rootLocalResource, i);
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("created the root-metadata-file: " + rootMetadataFileName);
+ }
- //#. if the rootMetadataFile exists, read it and set this.rootDir.
- rootLocalResource = readLocalResource(rootMetadataFile);
- this.rootDir = (String) rootLocalResource.getResourceObject();
- if (LOGGER.isLoggable(Level.INFO)) {
- LOGGER.info("The root directory of the local resource repository is " + this.rootDir);
- }
-
- //#. load all local resources.
- File rootDirFile = new File(this.rootDir);
- if (!rootDirFile.exists()) {
- //rootDir may not exist if this node is not the metadata node and doesn't have any user data.
- if (LOGGER.isLoggable(Level.INFO)) {
- LOGGER.info("The root directory of the local resource repository doesn't exist: there is no local resource.");
- LOGGER.info("Completed the initialization of the local resource repository");
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("Completed the initialization of the local resource repository");
+ }
}
return;
}
@@ -125,27 +120,50 @@
}
};
- long maxResourceId = 0;
- File[] dataverseFileList = rootDirFile.listFiles();
- if (dataverseFileList == null) {
- throw new HyracksDataException("Metadata dataverse doesn't exist.");
- }
- for (File dataverseFile : dataverseFileList) {
- if (dataverseFile.isDirectory()) {
- File[] indexFileList = dataverseFile.listFiles();
- if (indexFileList != null) {
- for (File indexFile : indexFileList) {
- if (indexFile.isDirectory()) {
- File[] metadataFiles = indexFile.listFiles(filter);
- if (metadataFiles != null) {
- for (File metadataFile : metadataFiles) {
- LocalResource localResource = readLocalResource(metadataFile);
- id2ResourceMap.put(localResource.getResourceId(), localResource);
- name2ResourceMap.put(localResource.getResourceName(), localResource);
- maxResourceId = Math.max(localResource.getResourceId(), maxResourceId);
- if (LOGGER.isLoggable(Level.INFO)) {
- LOGGER.info("loaded local resource - [id: " + localResource.getResourceId()
- + ", name: " + localResource.getResourceName() + "]");
+ for (int i = 0; i < numIODevices; i++) {
+ String rootMetadataFileName = prepareRootMetaDataFileName(mountPoints[i], nodeId, i) + File.separator
+ + ROOT_METADATA_FILE_NAME_PREFIX;
+ File rootMetadataFile = new File(rootMetadataFileName);
+ //#. if the rootMetadataFile exists, read it and set this.rootDir.
+ LocalResource rootLocalResource = readLocalResource(rootMetadataFile);
+ String mountedRootDir = (String) rootLocalResource.getResourceObject();
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("The root directory of the local resource repository is " + mountedRootDir);
+ }
+
+ //#. load all local resources.
+ File rootDirFile = new File(mountedRootDir);
+ if (!rootDirFile.exists()) {
+ //rootDir may not exist if this node is not the metadata node and doesn't have any user data.
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("The root directory of the local resource repository doesn't exist: there is no local resource.");
+ LOGGER.info("Completed the initialization of the local resource repository");
+ }
+ continue;
+ }
+
+ long maxResourceId = 0;
+ File[] dataverseFileList = rootDirFile.listFiles();
+ if (dataverseFileList == null) {
+ throw new HyracksDataException("Metadata dataverse doesn't exist.");
+ }
+ for (File dataverseFile : dataverseFileList) {
+ if (dataverseFile.isDirectory()) {
+ File[] indexFileList = dataverseFile.listFiles();
+ if (indexFileList != null) {
+ for (File indexFile : indexFileList) {
+ if (indexFile.isDirectory()) {
+ File[] metadataFiles = indexFile.listFiles(filter);
+ if (metadataFiles != null) {
+ for (File metadataFile : metadataFiles) {
+ LocalResource localResource = readLocalResource(metadataFile);
+ id2ResourceMap.put(localResource.getResourceId(), localResource);
+ name2ResourceMap.put(localResource.getResourceName(), localResource);
+ maxResourceId = Math.max(localResource.getResourceId(), maxResourceId);
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("loaded local resource - [id: " + localResource.getResourceId()
+ + ", name: " + localResource.getResourceName() + "]");
+ }
}
}
}
@@ -153,11 +171,11 @@
}
}
}
- }
- resourceIdFactory.initId(maxResourceId + 1);
- if (LOGGER.isLoggable(Level.INFO)) {
- LOGGER.info("The resource id factory is intialized with the value: " + (maxResourceId + 1));
- LOGGER.info("Completed the initialization of the local resource repository");
+ resourceIdFactory.initId(maxResourceId + 1);
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("The resource id factory is intialized with the value: " + (maxResourceId + 1));
+ LOGGER.info("Completed the initialization of the local resource repository");
+ }
}
}
@@ -172,7 +190,7 @@
}
@Override
- public synchronized void insert(LocalResource resource) throws HyracksDataException {
+ public synchronized void insert(LocalResource resource, int ioDeviceId) throws HyracksDataException {
long id = resource.getResourceId();
if (id2ResourceMap.containsKey(id)) {
@@ -186,8 +204,10 @@
FileOutputStream fos = null;
ObjectOutputStream oosToFos = null;
+
try {
- fos = new FileOutputStream(getFileName(mountPoint, resource.getResourceName(), resource.getResourceId()));
+ fos = new FileOutputStream(getFileName(mountPoints[ioDeviceId], resource.getResourceName(),
+ resource.getResourceId()));
oosToFos = new ObjectOutputStream(fos);
oosToFos.writeObject(resource);
oosToFos.flush();
@@ -212,26 +232,26 @@
}
@Override
- public synchronized void deleteResourceById(long id) throws HyracksDataException {
+ public synchronized void deleteResourceById(long id, int ioDeviceId) throws HyracksDataException {
LocalResource resource = id2ResourceMap.get(id);
if (resource == null) {
throw new HyracksDataException("Resource doesn't exist");
}
id2ResourceMap.remove(id);
name2ResourceMap.remove(resource.getResourceName());
- File file = new File(getFileName(mountPoint, resource.getResourceName(), resource.getResourceId()));
+ File file = new File(getFileName(mountPoints[ioDeviceId], resource.getResourceName(), resource.getResourceId()));
file.delete();
}
@Override
- public synchronized void deleteResourceByName(String name) throws HyracksDataException {
+ public synchronized void deleteResourceByName(String name, int ioDeviceId) throws HyracksDataException {
LocalResource resource = name2ResourceMap.get(name);
if (resource == null) {
throw new HyracksDataException("Resource doesn't exist");
}
id2ResourceMap.remove(resource.getResourceId());
name2ResourceMap.remove(name);
- File file = new File(getFileName(mountPoint, resource.getResourceName(), resource.getResourceId()));
+ File file = new File(getFileName(mountPoints[ioDeviceId], resource.getResourceName(), resource.getResourceId()));
file.delete();
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/PersistentLocalResourceRepositoryFactory.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/PersistentLocalResourceRepositoryFactory.java
index c7efca5..f6847f9 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/PersistentLocalResourceRepositoryFactory.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/resource/PersistentLocalResourceRepositoryFactory.java
@@ -14,11 +14,8 @@
*/
package edu.uci.ics.asterix.transaction.management.resource;
-import java.util.List;
-
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.api.io.IIOManager;
-import edu.uci.ics.hyracks.api.io.IODeviceHandle;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepositoryFactory;
@@ -31,7 +28,6 @@
@Override
public ILocalResourceRepository createRepository() throws HyracksDataException {
- List<IODeviceHandle> devices = ioManager.getIODevices();
- return new PersistentLocalResourceRepository(devices.get(0).getPath().getPath());
+ return new PersistentLocalResourceRepository(ioManager.getIODevices());
}
-}
+}
\ No newline at end of file
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/DeadlockDetector.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/DeadlockDetector.java
index 900725b..600beab 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/DeadlockDetector.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/DeadlockDetector.java
@@ -2,8 +2,8 @@
import java.util.HashMap;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.JobId;
/**
* @author pouria, kisskys Performing a BFS search, upon adding each waiter to a waiting
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/JobInfo.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/JobInfo.java
index 4f01f37..d846603 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/JobInfo.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/JobInfo.java
@@ -1,19 +1,19 @@
package edu.uci.ics.asterix.transaction.management.service.locking;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
public class JobInfo {
private EntityInfoManager entityInfoManager;
private LockWaiterManager lockWaiterManager;
- private TransactionContext jobCtx;
+ private ITransactionContext jobCtx;
private int lastHoldingResource; //resource(entity or dataset) which is held by this job lastly
private int firstWaitingResource; //resource(entity or dataset) which this job is waiting for
private int upgradingResource; //resource(entity or dataset) which this job is waiting for to upgrade
private PrimitiveIntHashMap datasetISLockHT; //used for keeping dataset-granule-lock's count acquired by this job.
- public JobInfo(EntityInfoManager entityInfoManager, LockWaiterManager lockWaiterManager, TransactionContext txnCtx) {
+ public JobInfo(EntityInfoManager entityInfoManager, LockWaiterManager lockWaiterManager, ITransactionContext txnCtx) {
this.entityInfoManager = entityInfoManager;
this.lockWaiterManager = lockWaiterManager;
this.jobCtx = txnCtx;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManager.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManager.java
index a354d2a..8fb7494 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManager.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManager.java
@@ -22,14 +22,15 @@
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager.TransactionState;
+import edu.uci.ics.asterix.common.transactions.JobId;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
import edu.uci.ics.asterix.transaction.management.service.logging.LogType;
import edu.uci.ics.asterix.transaction.management.service.logging.LogUtil;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionManager.TransactionState;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
@@ -107,12 +108,12 @@
}
@Override
- public void lock(DatasetId datasetId, int entityHashValue, byte lockMode, TransactionContext txnContext)
+ public void lock(DatasetId datasetId, int entityHashValue, byte lockMode, ITransactionContext txnContext)
throws ACIDException {
internalLock(datasetId, entityHashValue, lockMode, txnContext, false);
}
- private void internalLock(DatasetId datasetId, int entityHashValue, byte lockMode, TransactionContext txnContext,
+ private void internalLock(DatasetId datasetId, int entityHashValue, byte lockMode, ITransactionContext txnContext,
boolean isInstant) throws ACIDException {
JobId jobId = txnContext.getJobId();
@@ -252,7 +253,7 @@
return;
}
- private void releaseDatasetISLocks(JobInfo jobInfo, JobId jobId, DatasetId datasetId, TransactionContext txnContext)
+ private void releaseDatasetISLocks(JobInfo jobInfo, JobId jobId, DatasetId datasetId, ITransactionContext txnContext)
throws ACIDException {
int entityInfo;
int prevEntityInfo;
@@ -295,16 +296,16 @@
}
}
- private void validateJob(TransactionContext txnContext) throws ACIDException {
+ private void validateJob(ITransactionContext txnContext) throws ACIDException {
if (txnContext.getTxnState() == TransactionState.ABORTED) {
throw new ACIDException("" + txnContext.getJobId() + " is in ABORTED state.");
- } else if (txnContext.getStatus() == TransactionContext.TIMED_OUT_STATUS) {
+ } else if (txnContext.getStatus() == ITransactionContext.TIMED_OUT_STATUS) {
requestAbort(txnContext);
}
}
private int lockDatasetGranule(DatasetId datasetId, int entityHashValue, byte lockMode,
- TransactionContext txnContext) throws ACIDException {
+ ITransactionContext txnContext) throws ACIDException {
JobId jobId = txnContext.getJobId();
int jId = jobId.getId(); //int-type jobId
int dId = datasetId.getId(); //int-type datasetId
@@ -525,7 +526,7 @@
}
private void lockEntityGranule(DatasetId datasetId, int entityHashValue, byte lockMode,
- int entityInfoFromDLockInfo, TransactionContext txnContext) throws ACIDException {
+ int entityInfoFromDLockInfo, ITransactionContext txnContext) throws ACIDException {
JobId jobId = txnContext.getJobId();
int jId = jobId.getId(); //int-type jobId
int waiterObjId;
@@ -632,22 +633,22 @@
}
@Override
- public void unlock(DatasetId datasetId, int entityHashValue, TransactionContext txnContext) throws ACIDException {
+ public void unlock(DatasetId datasetId, int entityHashValue, ITransactionContext txnContext) throws ACIDException {
internalUnlock(datasetId, entityHashValue, txnContext, false, false);
}
@Override
- public void unlock(DatasetId datasetId, int entityHashValue, TransactionContext txnContext, boolean commitFlag)
+ public void unlock(DatasetId datasetId, int entityHashValue, ITransactionContext txnContext, boolean commitFlag)
throws ACIDException {
internalUnlock(datasetId, entityHashValue, txnContext, false, commitFlag);
}
- private void instantUnlock(DatasetId datasetId, int entityHashValue, TransactionContext txnContext)
+ private void instantUnlock(DatasetId datasetId, int entityHashValue, ITransactionContext txnContext)
throws ACIDException {
internalUnlock(datasetId, entityHashValue, txnContext, true, false);
}
- private void internalUnlock(DatasetId datasetId, int entityHashValue, TransactionContext txnContext,
+ private void internalUnlock(DatasetId datasetId, int entityHashValue, ITransactionContext txnContext,
boolean isInstant, boolean commitFlag) throws ACIDException {
JobId jobId = txnContext.getJobId();
int eLockInfo = -1;
@@ -712,7 +713,7 @@
//This code should be taken care properly when there is a way to avoid doubling memory space for txnIds.
//This commit log is written here in order to avoid increasing the memory space for managing transactionIds
if (commitFlag) {
- if (txnContext.getTransactionType().equals(TransactionContext.TransactionType.READ_WRITE)) {
+ if (txnContext.getTransactionType().equals(ITransactionContext.TransactionType.READ_WRITE)) {
try {
txnSubsystem.getLogManager().log(LogType.ENTITY_COMMIT, txnContext, datasetId.getId(),
entityHashValue, -1, (byte) 0, 0, null, null, logicalLogLocator);
@@ -785,7 +786,7 @@
}
@Override
- public void releaseLocks(TransactionContext txnContext) throws ACIDException {
+ public void releaseLocks(ITransactionContext txnContext) throws ACIDException {
LockWaiter waiterObj;
int entityInfo;
int prevEntityInfo;
@@ -962,7 +963,7 @@
jobHT.remove(jobId);
if (existWaiter) {
- txnContext.setStatus(TransactionContext.TIMED_OUT_STATUS);
+ txnContext.setStatus(ITransactionContext.TIMED_OUT_STATUS);
txnContext.setTxnState(TransactionState.ABORTED);
}
@@ -976,7 +977,7 @@
}
@Override
- public void instantLock(DatasetId datasetId, int entityHashValue, byte lockMode, TransactionContext txnContext)
+ public void instantLock(DatasetId datasetId, int entityHashValue, byte lockMode, ITransactionContext txnContext)
throws ACIDException {
// try {
@@ -990,19 +991,19 @@
}
@Override
- public boolean tryLock(DatasetId datasetId, int entityHashValue, byte lockMode, TransactionContext txnContext)
+ public boolean tryLock(DatasetId datasetId, int entityHashValue, byte lockMode, ITransactionContext txnContext)
throws ACIDException {
return internalTryLock(datasetId, entityHashValue, lockMode, txnContext, false);
}
@Override
- public boolean instantTryLock(DatasetId datasetId, int entityHashValue, byte lockMode, TransactionContext txnContext)
- throws ACIDException {
+ public boolean instantTryLock(DatasetId datasetId, int entityHashValue, byte lockMode,
+ ITransactionContext txnContext) throws ACIDException {
return internalInstantTryLock(datasetId, entityHashValue, lockMode, txnContext);
}
private boolean internalInstantTryLock(DatasetId datasetId, int entityHashValue, byte lockMode,
- TransactionContext txnContext) throws ACIDException {
+ ITransactionContext txnContext) throws ACIDException {
DatasetLockInfo dLockInfo = null;
boolean isSuccess = true;
@@ -1065,7 +1066,7 @@
}
private boolean instantTryLockDatasetGranule(DatasetId datasetId, int entityHashValue, byte lockMode,
- TransactionContext txnContext, DatasetLockInfo dLockInfo, byte datasetLockMode) throws ACIDException {
+ ITransactionContext txnContext, DatasetLockInfo dLockInfo, byte datasetLockMode) throws ACIDException {
JobId jobId = txnContext.getJobId();
int jId = jobId.getId(); //int-type jobId
int dId = datasetId.getId(); //int-type datasetId
@@ -1144,7 +1145,7 @@
}
private boolean instantTryLockEntityGranule(DatasetId datasetId, int entityHashValue, byte lockMode,
- TransactionContext txnContext, DatasetLockInfo dLockInfo) throws ACIDException {
+ ITransactionContext txnContext, DatasetLockInfo dLockInfo) throws ACIDException {
JobId jobId = txnContext.getJobId();
int jId = jobId.getId(); //int-type jobId
int waiterObjId;
@@ -1205,7 +1206,7 @@
}
private boolean internalTryLock(DatasetId datasetId, int entityHashValue, byte lockMode,
- TransactionContext txnContext, boolean isInstant) throws ACIDException {
+ ITransactionContext txnContext, boolean isInstant) throws ACIDException {
JobId jobId = txnContext.getJobId();
int jId = jobId.getId(); //int-type jobId
int dId = datasetId.getId(); //int-type datasetId
@@ -1352,7 +1353,7 @@
}
private void trackLockRequest(String msg, int requestType, DatasetId datasetIdObj, int entityHashValue,
- byte lockMode, TransactionContext txnContext, DatasetLockInfo dLockInfo, int eLockInfo) {
+ byte lockMode, ITransactionContext txnContext, DatasetLockInfo dLockInfo, int eLockInfo) {
StringBuilder s = new StringBuilder();
LockRequest request = new LockRequest(Thread.currentThread().getName(), requestType, datasetIdObj,
entityHashValue, lockMode, txnContext);
@@ -1425,7 +1426,7 @@
}
private void revertTryLockDatasetGranuleOperation(DatasetId datasetId, int entityHashValue, byte lockMode,
- int entityInfo, TransactionContext txnContext) {
+ int entityInfo, ITransactionContext txnContext) {
JobId jobId = txnContext.getJobId();
DatasetLockInfo dLockInfo;
JobInfo jobInfo;
@@ -1483,7 +1484,7 @@
}
private int tryLockDatasetGranule(DatasetId datasetId, int entityHashValue, byte lockMode,
- TransactionContext txnContext) throws ACIDException {
+ ITransactionContext txnContext) throws ACIDException {
JobId jobId = txnContext.getJobId();
int jId = jobId.getId(); //int-type jobId
int dId = datasetId.getId(); //int-type datasetId
@@ -1645,7 +1646,7 @@
}
private boolean tryLockEntityGranule(DatasetId datasetId, int entityHashValue, byte lockMode,
- int entityInfoFromDLockInfo, TransactionContext txnContext) throws ACIDException {
+ int entityInfoFromDLockInfo, ITransactionContext txnContext) throws ACIDException {
JobId jobId = txnContext.getJobId();
int jId = jobId.getId(); //int-type jobId
int waiterObjId;
@@ -1735,7 +1736,7 @@
}
private int handleLockWaiter(DatasetLockInfo dLockInfo, int eLockInfo, int entityInfo, boolean isUpgrade,
- boolean isDatasetLockInfo, TransactionContext txnContext, JobInfo jobInfo, int duplicatedWaiterObjId)
+ boolean isDatasetLockInfo, ITransactionContext txnContext, JobInfo jobInfo, int duplicatedWaiterObjId)
throws ACIDException {
int waiterId = -1;
LockWaiter waiter;
@@ -1812,7 +1813,7 @@
//waiter woke up -> remove/deallocate waiter object and abort if timeout
latchLockTable();
- if (txnContext.getStatus() == TransactionContext.TIMED_OUT_STATUS || waiter.isVictim()) {
+ if (txnContext.getStatus() == ITransactionContext.TIMED_OUT_STATUS || waiter.isVictim()) {
requestAbort(txnContext);
}
@@ -1868,9 +1869,9 @@
return deadlockDetector.isSafeToAdd(dLockInfo, eLockInfo, entityInfo, isDatasetLockInfo, isUpgrade);
}
- private void requestAbort(TransactionContext txnContext) throws ACIDException {
- txnContext.setStatus(TransactionContext.TIMED_OUT_STATUS);
- txnContext.setStartWaitTime(TransactionContext.INVALID_TIME);
+ private void requestAbort(ITransactionContext txnContext) throws ACIDException {
+ txnContext.setStatus(ITransactionContext.TIMED_OUT_STATUS);
+ txnContext.setStartWaitTime(ITransactionContext.INVALID_TIME);
throw new ACIDException("Transaction " + txnContext.getJobId()
+ " should abort (requested by the Lock Manager)");
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManagerDeterministicUnitTest.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManagerDeterministicUnitTest.java
index c3b47bc..0781276 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManagerDeterministicUnitTest.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManagerDeterministicUnitTest.java
@@ -7,10 +7,11 @@
import java.util.NoSuchElementException;
import java.util.Scanner;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionManager.TransactionState;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager.TransactionState;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManagerRandomUnitTest.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManagerRandomUnitTest.java
index 89a15ef..b2cc6ab 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManagerRandomUnitTest.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManagerRandomUnitTest.java
@@ -3,10 +3,12 @@
import java.util.ArrayList;
import java.util.Random;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionManager.TransactionState;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager.TransactionState;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
@@ -502,14 +504,14 @@
public DatasetId datasetIdObj;
public int entityHashValue;
public byte lockMode;
- public TransactionContext txnContext;
+ public ITransactionContext txnContext;
public boolean isUpgrade;
public boolean isTryLockFailed;
public long requestTime;
public String threadName;
public LockRequest(String threadName, int requestType, DatasetId datasetIdObj, int entityHashValue, byte lockMode,
- TransactionContext txnContext) {
+ ITransactionContext txnContext) {
this.requestType = requestType;
this.datasetIdObj = datasetIdObj;
this.entityHashValue = entityHashValue;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockMgrLatchHandlerException.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockMgrLatchHandlerException.java
index 05a582c..84ba407 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockMgrLatchHandlerException.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockMgrLatchHandlerException.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.transaction.management.service.locking;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
public class LockMgrLatchHandlerException extends ACIDException {
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/TimeOutDetector.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/TimeOutDetector.java
index 6bc8c6b..a53c890 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/TimeOutDetector.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/TimeOutDetector.java
@@ -2,7 +2,7 @@
import java.util.LinkedList;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
/**
* @author pouria, kisskys
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/Buffer.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/Buffer.java
index 23a60f7..284b081 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/Buffer.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/Buffer.java
@@ -17,6 +17,8 @@
import java.nio.ByteBuffer;
import java.util.Arrays;
+import edu.uci.ics.asterix.common.transactions.IBuffer;
+
/**
* Represents a wrapper over @see ByteBuffer supporting some custom APIs for
* transaction support. This class is not "thread-safe". For performance
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/DataUtil.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/DataUtil.java
index 91ce7ed5..0d8448c 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/DataUtil.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/DataUtil.java
@@ -16,6 +16,8 @@
import java.util.zip.CRC32;
+import edu.uci.ics.asterix.common.transactions.IBuffer;
+
/**
* A utility class for doing bit level operations such as forming checksum or
* converting between Integer and byte array. Used extensively during writing
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/GenericFilter.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/GenericFilter.java
index 6bb644d..e9ec4fa 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/GenericFilter.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/GenericFilter.java
@@ -17,6 +17,9 @@
import java.util.ArrayList;
import java.util.List;
+import edu.uci.ics.asterix.common.transactions.IBuffer;
+import edu.uci.ics.asterix.common.transactions.ILogFilter;
+
/*
* A generic filter that encompasses one or more filters (see @ILogFiler) that may be applied when selectively retrieving logs.
* The contained filters are assumed to form a conjunction.
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogger.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogger.java
deleted file mode 100644
index e26a3cc..0000000
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/ILogger.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed 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 from
- *
- * 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.
- */
-package edu.uci.ics.asterix.transaction.management.service.logging;
-
-
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.logging.IndexLogger.ReusableLogContentObject;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-
-/**
- * An interface providing call back APIs that are invoked {@link ILogManager} for providing the content for the log record and doing any pre/post
- * processing.
- */
-public interface ILogger {
-
- public void preLog(TransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException;
-
- public void log(TransactionContext context, final LogicalLogLocator logicalLogLocator, int logContentSize,
- ReusableLogContentObject reusableLogContentObject) throws ACIDException;
-
- public void postLog(TransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException;
-
-}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexLogger.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexLogger.java
index d69a36e..ca30124 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexLogger.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexLogger.java
@@ -18,11 +18,14 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.resource.ICloseable;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager.ResourceType;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.ICloseable;
+import edu.uci.ics.asterix.common.transactions.ILogger;
+import edu.uci.ics.asterix.common.transactions.IResourceManager.ResourceType;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.ReusableLogContentObject;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
import edu.uci.ics.hyracks.storage.am.common.api.IIndex;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
@@ -53,14 +56,14 @@
this.tupleWriter = new SimpleTupleWriter();
}
- public synchronized void close(TransactionContext context) {
+ public synchronized void close(ITransactionContext context) {
ReusableLogContentObjectRepository txnThreadStateRepository = (ReusableLogContentObjectRepository) jobId2ReusableLogContentObjectRepositoryMap
.get(context.getJobId());
txnThreadStateRepository.remove(Thread.currentThread().getId());
jobId2ReusableLogContentObjectRepositoryMap.remove(context.getJobId());
}
- public void generateLogRecord(TransactionSubsystem txnSubsystem, TransactionContext context, int datasetId,
+ public void generateLogRecord(ITransactionSubsystem txnSubsystem, ITransactionContext context, int datasetId,
int PKHashValue, long resourceId, IndexOperation newOperation, ITupleReference newValue,
IndexOperation oldOperation, ITupleReference oldValue) throws ACIDException {
@@ -120,7 +123,7 @@
}
@Override
- public void log(TransactionContext context, LogicalLogLocator logicalLogLocator, int logContentSize,
+ public void log(ITransactionContext context, LogicalLogLocator logicalLogLocator, int logContentSize,
ReusableLogContentObject reusableLogContentObject) throws ACIDException {
int offset = 0;
int tupleSize = 0;
@@ -175,12 +178,12 @@
}
@Override
- public void postLog(TransactionContext context, ReusableLogContentObject reusableLogContentObject)
+ public void postLog(ITransactionContext context, ReusableLogContentObject reusableLogContentObject)
throws ACIDException {
}
@Override
- public void preLog(TransactionContext context, ReusableLogContentObject reusableLogContentObject)
+ public void preLog(ITransactionContext context, ReusableLogContentObject reusableLogContentObject)
throws ACIDException {
}
@@ -207,67 +210,4 @@
}
}
- /**
- * Represents the state of a transaction thread. The state contains information
- * that includes the tuple being operated, the operation and the location of the
- * log record corresponding to the operation.
- */
- public class ReusableLogContentObject {
-
- private LogicalLogLocator logicalLogLocator;
- private IndexOperation newOperation;
- private ITupleReference newValue;
- private IndexOperation oldOperation;
- private ITupleReference oldValue;
-
- public ReusableLogContentObject(LogicalLogLocator logicalLogLocator, IndexOperation newOperation,
- ITupleReference newValue, IndexOperation oldOperation, ITupleReference oldValue) {
- this.logicalLogLocator = logicalLogLocator;
- this.newOperation = newOperation;
- this.newValue = newValue;
- this.oldOperation = oldOperation;
- this.oldValue = oldValue;
- }
-
- public synchronized LogicalLogLocator getLogicalLogLocator() {
- return logicalLogLocator;
- }
-
- public synchronized void setLogicalLogLocator(LogicalLogLocator logicalLogLocator) {
- this.logicalLogLocator = logicalLogLocator;
- }
-
- public synchronized void setNewOperation(IndexOperation newOperation) {
- this.newOperation = newOperation;
- }
-
- public synchronized IndexOperation getNewOperation() {
- return newOperation;
- }
-
- public synchronized void setNewValue(ITupleReference newValue) {
- this.newValue = newValue;
- }
-
- public synchronized ITupleReference getNewValue() {
- return newValue;
- }
-
- public synchronized void setOldOperation(IndexOperation oldOperation) {
- this.oldOperation = oldOperation;
- }
-
- public synchronized IndexOperation getOldOperation() {
- return oldOperation;
- }
-
- public synchronized void setOldValue(ITupleReference oldValue) {
- this.oldValue = oldValue;
- }
-
- public synchronized ITupleReference getOldValue() {
- return oldValue;
- }
- }
-
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexLoggerRepository.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexLoggerRepository.java
index da5042c..c51bb11 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexLoggerRepository.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexLoggerRepository.java
@@ -17,24 +17,27 @@
import java.util.HashMap;
import java.util.Map;
-import edu.uci.ics.asterix.transaction.management.service.transaction.MutableResourceId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.ILogger;
+import edu.uci.ics.asterix.common.transactions.ILoggerRepository;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.MutableResourceId;
import edu.uci.ics.hyracks.storage.am.common.api.IIndex;
-public class IndexLoggerRepository {
+public class IndexLoggerRepository implements ILoggerRepository {
- private final Map<MutableResourceId, IndexLogger> loggers = new HashMap<MutableResourceId, IndexLogger>();
- private final TransactionSubsystem txnSubsystem;
+ private final Map<MutableResourceId, ILogger> loggers = new HashMap<MutableResourceId, ILogger>();
+ private final ITransactionSubsystem txnSubsystem;
private MutableResourceId mutableResourceId;
- public IndexLoggerRepository(TransactionSubsystem provider) {
+ public IndexLoggerRepository(ITransactionSubsystem provider) {
this.txnSubsystem = provider;
mutableResourceId = new MutableResourceId(0);
}
- public synchronized IndexLogger getIndexLogger(long resourceId, byte resourceType) {
+ @Override
+ public synchronized ILogger getIndexLogger(long resourceId, byte resourceType) {
mutableResourceId.setId(resourceId);
- IndexLogger logger = loggers.get(mutableResourceId);
+ ILogger logger = loggers.get(mutableResourceId);
if (logger == null) {
MutableResourceId newMutableResourceId = new MutableResourceId(resourceId);
IIndex index = (IIndex) txnSubsystem.getAsterixAppRuntimeContextProvider().getIndexLifecycleManager()
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexResourceManager.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexResourceManager.java
index 7ecfa69..ce3401c 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexResourceManager.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/IndexResourceManager.java
@@ -14,9 +14,11 @@
*/
package edu.uci.ics.asterix.transaction.management.service.logging;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.ILogRecordHelper;
+import edu.uci.ics.asterix.common.transactions.IResourceManager;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
import edu.uci.ics.hyracks.storage.am.common.api.IIndex;
import edu.uci.ics.hyracks.storage.am.common.impls.NoOpOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
@@ -28,9 +30,9 @@
public final byte resourceType;
- private final TransactionSubsystem txnSubsystem;
+ private final ITransactionSubsystem txnSubsystem;
- public IndexResourceManager(byte resourceType, TransactionSubsystem provider) {
+ public IndexResourceManager(byte resourceType, ITransactionSubsystem provider) {
this.resourceType = resourceType;
this.txnSubsystem = provider;
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogCursor.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogCursor.java
index 7e954d8..f452631 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogCursor.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogCursor.java
@@ -17,7 +17,15 @@
import java.io.File;
import java.io.IOException;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.FileUtil;
+import edu.uci.ics.asterix.common.transactions.IBuffer;
+import edu.uci.ics.asterix.common.transactions.IFileBasedBuffer;
+import edu.uci.ics.asterix.common.transactions.ILogCursor;
+import edu.uci.ics.asterix.common.transactions.ILogFilter;
+import edu.uci.ics.asterix.common.transactions.LogManagerProperties;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.PhysicalLogLocator;
public class LogCursor implements ILogCursor {
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogManager.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogManager.java
index 38d39cc..318996a 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogManager.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogManager.java
@@ -31,8 +31,20 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.logging.IndexLogger.ReusableLogContentObject;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.FileBasedBuffer;
+import edu.uci.ics.asterix.common.transactions.FileUtil;
+import edu.uci.ics.asterix.common.transactions.IFileBasedBuffer;
+import edu.uci.ics.asterix.common.transactions.ILogCursor;
+import edu.uci.ics.asterix.common.transactions.ILogFilter;
+import edu.uci.ics.asterix.common.transactions.ILogManager;
+import edu.uci.ics.asterix.common.transactions.ILogRecordHelper;
+import edu.uci.ics.asterix.common.transactions.ILogger;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.LogManagerProperties;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.PhysicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.ReusableLogContentObject;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
@@ -78,7 +90,7 @@
*/
private AtomicLong lsn = new AtomicLong(0);
- private List<HashMap<TransactionContext, Integer>> activeTxnCountMaps;
+ private List<HashMap<ITransactionContext, Integer>> activeTxnCountMaps;
public void addFlushRequest(int pageIndex, long lsn, boolean isSynchronous) {
logPageFlusher.requestFlush(pageIndex, lsn, isSynchronous);
@@ -147,9 +159,10 @@
private void initLogManager() throws ACIDException {
logRecordHelper = new LogRecordHelper(this);
numLogPages = logManagerProperties.getNumLogPages();
- activeTxnCountMaps = new ArrayList<HashMap<TransactionContext, Integer>>(numLogPages);
+ activeTxnCountMaps = new ArrayList<HashMap<ITransactionContext, Integer>>(numLogPages);
+
for (int i = 0; i < numLogPages; i++) {
- activeTxnCountMaps.add(new HashMap<TransactionContext, Integer>());
+ activeTxnCountMaps.add(new HashMap<ITransactionContext, Integer>());
}
logPages = new FileBasedBuffer[numLogPages];
@@ -264,10 +277,10 @@
// space in the log page and hence is an owner.
logPages[prevPage].incRefCnt();
logPages[prevPage].releaseReadLatch();
-
+
// forward the nextWriteOffset in the log page
logPages[prevPage].setBufferNextWriteOffset(logPageSize);
-
+
logPages[prevPage].decRefCnt();
addFlushRequest(prevPage, old, false);
@@ -298,11 +311,11 @@
}
@Override
- public void log(byte logType, TransactionContext txnCtx, int datasetId, int PKHashValue, long resourceId,
+ public void log(byte logType, ITransactionContext txnCtx, int datasetId, int PKHashValue, long resourceId,
byte resourceMgrId, int logContentSize, ReusableLogContentObject reusableLogContentObject, ILogger logger,
LogicalLogLocator logicalLogLocator) throws ACIDException {
- HashMap<TransactionContext, Integer> map = null;
+ HashMap<ITransactionContext, Integer> map = null;
int activeTxnCount;
// logLocator is a re-usable object that is appropriately set in each
@@ -721,14 +734,14 @@
}
public void decrementActiveTxnCountOnIndexes(int pageIndex) throws HyracksDataException {
- TransactionContext ctx = null;
+ ITransactionContext ctx = null;
int count = 0;
int i = 0;
- HashMap<TransactionContext, Integer> map = activeTxnCountMaps.get(pageIndex);
- Set<Map.Entry<TransactionContext, Integer>> entrySet = map.entrySet();
+ HashMap<ITransactionContext, Integer> map = activeTxnCountMaps.get(pageIndex);
+ Set<Map.Entry<ITransactionContext, Integer>> entrySet = map.entrySet();
if (entrySet != null) {
- for (Map.Entry<TransactionContext, Integer> entry : entrySet) {
+ for (Map.Entry<ITransactionContext, Integer> entry : entrySet) {
if (entry != null) {
if (entry.getValue() != null) {
count = entry.getValue();
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogRecordHelper.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogRecordHelper.java
index 1b65d8f..ed30b88 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogRecordHelper.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogRecordHelper.java
@@ -14,7 +14,12 @@
*/
package edu.uci.ics.asterix.transaction.management.service.logging;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.common.transactions.ILogManager;
+import edu.uci.ics.asterix.common.transactions.ILogRecordHelper;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.LogManagerProperties;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.PhysicalLogLocator;
/**
* An implementation of the @see ILogRecordHelper interface that provides API
@@ -63,9 +68,7 @@
private final int RESOURCE_ID_POS = 25;
private final int RESOURCE_MGR_ID_POS = 33;
private final int LOG_RECORD_SIZE_POS = 34;
-
-
private ILogManager logManager;
public LogRecordHelper(ILogManager logManager) {
@@ -181,7 +184,7 @@
}
@Override
- public void writeLogHeader(LogicalLogLocator logicalLogLocator, byte logType, TransactionContext context,
+ public void writeLogHeader(LogicalLogLocator logicalLogLocator, byte logType, ITransactionContext context,
int datasetId, int PKHashValue, long prevLogicalLogLocator, long resourceId, byte resourceMgrId,
int logRecordSize) {
@@ -258,8 +261,8 @@
public int getLogChecksumSize() {
return LOG_CHECKSUM_SIZE;
}
-
+
public int getCommitLogSize() {
return COMMIT_LOG_SIZE;
}
-}
+}
\ No newline at end of file
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogUtil.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogUtil.java
index 77a99bc..e57bf32 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogUtil.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogUtil.java
@@ -24,7 +24,13 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.FileUtil;
+import edu.uci.ics.asterix.common.transactions.ILogManager;
+import edu.uci.ics.asterix.common.transactions.LogManagerProperties;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.PhysicalLogLocator;
+
/**
* A utility class providing helper methods for the {@link ILogManager}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/CheckpointThread.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/CheckpointThread.java
index 3eb87bc..a934d6c 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/CheckpointThread.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/CheckpointThread.java
@@ -2,7 +2,8 @@
import java.util.List;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.IRecoveryManager;
import edu.uci.ics.asterix.transaction.management.opcallbacks.IndexOperationTracker;
import edu.uci.ics.hyracks.storage.am.common.api.IIndex;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/RecoveryManager.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/RecoveryManager.java
index 47c5dcb..50d4625 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/RecoveryManager.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/RecoveryManager.java
@@ -34,23 +34,25 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.IAsterixAppRuntimeContextProvider;
+import edu.uci.ics.asterix.common.transactions.IBuffer;
+import edu.uci.ics.asterix.common.transactions.ILogCursor;
+import edu.uci.ics.asterix.common.transactions.ILogFilter;
+import edu.uci.ics.asterix.common.transactions.ILogManager;
+import edu.uci.ics.asterix.common.transactions.ILogRecordHelper;
+import edu.uci.ics.asterix.common.transactions.IRecoveryManager;
+import edu.uci.ics.asterix.common.transactions.IResourceManager;
+import edu.uci.ics.asterix.common.transactions.IResourceManager.ResourceType;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.PhysicalLogLocator;
import edu.uci.ics.asterix.transaction.management.opcallbacks.IndexOperationTracker;
import edu.uci.ics.asterix.transaction.management.resource.ILocalResourceMetadata;
-import edu.uci.ics.asterix.transaction.management.service.logging.IBuffer;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogCursor;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogFilter;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogManager;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogRecordHelper;
import edu.uci.ics.asterix.transaction.management.service.logging.IndexResourceManager;
import edu.uci.ics.asterix.transaction.management.service.logging.LogManager;
import edu.uci.ics.asterix.transaction.management.service.logging.LogType;
import edu.uci.ics.asterix.transaction.management.service.logging.LogUtil;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.logging.PhysicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager.ResourceType;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManagementConstants;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionManager;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
@@ -611,7 +613,7 @@
* @see edu.uci.ics.transaction.management.service.recovery.IRecoveryManager# rollbackTransaction (edu.uci.ics.TransactionContext.management.service.transaction .TransactionContext)
*/
@Override
- public void rollbackTransaction(TransactionContext txnContext) throws ACIDException {
+ public void rollbackTransaction(ITransactionContext txnContext) throws ACIDException {
ILogManager logManager = txnSubsystem.getLogManager();
ILogRecordHelper logRecordHelper = logManager.getLogRecordHelper();
Map<TxnId, List<Long>> loserTxnTable = new HashMap<TxnId, List<Long>>();
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/TransactionTableEntry.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/TransactionTableEntry.java
index 9bfcc8f..15e21bc 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/TransactionTableEntry.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/recovery/TransactionTableEntry.java
@@ -14,8 +14,8 @@
*/
package edu.uci.ics.asterix.transaction.management.service.recovery;
-import edu.uci.ics.asterix.transaction.management.service.logging.PhysicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionManager;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager;
+import edu.uci.ics.asterix.common.transactions.PhysicalLogLocator;
/**
* Represents a bookkeeping data-structure that is populated duing the analysis
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixRuntimeComponentsProvider.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/AsterixRuntimeComponentsProvider.java
similarity index 75%
rename from asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixRuntimeComponentsProvider.java
rename to asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/AsterixRuntimeComponentsProvider.java
index fad0a38..2b3d6cd 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixRuntimeComponentsProvider.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/AsterixRuntimeComponentsProvider.java
@@ -1,5 +1,7 @@
-package edu.uci.ics.asterix.common.context;
+package edu.uci.ics.asterix.transaction.management.service.transaction;
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
+import edu.uci.ics.asterix.common.api.IAsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.transaction.management.ioopcallbacks.LSMBTreeIOOperationCallbackFactory;
import edu.uci.ics.asterix.transaction.management.ioopcallbacks.LSMInvertedIndexIOOperationCallbackFactory;
import edu.uci.ics.asterix.transaction.management.ioopcallbacks.LSMRTreeIOOperationCallbackFactory;
@@ -23,9 +25,9 @@
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
-public class AsterixRuntimeComponentsProvider implements IIndexLifecycleManagerProvider, IStorageManagerInterface,
- ILSMIOOperationSchedulerProvider, ILSMMergePolicyProvider, ILSMOperationTrackerFactory,
- ILSMIOOperationCallbackProvider {
+public class AsterixRuntimeComponentsProvider implements
+ IIndexLifecycleManagerProvider, IStorageManagerInterface, ILSMIOOperationSchedulerProvider,
+ ILSMMergePolicyProvider, ILSMOperationTrackerFactory, ILSMIOOperationCallbackProvider {
private static final long serialVersionUID = 1L;
private final ILSMIOOperationCallbackFactory ioOpCallbackFactory;
@@ -54,43 +56,45 @@
@Override
public ILSMIOOperationScheduler getIOScheduler(IHyracksTaskContext ctx) {
- return ((AsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
+ return ((IAsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
.getLSMIOScheduler();
}
@Override
public ILSMMergePolicy getMergePolicy(IHyracksTaskContext ctx) {
- return ((AsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
+ return ((IAsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
.getLSMMergePolicy();
}
@Override
public IBufferCache getBufferCache(IHyracksTaskContext ctx) {
- return ((AsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
+ return ((IAsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
.getBufferCache();
}
@Override
public IFileMapProvider getFileMapProvider(IHyracksTaskContext ctx) {
- return ((AsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
+ return ((IAsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
.getFileMapManager();
}
@Override
public ILocalResourceRepository getLocalResourceRepository(IHyracksTaskContext ctx) {
- return ((AsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
+ return ((IAsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
.getLocalResourceRepository();
}
@Override
public IIndexLifecycleManager getLifecycleManager(IHyracksTaskContext ctx) {
- return ((AsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
+ return ((IAsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
.getIndexLifecycleManager();
}
@Override
public ResourceIdFactory getResourceIdFactory(IHyracksTaskContext ctx) {
- return ((AsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
+ return ((IAsterixAppRuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject())
.getResourceIdFactory();
}
+
+
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/JobIdFactory.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/JobIdFactory.java
index cac4f8e..8f9fa79 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/JobIdFactory.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/JobIdFactory.java
@@ -16,6 +16,8 @@
import java.util.concurrent.atomic.AtomicInteger;
+import edu.uci.ics.asterix.common.transactions.JobId;
+
/**
* Represents a factory to generate unique transaction IDs.
*/
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionContext.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionContext.java
index 5b01edf..2659d8f 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionContext.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionContext.java
@@ -19,15 +19,16 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.opcallbacks.AbstractOperationCallback;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.AbstractOperationCallback;
+import edu.uci.ics.asterix.common.transactions.ICloseable;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager.TransactionState;
+import edu.uci.ics.asterix.common.transactions.JobId;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
import edu.uci.ics.asterix.transaction.management.opcallbacks.IndexOperationTracker;
-import edu.uci.ics.asterix.transaction.management.resource.ICloseable;
import edu.uci.ics.asterix.transaction.management.service.logging.LogUtil;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionManager.TransactionState;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.storage.am.common.api.IModificationOperationCallback;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndex;
@@ -40,17 +41,7 @@
* initiate an operation on the behalf of the transaction associated with the
* context.
*/
-public class TransactionContext implements Serializable {
-
- public static final long INVALID_TIME = -1l; // used for showing a
- // transaction is not waiting.
- public static final int ACTIVE_STATUS = 0;
- public static final int TIMED_OUT_STATUS = 1;
-
- public enum TransactionType {
- READ,
- READ_WRITE
- }
+public class TransactionContext implements ITransactionContext, Serializable {
private static final long serialVersionUID = -6105616785783310111L;
private TransactionSubsystem transactionSubsystem;
@@ -170,7 +161,7 @@
closeable.close(this);
}
}
-
+
@Override
public int hashCode() {
return jobId.getId();
@@ -180,4 +171,6 @@
public boolean equals(Object o) {
return (o == this);
}
+
+
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionManager.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionManager.java
index d3294d0..4e8808f 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionManager.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionManager.java
@@ -20,9 +20,12 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager;
+import edu.uci.ics.asterix.common.transactions.JobId;
import edu.uci.ics.asterix.transaction.management.service.logging.LogType;
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
/**
* An implementation of the @see ITransactionManager interface that provides
@@ -31,7 +34,7 @@
public class TransactionManager implements ITransactionManager {
private static final Logger LOGGER = Logger.getLogger(TransactionManager.class.getName());
private final TransactionSubsystem transactionProvider;
- private Map<JobId, TransactionContext> transactionContextRepository = new HashMap<JobId, TransactionContext>();
+ private Map<JobId, ITransactionContext> ITransactionContextRepository = new HashMap<JobId, ITransactionContext>();
private AtomicInteger maxJobId = new AtomicInteger(0);
public TransactionManager(TransactionSubsystem provider) {
@@ -39,7 +42,7 @@
}
@Override
- public void abortTransaction(TransactionContext txnContext, DatasetId datasetId, int PKHashVal)
+ public void abortTransaction(ITransactionContext txnContext, DatasetId datasetId, int PKHashVal)
throws ACIDException {
synchronized (txnContext) {
if (txnContext.getTxnState().equals(TransactionState.ABORTED)) {
@@ -58,39 +61,39 @@
} finally {
txnContext.releaseResources();
transactionProvider.getLockManager().releaseLocks(txnContext);
- transactionContextRepository.remove(txnContext.getJobId());
+ ITransactionContextRepository.remove(txnContext.getJobId());
txnContext.setTxnState(TransactionState.ABORTED);
}
}
}
@Override
- public TransactionContext beginTransaction(JobId jobId) throws ACIDException {
+ public ITransactionContext beginTransaction(JobId jobId) throws ACIDException {
setMaxJobId(jobId.getId());
- TransactionContext txnContext = new TransactionContext(jobId, transactionProvider);
+ ITransactionContext txnContext = new TransactionContext(jobId, transactionProvider);
synchronized (this) {
- transactionContextRepository.put(jobId, txnContext);
+ ITransactionContextRepository.put(jobId, txnContext);
}
return txnContext;
}
@Override
- public TransactionContext getTransactionContext(JobId jobId) throws ACIDException {
+ public ITransactionContext getTransactionContext(JobId jobId) throws ACIDException {
setMaxJobId(jobId.getId());
- synchronized (transactionContextRepository) {
+ synchronized (ITransactionContextRepository) {
- TransactionContext context = transactionContextRepository.get(jobId);
+ ITransactionContext context = ITransactionContextRepository.get(jobId);
if (context == null) {
- context = transactionContextRepository.get(jobId);
+ context = ITransactionContextRepository.get(jobId);
context = new TransactionContext(jobId, transactionProvider);
- transactionContextRepository.put(jobId, context);
+ ITransactionContextRepository.put(jobId, context);
}
return context;
}
}
@Override
- public void commitTransaction(TransactionContext txnContext, DatasetId datasetId, int PKHashVal)
+ public void commitTransaction(ITransactionContext txnContext, DatasetId datasetId, int PKHashVal)
throws ACIDException {
synchronized (txnContext) {
if ((txnContext.getTxnState().equals(TransactionState.COMMITTED))) {
@@ -116,7 +119,7 @@
//for job-level commit
try {
- if (txnContext.getTransactionType().equals(TransactionContext.TransactionType.READ_WRITE)) {
+ if (txnContext.getTransactionType().equals(ITransactionContext.TransactionType.READ_WRITE)) {
transactionProvider.getLogManager().log(LogType.COMMIT, txnContext, -1, -1, -1, (byte) 0, 0, null,
null, txnContext.getLastLogLocator());
}
@@ -128,14 +131,14 @@
} finally {
txnContext.releaseResources();
transactionProvider.getLockManager().releaseLocks(txnContext); // release
- transactionContextRepository.remove(txnContext.getJobId());
+ ITransactionContextRepository.remove(txnContext.getJobId());
txnContext.setTxnState(TransactionState.COMMITTED);
}
}
}
@Override
- public void completedTransaction(TransactionContext txnContext, DatasetId datasetId, int PKHashVal, boolean success)
+ public void completedTransaction(ITransactionContext txnContext, DatasetId datasetId, int PKHashVal, boolean success)
throws ACIDException {
if (!success) {
abortTransaction(txnContext, datasetId, PKHashVal);
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionSubsystem.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionSubsystem.java
index c83b7bc..eb6e9a2 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionSubsystem.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionSubsystem.java
@@ -14,23 +14,25 @@
*/
package edu.uci.ics.asterix.transaction.management.service.transaction;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.resource.TransactionalResourceManagerRepository;
-import edu.uci.ics.asterix.transaction.management.service.locking.ILockManager;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.IAsterixAppRuntimeContextProvider;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ILogManager;
+import edu.uci.ics.asterix.common.transactions.IRecoveryManager;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.asterix.common.transactions.TransactionalResourceManagerRepository;
import edu.uci.ics.asterix.transaction.management.service.locking.LockManager;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogManager;
import edu.uci.ics.asterix.transaction.management.service.logging.IndexLoggerRepository;
import edu.uci.ics.asterix.transaction.management.service.logging.LogManager;
import edu.uci.ics.asterix.transaction.management.service.recovery.CheckpointThread;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IAsterixAppRuntimeContextProvider;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IRecoveryManager;
import edu.uci.ics.asterix.transaction.management.service.recovery.RecoveryManager;
/**
* Provider for all the sub-systems (transaction/lock/log/recovery) managers.
* Users of transaction sub-systems must obtain them from the provider.
*/
-public class TransactionSubsystem {
+public class TransactionSubsystem implements ITransactionSubsystem {
private final String id;
private final ILogManager logManager;
private final ILockManager lockManager;
@@ -52,10 +54,10 @@
this.resourceRepository = new TransactionalResourceManagerRepository();
this.asterixAppRuntimeContextProvider = asterixAppRuntimeContextProvider;
if (asterixAppRuntimeContextProvider != null) {
- this.checkpointThread = new CheckpointThread(recoveryManager,
- asterixAppRuntimeContextProvider.getIndexLifecycleManager(), 0);
+ this.checkpointThread = new CheckpointThread(recoveryManager,
+ asterixAppRuntimeContextProvider.getIndexLifecycleManager(), 0);
} else {
- this.checkpointThread = null;
+ this.checkpointThread = null;
}
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionSubsystemProvider.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionSubsystemProvider.java
new file mode 100644
index 0000000..ab89ef4
--- /dev/null
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionSubsystemProvider.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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.
+ */
+
+package edu.uci.ics.asterix.transaction.management.service.transaction;
+
+import edu.uci.ics.asterix.common.api.IAsterixAppRuntimeContext;
+import edu.uci.ics.asterix.common.context.ITransactionSubsystemProvider;
+import edu.uci.ics.asterix.common.transactions.ITransactionSubsystem;
+import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+
+/**
+ * The purpose of this provider is to work around a cyclic dependency between asterix-common and asterix-transactions.
+ * The operation callbacks would depend on the AsterixAppRuntimeContext to get the transaction subsystem,
+ * while at the same time the AsterixAppRuntimeContext depends on asterix-transactions for the TransactionSubsystem.
+ */
+public class TransactionSubsystemProvider implements ITransactionSubsystemProvider {
+ @Override
+ public ITransactionSubsystem getTransactionSubsystem(IHyracksTaskContext ctx) {
+ IAsterixAppRuntimeContext runtimeCtx = (IAsterixAppRuntimeContext) ctx.getJobletContext()
+ .getApplicationContext().getApplicationObject();
+ return runtimeCtx.getTransactionSubsystem();
+ }
+}
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/BasicLogger.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/BasicLogger.java
index c9d01a0..076227b 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/BasicLogger.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/BasicLogger.java
@@ -16,19 +16,19 @@
import java.util.Random;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.logging.IBuffer;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogger;
-import edu.uci.ics.asterix.transaction.management.service.logging.IndexLogger.ReusableLogContentObject;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.IBuffer;
+import edu.uci.ics.asterix.common.transactions.ILogger;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.ReusableLogContentObject;
public class BasicLogger implements ILogger {
private static long averageContentCreationTime = 0;
private static long count = 0;
- public void log(TransactionContext context, LogicalLogLocator wMemLSN, int length,
+ public void log(ITransactionContext context, LogicalLogLocator wMemLSN, int length,
ReusableLogContentObject reusableLogContentObject) throws ACIDException {
byte[] logContent = getRandomBytes(length);
@@ -66,12 +66,12 @@
return averageContentCreationTime;
}
- public void postLog(TransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException {
+ public void postLog(ITransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException {
// TODO Auto-generated method stub
}
- public void preLog(TransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException {
+ public void preLog(ITransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException {
// TODO Auto-generated method stub
}
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/IResource.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/IResource.java
index fbc44da..a0e0980 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/IResource.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/IResource.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.transaction.management.logging;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogger;
+import edu.uci.ics.asterix.common.transactions.ILogger;
public interface IResource {
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/test/RecoverySimulator.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/test/RecoverySimulator.java
index 54ec036..07f7474 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/test/RecoverySimulator.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/test/RecoverySimulator.java
@@ -16,8 +16,8 @@
import java.io.IOException;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IRecoveryManager;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.IRecoveryManager;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
public class RecoverySimulator {
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/test/TransactionWorkloadSimulator.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/test/TransactionWorkloadSimulator.java
index dcd644d..8f56e3b 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/test/TransactionWorkloadSimulator.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/logging/test/TransactionWorkloadSimulator.java
@@ -18,18 +18,18 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ILogManager;
+import edu.uci.ics.asterix.common.transactions.ILogRecordHelper;
+import edu.uci.ics.asterix.common.transactions.IResourceManager;
+import edu.uci.ics.asterix.common.transactions.IResourceManager.ResourceType;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
import edu.uci.ics.asterix.transaction.management.logging.BasicLogger;
-import edu.uci.ics.asterix.transaction.management.service.locking.ILockManager;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogManager;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogRecordHelper;
import edu.uci.ics.asterix.transaction.management.service.logging.LogActionType;
import edu.uci.ics.asterix.transaction.management.service.logging.LogType;
import edu.uci.ics.asterix.transaction.management.service.logging.LogUtil;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager.ResourceType;
import edu.uci.ics.asterix.transaction.management.service.transaction.JobIdFactory;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileLogger.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileLogger.java
index 54bb0b8..3b251bc 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileLogger.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileLogger.java
@@ -15,12 +15,12 @@
package edu.uci.ics.asterix.transaction.management.test;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.ILogger;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.ReusableLogContentObject;
import edu.uci.ics.asterix.transaction.management.logging.IResource;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogger;
-import edu.uci.ics.asterix.transaction.management.service.logging.IndexLogger.ReusableLogContentObject;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
class FileLogger implements ILogger {
@@ -39,13 +39,13 @@
}
@Override
- public void preLog(TransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException {
+ public void preLog(ITransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException {
// TODO Auto-generated method stub
}
@Override
- public void log(TransactionContext context, final LogicalLogLocator memLSN, int logContentSize,
+ public void log(ITransactionContext context, final LogicalLogLocator memLSN, int logContentSize,
ReusableLogContentObject reusableLogContentObject) throws ACIDException {
byte[] buffer = memLSN.getBuffer().getArray();
byte[] content = logRecordContent.getBytes();
@@ -58,7 +58,7 @@
}
@Override
- public void postLog(TransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException {
+ public void postLog(ITransactionContext context, ReusableLogContentObject reusableLogContentObject) throws ACIDException {
// TODO Auto-generated method stub
}
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileResource.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileResource.java
index bc1a6f0..fc1eb86 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileResource.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileResource.java
@@ -21,9 +21,9 @@
import java.io.FileWriter;
import java.io.IOException;
+import edu.uci.ics.asterix.common.transactions.FileUtil;
+import edu.uci.ics.asterix.common.transactions.ILogger;
import edu.uci.ics.asterix.transaction.management.logging.IResource;
-import edu.uci.ics.asterix.transaction.management.service.logging.FileUtil;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogger;
class FileResource implements IResource {
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileResourceManager.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileResourceManager.java
index 6014003..f47b1df 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileResourceManager.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/FileResourceManager.java
@@ -17,11 +17,11 @@
import java.util.HashMap;
import java.util.Map;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.ILogRecordHelper;
+import edu.uci.ics.asterix.common.transactions.IResourceManager;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
import edu.uci.ics.asterix.transaction.management.logging.IResource;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogRecordHelper;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager;
class FileResourceManager implements IResourceManager {
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/LogRecordReader.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/LogRecordReader.java
index ad1238a..1aa8454 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/LogRecordReader.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/LogRecordReader.java
@@ -15,19 +15,17 @@
package edu.uci.ics.asterix.transaction.management.test;
import java.io.IOException;
-import java.util.Properties;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.logging.IBuffer;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogCursor;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogFilter;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogManager;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogRecordHelper;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.IBuffer;
+import edu.uci.ics.asterix.common.transactions.ILogCursor;
+import edu.uci.ics.asterix.common.transactions.ILogFilter;
+import edu.uci.ics.asterix.common.transactions.ILogManager;
+import edu.uci.ics.asterix.common.transactions.ILogRecordHelper;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
+import edu.uci.ics.asterix.common.transactions.PhysicalLogLocator;
import edu.uci.ics.asterix.transaction.management.service.logging.LogManager;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogManagerProperties;
import edu.uci.ics.asterix.transaction.management.service.logging.LogUtil;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.logging.PhysicalLogLocator;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
public class LogRecordReader {
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/TransactionRecoverySimulator.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/TransactionRecoverySimulator.java
index 2bd277c..ccd83eb 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/TransactionRecoverySimulator.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/TransactionRecoverySimulator.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.transaction.management.test;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
public class TransactionRecoverySimulator {
diff --git a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/TransactionSimulator.java b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/TransactionSimulator.java
index 092f2ed..66e9bdf 100644
--- a/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/TransactionSimulator.java
+++ b/asterix-transactions/src/test/java/edu/uci/ics/asterix/transaction/management/test/TransactionSimulator.java
@@ -17,23 +17,22 @@
import java.io.IOException;
import java.util.Random;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.common.exceptions.ACIDException;
+import edu.uci.ics.asterix.common.transactions.DatasetId;
+import edu.uci.ics.asterix.common.transactions.ILockManager;
+import edu.uci.ics.asterix.common.transactions.ILogManager;
+import edu.uci.ics.asterix.common.transactions.ILogger;
+import edu.uci.ics.asterix.common.transactions.IRecoveryManager;
+import edu.uci.ics.asterix.common.transactions.IResourceManager;
+import edu.uci.ics.asterix.common.transactions.IResourceManager.ResourceType;
+import edu.uci.ics.asterix.common.transactions.ITransactionContext;
+import edu.uci.ics.asterix.common.transactions.ITransactionManager;
+import edu.uci.ics.asterix.common.transactions.JobId;
+import edu.uci.ics.asterix.common.transactions.LogicalLogLocator;
import edu.uci.ics.asterix.transaction.management.logging.IResource;
-import edu.uci.ics.asterix.transaction.management.service.locking.ILockManager;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogManager;
-import edu.uci.ics.asterix.transaction.management.service.logging.ILogger;
import edu.uci.ics.asterix.transaction.management.service.logging.LogType;
import edu.uci.ics.asterix.transaction.management.service.logging.LogUtil;
-import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IRecoveryManager;
-import edu.uci.ics.asterix.transaction.management.service.recovery.IRecoveryManager.SystemState;
-import edu.uci.ics.asterix.transaction.management.service.transaction.DatasetId;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.IResourceManager.ResourceType;
-import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionManager;
-import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
import edu.uci.ics.asterix.transaction.management.service.transaction.JobIdFactory;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
public class TransactionSimulator {
@@ -63,12 +62,12 @@
memLSN = LogUtil.getDummyLogicalLogLocator(transactionProvider.getLogManager());
}
- public TransactionContext beginTransaction() throws ACIDException {
+ public ITransactionContext beginTransaction() throws ACIDException {
JobId jobId = JobIdFactory.generateJobId();
return transactionManager.beginTransaction(jobId);
}
- public void executeTransactionOperation(TransactionContext txnContext, FileResource.CounterOperation operation)
+ public void executeTransactionOperation(ITransactionContext txnContext, FileResource.CounterOperation operation)
throws ACIDException {
// lockManager.lock(txnContext, resourceId, 0);
ILogManager logManager = transactionProvider.getLogManager();
@@ -91,7 +90,7 @@
}
- public void commitTransaction(TransactionContext context) throws ACIDException {
+ public void commitTransaction(ITransactionContext context) throws ACIDException {
transactionManager.commitTransaction(context, new DatasetId(-1), -1);
}
@@ -116,7 +115,7 @@
Schedule schedule = new Schedule(numTransactions);
for (int i = 0; i < numTransactions; i++) {
- TransactionContext context = txnSimulator.beginTransaction();
+ ITransactionContext context = txnSimulator.beginTransaction();
txnSimulator.executeTransactionOperation(context, schedule.getOperations()[i]);
if (schedule.getWillCommit()[i]) {
txnSimulator.commitTransaction(context);
diff --git a/pom.xml b/pom.xml
index f4c46c6..aa0bc82 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,14 +135,6 @@
<url>http://obelix.ics.uci.edu/nexus/content/repositories/algebricks-snapshots/</url>
</repository>
</repositories>
- <dependencies>
- <dependency>
- <groupId>net.sourceforge.cobertura</groupId>
- <artifactId>cobertura</artifactId>
- <version>1.9.4</version>
- <optional>true</optional>
- </dependency>
- </dependencies>
<dependencyManagement>
<dependencies>
<dependency>
@@ -232,6 +224,18 @@
<artifactId>hyracks-storage-am-lsm-invertedindex</artifactId>
<version>${hyracks.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20090211</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <type>jar</type>
+ </dependency>
</dependencies>
</dependencyManagement>
</project>