merged asterix_stabilization r348:407
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_temporal_fixes@408 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/jobgen/AqlLogicalExpressionJobGen.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/jobgen/AqlLogicalExpressionJobGen.java
index c21043b..9717d6a 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/jobgen/AqlLogicalExpressionJobGen.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/jobgen/AqlLogicalExpressionJobGen.java
@@ -34,11 +34,11 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IRunningAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
import edu.uci.ics.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
public class AqlLogicalExpressionJobGen implements ILogicalExpressionJobGen {
@@ -49,10 +49,10 @@
}
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(AggregateFunctionCallExpression expr,
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(AggregateFunctionCallExpression expr,
IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
throws AlgebricksException {
- IEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+ ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
IFunctionDescriptor fd;
AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
AqlCompiledMetadataDeclarations compiledDecls = mp.getMetadataDeclarations();
@@ -92,10 +92,10 @@
}
@Override
- public IRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(StatefulFunctionCallExpression expr,
+ public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(StatefulFunctionCallExpression expr,
IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
throws AlgebricksException {
- IEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+ ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
IFunctionDescriptor fd;
AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
AqlCompiledMetadataDeclarations compiledDecls = mp.getMetadataDeclarations();
@@ -129,10 +129,10 @@
}
@Override
- public IUnnestingFunctionFactory createUnnestingFunctionFactory(UnnestingFunctionCallExpression expr,
+ public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(UnnestingFunctionCallExpression expr,
IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
throws AlgebricksException {
- IEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+ ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
IFunctionDescriptor fd;
AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
AqlCompiledMetadataDeclarations compiledDecls = mp.getMetadataDeclarations();
@@ -154,7 +154,7 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(ILogicalExpression expr, IVariableTypeEnvironment env,
+ public ICopyEvaluatorFactory createEvaluatorFactory(ILogicalExpression expr, IVariableTypeEnvironment env,
IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
switch (expr.getExpressionTag()) {
case VARIABLE: {
@@ -181,7 +181,7 @@
}
}
- private IEvaluatorFactory createVariableEvaluatorFactory(VariableReferenceExpression expr,
+ private ICopyEvaluatorFactory createVariableEvaluatorFactory(VariableReferenceExpression expr,
IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
LogicalVariable variable = expr.getVariableReference();
for (IOperatorSchema scm : inputSchemas) {
@@ -193,10 +193,10 @@
throw new AlgebricksException("Variable " + variable + " could not be found in any input schema.");
}
- private IEvaluatorFactory createScalarFunctionEvaluatorFactory(AbstractFunctionCallExpression expr,
+ private ICopyEvaluatorFactory createScalarFunctionEvaluatorFactory(AbstractFunctionCallExpression expr,
IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
throws AlgebricksException {
- IEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+ ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
FunctionIdentifier fi = expr.getFunctionIdentifier();
ComparisonKind ck = AlgebricksBuiltinFunctions.getComparisonType(fi);
if (ck != null) {
@@ -226,18 +226,18 @@
}
- private IEvaluatorFactory createConstantEvaluatorFactory(ConstantExpression expr, IOperatorSchema[] inputSchemas,
+ private ICopyEvaluatorFactory createConstantEvaluatorFactory(ConstantExpression expr, IOperatorSchema[] inputSchemas,
JobGenContext context) throws AlgebricksException {
AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
IDataFormat format = mp == null ? FormatUtils.getDefaultFormat() : mp.getMetadataDeclarations().getFormat();
return format.getConstantEvalFactory(expr.getValue());
}
- private IEvaluatorFactory[] codegenArguments(AbstractFunctionCallExpression expr, IVariableTypeEnvironment env,
+ private ICopyEvaluatorFactory[] codegenArguments(AbstractFunctionCallExpression expr, IVariableTypeEnvironment env,
IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
List<Mutable<ILogicalExpression>> arguments = expr.getArguments();
int n = arguments.size();
- IEvaluatorFactory[] args = new IEvaluatorFactory[n];
+ ICopyEvaluatorFactory[] args = new ICopyEvaluatorFactory[n];
int i = 0;
for (Mutable<ILogicalExpression> a : arguments) {
args[i++] = createEvaluatorFactory(a.getValue(), env, inputSchemas, context);
@@ -246,10 +246,10 @@
}
@Override
- public ISerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
+ public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
AggregateFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas,
JobGenContext context) throws AlgebricksException {
- IEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+ ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
IFunctionDescriptor fd;
AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
AqlCompiledMetadataDeclarations compiledDecls = mp.getMetadataDeclarations();
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/ConstantFoldingRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/ConstantFoldingRule.java
index a8e6961..2310ba5 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/ConstantFoldingRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/ConstantFoldingRule.java
@@ -50,6 +50,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.StatefulFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.UnnestingFunctionCallExpression;
@@ -59,12 +60,13 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionVisitor;
import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.primitive.VoidPointable;
import edu.uci.ics.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
public class ConstantFoldingRule implements IAlgebraicRewriteRule {
@@ -104,8 +106,9 @@
AqlBinaryComparatorFactoryProvider.INSTANCE, AqlTypeTraitProvider.INSTANCE,
AqlBinaryBooleanInspectorImpl.INSTANCE, AqlBinaryIntegerInspector.INSTANCE,
AqlPrinterFactoryProvider.INSTANCE, AqlNullWriterFactory.INSTANCE, null,
- AqlLogicalExpressionJobGen.INSTANCE, AqlExpressionTypeComputer.INSTANCE, AqlNullableTypeComputer.INSTANCE,
- null, null, null, GlobalConfig.DEFAULT_FRAME_SIZE, null);
+ new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter(AqlLogicalExpressionJobGen.INSTANCE),
+ AqlExpressionTypeComputer.INSTANCE, AqlNullableTypeComputer.INSTANCE, null, null, null,
+ GlobalConfig.DEFAULT_FRAME_SIZE, null);
private static final IOperatorSchema[] _emptySchemas = new IOperatorSchema[] {};
@@ -127,7 +130,7 @@
private class ConstantFoldingVisitor implements ILogicalExpressionVisitor<Pair<Boolean, ILogicalExpression>, Void>,
ILogicalExpressionReferenceTransform {
- private ArrayBackedValueStorage resStore = new ArrayBackedValueStorage();
+ private IPointable p = VoidPointable.FACTORY.createPointable();
private ByteBufferInputStream bbis = new ByteBufferInputStream();
private DataInputStream dis = new DataInputStream(bbis);
@@ -175,16 +178,15 @@
return new Pair<Boolean, ILogicalExpression>(changed, expr);
}
}
- IEvaluatorFactory fact = _jobGenCtx.getExpressionJobGen().createEvaluatorFactory(expr, _emptyTypeEnv,
- _emptySchemas, _jobGenCtx);
- IEvaluator eval = fact.createEvaluator(resStore);
- resStore.reset();
- eval.evaluate(null);
+ IScalarEvaluatorFactory fact = _jobGenCtx.getExpressionRuntimeProvider().createEvaluatorFactory(expr,
+ _emptyTypeEnv, _emptySchemas, _jobGenCtx);
+ IScalarEvaluator eval = fact.createScalarEvaluator();
+ eval.evaluate(null, p);
Object t = _emptyTypeEnv.getType(expr);
-
+
@SuppressWarnings("rawtypes")
ISerializerDeserializer serde = _jobGenCtx.getSerializerDeserializerProvider().getSerializerDeserializer(t);
- bbis.setByteBuffer(ByteBuffer.wrap(resStore.getBytes(), resStore.getStartIndex(), resStore.getLength()), 0);
+ bbis.setByteBuffer(ByteBuffer.wrap(p.getByteArray(), p.getStartOffset(), p.getLength()), 0);
IAObject o;
try {
o = (IAObject) serde.deserialize(dis);
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceBTreeIndexSearchRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceBTreeIndexSearchRule.java
index abaf0e2..9e67b2d 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceBTreeIndexSearchRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceBTreeIndexSearchRule.java
@@ -52,7 +52,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.SelectOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.UnnestMapOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class IntroduceBTreeIndexSearchRule extends IntroduceTreeIndexSearchRule {
@@ -624,7 +624,7 @@
Pair<IAType, Boolean> keyPair = AqlCompiledIndexDecl.getNonNullableKeyFieldType(sk, itemType);
types.add(keyPair.first);
}
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> t : DatasetUtils
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> t : DatasetUtils
.getPartitioningFunctions(ddecl)) {
types.add(t.third);
}
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 35a5966..c41d908 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
@@ -43,6 +43,31 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities;
import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
+/**
+ * Dynamically cast a variable from its type to a specified required type, in a
+ * recursive way. It enables: 1. bag-based fields in a record, 2. bidirectional
+ * cast of a open field and a matched closed field, and 3. put in null fields
+ * when necessary.
+ *
+ * Here is an example: A record { "hobby": {{"music", "coding"}}, "id": "001",
+ * "name": "Person Three"} which confirms to closed type ( id: string, name:
+ * string, hobby: {{string}}? ) can be cast to an open type (id: string ), or
+ * vice versa.
+ *
+ * However, if the input record is a variable, then we don't know its exact
+ * field layout at compile time. For example, records conforming to the same
+ * type can have different field orderings and different open parts. That's why
+ * we need dynamic type casting.
+ *
+ * Note that as we can see in the example, the ordering of fields of a record is
+ * not required. Since the open/closed part of a record has completely different
+ * underlying memory/storage layout, a cast-record function will change the
+ * layout as specified at runtime.
+ *
+ * Implementation wise, this rule checks the target dataset type and the input
+ * record type, and if the types are different, then it plugs in an assign with
+ * a cast-record function, and projects away the original (uncast) field.
+ */
public class IntroduceDynamicTypeCastRule implements IAlgebraicRewriteRule {
@Override
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceRTreeIndexSearchRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceRTreeIndexSearchRule.java
index 3a7dec0..de482dd 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceRTreeIndexSearchRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceRTreeIndexSearchRule.java
@@ -52,7 +52,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.SelectOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.UnnestMapOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class IntroduceRTreeIndexSearchRule extends IntroduceTreeIndexSearchRule {
@@ -386,7 +386,7 @@
for (int i = 0; i < numKeys; i++) {
types.add(nestedKeyType);
}
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> t : DatasetUtils
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> t : DatasetUtils
.getPartitioningFunctions(ddecl)) {
types.add(t.third);
}
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceStaticTypeCastRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceStaticTypeCastRule.java
index fc0a2e8..7dc35fe 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceStaticTypeCastRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceStaticTypeCastRule.java
@@ -1,6 +1,22 @@
+/*
+ * 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.optimizer.rules;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.mutable.Mutable;
@@ -10,13 +26,16 @@
import edu.uci.ics.asterix.om.base.ANull;
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.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.AbstractCollectionType;
import edu.uci.ics.asterix.om.types.BuiltinType;
import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.asterix.runtime.pointables.base.DefaultOpenFieldType;
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;
@@ -34,6 +53,32 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities;
import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
+/**
+ * Statically cast a constant from its type to a specified required type, in a
+ * recursive way. It enables: 1. bag-based fields in a record, 2. bidirectional
+ * cast of a open field and a matched closed field, and 3. put in null fields
+ * when necessary. It should be fired before the constant folding rule.
+ *
+ * This rule is not responsible for type casting between primitive types.
+ *
+ * Here is an example: A record { "hobby": {{"music", "coding"}}, "id": "001",
+ * "name": "Person Three"} which confirms to closed type ( id: string, name:
+ * string, hobby: {{string}}? ) can be cast to an open type (id: string ), or
+ * vice versa.
+ *
+ * Implementation wise: first, we match the record's type and its target dataset
+ * type to see if it is "cast-able"; second, if the types are cast-able, we
+ * embed the required type into the original producer expression. If the types
+ * are not cast-able, we throw a compile time exception.
+ *
+ * Then, at runtime (not in this rule), the corresponding record/list
+ * constructors know what to do by checking the required output type.
+ *
+ * TODO: right now record/list constructor of the cast result is not done in the
+ * ConstantFoldingRule and has to go to the runtime, because the
+ * ConstantFoldingRule uses ARecordSerializerDeserializer which seems to have
+ * some problem.
+ */
public class IntroduceStaticTypeCastRule implements IAlgebraicRewriteRule {
@Override
@@ -65,7 +110,7 @@
* get required record type
*/
InsertDeleteOperator insertDeleteOperator = (InsertDeleteOperator) op2;
- AssignOperator oldAssignOperator = (AssignOperator) op3;
+ AssignOperator topAssignOperator = (AssignOperator) op3;
AqlDataSource dataSource = (AqlDataSource) insertDeleteOperator.getDataSource();
IAType[] schemaTypes = (IAType[]) dataSource.getSchemaTypes();
ARecordType requiredRecordType = (ARecordType) schemaTypes[schemaTypes.length - 1];
@@ -74,23 +119,27 @@
* get input record type to the insert operator
*/
List<LogicalVariable> usedVariables = new ArrayList<LogicalVariable>();
- VariableUtilities.getUsedVariables(oldAssignOperator, usedVariables);
+ VariableUtilities.getUsedVariables(topAssignOperator, usedVariables);
+
+ // the used variable should contain the record that will be inserted
+ // but it will not fail in many cases even if the used variable set is
+ // empty
if (usedVariables.size() == 0)
return false;
LogicalVariable oldRecordVariable = usedVariables.get(0);
LogicalVariable inputRecordVar = usedVariables.get(0);
- IVariableTypeEnvironment env = oldAssignOperator.computeOutputTypeEnvironment(context);
+ IVariableTypeEnvironment env = topAssignOperator.computeOutputTypeEnvironment(context);
ARecordType inputRecordType = (ARecordType) env.getVarType(inputRecordVar);
- AbstractLogicalOperator currentOperator = oldAssignOperator;
+ AbstractLogicalOperator currentOperator = topAssignOperator;
List<LogicalVariable> producedVariables = new ArrayList<LogicalVariable>();
- boolean changed = false;
/**
* find the assign operator for the "input record" to the insert_delete
* operator
*/
do {
+ context.addToDontApplySet(this, currentOperator);
if (currentOperator.getOperatorTag() == LogicalOperatorTag.ASSIGN) {
producedVariables.clear();
VariableUtilities.getProducedVariables(currentOperator, producedVariables);
@@ -101,25 +150,16 @@
*/
if (position >= 0) {
AssignOperator originalAssign = (AssignOperator) currentOperator;
- List<Mutable<ILogicalExpression>> expressionPointers = originalAssign.getExpressions();
- ILogicalExpression expr = expressionPointers.get(position).getValue();
+ List<Mutable<ILogicalExpression>> expressionRefs = originalAssign.getExpressions();
+ ILogicalExpression expr = expressionRefs.get(position).getValue();
if (expr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
ScalarFunctionCallExpression funcExpr = (ScalarFunctionCallExpression) expr;
- changed = TypeComputerUtilities.setRequiredAndInputTypes(funcExpr, requiredRecordType,
- inputRecordType);
- changed &= !requiredRecordType.equals(inputRecordType);
- if (changed) {
- staticTypeCast(funcExpr, requiredRecordType, inputRecordType);
- List<Mutable<ILogicalExpression>> args = funcExpr.getArguments();
- int openPartStart = requiredRecordType.getFieldTypes().length * 2;
- for (int j = openPartStart; j < args.size(); j++) {
- ILogicalExpression arg = args.get(j).getValue();
- if (arg.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
- AbstractFunctionCallExpression argFunc = (AbstractFunctionCallExpression) arg;
- TypeComputerUtilities.setOpenType(argFunc, true);
- }
- }
- }
+ // that expression has been rewritten, and it will not
+ // fail but just return false
+ if (TypeComputerUtilities.getRequiredType(funcExpr) != null)
+ return false;
+ IVariableTypeEnvironment assignEnv = topAssignOperator.computeOutputTypeEnvironment(context);
+ rewriteFuncExpr(funcExpr, requiredRecordType, inputRecordType, assignEnv);
}
context.computeAndSetTypeEnvironmentForOperator(originalAssign);
}
@@ -129,10 +169,82 @@
else
break;
} while (currentOperator != null);
- return changed;
+ return true;
}
- private void staticTypeCast(ScalarFunctionCallExpression func, ARecordType reqType, ARecordType inputType) {
+ private void rewriteFuncExpr(ScalarFunctionCallExpression funcExpr, IAType reqType, IAType inputType,
+ IVariableTypeEnvironment env) throws AlgebricksException {
+ if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.UNORDERED_LIST_CONSTRUCTOR) {
+ rewriteListFuncExpr(funcExpr, (AbstractCollectionType) reqType, (AbstractCollectionType) inputType, env);
+ } else if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.ORDERED_LIST_CONSTRUCTOR) {
+ rewriteListFuncExpr(funcExpr, (AbstractCollectionType) reqType, (AbstractCollectionType) inputType, env);
+ } else if (reqType.getTypeTag().equals(ATypeTag.RECORD)) {
+ rewriteRecordFuncExpr(funcExpr, (ARecordType) reqType, (ARecordType) inputType, env);
+ }
+ }
+
+ /**
+ * only called when funcExpr is record constructor
+ *
+ * @param funcExpr
+ * record constructor function expression
+ * @param requiredListType
+ * required record type
+ * @param inputRecordType
+ * @param env
+ * type environment
+ * @throws AlgebricksException
+ */
+ private void rewriteRecordFuncExpr(ScalarFunctionCallExpression funcExpr, ARecordType requiredRecordType,
+ ARecordType inputRecordType, IVariableTypeEnvironment env) throws AlgebricksException {
+ // if already rewritten, the required type is not null
+ if (TypeComputerUtilities.getRequiredType(funcExpr) != null)
+ return;
+ TypeComputerUtilities.setRequiredAndInputTypes(funcExpr, requiredRecordType, inputRecordType);
+ staticRecordTypeCast(funcExpr, requiredRecordType, inputRecordType, env);
+ }
+
+ /**
+ * only called when funcExpr is list constructor
+ *
+ * @param funcExpr
+ * list constructor function expression
+ * @param requiredListType
+ * required list type
+ * @param inputListType
+ * @param env
+ * type environment
+ * @throws AlgebricksException
+ */
+ private void rewriteListFuncExpr(ScalarFunctionCallExpression funcExpr, AbstractCollectionType requiredListType,
+ AbstractCollectionType inputListType, IVariableTypeEnvironment env) throws AlgebricksException {
+ if (TypeComputerUtilities.getRequiredType(funcExpr) != null)
+ return;
+
+ TypeComputerUtilities.setRequiredAndInputTypes(funcExpr, requiredListType, inputListType);
+ List<Mutable<ILogicalExpression>> args = funcExpr.getArguments();
+
+ IAType itemType = requiredListType.getItemType();
+ if (itemType == null || itemType.getTypeTag().equals(ATypeTag.ANY))
+ return;
+ IAType inputItemType = inputListType.getItemType();
+ for (int j = 0; j < args.size(); j++) {
+ ILogicalExpression arg = args.get(j).getValue();
+ if (arg.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
+ ScalarFunctionCallExpression argFunc = (ScalarFunctionCallExpression) arg;
+ IAType currentItemType = (IAType) env.getType(argFunc);
+ if (inputItemType == null || inputItemType == BuiltinType.ANY) {
+ currentItemType = (IAType) env.getType(argFunc);
+ rewriteFuncExpr(argFunc, itemType, currentItemType, env);
+ } else {
+ rewriteFuncExpr(argFunc, itemType, inputItemType, env);
+ }
+ }
+ }
+ }
+
+ private void staticRecordTypeCast(ScalarFunctionCallExpression func, ARecordType reqType, ARecordType inputType,
+ IVariableTypeEnvironment env) throws AlgebricksException {
IAType[] reqFieldTypes = reqType.getFieldTypes();
String[] reqFieldNames = reqType.getFieldNames();
IAType[] inputFieldTypes = inputType.getFieldTypes();
@@ -142,18 +254,21 @@
boolean[] nullFields = new boolean[reqFieldTypes.length];
boolean[] openFields = new boolean[inputFieldTypes.length];
- for (int i = 0; i < nullFields.length; i++)
- nullFields[i] = false;
- for (int i = 0; i < openFields.length; i++)
- openFields[i] = true;
- for (int i = 0; i < fieldPermutation.length; i++)
- fieldPermutation[i] = -1;
+ Arrays.fill(nullFields, false);
+ Arrays.fill(openFields, true);
+ Arrays.fill(fieldPermutation, -1);
// forward match: match from actual to required
boolean matched = false;
for (int i = 0; i < inputFieldNames.length; i++) {
String fieldName = inputFieldNames[i];
IAType fieldType = inputFieldTypes[i];
+
+ if (2 * i + 1 > func.getArguments().size())
+ throw new AlgebricksException("expression index out of bound");
+
+ // 2*i+1 is the index of field value expression
+ ILogicalExpression arg = func.getArguments().get(2 * i + 1).getValue();
matched = false;
for (int j = 0; j < reqFieldNames.length; j++) {
String reqFieldName = reqFieldNames[j];
@@ -163,6 +278,11 @@
fieldPermutation[j] = i;
openFields[i] = false;
matched = true;
+
+ if (arg.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
+ ScalarFunctionCallExpression scalarFunc = (ScalarFunctionCallExpression) arg;
+ rewriteFuncExpr(scalarFunc, reqFieldType, fieldType, env);
+ }
break;
}
@@ -171,20 +291,35 @@
&& NonTaggedFormatUtil.isOptionalField((AUnionType) reqFieldType)) {
IAType itemType = ((AUnionType) reqFieldType).getUnionList().get(
NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ reqFieldType = itemType;
if (fieldType.equals(BuiltinType.ANULL) || fieldType.equals(itemType)) {
fieldPermutation[j] = i;
openFields[i] = false;
matched = true;
+
+ // rewrite record expr
+ if (arg.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
+ ScalarFunctionCallExpression scalarFunc = (ScalarFunctionCallExpression) arg;
+ rewriteFuncExpr(scalarFunc, reqFieldType, fieldType, env);
+ }
break;
}
}
+
+ // match the record field: need cast
+ if (arg.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
+ ScalarFunctionCallExpression scalarFunc = (ScalarFunctionCallExpression) arg;
+ rewriteFuncExpr(scalarFunc, reqFieldType, fieldType, env);
+ fieldPermutation[j] = i;
+ openFields[i] = false;
+ matched = true;
+ break;
+ }
}
}
- if (matched)
- continue;
// the input has extra fields
- if (!reqType.isOpen())
- throw new IllegalStateException("static type mismatch: including extra closed fields");
+ if (!matched && !reqType.isOpen())
+ throw new AlgebricksException("static type mismatch: including an extra closed field " + fieldName);
}
// backward match: match from required to actual
@@ -195,47 +330,52 @@
for (int j = 0; j < inputFieldNames.length; j++) {
String fieldName = inputFieldNames[j];
IAType fieldType = inputFieldTypes[j];
- if (fieldName.equals(reqFieldName)) {
- if (fieldType.equals(reqFieldType)) {
+ if (!fieldName.equals(reqFieldName))
+ continue;
+ // should check open field here
+ // because number of entries in fieldPermuations is the
+ // number of required schema fields
+ // here we want to check if an input field is matched
+ // the entry index of fieldPermuatons is req field index
+ if (!openFields[j]) {
+ matched = true;
+ break;
+ }
+
+ // match the optional field
+ if (reqFieldType.getTypeTag() == ATypeTag.UNION
+ && NonTaggedFormatUtil.isOptionalField((AUnionType) reqFieldType)) {
+ IAType itemType = ((AUnionType) reqFieldType).getUnionList().get(
+ NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ if (fieldType.equals(BuiltinType.ANULL) || fieldType.equals(itemType)) {
matched = true;
break;
}
-
- // match the optional field
- if (reqFieldType.getTypeTag() == ATypeTag.UNION
- && NonTaggedFormatUtil.isOptionalField((AUnionType) reqFieldType)) {
- IAType itemType = ((AUnionType) reqFieldType).getUnionList().get(
- NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
- if (fieldType.equals(BuiltinType.ANULL) || fieldType.equals(itemType)) {
- matched = true;
- break;
- }
- }
}
}
if (matched)
continue;
- IAType t = reqFieldTypes[i];
- if (t.getTypeTag() == ATypeTag.UNION && NonTaggedFormatUtil.isOptionalField((AUnionType) t)) {
+ if (reqFieldType.getTypeTag() == ATypeTag.UNION
+ && NonTaggedFormatUtil.isOptionalField((AUnionType) reqFieldType)) {
// add a null field
nullFields[i] = true;
} else {
// no matched field in the input for a required closed field
- throw new IllegalStateException("static type mismatch: miss a required closed field");
+ throw new AlgebricksException("static type mismatch: miss a required closed field " + reqFieldName);
}
}
List<Mutable<ILogicalExpression>> arguments = func.getArguments();
- List<Mutable<ILogicalExpression>> argumentsClone = new ArrayList<Mutable<ILogicalExpression>>();
- argumentsClone.addAll(arguments);
+ List<Mutable<ILogicalExpression>> originalArguments = new ArrayList<Mutable<ILogicalExpression>>();
+ originalArguments.addAll(arguments);
arguments.clear();
// re-order the closed part and fill in null fields
for (int i = 0; i < fieldPermutation.length; i++) {
int pos = fieldPermutation[i];
if (pos >= 0) {
- arguments.add(argumentsClone.get(2 * pos));
- arguments.add(argumentsClone.get(2 * pos + 1));
+ arguments.add(originalArguments.get(2 * pos));
+ arguments.add(originalArguments.get(2 * pos + 1));
}
if (nullFields[i]) {
// add a null field
@@ -249,8 +389,31 @@
// add the open part
for (int i = 0; i < openFields.length; i++) {
if (openFields[i]) {
- arguments.add(argumentsClone.get(2 * i));
- arguments.add(argumentsClone.get(2 * i + 1));
+ arguments.add(originalArguments.get(2 * i));
+ Mutable<ILogicalExpression> fExprRef = originalArguments.get(2 * i + 1);
+ ILogicalExpression argExpr = fExprRef.getValue();
+
+ // we need to handle open fields recursively by their default
+ // types
+ // for list, their item type is any
+ // for record, their
+ if (argExpr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
+ IAType reqFieldType = inputFieldTypes[i];
+ if (inputFieldTypes[i].getTypeTag() == ATypeTag.RECORD) {
+ reqFieldType = DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE;
+ }
+ if (inputFieldTypes[i].getTypeTag() == ATypeTag.ORDEREDLIST) {
+ reqFieldType = DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE;
+ }
+ if (inputFieldTypes[i].getTypeTag() == ATypeTag.UNORDEREDLIST) {
+ reqFieldType = DefaultOpenFieldType.NESTED_OPEN_AUNORDERED_LIST_TYPE;
+ }
+ if (TypeComputerUtilities.getRequiredType((AbstractFunctionCallExpression) argExpr) == null) {
+ ScalarFunctionCallExpression argFunc = (ScalarFunctionCallExpression) argExpr;
+ rewriteFuncExpr(argFunc, reqFieldType, inputFieldTypes[i], env);
+ }
+ }
+ arguments.add(fExprRef);
}
}
}
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceTreeIndexSearchRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceTreeIndexSearchRule.java
index 0153519..be00f6d 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceTreeIndexSearchRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceTreeIndexSearchRule.java
@@ -21,7 +21,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public abstract class IntroduceTreeIndexSearchRule implements IAlgebraicRewriteRule {
@@ -96,9 +96,9 @@
protected static List<Object> primaryIndexTypes(AqlCompiledMetadataDeclarations metadata,
AqlCompiledDatasetDecl ddecl, IAType itemType) {
List<Object> types = new ArrayList<Object>();
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
.getPartitioningFunctions(ddecl);
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> t : partitioningFunctions) {
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> t : partitioningFunctions) {
types.add(t.third);
}
types.add(itemType);
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 2e45da4..e6aaaad 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
@@ -141,7 +141,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.WriteOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.plan.ALogicalPlanImpl;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
/**
*
@@ -265,7 +265,7 @@
ArrayList<LogicalVariable> vars = new ArrayList<LogicalVariable>();
ArrayList<Mutable<ILogicalExpression>> exprs = new ArrayList<Mutable<ILogicalExpression>>();
List<Mutable<ILogicalExpression>> varRefsForLoading = new ArrayList<Mutable<ILogicalExpression>>();
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioner : DatasetUtils
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioner : DatasetUtils
.getPartitioningFunctions(adecl)) {
AbstractFunctionCallExpression f = partitioner.second.cloneExpression();
f.substituteVar(METADATA_DUMMY_VAR, resVar);
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 7f6769e..25aea8f 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
@@ -59,6 +59,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter;
import edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.LogicalOperatorPrettyPrintVisitor;
import edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.PlanPrettyPrinter;
import edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController;
@@ -512,7 +513,8 @@
builder.setBinaryIntegerInspector(format.getBinaryIntegerInspector());
builder.setClusterLocations(clusterLocs);
builder.setComparatorFactoryProvider(format.getBinaryComparatorFactoryProvider());
- builder.setExprJobGen(AqlLogicalExpressionJobGen.INSTANCE);
+ builder.setExpressionRuntimeProvider(new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter(
+ AqlLogicalExpressionJobGen.INSTANCE));
builder.setHashFunctionFactoryProvider(format.getBinaryHashFunctionFactoryProvider());
builder.setNullWriterFactory(format.getNullWriterFactory());
builder.setPrinterProvider(format.getPrinterFactoryProvider());
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 7c07ba3..15b959e 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
@@ -119,7 +119,7 @@
response.setContentType("text/html");
final String form = "<form method=\"post\">"
+ "<center><textarea cols=\"80\" rows=\"25\" name=\"query\" ></textarea><br/>"
- + "IP Address: <input type = \"text\" name = \"hyracks-ip\" size=\"15\" maxlength=\"35\" value=\"locahost\" /><br/>"
+ + "IP Address: <input type = \"text\" name = \"hyracks-ip\" size=\"15\" maxlength=\"35\" value=\"localhost\" /><br/>"
+ "Port: <input type = \"text\" name = \"hyracks-port\" size=\"5\" maxlength=\"5\" value=\"1098\" /><br/>"
+ "<input type = \"checkbox\" name = \"print-expr-tree\" value=\"true\" />print parsed expressions<P>"
+ "<input type = \"checkbox\" name = \"print-rewritten-expr-tree\" value=\"true\" />print rewritten expressions<P>"
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 2b341db..5aa0f6e 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
@@ -42,11 +42,13 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.ConnectorPolicyAssignmentPolicy;
import edu.uci.ics.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
import edu.uci.ics.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor;
import edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory;
import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
@@ -139,8 +141,8 @@
}
// TODO: Lots of common code in this file. Refactor everything after merging in asterix-fix-issue-9.
- public static JobSpecification createDatasetJobSpec(String datasetName,
- AqlCompiledMetadataDeclarations metadata) throws AsterixException, AlgebricksException {
+ public static JobSpecification createDatasetJobSpec(String datasetName, AqlCompiledMetadataDeclarations metadata)
+ throws AsterixException, AlgebricksException {
AqlCompiledDatasetDecl compiledDatasetDecl = metadata.findDataset(datasetName);
if (compiledDatasetDecl == null) {
throw new AsterixException("Could not find dataset " + datasetName);
@@ -159,15 +161,15 @@
LOGGER.info("CREATING File Splits: " + sb.toString());
IIndexRegistryProvider<IIndex> indexRegistryProvider = AsterixIndexRegistryProvider.INSTANCE;
IStorageManagerInterface storageManager = AsterixStorageManagerInterface.INSTANCE;
- TreeIndexCreateOperatorDescriptor indexCreateOp = new TreeIndexCreateOperatorDescriptor(spec,
- storageManager, indexRegistryProvider, splitsAndConstraint.first, typeTraits, comparatorFactories,
+ TreeIndexCreateOperatorDescriptor indexCreateOp = new TreeIndexCreateOperatorDescriptor(spec, storageManager,
+ indexRegistryProvider, splitsAndConstraint.first, typeTraits, comparatorFactories,
new BTreeDataflowHelperFactory(), NoOpOperationCallbackProvider.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, indexCreateOp,
splitsAndConstraint.second);
spec.addRoot(indexCreateOp);
return spec;
}
-
+
public static Job createLoadDatasetJobSpec(CompiledLoadFromFileStatement loadStmt,
AqlCompiledMetadataDeclarations metadata) throws AsterixException, AlgebricksException {
String datasetName = loadStmt.getDatasetName();
@@ -208,7 +210,7 @@
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, asterixOp, scannerPc);
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
.getPartitioningFunctions(compiledDatasetDecl);
int numKeys = partitioningFunctions.size();
int[] keys = new int[numKeys];
@@ -269,12 +271,12 @@
}
private static AssignRuntimeFactory makeAssignRuntimeFactory(AqlCompiledDatasetDecl compiledDatasetDecl) {
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
.getPartitioningFunctions(compiledDatasetDecl);
int numKeys = partitioningFunctions.size();
- IEvaluatorFactory[] evalFactories = new IEvaluatorFactory[numKeys];
+ ICopyEvaluatorFactory[] evalFactories = new ICopyEvaluatorFactory[numKeys];
for (int i = 0; i < numKeys; i++) {
- Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
+ Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
.get(i);
evalFactories[i] = evalFactoryAndType.first;
}
@@ -286,18 +288,23 @@
outColumns[i] = i + 1;
projectionList[i + 1] = i + 1;
}
- return new AssignRuntimeFactory(outColumns, evalFactories, projectionList);
+ IScalarEvaluatorFactory[] sefs = new IScalarEvaluatorFactory[evalFactories.length];
+ for (int i = 0; i < evalFactories.length; ++i) {
+ sefs[i] = new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.ScalarEvaluatorFactoryAdapter(
+ evalFactories[i]);
+ }
+ return new AssignRuntimeFactory(outColumns, sefs, projectionList);
}
private static RecordDescriptor computePayloadKeyRecordDescriptor(AqlCompiledDatasetDecl compiledDatasetDecl,
ISerializerDeserializer payloadSerde, IDataFormat dataFormat) throws AlgebricksException {
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
.getPartitioningFunctions(compiledDatasetDecl);
int numKeys = partitioningFunctions.size();
ISerializerDeserializer[] recordFields = new ISerializerDeserializer[1 + numKeys];
recordFields[0] = payloadSerde;
for (int i = 0; i < numKeys; i++) {
- Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
+ Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
.get(i);
IAType keyType = evalFactoryAndType.third;
ISerializerDeserializer keySerde = dataFormat.getSerdeProvider().getSerializerDeserializer(keyType);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/FeedOperations.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/FeedOperations.java
index 896dcd7..4d7cbe2 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/FeedOperations.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/FeedOperations.java
@@ -37,8 +37,10 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
import edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory;
import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -126,13 +128,13 @@
}
private static AssignRuntimeFactory makeAssignRuntimeFactory(AqlCompiledDatasetDecl compiledDatasetDecl) {
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
.getPartitioningFunctions(compiledDatasetDecl);
int numKeys = partitioningFunctions.size();
- IEvaluatorFactory[] evalFactories = new IEvaluatorFactory[numKeys];
+ ICopyEvaluatorFactory[] evalFactories = new ICopyEvaluatorFactory[numKeys];
int index = 0;
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : partitioningFunctions) {
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : partitioningFunctions) {
evalFactories[index++] = evalFactoryAndType.first;
}
@@ -144,20 +146,25 @@
outColumns[i] = i + 1;
projectionList[i + 1] = i + 1;
}
- return new AssignRuntimeFactory(outColumns, evalFactories, projectionList);
+ IScalarEvaluatorFactory[] sefs = new IScalarEvaluatorFactory[evalFactories.length];
+ for (int i = 0; i < evalFactories.length; ++i) {
+ sefs[i] = new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.ScalarEvaluatorFactoryAdapter(
+ evalFactories[i]);
+ }
+ return new AssignRuntimeFactory(outColumns, sefs, projectionList);
}
@SuppressWarnings("unchecked")
private static RecordDescriptor computePayloadKeyRecordDescriptor(AqlCompiledDatasetDecl compiledDatasetDecl,
ISerializerDeserializer payloadSerde, IDataFormat dataFormat) throws AlgebricksException {
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
.getPartitioningFunctions(compiledDatasetDecl);
int numKeys = partitioningFunctions.size();
ISerializerDeserializer[] recordFields = new ISerializerDeserializer[1 + numKeys];
recordFields[0] = payloadSerde;
int index = 0;
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : partitioningFunctions) {
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : partitioningFunctions) {
IAType keyType = evalFactoryAndType.third;
ISerializerDeserializer keySerde = dataFormat.getSerdeProvider().getSerializerDeserializer(keyType);
recordFields[index + 1] = keySerde;
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 7da18fb..5a4d6c9 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
@@ -27,11 +27,13 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
import edu.uci.ics.hyracks.algebricks.data.ISerializerDeserializerProvider;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
import edu.uci.ics.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
import edu.uci.ics.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor;
import edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory;
@@ -59,13 +61,13 @@
// not just for creation.
public abstract class SecondaryIndexCreator {
protected final PhysicalOptimizationConfig physOptConf;
-
+
protected int numPrimaryKeys;
protected int numSecondaryKeys;
protected AqlCompiledMetadataDeclarations metadata;
protected String datasetName;
protected AqlCompiledDatasetDecl datasetDecl;
- protected ARecordType itemType;
+ protected ARecordType itemType;
protected ISerializerDeserializer payloadSerde;
protected IFileSplitProvider primaryFileSplitProvider;
protected AlgebricksPartitionConstraint primaryPartitionConstraint;
@@ -78,14 +80,16 @@
protected RecordDescriptor primaryRecDesc;
protected IBinaryComparatorFactory[] secondaryComparatorFactories;
protected RecordDescriptor secondaryRecDesc;
- protected IEvaluatorFactory[] evalFactories;
-
+ protected ICopyEvaluatorFactory[] evalFactories;
+
// Prevent public construction. Should be created via createIndexCreator().
protected SecondaryIndexCreator(PhysicalOptimizationConfig physOptConf) {
this.physOptConf = physOptConf;
}
- public static SecondaryIndexCreator createIndexCreator(CompiledCreateIndexStatement createIndexStmt, AqlCompiledMetadataDeclarations metadata, PhysicalOptimizationConfig physOptConf) throws AsterixException, AlgebricksException {
+ public static SecondaryIndexCreator createIndexCreator(CompiledCreateIndexStatement createIndexStmt,
+ AqlCompiledMetadataDeclarations metadata, PhysicalOptimizationConfig physOptConf) throws AsterixException,
+ AlgebricksException {
SecondaryIndexCreator indexCreator = null;
switch (createIndexStmt.getIndexType()) {
case BTREE: {
@@ -107,12 +111,13 @@
indexCreator.init(createIndexStmt, metadata);
return indexCreator;
}
-
+
public abstract JobSpecification buildCreationJobSpec() throws AsterixException, AlgebricksException;
-
+
public abstract JobSpecification buildLoadingJobSpec() throws AsterixException, AlgebricksException;
-
- protected void init(CompiledCreateIndexStatement createIndexStmt, AqlCompiledMetadataDeclarations metadata) throws AsterixException, AlgebricksException {
+
+ protected void init(CompiledCreateIndexStatement createIndexStmt, AqlCompiledMetadataDeclarations metadata)
+ throws AsterixException, AlgebricksException {
this.metadata = metadata;
datasetName = createIndexStmt.getDatasetName();
secondaryIndexName = createIndexStmt.getIndexName();
@@ -124,8 +129,7 @@
throw new AsterixException("Cannot index an external dataset (" + datasetName + ").");
}
itemType = (ARecordType) metadata.findType(datasetDecl.getItemTypeName());
- payloadSerde = AqlSerializerDeserializerProvider.INSTANCE
- .getSerializerDeserializer(itemType);
+ payloadSerde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(itemType);
numPrimaryKeys = DatasetUtils.getPartitioningFunctions(datasetDecl).size();
numSecondaryKeys = createIndexStmt.getKeyFields().size();
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> primarySplitsAndConstraint = metadata
@@ -140,22 +144,22 @@
setPrimaryRecDescAndComparators();
setSecondaryRecDescAndComparators(createIndexStmt.getKeyFields());
}
-
+
protected void setPrimaryRecDescAndComparators() throws AlgebricksException {
int numPrimaryKeys = DatasetUtils.getPartitioningFunctions(datasetDecl).size();
ISerializerDeserializer[] primaryRecFields = new ISerializerDeserializer[numPrimaryKeys + 1];
ITypeTraits[] primaryTypeTraits = new ITypeTraits[numPrimaryKeys + 1];
primaryComparatorFactories = new IBinaryComparatorFactory[numPrimaryKeys];
ISerializerDeserializerProvider serdeProvider = metadata.getFormat().getSerdeProvider();
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
.getPartitioningFunctions(datasetDecl);
int i = 0;
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : partitioningFunctions) {
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : partitioningFunctions) {
IAType keyType = evalFactoryAndType.third;
ISerializerDeserializer keySerde = serdeProvider.getSerializerDeserializer(keyType);
primaryRecFields[i] = keySerde;
- primaryComparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE
- .getBinaryComparatorFactory(keyType, true);
+ primaryComparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(
+ keyType, true);
primaryTypeTraits[i] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(keyType);
++i;
}
@@ -163,9 +167,10 @@
primaryTypeTraits[numPrimaryKeys] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(itemType);
primaryRecDesc = new RecordDescriptor(primaryRecFields, primaryTypeTraits);
}
-
- protected void setSecondaryRecDescAndComparators(List<String> secondaryKeyFields) throws AlgebricksException, AsterixException {
- evalFactories = new IEvaluatorFactory[numSecondaryKeys];
+
+ protected void setSecondaryRecDescAndComparators(List<String> secondaryKeyFields) throws AlgebricksException,
+ AsterixException {
+ evalFactories = new ICopyEvaluatorFactory[numSecondaryKeys];
secondaryComparatorFactories = new IBinaryComparatorFactory[numSecondaryKeys + numPrimaryKeys];
ISerializerDeserializer[] secondaryRecFields = new ISerializerDeserializer[numPrimaryKeys + numSecondaryKeys];
ITypeTraits[] secondaryTypeTraits = new ITypeTraits[numSecondaryKeys + numPrimaryKeys];
@@ -173,13 +178,14 @@
for (int i = 0; i < numSecondaryKeys; i++) {
evalFactories[i] = metadata.getFormat().getFieldAccessEvaluatorFactory(itemType, secondaryKeyFields.get(i),
numPrimaryKeys);
- Pair<IAType, Boolean> keyTypePair = AqlCompiledIndexDecl.getNonNullableKeyFieldType(secondaryKeyFields.get(i), itemType);
+ Pair<IAType, Boolean> keyTypePair = AqlCompiledIndexDecl.getNonNullableKeyFieldType(
+ secondaryKeyFields.get(i), itemType);
IAType keyType = keyTypePair.first;
anySecondaryKeyIsNullable = anySecondaryKeyIsNullable || keyTypePair.second;
ISerializerDeserializer keySerde = serdeProvider.getSerializerDeserializer(keyType);
secondaryRecFields[i] = keySerde;
- secondaryComparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE
- .getBinaryComparatorFactory(keyType, true);
+ secondaryComparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(
+ keyType, true);
secondaryTypeTraits[i] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(keyType);
}
// Add serializers and comparators for primary index fields.
@@ -190,9 +196,9 @@
}
secondaryRecDesc = new RecordDescriptor(secondaryRecFields, secondaryTypeTraits);
}
-
- protected AbstractOperatorDescriptor createDummyKeyProviderOp(
- JobSpecification spec) throws AsterixException, AlgebricksException {
+
+ protected AbstractOperatorDescriptor createDummyKeyProviderOp(JobSpecification spec) throws AsterixException,
+ AlgebricksException {
// Build dummy tuple containing one field with a dummy value inside.
ArrayTupleBuilder tb = new ArrayTupleBuilder(1);
DataOutput dos = tb.getDataOutput();
@@ -207,14 +213,13 @@
tb.addFieldEndOffset();
ISerializerDeserializer[] keyRecDescSers = { IntegerSerializerDeserializer.INSTANCE };
RecordDescriptor keyRecDesc = new RecordDescriptor(keyRecDescSers);
- ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(
- spec, keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(),
- tb.getSize());
- AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(
- spec, keyProviderOp, primaryPartitionConstraint);
+ ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(spec,
+ keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(), tb.getSize());
+ AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, keyProviderOp,
+ primaryPartitionConstraint);
return keyProviderOp;
}
-
+
protected BTreeSearchOperatorDescriptor createPrimaryIndexScanOp(JobSpecification spec) throws AlgebricksException {
// -Infinity
int[] lowKeyFields = null;
@@ -228,7 +233,7 @@
primaryPartitionConstraint);
return primarySearchOp;
}
-
+
protected AlgebricksMetaOperatorDescriptor createAssignOp(JobSpecification spec,
BTreeSearchOperatorDescriptor primaryScanOp, int numSecondaryKeyFields) throws AlgebricksException {
int[] outColumns = new int[numSecondaryKeyFields];
@@ -243,15 +248,19 @@
for (int i = 0; i < numPrimaryKeys; i++) {
projectionList[projCount++] = i;
}
-
- AssignRuntimeFactory assign = new AssignRuntimeFactory(outColumns, evalFactories, projectionList);
+ IScalarEvaluatorFactory[] sefs = new IScalarEvaluatorFactory[evalFactories.length];
+ for (int i = 0; i < evalFactories.length; ++i) {
+ sefs[i] = new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.ScalarEvaluatorFactoryAdapter(
+ evalFactories[i]);
+ }
+ AssignRuntimeFactory assign = new AssignRuntimeFactory(outColumns, sefs, projectionList);
AlgebricksMetaOperatorDescriptor asterixAssignOp = new AlgebricksMetaOperatorDescriptor(spec, 1, 1,
new IPushRuntimeFactory[] { assign }, new RecordDescriptor[] { secondaryRecDesc });
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, asterixAssignOp,
primaryPartitionConstraint);
return asterixAssignOp;
}
-
+
protected ExternalSortOperatorDescriptor createSortOp(JobSpecification spec,
IBinaryComparatorFactory[] secondaryComparatorFactories, RecordDescriptor secondaryRecDesc) {
int[] sortFields = new int[secondaryComparatorFactories.length];
@@ -260,14 +269,13 @@
}
ExternalSortOperatorDescriptor sortOp = new ExternalSortOperatorDescriptor(spec,
physOptConf.getMaxFramesExternalSort(), sortFields, secondaryComparatorFactories, secondaryRecDesc);
- AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, sortOp,
- primaryPartitionConstraint);
+ AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, sortOp, primaryPartitionConstraint);
return sortOp;
}
-
+
protected TreeIndexBulkLoadOperatorDescriptor createTreeIndexBulkLoadOp(JobSpecification spec,
- int numSecondaryKeyFields, IIndexDataflowHelperFactory dataflowHelperFactory, float fillFactor) throws MetadataException,
- AlgebricksException {
+ int numSecondaryKeyFields, IIndexDataflowHelperFactory dataflowHelperFactory, float fillFactor)
+ throws MetadataException, AlgebricksException {
int[] fieldPermutation = new int[numSecondaryKeyFields + numPrimaryKeys];
for (int i = 0; i < numSecondaryKeyFields + numPrimaryKeys; i++) {
fieldPermutation[i] = i;
@@ -282,19 +290,22 @@
secondarySplitsAndConstraint.second);
return treeIndexBulkLoadOp;
}
-
- public AlgebricksMetaOperatorDescriptor createFilterNullsSelectOp(JobSpecification spec, int numSecondaryKeyFields) throws AlgebricksException {
- IEvaluatorFactory[] andArgsEvalFactories = new IEvaluatorFactory[numSecondaryKeyFields];
+
+ public AlgebricksMetaOperatorDescriptor createFilterNullsSelectOp(JobSpecification spec, int numSecondaryKeyFields)
+ throws AlgebricksException {
+ ICopyEvaluatorFactory[] andArgsEvalFactories = new ICopyEvaluatorFactory[numSecondaryKeyFields];
NotDescriptor notDesc = new NotDescriptor();
IsNullDescriptor isNullDesc = new IsNullDescriptor();
for (int i = 0; i < numSecondaryKeyFields; i++) {
// Access column i, and apply 'is not null'.
ColumnAccessEvalFactory columnAccessEvalFactory = new ColumnAccessEvalFactory(i);
- IEvaluatorFactory isNullEvalFactory = isNullDesc.createEvaluatorFactory(new IEvaluatorFactory[] { columnAccessEvalFactory });
- IEvaluatorFactory notEvalFactory = notDesc.createEvaluatorFactory(new IEvaluatorFactory[] { isNullEvalFactory });
+ ICopyEvaluatorFactory isNullEvalFactory = isNullDesc
+ .createEvaluatorFactory(new ICopyEvaluatorFactory[] { columnAccessEvalFactory });
+ ICopyEvaluatorFactory notEvalFactory = notDesc
+ .createEvaluatorFactory(new ICopyEvaluatorFactory[] { isNullEvalFactory });
andArgsEvalFactories[i] = notEvalFactory;
}
- IEvaluatorFactory selectCond = null;
+ ICopyEvaluatorFactory selectCond = null;
if (numSecondaryKeyFields > 1) {
// Create conjunctive condition where all secondary index keys must satisfy 'is not null'.
AndDescriptor andDesc = new AndDescriptor();
@@ -302,7 +313,9 @@
} else {
selectCond = andArgsEvalFactories[0];
}
- StreamSelectRuntimeFactory select = new StreamSelectRuntimeFactory(selectCond, null, AqlBinaryBooleanInspectorImpl.INSTANCE);
+ StreamSelectRuntimeFactory select = new StreamSelectRuntimeFactory(
+ new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.ScalarEvaluatorFactoryAdapter(selectCond),
+ null, AqlBinaryBooleanInspectorImpl.INSTANCE);
AlgebricksMetaOperatorDescriptor asterixSelectOp = new AlgebricksMetaOperatorDescriptor(spec, 1, 1,
new IPushRuntimeFactory[] { select }, new RecordDescriptor[] { secondaryRecDesc });
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, asterixSelectOp,
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 b2db19a..6980b14 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
@@ -38,7 +38,7 @@
protected IPrimitiveValueProviderFactory[] valueProviderFactories;
protected int numNestedSecondaryKeyFields;
-
+
protected SecondaryRTreeCreator(PhysicalOptimizationConfig physOptConf) {
super(physOptConf);
}
@@ -56,7 +56,7 @@
spec.setConnectorPolicyAssignmentPolicy(new ConnectorPolicyAssignmentPolicy());
return spec;
}
-
+
@Override
protected void setSecondaryRecDescAndComparators(List<String> secondaryKeyFields) throws AlgebricksException,
AsterixException {
@@ -67,7 +67,8 @@
+ numSecondaryKeys
+ " fields as a key for the R-tree index. There can be only one field as a key for the R-tree index.");
}
- Pair<IAType, Boolean> spatialTypePair = AqlCompiledIndexDecl.getNonNullableKeyFieldType(secondaryKeyFields.get(0), itemType);
+ Pair<IAType, Boolean> spatialTypePair = AqlCompiledIndexDecl.getNonNullableKeyFieldType(
+ secondaryKeyFields.get(0), itemType);
IAType spatialType = spatialTypePair.first;
anySecondaryKeyIsNullable = spatialTypePair.second;
if (spatialType == null) {
@@ -87,8 +88,8 @@
ISerializerDeserializer keySerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(nestedKeyType);
secondaryRecFields[i] = keySerde;
- secondaryComparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE
- .getBinaryComparatorFactory(nestedKeyType, true);
+ secondaryComparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(
+ nestedKeyType, true);
secondaryTypeTraits[i] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(nestedKeyType);
valueProviderFactories[i] = AqlPrimitiveValueProviderFactory.INSTANCE;
}
@@ -99,26 +100,27 @@
}
secondaryRecDesc = new RecordDescriptor(secondaryRecFields, secondaryTypeTraits);
}
-
+
@Override
public JobSpecification buildLoadingJobSpec() throws AsterixException, AlgebricksException {
JobSpecification spec = new JobSpecification();
-
+
// Create dummy key provider for feeding the primary index scan.
AbstractOperatorDescriptor keyProviderOp = createDummyKeyProviderOp(spec);
-
+
// Create primary index scan op.
BTreeSearchOperatorDescriptor primaryScanOp = createPrimaryIndexScanOp(spec);
// Assign op.
- AlgebricksMetaOperatorDescriptor asterixAssignOp = createAssignOp(spec, primaryScanOp, numNestedSecondaryKeyFields);
+ AlgebricksMetaOperatorDescriptor asterixAssignOp = createAssignOp(spec, primaryScanOp,
+ numNestedSecondaryKeyFields);
// If any of the secondary fields are nullable, then add a select op that filters nulls.
AlgebricksMetaOperatorDescriptor selectOp = null;
if (anySecondaryKeyIsNullable) {
selectOp = createFilterNullsSelectOp(spec, numNestedSecondaryKeyFields);
}
-
+
// Create secondary RTree bulk load op.
TreeIndexBulkLoadOperatorDescriptor secondaryBulkLoadOp = createTreeIndexBulkLoadOp(spec,
numNestedSecondaryKeyFields, new RTreeDataflowHelperFactory(valueProviderFactories),
diff --git a/asterix-app/src/test/resources/runtimets/ignore.txt b/asterix-app/src/test/resources/runtimets/ignore.txt
index 2b456ca..a850d3c 100644
--- a/asterix-app/src/test/resources/runtimets/ignore.txt
+++ b/asterix-app/src/test/resources/runtimets/ignore.txt
@@ -14,5 +14,17 @@
fuzzyjoin/events-users-aqlplus_1.aql
fuzzyjoin
failure/q1_pricing_summary_report_failure.aql
-open-closed
dml/load-from-hdfs.aql
+open-closed/open-closed-15
+open-closed/open-closed-16
+open-closed/open-closed-17
+open-closed/open-closed-18
+open-closed/open-closed-19
+open-closed/open-closed-20
+open-closed/open-closed-21
+open-closed/open-closed-22
+open-closed/open-closed-28
+open-closed/open-closed-30
+open-closed/heterog-list02
+open-closed/heterog-list03
+open-closed/c2c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/opentype-c2o-recursive.aql b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-c2o-recursive.aql
new file mode 100644
index 0000000..6c8264f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-c2o-recursive.aql
@@ -0,0 +1,62 @@
+/*
+ * Test case Name : opentype-o2c-recursive.aql
+ * Description : verify the static casting of nest record constants
+ * Expected Result : Success
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+
+create type AddressType as open{
+ street: string,
+ city: string
+}
+create type Dept as open{
+ name: string,
+ id: int32
+}
+
+create type testtype as closed {
+ name: string,
+ id: string,
+ address: AddressType?,
+ department: {{Dept}}?
+}
+
+create type testtype2 as open {
+ name: string,
+ id: string
+}
+
+create dataset testds(testtype) partitioned by key id;
+
+create dataset testds2(testtype2) partitioned by key id;
+
+insert into dataset testds (
+{ "id": "001", "name": "Person One", "address": {"street": "3019 DBH", "city": "Irvine", "zip": 92697}, "department": {{ {"name":"CS", "id":299, "review":5}, {"name":"EE", "id":399} }} }
+);
+
+insert into dataset testds (
+{ "id": "002", "name": "Person Two" }
+);
+
+insert into dataset testds (
+{ "id": "003", "name": "Person Three", "address": {"street": "2019 DBH", "city": "Irvine"} }
+);
+
+insert into dataset testds (
+{ "id": "004", "name": "Person Four", "address": {"street": "1019 DBH", "city": "irvine", "property": {"zip": 92697, "review": "positive" } } }
+);
+
+insert into dataset testds2 (
+ for $d in dataset("testds")
+ return $d
+);
+
+write output to nc1:"rttest/dml_opentype-c2o-recursive.adm";
+
+for $d in dataset("testds2")
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/opentype-c2o.aql b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-c2o.aql
index e29ccdc..a63e2df 100644
--- a/asterix-app/src/test/resources/runtimets/queries/dml/opentype-c2o.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-c2o.aql
@@ -12,7 +12,7 @@
create type testtype as closed {
id: string,
name: string,
- hobby: string?
+ hobby: {{string}}?
}
/*
@@ -28,19 +28,19 @@
create dataset testds2(testtype2) partitioned by key id;
insert into dataset testds (
-{ "hobby": "music", "id": "001", "name": "Person Three"}
+{ "hobby": {{"music", "coding"}}, "id": "001", "name": "Person Three"}
);
insert into dataset testds (
-{ "name": "Person One", "id": "002", "hobby": "sports"}
+{ "name": "Person One", "id": "002", "hobby": {{"sports"}} }
);
insert into dataset testds (
-{ "id": "003", "hobby": "movie", "name": "Person Two"}
+{ "id": "003", "hobby": {{"movie", "sports"}}, "name": "Person Two"}
);
insert into dataset testds (
-{ "id": "004", "name": "Person Four", "hobby": "swimming"}
+{ "id": "004", "name": "Person Four", "hobby": {{"swimming"}} }
);
insert into dataset testds (
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/opentype-o2c-recursive.aql b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-o2c-recursive.aql
new file mode 100644
index 0000000..2070e20
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-o2c-recursive.aql
@@ -0,0 +1,63 @@
+/*
+ * Test case Name : opentype-o2c-recursive.aql
+ * Description : verify the static casting of nest record constants
+ * Expected Result : Success
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+
+create type AddressType as open{
+ street: string,
+ city: string
+}
+
+create type Dept as closed{
+ name: string,
+ id: int32
+}
+
+create type testtype as open {
+ name: string,
+ id: string
+}
+
+create type testtype2 as closed {
+ name: string,
+ id: string,
+ address: AddressType?,
+ department: {{Dept}}?
+}
+
+create dataset testds(testtype) partitioned by key id;
+
+create dataset testds2(testtype2) partitioned by key id;
+
+insert into dataset testds (
+{ "id": "001", "name": "Person One", "address": {"street": "3019 DBH", "city": "Irvine", "zip": 92697}, "department": {{ {"name":"CS", "id":299}, {"name":"EE", "id":399} }} }
+);
+
+insert into dataset testds (
+{ "id": "002", "name": "Person Two" }
+);
+
+insert into dataset testds (
+{ "id": "003", "name": "Person Three", "address": {"street": "2019 DBH", "city": "Irvine"} }
+);
+
+insert into dataset testds (
+{ "id": "004", "name": "Person Four", "address": {"street": "1019 DBH", "city": "irvine", "property": {"zip": 92697, "review": "positive" } } }
+);
+
+insert into dataset testds2 (
+ for $d in dataset("testds")
+ return $d
+);
+
+write output to nc1:"rttest/dml_opentype-o2c-recursive.adm";
+
+for $d in dataset("testds2")
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/opentype-o2c.aql b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-o2c.aql
index a6ed9cc..015aa7b 100644
--- a/asterix-app/src/test/resources/runtimets/queries/dml/opentype-o2c.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-o2c.aql
@@ -16,7 +16,7 @@
}
create type testtype2 as closed {
- hobby: string?,
+ hobby: {{string}}?,
id: string,
name: string
}
@@ -26,19 +26,19 @@
create dataset testds2(testtype2) partitioned by key id;
insert into dataset testds (
-{ "id": "001", "hobby": "music", "name": "Person Three"}
+{ "id": "001", "hobby": {{"music"}}, "name": "Person Three"}
);
insert into dataset testds (
-{ "id": "002", "name": "Person Three", "hobby": "football"}
+{ "id": "002", "name": "Person Three", "hobby": {{"football"}}}
);
insert into dataset testds (
-{ "id": "003", "name": "Person Three", "hobby": "movie"}
+{ "id": "003", "name": "Person Three", "hobby": {{"movie", "coding", "debugging"}}}
);
insert into dataset testds (
-{ "name": "Person Three", "hobby": "swimming", "id": "004"}
+{ "name": "Person Three", "hobby": {{"swimming", "music"}}, "id": "004"}
);
insert into dataset testds (
diff --git a/asterix-app/src/test/resources/runtimets/queries/nestrecords/nestrecord.aql b/asterix-app/src/test/resources/runtimets/queries/nestrecords/nestrecord.aql
new file mode 100644
index 0000000..c0b5e06
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nestrecords/nestrecord.aql
@@ -0,0 +1,45 @@
+/*
+ * Test case Name : nestrecord.aql
+ * Description : verify the static casting of nest record constants
+ * Expected Result : Success
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+
+create type AddressType as open{
+ street: string,
+ city: string
+}
+
+create type testtype as open {
+ name: string,
+ id: string,
+ address: AddressType?
+}
+
+create dataset testds(testtype) partitioned by key id;
+
+insert into dataset testds (
+{ "id": "001", "name": "Person One", "address": {"street": "3019 DBH", "city": "Irvine", "zip": 92697} }
+);
+
+insert into dataset testds (
+{ "id": "002", "name": "Person Two" }
+);
+
+insert into dataset testds (
+{ "id": "003", "name": "Person Three", "address": {"street": "2019 DBH", "city": "Irvine"} }
+);
+
+insert into dataset testds (
+{ "id": "004", "name": "Person Four", "home": {"street": "2019 DBH", "city": {"name": "Irvine", "zip": 92697} } }
+);
+
+write output to nc1:"rttest/nestrecords_nestrecord.adm";
+
+for $d in dataset("testds")
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional.aql
new file mode 100644
index 0000000..354757d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional.aql
@@ -0,0 +1,37 @@
+/*
+ * Testcase Name : c2c-w-optional.aql
+ * Description : Insert data into target datase by doing a select on source dataset.
+ * : Here both source and target datasets are internal datasets
+ * : The schema includes one optional field named optnl_fld.
+ * Success : Yes
+ * Date : 23rd May 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as closed {
+id:int32,
+description:string,
+name:string,
+optnl_fld:string?
+}
+
+create dataset T1(TestType) partitioned by key id;
+
+create dataset T2(TestType) partitioned by key id;
+
+insert into dataset T1({
+"id":1234,
+"description":"donut",
+"name":"Cake",
+"optnl_fld":"optional data goes here"
+}
+);
+
+insert into dataset T2(for $l in dataset("T1") return $l );
+
+for $d in dataset("T2")
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional.aql
new file mode 100644
index 0000000..9d4b90a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional.aql
@@ -0,0 +1,37 @@
+/*
+ * Testcase Name : c2c-wo-optional.aql
+ * Description : Insert data into target datase by doing a select on source dataset.
+ * : Here both source and target datasets are internal datasets
+ * : The schema includes one optional field named optnl_fld.
+ * : Note that the optional field in source dataset does not hold any data.
+ * Success : Yes
+ * Date : 23rd May 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as closed {
+id:int32,
+description:string,
+name:string,
+optnl_fld:string?
+}
+
+create dataset T1(TestType) partitioned by key id;
+
+create dataset T2(TestType) partitioned by key id;
+
+insert into dataset T1({
+"id":1234,
+"description":"donut",
+"name":"Cake"
+}
+);
+
+insert into dataset T2(for $l in dataset("T1") return $l );
+
+for $d in dataset("T2")
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c.aql
new file mode 100644
index 0000000..83888f3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c.aql
@@ -0,0 +1,36 @@
+/*
+ * Testcase Name : c2c.aql
+ * Description : Insert data into target datase by doing a select on source dataset.
+ * : Here both source and target datasets are internal datasets
+ * Success : Yes
+ * Date : 23rd May 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as closed {
+id:int32,
+description:string,
+name:string
+}
+
+// source dataset
+create dataset T1(TestType) partitioned by key id;
+
+// target dataset
+create dataset T2(TestType) partitioned by key id;
+
+insert into dataset T1({
+"id":1234,
+"description":"donut",
+"name":"Cake"
+}
+);
+
+insert into dataset T2(for $l in dataset("T1") return $l );
+
+for $d in dataset("T2")
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list-ordered01.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list-ordered01.aql
new file mode 100644
index 0000000..27935e0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list-ordered01.aql
@@ -0,0 +1,39 @@
+/*
+ * Test case Name : heterog-list01.aql
+ * Description : To test insertion of an array of objects into internal dataset.
+ * : Heterogenous list construction.
+ * Success : Yes
+ * Date : 14th April 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type BatterType as {
+id:int32,
+descrpt:string
+}
+
+create type TestType as closed {
+id:int32,
+description:string,
+name:string,
+batters:[[BatterType]]
+}
+
+create dataset T1(TestType) partitioned by key id;
+
+insert into dataset T1({
+"id":1234,
+"description":"donut",
+"name":"Cake",
+"batters":[[ {"id":345,"descrpt":"Regular"},{"id":445,"descrpt":"Chocolate"} ]] }
+);
+
+write output to nc1:"rttest/open-closed_heterog-list-ordered01.adm";
+
+for $d in dataset("T1")
+order by $d.id
+return $d
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list01.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list01.aql
index d1edc3d..7ba1641 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list01.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list01.aql
@@ -19,7 +19,7 @@
id:int32,
description:string,
name:string,
-batters:[BatterType]
+batters:{{BatterType}}
}
create dataset T1(TestType) partitioned by key id;
@@ -28,11 +28,12 @@
"id":1234,
"description":"donut",
"name":"Cake",
-"batters":[{"id":345,"descprt":"Regular"},{"id":445,"descprt":"Chocolate"}] }
+"batters":{{ {"id":345,"descrpt":"Regular"},{"id":445,"descrpt":"Chocolate"} }} }
);
-write output to nc1:"rttest/open-closed_heteror-list01.adm";
+write output to nc1:"rttest/open-closed_heterog-list01.adm";
for $d in dataset("T1")
+order by $d.id
return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list02.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list02.aql
new file mode 100644
index 0000000..47dd921
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list02.aql
@@ -0,0 +1,35 @@
+/*
+ * Test case Name : heterog-list02.aql
+ * Description : To test insertion of an array of arrays into internal dataset.
+ * : Heterogenous list construction.
+ * Success : Yes
+ * Date : 28th May 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type BatterType as {
+id:int32,
+descrpt:string
+}
+
+create type TestType as {
+id:int32,
+description:string,
+name:string,
+batters:[[BatterType]]
+}
+
+create dataset T1(TestType) partitioned by key id;
+
+insert into dataset T1({
+"id":1234,
+"description":"donut",
+"name":"Cake",
+"batters":[[{"id":345,"descrpt":"Regular"},{"id":445,"descrpt":"Chocolate"}],[{"id":349,"descrpt":"Soft"},{"id":449,"descrpt":"Vanilla"}]] }
+);
+
+for $l in dataset('T1')
+return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list03.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list03.aql
new file mode 100644
index 0000000..94a87c0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list03.aql
@@ -0,0 +1,36 @@
+/*
+ * Test case Name : heterog-list03.aql
+ * Description : To test insertion of an array of arrays into internal dataset.
+ * : batters field is optional in this scenario.
+ * : Heterogenous list construction.
+ * Success : Yes
+ * Date : 28th May 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type BatterType as {
+id:int32,
+descrpt:string
+}
+
+create type TestType as {
+id:int32,
+description:string,
+name:string,
+batters:[[BatterType]]?
+}
+
+create dataset T1(TestType) partitioned by key id;
+
+insert into dataset T1({
+"id":1234,
+"description":"donut",
+"name":"Cake",
+"batters":[[{"id":345,"descrpt":"Regular"},{"id":445,"descrpt":"Chocolate"}],[{"id":349,"descrpt":"Soft"},{"id":449,"descrpt":"Vanilla"}]] }
+);
+
+for $l in dataset('T1')
+return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-01.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-01.aql
index 6373569..0d26b5d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-01.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-01.aql
@@ -23,4 +23,6 @@
);
write output to nc1:"rttest/open-closed_open-closed-01.adm";
-for $l in dataset("testds") return $l
+for $l in dataset("testds")
+order by $l.id
+return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-02.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-02.aql
deleted file mode 100644
index e15577b..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-02.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Test case Name : open-closed-02.aql
- * Description : This test is intended to test insertion of additional data into a dataset of closed type
- * Expected Result : This test should fail because closed type internal datasets can not ingest additional data.
- *
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-// name field here is optional.
-create type testType as closed {
-id : int32,
-name : string?
-}
-
-create dataset testds(testType) partitioned by key id;
-
-insert into dataset testds({"id": 123});
-
-write output to nc1:"rttest/open-closed_open-closed-02.adm";
-for $l in dataset("testds") return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-03.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-03.aql
deleted file mode 100644
index f028c89..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-03.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Test case Name : open-closed-03.aql
- * Description : This test is intended to test insertion of additional data into a closed type
- * Expected Result : Failure - This should NOT be allowed!
- * Issue number : Issue 66
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-create type testType as closed {
-id : int32,
-name : string
-}
-
-create dataset testds(testType) partitioned by key id;
-
-insert into dataset testds({"id": 123, "name": "John Doe", "hobbies": {{ "scuba", "music" }} }
-);
-
-for $l in dataset("testds") return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-04.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-04.aql
deleted file mode 100644
index 82912bd..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-04.aql
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Test case Name : open-closed-04.aql
- * Description : This test is intended to test type in the Metdata for the dataset.
- * : Verify if the type is open.
- * Expected Result : Success - This should be allowed!
- * Issue number : Issue 73
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-create type TestType as open {
-id : int32,
-name : string
-}
-
-create dataset testds(TestType) partitioned by key id;
-
-/*
- * Connect to the Metadata dataverse and run the following commands.
- */
-
-use dataverse Metadata;
-
-for $l in dataset('Datatype')
-let $x := $l.Derived
-where $l.DatatypeName="TestType"
-return $x.Record
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-05.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-05.aql
deleted file mode 100644
index 2bd18fe..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-05.aql
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Test case Name : open-closed-05.aql
- * Description : Create internal dataset and verify if the type is marked as closed in metadata.
- * Expected Result : Success
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-create type testType as closed {
-id : int32,
-name : string
-}
-
-create dataset testds(testType) partitioned by key id;
-
-/*
- * Connect to the Metadata dataverse and run the following commands.
- * Verify if the type is closed by querying Metadata.
- */
-
-use dataverse Metadata;
-
-for $l in dataset('Datatype')
-let $x := $l.Derived
-where $l.DatatypeName="TestType"
-return $x.Record
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-06.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-06.aql
deleted file mode 100644
index f6605a6..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-06.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Test case Name : open-closed-06.aql
- * Description : To test non nullable field types in closed type datasets.
- * Success : Yes this test should Fail!
- * Date : 03/26/2012
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-create type testType as closed {
-id : int32,
-name : string
-}
-
-create dataset testds(testType) partitioned by key id;
-
-// Missing name field this insert stmt should fail.
-
-insert into dataset testds({"id": 123});
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-07.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-07.aql
deleted file mode 100644
index 155f8bb..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-07.aql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Test case Name : open-closed-07.aql
- * Description : To test non nullable field types in datasets of type open.
- * Success : Yes this test should Fail!
- * Date : 03/26/2012
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-create type testType as open {
-id : int32,
-name : string
-}
-
-create dataset testds(testType) partitioned by key id;
-
-insert into dataset testds({"id": 123});
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-08.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-08.aql
deleted file mode 100644
index 24423e8..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-08.aql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Test case Name : open-closed-08.aql
- * Description : To test nullable and non nullable field types in datasets of type closed.
- * Success : Yes this test should succeed!
- * Date : 03/26/2012
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-create type testType as closed {
-id : int32,
-name : string?
-}
-
-create dataset testds(testType) partitioned by key id;
-
-insert into dataset testds({"id": 123});
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-09.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-09.aql
deleted file mode 100644
index 63288d7..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-09.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Test case Name : open-closed-09.aql
- * Description : To test nullable and non nullable field types in datasets of type open.
- * : Missing value for nullable field and missing value for non-nullable field in insert statement.
- * Success : This test should Fail!
- * Date : 03/26/2012
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-create type testType as open {
-id : int32,
-name : string?
-}
-
-create dataset testds(testType) partitioned by key id;
-
-insert into dataset testds({ });
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-10.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-10.aql
deleted file mode 100644
index cad1f12..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-10.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Test case Name : open-closed-10.aql
- * Description : To test nullable and non nullable field types in datasets of type open.
- * : Missing value for nullable field in insert statement.
- * Success : This test should succeed!
- * Date : 03/26/2012
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-create type testType as open {
-id : int32,
-name : string?
-}
-
-create dataset testds(testType) partitioned by key id;
-
-insert into dataset testds({"id :" 32 });
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-11.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-11.aql
deleted file mode 100644
index 50d52d2..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-11.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Test case Name : open-closed-11.aql
- * Description : To test nullable and non nullable field types in datasets of type open.
- * : No missing value for nullable field in insert statement.
- * Success : This test should succeed!
- * Date : 03/26/2012
- */
-
-drop dataverse test if exists;
-
-create dataverse test;
-
-use dataverse test;
-
-create type testType as open {
-id : int32,
-name : string?
-}
-
-create dataset testds(testType) partitioned by key id;
-
-insert into dataset testds({"id :" 32,"name :" "UCI"});
-
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-12.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-12.aql
index 2459fcc..ae21794 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-12.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-12.aql
@@ -43,6 +43,8 @@
return $d
);
+write output to nc1:"rttest/open-closed_open-closed-12.adm";
for $d in dataset("testds01")
+order by $d.id
return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-13.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-13.aql
deleted file mode 100644
index 379e282..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-13.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Testcase Name : open-closed-13.aql
- * Description : Attempt to insert additional data into a dataset which is defined as closed type.
- * Success : This test should fail! No additional data allowed in datasets of closed type.
- * Date : March 27 2012
- */
-
-
-create dataverse testdv2;
-use dataverse testdv2;
-
-create type testtype as closed {
- id: string,
- name: string
-}
-
-create dataset testds(testtype) partitioned by key id;
-
-insert into dataset testds (
-{ "id": "001", "name": "Person Three", "hobbies": {{"scuba", "music"}}}
-);
-
-for $d in dataset("testds")
-return $d
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-14.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-14.aql
index 03e6e33..6c517ca 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-14.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-14.aql
@@ -48,6 +48,8 @@
return $d
);
+write output to nc1:"rttest/open-closed_open-closed-14.adm";
for $d in dataset("testds01")
+order by $d.id
return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-15.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-15.aql
index 80cfa30..2ac2567 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-15.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-15.aql
@@ -46,6 +46,7 @@
}
);
+write output to nc1:"rttest/open-closed_open-closed-15.adm";
for $l in dataset('tdtst')
return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-16.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-16.aql
index c463cb0..5e1a591 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-16.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-16.aql
@@ -46,6 +46,7 @@
}
);
+write output to nc1:"rttest/open-closed_open-closed-16.adm";
for $l in dataset('tdtst')
return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-17.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-17.aql
index f1fe349..a590cf1 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-17.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-17.aql
@@ -43,5 +43,6 @@
}
);
+write output to nc1:"rttest/open-closed_open-closed-17.adm";
for $l in dataset('tdtst')
return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-18.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-18.aql
deleted file mode 100644
index 0da1474..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-18.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Test case name : open-closed-18.aql
- * Description : Test insertion of additional data into an open type internal dataset.
- * Success : Yes
- * Date : 29 April 2012
- */
-
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type TestType as open {
-id:int32
-}
-
-create dataset testds(TestType) partitioned by key id;
-
-insert into dataset testds( for $i in range(1,10) return { "id":$i,"name":"John Doe" });
-
-for $l in dataset('testds')
-return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-19.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-19.aql
index 3ff2d71..b406663 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-19.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-19.aql
@@ -47,5 +47,6 @@
insert into dataset dtst01({for $l in dataset('employee') return $l});
+write output to nc1:"rttest/open-closed_open-closed-19.adm";
for $l in dataset('dtst01')
retunr $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-20.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-20.aql
index d7ad173..29b4366 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-20.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-20.aql
@@ -41,5 +41,6 @@
insert into dataset dtst01(for $l in dataset('employee') return $l);
+write output to nc1:"rttest/open-closed_open-closed-20.adm";
for $l in dataset('dtst01')
return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-21.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-21.aql
index 71ce585..c52344e 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-21.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-21.aql
@@ -38,5 +38,6 @@
insert into dataset dtst01(for $l in dataset('employee') return $l);
+write output to nc1:"rttest/open-closed_open-closed-21.adm";
for $l in dataset('dtst01')
return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-22.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-22.aql
index 6e05f61..cd9ac44 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-22.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-22.aql
@@ -39,5 +39,6 @@
// missing dept field
insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"sex":"M","dob":date("1970-12-22")});
+write output to nc1:"rttest/open-closed_open-closed-22.adm";
for $l in dataset('employee')
return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-24.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-24.aql
new file mode 100644
index 0000000..7012a5a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-24.aql
@@ -0,0 +1,26 @@
+/*
+ * Testcase Name : open-closed-24.aql
+ * Description : Test use of additional data(open) field in create type statement
+ * Success : Yes
+ * Date : 29th May 2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as open {
+id : int32,
+name : string,
+opt_tag : {{ string }}
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id": 32,"name": "UCI","opt_tag":{{"optional text","put any text here","and more"}}});
+
+write output to nc1:"rttest/open-closed_open-closed-24.adm";
+for $l in dataset('testds')
+return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-25.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-25.aql
new file mode 100644
index 0000000..b29b63a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-25.aql
@@ -0,0 +1,26 @@
+/*
+ * Testcase Name : open-closed-25.aql
+ * Description : Test use of additional data(open) optional field in create type statement
+ * Success : Yes
+ * Date : 29th May 2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as open {
+id : int32,
+name : string,
+opt_tag : {{ string }}?
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id": 32,"name": "UCI","opt_tag":{{"optional text","put any text here","and more"}}});
+
+write output to nc1:"rttest/open-closed_open-closed-25.adm";
+for $l in dataset('testds')
+return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-26.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-26.aql
new file mode 100644
index 0000000..f19e4a7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-26.aql
@@ -0,0 +1,27 @@
+/*
+ * Testcase Name : open-closed-26.aql
+ * Description : Test use of additional data(open) optional field in create type statement
+ * : No additional data is inserted (as it is declared as optional) from the insert statement.
+ * Success : Yes
+ * Date : 29th May 2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as open {
+id : int32,
+name : string,
+opt_tag : {{ string }}?
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id": 32,"name": "UCI"});
+
+write output to nc1:"rttest/open-closed_open-closed-26.adm";
+for $l in dataset('testds')
+return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-28.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-28.aql
new file mode 100644
index 0000000..8fdab75
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-28.aql
@@ -0,0 +1,51 @@
+/*
+ * Testcase Name : open-closed-28.aql
+ * Description : Query for undeclared data from an open type internal dataset
+ * : use the every keyword in the where clause
+ * Status : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+ id: string,
+ name: string
+}
+
+create type testtype02 as open {
+id : string,
+name : string
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds02 (
+{ "id": "001", "name": "Person One", "hobbies": {{"scuba", "music"}}}
+);
+
+insert into dataset testds02 (
+{ "id": "002", "name": "Person Two", "hobbies": {{"fishing", "dance"}}}
+);
+
+
+insert into dataset testds02 (
+{ "id": "003", "name": "Person Three", "hobbies": {{"hiking", "surfing"}}}
+);
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+// select all hobbies where hiking is one of the hobbies
+
+write output to nc1:"rttest/open-closed_open-closed-28.adm";
+for $d in dataset('testds01')
+where every $h in $d.hobbies satisfies $h='hiking'
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-29.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-29.aql
new file mode 100644
index 0000000..9560430
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-29.aql
@@ -0,0 +1,50 @@
+/*
+ * Testcase Name : open-closed-29.aql
+ * Description : Query for undeclared data from an open type internal dataset
+ * : use the some keyword in the where clause
+ * Status : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+ id: string,
+ name: string
+}
+
+create type testtype02 as open {
+id : string,
+name : string
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds02 (
+{ "id": "001", "name": "Person One", "hobbies": {{"scuba", "music"}}}
+);
+
+insert into dataset testds02 (
+{ "id": "002", "name": "Person Two", "hobbies": {{"fishing", "dance"}}}
+);
+
+
+insert into dataset testds02 (
+{ "id": "003", "name": "Person Three", "hobbies": {{"hiking", "surfing"}}}
+);
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+// select all hobbies where hiking is one of the hobbies
+write output to nc1:"rttest/open-closed_open-closed-29.adm";
+for $d in dataset('testds01')
+where some $h in $d.hobbies satisfies $h='hiking'
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-30.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-30.aql
new file mode 100644
index 0000000..42aa2e6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-30.aql
@@ -0,0 +1,49 @@
+/*
+ * Test case Name : open-closed-30.aql
+ * Description : Query undeclared data using every in the WHERE clause
+ * : where every $h in $d.hobbies satisfies $h='hiking'
+ * Success : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+ id: string
+}
+
+create type testtype02 as open {
+id : string,
+name : string
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds02 (
+{ "id": "011", "name": "John Doe", "hobbies": {{"scuba", "music"}}}
+);
+
+insert into dataset testds02 (
+{ "id": "102", "name": "Roger Sanders", "hobbies": {{"fishing", "dance"}}}
+);
+
+
+insert into dataset testds02 (
+{ "id": "203", "name": "Phil Smith", "hobbies": {{"hiking", "surfing"}}}
+);
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+write output to nc1:"rttest/open-closed_open-closed-30.adm";
+for $d in dataset('testds01')
+where every $h in $d.hobbies satisfies $h='hiking'
+order by $d.id
+return $d.hobbies
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-31.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-31.aql
new file mode 100644
index 0000000..03b1754
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-31.aql
@@ -0,0 +1,48 @@
+/*
+ * Test case Name : open-closed-31.aql
+ * Description :
+ * Success : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+ id: string
+}
+
+create type testtype02 as open {
+id : string,
+name : string
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds02 (
+{ "id": "011", "name": "John Doe", "hobbies": {{"scuba", "music"}}}
+);
+
+insert into dataset testds02 (
+{ "id": "102", "name": "Roger Sanders", "hobbies": {{"fishing", "dance"}}}
+);
+
+
+insert into dataset testds02 (
+{ "id": "203", "name": "Phil Smith", "hobbies": {{"hiking", "surfing"}}}
+);
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+write output to nc1:"rttest/open-closed_open-closed-31.adm";
+for $d in dataset('testds01')
+where some $h in $d.hobbies satisfies $h='hiking'
+order by $d.id
+return $d.hobbies
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-32.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-32.aql
new file mode 100644
index 0000000..f101e47
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-32.aql
@@ -0,0 +1,54 @@
+/*
+ * Test case Name : open-closed-32.aql
+ * Description : INSERT into target (closed type) internal dataset by doing SELECT on (closed type) source internal dataset
+ * : then query the target internal dataset for data enclosed within {{ }} braces, in this case interests field.
+ * Success : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+id: string
+}
+
+create type testtype02 as closed {
+id : string,
+name : string,
+sex : string,
+dept : string,
+salary : int32,
+interests : {{string}}
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds02 (
+{ "id": "011", "name": "John Doe", "sex":"Male", "dept":"HR", "salary":80000,"interests":{{"hiking","scuba","painting","biking"}}});
+
+insert into dataset testds02 (
+{ "id": "921", "name": "John Smith", "sex":"Male", "dept":"Sales", "salary":65000,"interests":{{"gardening","biking","reading","hiking","fishing"}}});
+
+insert into dataset testds02 (
+{ "id": "959", "name": "Susan Malaika", "sex":"Female", "dept":"XML Dev", "salary":200000,"interests":{{"XML","Web Services","Cloud","X-Forms","art","travelling"}}});
+
+insert into dataset testds02 (
+{ "id": "371", "name": "Tom Sawyer", "sex":"Male", "dept":"Well Being", "salary":90000,"interests":{{"tennis","scuba","running","biking"}}});
+
+// insert into open type target dataset by doing a select on the closed type (source) internal dataset
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+write output to nc1:"rttest/open-closed_open-closed-32.adm";
+for $d in dataset('testds01')
+where some $h in $d.interests satisfies $h='biking'
+order by $d.id
+return $d.interests
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-33.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-33.aql
new file mode 100644
index 0000000..b75e6c6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-33.aql
@@ -0,0 +1,55 @@
+/*
+ * Test case Name : open-closed-33.aql
+ * Description : INSERT into target (closed type) internal dataset by doing SELECT on (closed type) source internal dataset
+ * : then query the target internal dataset for data enclosed within {{ }} braces, in this case interests field.
+ * : Here the interests field is optional.
+ * Success : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+id: string
+}
+
+create type testtype02 as closed {
+id : string,
+name : string,
+sex : string,
+dept : string,
+salary : int32,
+interests : {{string}}?
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds02 (
+{ "id": "011", "name": "John Doe", "sex":"Male", "dept":"HR", "salary":80000,"interests":{{"hiking","scuba","painting","biking"}}});
+
+insert into dataset testds02 (
+{ "id": "921", "name": "John Smith", "sex":"Male", "dept":"Sales", "salary":65000,"interests":{{"gardening","biking","reading","hiking","fishing"}}});
+
+insert into dataset testds02 (
+{ "id": "959", "name": "Susan Malaika", "sex":"Female", "dept":"XML Dev", "salary":200000,"interests":{{"XML","Web Services","Cloud","X-Forms","art","travelling"}}});
+
+insert into dataset testds02 (
+{ "id": "371", "name": "Tom Sawyer", "sex":"Male", "dept":"Well Being", "salary":90000,"interests":{{"tennis","scuba","running","biking"}}});
+
+// insert into open type target dataset by doing a select on the closed type (source) internal dataset
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+write output to nc1:"rttest/open-closed_open-closed-33.adm";
+for $d in dataset('testds01')
+where some $h in $d.interests satisfies $h='biking'
+order by $d.id
+return $d.interests
+
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/opentype-c2o-recursive.adm b/asterix-app/src/test/resources/runtimets/results/dml/opentype-c2o-recursive.adm
new file mode 100644
index 0000000..60a389c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/dml/opentype-c2o-recursive.adm
@@ -0,0 +1,4 @@
+{ "name": "Person One", "id": "001", "address": { "street": "3019 DBH", "city": "Irvine", "zip": 92697 }, "department": {{ { "name": "CS", "id": 299, "review": 5 }, { "name": "EE", "id": 399 } }} }
+{ "name": "Person Two", "id": "002", "address": null, "department": null }
+{ "name": "Person Three", "id": "003", "address": { "street": "2019 DBH", "city": "Irvine" }, "department": null }
+{ "name": "Person Four", "id": "004", "address": { "street": "1019 DBH", "city": "irvine", "property": { "zip": 92697, "review": "positive" } }, "department": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/opentype-c2o.adm b/asterix-app/src/test/resources/runtimets/results/dml/opentype-c2o.adm
index 5e7a349..6086a08 100644
--- a/asterix-app/src/test/resources/runtimets/results/dml/opentype-c2o.adm
+++ b/asterix-app/src/test/resources/runtimets/results/dml/opentype-c2o.adm
@@ -1,5 +1,5 @@
-{ "id": "001", "name": "Person Three", "hobby": "music" }
-{ "id": "002", "name": "Person One", "hobby": "sports" }
-{ "id": "003", "name": "Person Two", "hobby": "movie" }
-{ "id": "004", "name": "Person Four", "hobby": "swimming" }
+{ "id": "001", "name": "Person Three", "hobby": {{ "music", "coding" }} }
+{ "id": "002", "name": "Person One", "hobby": {{ "sports" }} }
+{ "id": "003", "name": "Person Two", "hobby": {{ "movie", "sports" }} }
+{ "id": "004", "name": "Person Four", "hobby": {{ "swimming" }} }
{ "id": "005", "name": "Person Five", "hobby": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/opentype-o2c-recursive.adm b/asterix-app/src/test/resources/runtimets/results/dml/opentype-o2c-recursive.adm
new file mode 100644
index 0000000..c67c3cb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/dml/opentype-o2c-recursive.adm
@@ -0,0 +1,4 @@
+{ "name": "Person One", "id": "001", "address": { "street": "3019 DBH", "city": "Irvine", "zip": 92697 }, "department": {{ { "name": "CS", "id": 299 }, { "name": "EE", "id": 399 } }} }
+{ "name": "Person Two", "id": "002", "address": null, "department": null }
+{ "name": "Person Three", "id": "003", "address": { "street": "2019 DBH", "city": "Irvine" }, "department": null }
+{ "name": "Person Four", "id": "004", "address": { "street": "1019 DBH", "city": "irvine", "property": { "zip": 92697, "review": "positive" } }, "department": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/opentype-o2c.adm b/asterix-app/src/test/resources/runtimets/results/dml/opentype-o2c.adm
index d9c778b..92809fd 100644
--- a/asterix-app/src/test/resources/runtimets/results/dml/opentype-o2c.adm
+++ b/asterix-app/src/test/resources/runtimets/results/dml/opentype-o2c.adm
@@ -1,5 +1,5 @@
-{ "hobby": "music", "id": "001", "name": "Person Three" }
-{ "hobby": "football", "id": "002", "name": "Person Three" }
-{ "hobby": "movie", "id": "003", "name": "Person Three" }
-{ "hobby": "swimming", "id": "004", "name": "Person Three" }
+{ "hobby": {{ "music" }}, "id": "001", "name": "Person Three" }
+{ "hobby": {{ "football" }}, "id": "002", "name": "Person Three" }
+{ "hobby": {{ "movie", "coding", "debugging" }}, "id": "003", "name": "Person Three" }
+{ "hobby": {{ "swimming", "music" }}, "id": "004", "name": "Person Three" }
{ "hobby": null, "id": "005", "name": "Person Five" }
diff --git a/asterix-app/src/test/resources/runtimets/results/nestrecords/nestrecord.adm b/asterix-app/src/test/resources/runtimets/results/nestrecords/nestrecord.adm
new file mode 100644
index 0000000..2b255b0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/nestrecords/nestrecord.adm
@@ -0,0 +1,4 @@
+{ "name": "Person One", "id": "001", "address": { "street": "3019 DBH", "city": "Irvine", "zip": 92697 } }
+{ "name": "Person Two", "id": "002", "address": null }
+{ "name": "Person Three", "id": "003", "address": { "street": "2019 DBH", "city": "Irvine" } }
+{ "name": "Person Four", "id": "004", "address": null, "home": { "street": "2019 DBH", "city": { "name": "Irvine", "zip": 92697 } } }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/heterog-list-ordered01.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/heterog-list-ordered01.adm
new file mode 100644
index 0000000..ee958f2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/heterog-list-ordered01.adm
@@ -0,0 +1 @@
+{ "id": 1234, "description": "donut", "name": "Cake", "batters": [ [ { "id": 345, "descrpt": "Regular" }, { "id": 445, "descrpt": "Chocolate" } ] ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/heterog-list01.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/heterog-list01.adm
new file mode 100644
index 0000000..30c55c2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/heterog-list01.adm
@@ -0,0 +1 @@
+{ "id": 1234, "description": "donut", "name": "Cake", "batters": {{ { "id": 345, "descrpt": "Regular" }, { "id": 445, "descrpt": "Chocolate" } }} }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-01.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-01.adm
new file mode 100644
index 0000000..c5aac6d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-01.adm
@@ -0,0 +1 @@
+{ "id": 123, "name": "John Doe", "hobbies": {{ "scuba", "music" }} }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-12.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-12.adm
new file mode 100644
index 0000000..7570226
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-12.adm
@@ -0,0 +1,3 @@
+{ "id": "001", "name": "Person One", "hobbies": {{ "scuba", "music" }} }
+{ "id": "002", "name": "Person Two", "hobbies": {{ "fishing", "dance" }} }
+{ "id": "003", "name": "Person Three", "hobbies": {{ "hiking", "surfing" }} }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-14.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-14.adm
new file mode 100644
index 0000000..70b6b95
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-14.adm
@@ -0,0 +1,5 @@
+{ "id": "001", "name": null }
+{ "id": "002", "name": "John Doe" }
+{ "id": "003", "name": null }
+{ "id": "004", "name": null }
+{ "id": "005", "name": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-24.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-24.adm
new file mode 100644
index 0000000..fbcf8ee
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-24.adm
@@ -0,0 +1 @@
+{ "id": 32, "name": "UCI", "opt_tag": {{ "optional text", "put any text here", "and more" }} }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-25.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-25.adm
new file mode 100644
index 0000000..fbcf8ee
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-25.adm
@@ -0,0 +1 @@
+{ "id": 32, "name": "UCI", "opt_tag": {{ "optional text", "put any text here", "and more" }} }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-26.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-26.adm
new file mode 100644
index 0000000..755a799
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-26.adm
@@ -0,0 +1 @@
+{ "id": 32, "name": "UCI", "opt_tag": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-29.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-29.adm
new file mode 100644
index 0000000..2c3d0ea
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-29.adm
@@ -0,0 +1 @@
+{ "id": "003", "name": "Person Three", "hobbies": {{ "hiking", "surfing" }} }
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-31.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-31.adm
new file mode 100644
index 0000000..d5816e2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-31.adm
@@ -0,0 +1 @@
+{{ "hiking", "surfing" }}
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-32.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-32.adm
new file mode 100644
index 0000000..2103e83
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-32.adm
@@ -0,0 +1,3 @@
+{{ "hiking", "scuba", "painting", "biking" }}
+{{ "tennis", "scuba", "running", "biking" }}
+{{ "gardening", "biking", "reading", "hiking", "fishing" }}
diff --git a/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-33.adm b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-33.adm
new file mode 100644
index 0000000..2103e83
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/open-closed/open-closed-33.adm
@@ -0,0 +1,3 @@
+{{ "hiking", "scuba", "painting", "biking" }}
+{{ "tennis", "scuba", "running", "biking" }}
+{{ "gardening", "biking", "reading", "hiking", "fishing" }}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/utils/UTF8CharSequence.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/utils/UTF8CharSequence.java
index fc5c930..a6d1c54 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/utils/UTF8CharSequence.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/utils/UTF8CharSequence.java
@@ -1,8 +1,7 @@
package edu.uci.ics.asterix.common.utils;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
-import edu.uci.ics.hyracks.dataflow.common.data.util.StringUtils;
public class UTF8CharSequence implements CharSequence {
@@ -48,7 +47,7 @@
int sStart = start + 2;
int c = 0;
int i = 0;
- byte[] bytes = valueRef.getBytes();
+ byte[] bytes = valueRef.getByteArray();
while (c < len) {
buf[i++] = UTF8StringPointable.charAt(bytes, sStart + c);
c += UTF8StringPointable.charSize(bytes, sStart + c);
@@ -57,7 +56,7 @@
}
private void resetLength(IValueReference valueRef) {
- this.len = UTF8StringPointable.getUTFLen(valueRef.getBytes(), start);
+ this.len = UTF8StringPointable.getUTFLength(valueRef.getByteArray(), start);
}
}
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledFeedDatasetDetails.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledFeedDatasetDetails.java
index 64503c4..5cfc8be 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledFeedDatasetDetails.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledFeedDatasetDetails.java
@@ -21,7 +21,7 @@
import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class AqlCompiledFeedDatasetDetails extends
AqlCompiledInternalDatasetDetails {
@@ -32,7 +32,7 @@
public AqlCompiledFeedDatasetDetails(
List<String> partitioningExprs,
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitionFuns,
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitionFuns,
String nodegroupName, AqlCompiledIndexDecl primaryIndex,
List<AqlCompiledIndexDecl> secondaryIndexes, String adapter,
Map<String, String> properties, String functionIdentifier,
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledInternalDatasetDetails.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledInternalDatasetDetails.java
index 36c53cc..912b766 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledInternalDatasetDetails.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledInternalDatasetDetails.java
@@ -22,18 +22,18 @@
import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class AqlCompiledInternalDatasetDetails implements IAqlCompiledDatasetDetails {
private final List<String> partitioningExprs;
- private final List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitionFuns;
+ private final List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitionFuns;
private final String nodegroupName;
private final List<AqlCompiledIndexDecl> secondaryIndexes;
private final AqlCompiledIndexDecl primaryIndex;
private HashMap<String, List<AqlCompiledIndexDecl>> secondaryIndexInvertedList;
public AqlCompiledInternalDatasetDetails(List<String> partitioningExprs,
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitionFuns, String nodegroupName,
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitionFuns, String nodegroupName,
AqlCompiledIndexDecl primaryIndex, List<AqlCompiledIndexDecl> secondaryIndexes) {
this.partitioningExprs = partitioningExprs;
this.partitionFuns = partitionFuns;
@@ -52,7 +52,7 @@
return sb.toString();
}
- public List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> getPartitioningFunctions() {
+ public List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> getPartitioningFunctions() {
return partitionFuns;
}
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 418eac5..c76208c 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
@@ -49,7 +49,7 @@
import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.data.IAWriterFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.io.FileReference;
import edu.uci.ics.hyracks.dataflow.std.file.ConstantFileSplitProvider;
import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
@@ -187,7 +187,7 @@
String typeName = datasetRecord.getDatatypeName();
InternalDatasetDetails id = (InternalDatasetDetails) datasetRecord.getDatasetDetails();
ARecordType recType = (ARecordType) findType(typeName);
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningEvalFactories = computePartitioningEvaluatorFactories(
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningEvalFactories = computePartitioningEvaluatorFactories(
id.getPartitioningKey(), recType);
List<Index> indexRecord = this.metadataManager.getDatasetIndexes(mdTxnCtx, dataverseName,
datasetName);
@@ -239,12 +239,12 @@
this.outputFile = outputFile;
}
- public List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> computePartitioningEvaluatorFactories(
+ public List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> computePartitioningEvaluatorFactories(
List<String> partitioningExprs, ARecordType recType) {
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> evalFactories = new ArrayList<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>>(
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> evalFactories = new ArrayList<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>>(
partitioningExprs.size());
for (String expr : partitioningExprs) {
- Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFact = null;
+ Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFact = null;
try {
evalFact = format.partitioningEvaluatorFactory(recType, expr);
} catch (AlgebricksException e) {
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 2545926..4ae38eb 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
@@ -41,7 +41,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.properties.RandomPartitioningProperty;
import edu.uci.ics.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector;
import edu.uci.ics.hyracks.algebricks.core.algebra.properties.UnorderedPartitionedProperty;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class AqlDataSource implements IDataSource<AqlSourceId> {
@@ -102,7 +102,7 @@
}
private void initInternalDataset(IAType itemType) {
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
.getPartitioningFunctions(adecl);
int n = partitioningFunctions.size();
schemaTypes = new IAType[n + 1];
@@ -118,7 +118,7 @@
if (decl.getAqlCompiledDatasetDetails() instanceof AqlCompiledExternalDatasetDetails) {
initExternalDataset(itemType);
} else {
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions = DatasetUtils
.getPartitioningFunctions(adecl);
int n = partitioningFunctions.size();
schemaTypes = new IAType[n + 1];
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 d8e340c..3affe24 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
@@ -50,7 +50,7 @@
import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ILogicalExpressionJobGen;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionRuntimeProvider;
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.functions.FunctionIdentifier;
@@ -62,8 +62,9 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
import edu.uci.ics.hyracks.algebricks.runtime.operators.std.SinkWriterRuntimeFactory;
import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
@@ -359,7 +360,7 @@
typeTraits[numPrimaryKeys] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(itemType);
}
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : DatasetUtils
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : DatasetUtils
.getPartitioningFunctions(ddecl)) {
IAType keyType = evalFactoryAndType.third;
ISerializerDeserializer keySerde = metadata.getFormat().getSerdeProvider()
@@ -468,7 +469,7 @@
throw new AlgebricksException("R-tree can only be used as a secondary index");
}
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : DatasetUtils
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : DatasetUtils
.getPartitioningFunctions(ddecl)) {
IAType keyType = evalFactoryAndType.third;
ISerializerDeserializer keySerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -756,9 +757,9 @@
if (filterExpr == null) {
return null;
}
- ILogicalExpressionJobGen exprJobGen = context.getExpressionJobGen();
- IEvaluatorFactory filterEvalFactory = exprJobGen.createEvaluatorFactory(filterExpr, typeEnv, inputSchemas,
- context);
+ IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider();
+ IScalarEvaluatorFactory filterEvalFactory = expressionRuntimeProvider.createEvaluatorFactory(filterExpr,
+ typeEnv, inputSchemas, context);
return new AsterixTupleFilterFactory(filterEvalFactory, context.getBinaryBooleanInspector());
}
@@ -809,7 +810,7 @@
true);
typeTraits[i] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(keyType);
}
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : DatasetUtils
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : DatasetUtils
.getPartitioningFunctions(compiledDatasetDecl)) {
IAType keyType = evalFactoryAndType.third;
comparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(keyType,
@@ -883,7 +884,7 @@
typeTraits[i] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(nestedKeyType);
valueProviderFactories[i] = AqlPrimitiveValueProviderFactory.INSTANCE;
}
- for (Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : DatasetUtils
+ for (Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType : DatasetUtils
.getPartitioningFunctions(compiledDatasetDecl)) {
IAType keyType = evalFactoryAndType.third;
comparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(keyType,
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/utils/DatasetUtils.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/utils/DatasetUtils.java
index b7f0f75..a34f14b 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/utils/DatasetUtils.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/utils/DatasetUtils.java
@@ -14,7 +14,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
import edu.uci.ics.hyracks.algebricks.data.IBinaryHashFunctionFactoryProvider;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
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;
@@ -25,12 +25,12 @@
throws AlgebricksException {
if (compiledDatasetDecl.getDatasetType() == DatasetType.EXTERNAL)
throw new AlgebricksException("not implemented");
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions;
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions;
partitioningFunctions = getPartitioningFunctions(compiledDatasetDecl);
int numKeys = partitioningFunctions.size();
IBinaryComparatorFactory[] bcfs = new IBinaryComparatorFactory[numKeys];
for (int i = 0; i < numKeys; i++) {
- Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
+ Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
.get(i);
IAType keyType = evalFactoryAndType.third;
bcfs[i] = comparatorFactoryProvider.getBinaryComparatorFactory(keyType, true);
@@ -43,13 +43,13 @@
throws AlgebricksException {
if (compiledDatasetDecl.getDatasetType() == DatasetType.EXTERNAL)
throw new AlgebricksException("not implemented");
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions;
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions;
partitioningFunctions = ((AqlCompiledInternalDatasetDetails) compiledDatasetDecl.getAqlCompiledDatasetDetails())
.getPartitioningFunctions();
int numKeys = partitioningFunctions.size();
IBinaryHashFunctionFactory[] bhffs = new IBinaryHashFunctionFactory[numKeys];
for (int i = 0; i < numKeys; i++) {
- Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
+ Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
.get(i);
IAType keyType = evalFactoryAndType.third;
bhffs[i] = hashFunProvider.getBinaryHashFunctionFactory(keyType);
@@ -61,13 +61,13 @@
AqlCompiledMetadataDeclarations datasetDecls) throws AlgebricksException {
if (compiledDatasetDecl.getDatasetType() == DatasetType.EXTERNAL)
throw new AlgebricksException("not implemented");
- List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions;
+ List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> partitioningFunctions;
partitioningFunctions = ((AqlCompiledInternalDatasetDetails) compiledDatasetDecl.getAqlCompiledDatasetDetails())
.getPartitioningFunctions();
int numKeys = partitioningFunctions.size();
ITypeTraits[] typeTraits = new ITypeTraits[numKeys + 1];
for (int i = 0; i < numKeys; i++) {
- Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
+ Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> evalFactoryAndType = partitioningFunctions
.get(i);
IAType keyType = evalFactoryAndType.third;
typeTraits[i] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(keyType);
@@ -77,7 +77,7 @@
return typeTraits;
}
- public static List<Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>> getPartitioningFunctions(
+ public static List<Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>> getPartitioningFunctions(
AqlCompiledDatasetDecl decl) {
return ((AqlCompiledInternalDatasetDetails) decl.getAqlCompiledDatasetDetails()).getPartitioningFunctions();
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAOrderedListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAOrderedListBuilder.java
index 881c302..0ca40a5 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAOrderedListBuilder.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAOrderedListBuilder.java
@@ -4,7 +4,7 @@
import edu.uci.ics.asterix.om.types.AOrderedListType;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
public interface IAOrderedListBuilder {
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IARecordBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IARecordBuilder.java
index 18699f1..544b532 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IARecordBuilder.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IARecordBuilder.java
@@ -19,7 +19,7 @@
import java.io.IOException;
import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
/**
* A record builder helps to construct Asterix Records in a serialized format.
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAUnorderedListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAUnorderedListBuilder.java
index f962dfb..50d2038 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAUnorderedListBuilder.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAUnorderedListBuilder.java
@@ -4,7 +4,7 @@
import edu.uci.ics.asterix.om.types.AUnorderedListType;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
public interface IAUnorderedListBuilder {
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/OrderedListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/OrderedListBuilder.java
index dcb0b87..18cec15 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/OrderedListBuilder.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/OrderedListBuilder.java
@@ -10,7 +10,7 @@
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
public class OrderedListBuilder implements IAOrderedListBuilder {
@@ -60,10 +60,10 @@
this.offsets.add((short) outputStream.size());
if (itemTypeTag == ATypeTag.ANY) {
this.numberOfItems++;
- this.outputStream.write(item.getBytes(), item.getStartIndex(), item.getLength());
- } else if (item.getBytes()[0] != serNullTypeTag) {
+ this.outputStream.write(item.getByteArray(), item.getStartOffset(), item.getLength());
+ } else if (item.getByteArray()[0] != serNullTypeTag) {
this.numberOfItems++;
- this.outputStream.write(item.getBytes(), item.getStartIndex() + 1, item.getLength() - 1);
+ this.outputStream.write(item.getByteArray(), item.getStartOffset() + 1, item.getLength() - 1);
}
}
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 fb8d2e4..03f0e20 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
@@ -11,8 +11,8 @@
import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
import edu.uci.ics.hyracks.data.std.accessors.PointableBinaryHashFunctionFactory;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
public class RecordBuilder implements IARecordBuilder {
private int openPartOffset;
@@ -127,9 +127,9 @@
closedPartOffsets[id] = closedPartOutputStream.size();
int len = value.getLength() - 1;
// +1 because we do not store the value tag.
- closedPartOutputStream.write(value.getBytes(), value.getStartIndex() + 1, len);
+ closedPartOutputStream.write(value.getByteArray(), value.getStartOffset() + 1, len);
numberOfClosedFields++;
- if (isNullable && value.getBytes()[0] != SER_NULL_TYPE_TAG) {
+ if (isNullable && value.getByteArray()[0] != SER_NULL_TYPE_TAG) {
nullBitMap[id / 8] |= (byte) (1 << (7 - (id % 8)));
}
}
@@ -142,12 +142,12 @@
for (int i = 0; i < tempOpenPartOffsets.length; i++)
openPartOffsets[i] = tempOpenPartOffsets[i];
}
- fieldNameHashCode = utf8HashFunction.hash(name.getBytes(), name.getStartIndex() + 1, name.getLength());
+ fieldNameHashCode = utf8HashFunction.hash(name.getByteArray(), name.getStartOffset() + 1, name.getLength());
openPartOffsets[this.numberOfOpenFields] = fieldNameHashCode;
openPartOffsets[this.numberOfOpenFields] = (openPartOffsets[numberOfOpenFields] << 32);
openPartOffsets[numberOfOpenFields++] += openPartOutputStream.size();
- openPartOutputStream.write(name.getBytes(), name.getStartIndex() + 1, name.getLength() - 1);
- openPartOutputStream.write(value.getBytes(), value.getStartIndex(), value.getLength());
+ openPartOutputStream.write(name.getByteArray(), name.getStartOffset() + 1, name.getLength() - 1);
+ openPartOutputStream.write(value.getByteArray(), value.getStartOffset(), value.getLength());
}
@Override
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/UnorderedListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/UnorderedListBuilder.java
index 2f74f97..e8dbc29 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/UnorderedListBuilder.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/UnorderedListBuilder.java
@@ -10,7 +10,7 @@
import edu.uci.ics.asterix.om.types.AUnorderedListType;
import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
public class UnorderedListBuilder implements IAUnorderedListBuilder {
@@ -63,10 +63,10 @@
this.offsets.add((short) outputStream.size());
if (itemTypeTag == ATypeTag.ANY) {
this.numberOfItems++;
- this.outputStream.write(item.getBytes(), item.getStartIndex(), item.getLength());
- } else if (item.getBytes()[0] != serNullTypeTag) {
+ this.outputStream.write(item.getByteArray(), item.getStartOffset(), item.getLength());
+ } else if (item.getByteArray()[0] != serNullTypeTag) {
this.numberOfItems++;
- this.outputStream.write(item.getBytes(), item.getStartIndex() + 1, item.getLength() - 1);
+ this.outputStream.write(item.getByteArray(), item.getStartOffset() + 1, item.getLength() - 1);
}
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
index 5494669..694d189 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
@@ -1,3 +1,18 @@
+/*
+ * 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.serde;
import java.io.DataInput;
@@ -33,9 +48,9 @@
private ARecordType recordType;
private int numberOfSchemaFields = 0;
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
private ISerializerDeserializer serializers[];
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
private ISerializerDeserializer deserializers[];
private ARecordSerializerDeserializer() {
@@ -253,11 +268,13 @@
return -1; // this record does not have an open part
int numberOfOpenField = AInt32SerializerDeserializer.getInt(serRecord, openPartOffset);
- int utflength = UTF8StringPointable.getUTFLen(fieldName, 1);
-
- IBinaryHashFunction utf8HashFunction = AqlBinaryHashFunctionFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryHashFunction();
+ int utflength = UTF8StringPointable.getUTFLength(fieldName, 1);
- IBinaryComparator utf8BinaryComparator = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryComparator();
+ IBinaryHashFunction utf8HashFunction = AqlBinaryHashFunctionFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
+ .createBinaryHashFunction();
+
+ IBinaryComparator utf8BinaryComparator = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
+ .createBinaryComparator();
int fieldNameHashCode = utf8HashFunction.hash(fieldName, 1, utflength);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/base/IDataFormat.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/base/IDataFormat.java
index 9142d9e..9da5b8b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/base/IDataFormat.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/base/IDataFormat.java
@@ -20,7 +20,7 @@
import edu.uci.ics.hyracks.algebricks.data.IPrinterFactoryProvider;
import edu.uci.ics.hyracks.algebricks.data.ISerializerDeserializerProvider;
import edu.uci.ics.hyracks.algebricks.data.ITypeTraitProvider;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.INullWriterFactory;
import edu.uci.ics.hyracks.dataflow.std.file.ITupleParserFactory;
@@ -43,10 +43,10 @@
public INullWriterFactory getNullWriterFactory();
- public Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
+ public Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
ARecordType recType, String fldName) throws AlgebricksException;
- public IEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, String fldName, int recordColumn)
+ public ICopyEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, String fldName, int recordColumn)
throws AlgebricksException;
public ITupleParserFactory createTupleParser(ARecordType recType, IParseFileSplitsDecl decl);
@@ -56,9 +56,9 @@
public IFunctionDescriptor resolveFunction(ILogicalExpression expr, IVariableTypeEnvironment typeEnvironment)
throws AlgebricksException;
- public IEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException;
+ public ICopyEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException;
- public IEvaluatorFactory[] createMBRFactory(ARecordType recType, String fldName, int recordColumn, int dimension)
+ public ICopyEvaluatorFactory[] createMBRFactory(ARecordType recType, String fldName, int recordColumn, int dimension)
throws AlgebricksException;
public IExpressionEvalSizeComputer getExpressionEvalSizeComputer();
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/base/TypeComputerUtilities.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/base/TypeComputerUtilities.java
index e8786ec..2c7ff10 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/base/TypeComputerUtilities.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/base/TypeComputerUtilities.java
@@ -1,28 +1,27 @@
+/*
+ * 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.om.typecomputer.base;
-import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
public class TypeComputerUtilities {
- public static void setOpenType(AbstractFunctionCallExpression expr, boolean openType) {
- Boolean openField = true;
- Object[] opaqueParameters = new Object[1];
- opaqueParameters[0] = openField;
- expr.setOpaqueParameters(opaqueParameters);
- }
-
- public static boolean isOpenType(AbstractFunctionCallExpression expr) {
- boolean openType = false;
- Object[] opaqueParameters = expr.getOpaqueParameters();
- if (opaqueParameters != null) {
- openType = (Boolean) opaqueParameters[0];
- }
- return openType;
- }
-
- public static boolean setRequiredAndInputTypes(AbstractFunctionCallExpression expr, ARecordType requiredRecordType,
- ARecordType inputRecordType) {
+ public static boolean setRequiredAndInputTypes(AbstractFunctionCallExpression expr, IAType requiredRecordType,
+ IAType inputRecordType) {
boolean changed = false;
Object opaqueParameter = expr.getOpaqueParameters();
if (opaqueParameter == null) {
@@ -35,22 +34,21 @@
return changed;
}
- public static ARecordType getRequiredType(AbstractFunctionCallExpression expr) {
+ public static IAType getRequiredType(AbstractFunctionCallExpression expr) {
Object[] type = expr.getOpaqueParameters();
if (type != null) {
- ARecordType recordType = (ARecordType) type[0];
- return recordType;
+ IAType returnType = (IAType) type[0];
+ return returnType;
} else
return null;
}
- public static ARecordType getInputType(AbstractFunctionCallExpression expr) {
+ public static IAType getInputType(AbstractFunctionCallExpression expr) {
Object[] type = expr.getOpaqueParameters();
if (type != null) {
- ARecordType recordType = (ARecordType) type[1];
- return recordType;
+ IAType returnType = (IAType) type[1];
+ return returnType;
} else
return null;
}
-
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/ClosedRecordConstructorResultType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/ClosedRecordConstructorResultType.java
index 6a17a46..daf7164 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/ClosedRecordConstructorResultType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/ClosedRecordConstructorResultType.java
@@ -1,3 +1,18 @@
+/*
+ * 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.om.typecomputer.impl;
import java.util.Iterator;
@@ -31,10 +46,10 @@
/**
* if type has been top-down propagated, use the enforced type
*/
- ARecordType type = TypeComputerUtilities.getRequiredType(f);
+ ARecordType type = (ARecordType) TypeComputerUtilities.getRequiredType(f);
if (type != null)
return type;
-
+
int n = f.getArguments().size() / 2;
String[] fieldNames = new String[n];
IAType[] fieldTypes = new IAType[n];
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
index 8b27a82..c46c59b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
@@ -1,3 +1,18 @@
+/*
+ * 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.om.typecomputer.impl;
import java.util.ArrayList;
@@ -33,7 +48,7 @@
/**
* if type has been top-down propagated, use the enforced type
*/
- ARecordType type = TypeComputerUtilities.getRequiredType(f);
+ ARecordType type = (ARecordType) TypeComputerUtilities.getRequiredType(f);
if (type != null)
return type;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListConstructorResultType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListConstructorResultType.java
index 47f239b..01e43d3 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListConstructorResultType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListConstructorResultType.java
@@ -1,3 +1,18 @@
+/*
+ * 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.om.typecomputer.impl;
import java.util.ArrayList;
@@ -24,26 +39,28 @@
public AOrderedListType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) expression;
- boolean openType = TypeComputerUtilities.isOpenType(f);
- int n = f.getArguments().size();
- if (n == 0 || openType) {
- return new AOrderedListType(BuiltinType.ANY, null);
- } else {
- ArrayList<IAType> types = new ArrayList<IAType>();
- for (int k = 0; k < f.getArguments().size(); k++) {
- IAType type = (IAType) env.getType(f.getArguments().get(k).getValue());
- if (type.getTypeTag() == ATypeTag.UNION && NonTaggedFormatUtil.isOptionalField((AUnionType) type))
- type = ((AUnionType) type).getUnionList()
- .get(NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
- if (types.indexOf(type) < 0) {
- types.add(type);
- }
- }
- if (types.size() == 1) {
- return new AOrderedListType(types.get(0), null);
- } else {
- throw new AlgebricksException("You can not construct a heterogenous list.");
+
+ /**
+ * if type has been top-down propagated, use the enforced type
+ */
+ AOrderedListType reqType = (AOrderedListType) TypeComputerUtilities.getRequiredType(f);
+ if (reqType != null)
+ return reqType;
+
+ ArrayList<IAType> types = new ArrayList<IAType>();
+ for (int k = 0; k < f.getArguments().size(); k++) {
+ IAType type = (IAType) env.getType(f.getArguments().get(k).getValue());
+ if (type.getTypeTag() == ATypeTag.UNION && NonTaggedFormatUtil.isOptionalField((AUnionType) type))
+ type = ((AUnionType) type).getUnionList().get(NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ if (types.indexOf(type) < 0) {
+ types.add(type);
}
}
+ if (types.size() == 1) {
+ return new AOrderedListType(types.get(0), null);
+ } else {
+ return new AOrderedListType(BuiltinType.ANY, null);
+ }
+
}
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
index 0e03e6d..2fa36f2 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
@@ -1,3 +1,18 @@
+/*
+ * 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.om.typecomputer.impl;
import java.util.ArrayList;
@@ -24,26 +39,28 @@
public AUnorderedListType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) expression;
- boolean openType = TypeComputerUtilities.isOpenType(f);
- int n = f.getArguments().size();
- if (n == 0 || openType) {
- return new AUnorderedListType(BuiltinType.ANY, null);
- } else {
- ArrayList<IAType> types = new ArrayList<IAType>();
- for (int k = 0; k < f.getArguments().size(); k++) {
- IAType type = (IAType) env.getType(f.getArguments().get(k).getValue());
- if (type.getTypeTag() == ATypeTag.UNION && NonTaggedFormatUtil.isOptionalField((AUnionType) type))
- type = ((AUnionType) type).getUnionList()
- .get(NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
- if (types.indexOf(type) < 0) {
- types.add(type);
- }
- }
- if (types.size() == 1) {
- return new AUnorderedListType(types.get(0), null);
- } else {
- throw new AlgebricksException("You can not construct a heterogenous list.");
+
+ /**
+ * if type has been top-down propagated, use the enforced type
+ */
+ AUnorderedListType reqType = (AUnorderedListType) TypeComputerUtilities.getRequiredType(f);
+ if (reqType != null)
+ return reqType;
+
+ ArrayList<IAType> types = new ArrayList<IAType>();
+ for (int k = 0; k < f.getArguments().size(); k++) {
+ IAType type = (IAType) env.getType(f.getArguments().get(k).getValue());
+ if (type.getTypeTag() == ATypeTag.UNION && NonTaggedFormatUtil.isOptionalField((AUnionType) type))
+ type = ((AUnionType) type).getUnionList().get(NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ if (types.indexOf(type) < 0) {
+ types.add(type);
}
}
+ if (types.size() == 1) {
+ return new AUnorderedListType(types.get(0), null);
+ } else {
+ return new AUnorderedListType(BuiltinType.ANY, null);
+ }
+
}
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AUnionType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AUnionType.java
index 4e77e0d..1e70f15 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AUnionType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AUnionType.java
@@ -27,7 +27,7 @@
}
public boolean isNullableType() {
- return unionList.size() == 2 && unionList.get(0).equals(BuiltinType.ANULL);
+ return unionList.size() == 2 && unionList.get(0).equals(BuiltinType.ANULL);
}
@Override
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/BuiltinType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/BuiltinType.java
index 3af6e6f..0ec3b21 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/BuiltinType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/BuiltinType.java
@@ -515,15 +515,26 @@
return getTypeTag().toString();
}
- @Override
- public boolean deepEqual(IAObject obj) {
- return obj == this;
- }
+ @Override
+ public boolean deepEqual(IAObject obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof BuiltinType)) {
+ return false;
+ }
+ return ((BuiltinType) obj).getTypeTag().equals(getTypeTag());
+ }
@Override
public boolean equals(Object object) {
return this.deepEqual((IAObject) object);
}
+
+ @Override
+ public int hashCode() {
+ return getTypeTag().hashCode();
+ }
@Override
public int hash() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
index c238af4..05aa2ea 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
@@ -7,8 +7,8 @@
import edu.uci.ics.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class ListifyAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
@@ -33,7 +33,7 @@
}
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
return new ListifyAggregateFunctionEvalFactory(args, oltype);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
index 84ebe91..b7d295a 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
@@ -6,33 +6,33 @@
import edu.uci.ics.asterix.builders.OrderedListBuilder;
import edu.uci.ics.asterix.om.types.AOrderedListType;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public class ListifyAggregateFunctionEvalFactory implements IAggregateFunctionFactory {
+public class ListifyAggregateFunctionEvalFactory implements ICopyAggregateFunctionFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory[] args;
+ private ICopyEvaluatorFactory[] args;
private final AOrderedListType orderedlistType;
- public ListifyAggregateFunctionEvalFactory(IEvaluatorFactory[] args, AOrderedListType type) {
+ public ListifyAggregateFunctionEvalFactory(ICopyEvaluatorFactory[] args, AOrderedListType type) {
this.args = args;
this.orderedlistType = type;
}
@Override
- public IAggregateFunction createAggregateFunction(final IDataOutputProvider provider) throws AlgebricksException {
+ public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider) throws AlgebricksException {
- return new IAggregateFunction() {
+ return new ICopyAggregateFunction() {
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
private DataOutput out = provider.getDataOutput();
private OrderedListBuilder builder = new OrderedListBuilder();
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
index acc1e09..c8cfbbe 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
@@ -24,10 +24,10 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -49,17 +49,17 @@
}
@Override
- public ISerializableAggregateFunctionFactory createAggregateFunctionFactory(IEvaluatorFactory[] args)
+ public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- final IEvaluatorFactory[] evals = args;
+ final ICopyEvaluatorFactory[] evals = args;
- return new ISerializableAggregateFunctionFactory() {
+ return new ICopySerializableAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
- public ISerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
- return new ISerializableAggregateFunction() {
+ public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
+ return new ICopySerializableAggregateFunction() {
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = evals[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = evals[0].createEvaluator(inputVal);
private AMutableDouble aDouble = new AMutableDouble(0);
@SuppressWarnings("unchecked")
@@ -91,35 +91,35 @@
if (inputVal.getLength() > 0) {
++count;
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
- .deserialize(inputVal.getBytes()[0]);
+ .deserialize(inputVal.getByteArray()[0]);
switch (typeTag) {
case INT8: {
- byte val = AInt8SerializerDeserializer.getByte(inputVal.getBytes(), 1);
+ byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT16: {
- short val = AInt16SerializerDeserializer.getShort(inputVal.getBytes(), 1);
+ short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT32: {
- int val = AInt32SerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT64: {
- long val = AInt64SerializerDeserializer.getLong(inputVal.getBytes(), 1);
+ long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
sum += val;
break;
}
case FLOAT: {
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getBytes(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
sum += val;
break;
}
case DOUBLE: {
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getBytes(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
sum += val;
break;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
index 0c96111..b030d11 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
@@ -13,9 +13,9 @@
import edu.uci.ics.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -39,15 +39,15 @@
}
@Override
- public ISerializableAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new ISerializableAggregateFunctionFactory() {
+ return new ICopySerializableAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public ISerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
+ public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
- return new ISerializableAggregateFunction() {
+ return new ICopySerializableAggregateFunction() {
private AMutableInt32 result = new AMutableInt32(-1);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<AInt32> int32Serde = AqlSerializerDeserializerProvider.INSTANCE
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
index b2c9be8..d281750 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
@@ -30,10 +30,10 @@
import edu.uci.ics.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory.ClosedRecordConstructorEval;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.comm.io.ByteArrayAccessibleOutputStream;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -58,24 +58,24 @@
}
@Override
- public ISerializableAggregateFunctionFactory createAggregateFunctionFactory(IEvaluatorFactory[] args)
+ public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- final IEvaluatorFactory[] evals = args;
+ final ICopyEvaluatorFactory[] evals = args;
List<IAType> unionList = new ArrayList<IAType>();
unionList.add(BuiltinType.ANULL);
unionList.add(BuiltinType.ADOUBLE);
final ARecordType recType = new ARecordType(null, new String[] { "sum", "count" }, new IAType[] {
new AUnionType(unionList, "OptionalDouble"), BuiltinType.AINT64 }, true);
- return new ISerializableAggregateFunctionFactory() {
+ return new ICopySerializableAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public ISerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
+ public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
- return new ISerializableAggregateFunction() {
+ return new ICopySerializableAggregateFunction() {
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = evals[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = evals[0].createEvaluator(inputVal);
private AMutableDouble aDouble = new AMutableDouble(0);
private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -84,8 +84,8 @@
private DataOutput sumBytesOutput = new DataOutputStream(sumBytes);
private ByteArrayAccessibleOutputStream countBytes = new ByteArrayAccessibleOutputStream();
private DataOutput countBytesOutput = new DataOutputStream(countBytes);
- private IEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
- private IEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
+ private ICopyEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
+ private ICopyEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
private ClosedRecordConstructorEval recordEval;
@SuppressWarnings("unchecked")
@@ -118,7 +118,7 @@
inputVal.reset();
eval.evaluate(tuple);
- byte[] serBytes = inputVal.getBytes();
+ byte[] serBytes = inputVal.getByteArray();
if (serBytes[0] == SER_NULL_TYPE_TAG)
metNull = true;
if (serBytes[0] != SER_RECORD_TYPE_TAG) {
@@ -171,7 +171,7 @@
if (recordEval == null)
recordEval = new ClosedRecordConstructorEval(recType,
- new IEvaluator[] { evalSum, evalCount }, avgBytes, result);
+ new ICopyEvaluator[] { evalSum, evalCount }, avgBytes, result);
if (globalCount == 0) {
GlobalConfig.ASTERIX_LOGGER.fine("AVG aggregate ran over empty input.");
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java
index 9d65ad4..c04dcf0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java
@@ -34,10 +34,10 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.comm.io.ByteArrayAccessibleOutputStream;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -60,22 +60,22 @@
}
@Override
- public ISerializableAggregateFunctionFactory createAggregateFunctionFactory(IEvaluatorFactory[] args)
+ public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- final IEvaluatorFactory[] evals = args;
+ final ICopyEvaluatorFactory[] evals = args;
List<IAType> unionList = new ArrayList<IAType>();
unionList.add(BuiltinType.ANULL);
unionList.add(BuiltinType.ADOUBLE);
final ARecordType recType = new ARecordType(null, new String[] { "sum", "count" }, new IAType[] {
new AUnionType(unionList, "OptionalDouble"), BuiltinType.AINT64 }, true);
- return new ISerializableAggregateFunctionFactory() {
+ return new ICopySerializableAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
- public ISerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
- return new ISerializableAggregateFunction() {
+ public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
+ return new ICopySerializableAggregateFunction() {
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = evals[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = evals[0].createEvaluator(inputVal);
private ClosedRecordConstructorEval recordEval;
private AMutableDouble aDouble = new AMutableDouble(0);
@@ -96,8 +96,8 @@
private DataOutput sumBytesOutput = new DataOutputStream(sumBytes);
private ByteArrayAccessibleOutputStream countBytes = new ByteArrayAccessibleOutputStream();
private DataOutput countBytesOutput = new DataOutputStream(countBytes);
- private IEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
- private IEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
+ private ICopyEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
+ private ICopyEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
@Override
public void init(DataOutput state) throws AlgebricksException {
@@ -121,35 +121,35 @@
if (inputVal.getLength() > 0) {
++count;
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
- .deserialize(inputVal.getBytes()[0]);
+ .deserialize(inputVal.getByteArray()[0]);
switch (typeTag) {
case INT8: {
- byte val = AInt8SerializerDeserializer.getByte(inputVal.getBytes(), 1);
+ byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT16: {
- short val = AInt16SerializerDeserializer.getShort(inputVal.getBytes(), 1);
+ short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT32: {
- int val = AInt32SerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT64: {
- long val = AInt64SerializerDeserializer.getLong(inputVal.getBytes(), 1);
+ long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
sum += val;
break;
}
case FLOAT: {
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getBytes(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
sum += val;
break;
}
case DOUBLE: {
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getBytes(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
sum += val;
break;
}
@@ -176,7 +176,7 @@
boolean metNull = BufferSerDeUtil.getBoolean(state, start + 16);
if (recordEval == null)
recordEval = new ClosedRecordConstructorEval(recType,
- new IEvaluator[] { evalSum, evalCount }, avgBytes, result);
+ new ICopyEvaluator[] { evalSum, evalCount }, avgBytes, result);
if (count == 0) {
if (GlobalConfig.DEBUG) {
GlobalConfig.ASTERIX_LOGGER.finest("AVG aggregate ran over empty input.");
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java
index ac1b4e1..cbc5358 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java
@@ -28,10 +28,10 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -53,18 +53,18 @@
}
@Override
- public ISerializableAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new ISerializableAggregateFunctionFactory() {
+ return new ICopySerializableAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public ISerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
+ public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
- return new ISerializableAggregateFunction() {
+ return new ICopySerializableAggregateFunction() {
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
private AMutableDouble aDouble = new AMutableDouble(0);
private AMutableFloat aFloat = new AMutableFloat(0);
private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -107,41 +107,41 @@
eval.evaluate(tuple);
if (inputVal.getLength() > 0) {
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
- .deserialize(inputVal.getBytes()[0]);
+ .deserialize(inputVal.getByteArray()[0]);
switch (typeTag) {
case INT8: {
metInt8s = true;
- byte val = AInt8SerializerDeserializer.getByte(inputVal.getBytes(), 1);
+ byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT16: {
metInt16s = true;
- short val = AInt16SerializerDeserializer.getShort(inputVal.getBytes(), 1);
+ short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT32: {
metInt32s = true;
- int val = AInt32SerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT64: {
metInt64s = true;
- long val = AInt64SerializerDeserializer.getLong(inputVal.getBytes(), 1);
+ long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
sum += val;
break;
}
case FLOAT: {
metFloats = true;
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getBytes(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
sum += val;
break;
}
case DOUBLE: {
metDoubles = true;
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getBytes(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
sum += val;
break;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/AvgAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/AvgAggregateDescriptor.java
index 028a9a2..078e32d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/AvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/AvgAggregateDescriptor.java
@@ -34,10 +34,10 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.comm.io.ByteArrayAccessibleOutputStream;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -61,7 +61,7 @@
}
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
List<IAType> unionList = new ArrayList<IAType>();
unionList.add(BuiltinType.ANULL);
@@ -69,18 +69,18 @@
final ARecordType recType = new ARecordType(null, new String[] { "sum", "count" }, new IAType[] {
new AUnionType(unionList, "OptionalDouble"), BuiltinType.AINT32 }, true);
- return new IAggregateFunctionFactory() {
+ return new ICopyAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+ public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
throws AlgebricksException {
- return new IAggregateFunction() {
+ return new ICopyAggregateFunction() {
private DataOutput out = provider.getDataOutput();
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
private double sum;
private int count;
private AMutableDouble aDouble = new AMutableDouble(0);
@@ -91,10 +91,10 @@
private DataOutput sumBytesOutput = new DataOutputStream(sumBytes);
private ByteArrayAccessibleOutputStream countBytes = new ByteArrayAccessibleOutputStream();
private DataOutput countBytesOutput = new DataOutputStream(countBytes);
- private IEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
- private IEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
+ private ICopyEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
+ private ICopyEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
private ClosedRecordConstructorEval recordEval = new ClosedRecordConstructorEval(recType,
- new IEvaluator[] { evalSum, evalCount }, avgBytes, out);
+ new ICopyEvaluator[] { evalSum, evalCount }, avgBytes, out);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ADouble> doubleSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -120,35 +120,35 @@
if (inputVal.getLength() > 0) {
++count;
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
- .deserialize(inputVal.getBytes()[0]);
+ .deserialize(inputVal.getByteArray()[0]);
switch (typeTag) {
case INT8: {
- byte val = AInt8SerializerDeserializer.getByte(inputVal.getBytes(), 1);
+ byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT16: {
- short val = AInt16SerializerDeserializer.getShort(inputVal.getBytes(), 1);
+ short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT32: {
- int val = AInt32SerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT64: {
- long val = AInt64SerializerDeserializer.getLong(inputVal.getBytes(), 1);
+ long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
sum += val;
break;
}
case FLOAT: {
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getBytes(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
sum += val;
break;
}
case DOUBLE: {
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getBytes(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
sum += val;
break;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/CountAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/CountAggregateDescriptor.java
index 99c845a..f0f7602 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/CountAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/CountAggregateDescriptor.java
@@ -13,9 +13,9 @@
import edu.uci.ics.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -40,18 +40,18 @@
}
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new IAggregateFunctionFactory() {
+ return new ICopyAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IAggregateFunction createAggregateFunction(IDataOutputProvider provider) throws AlgebricksException {
+ public ICopyAggregateFunction createAggregateFunction(IDataOutputProvider provider) throws AlgebricksException {
final DataOutput out = provider.getDataOutput();
- return new IAggregateFunction() {
+ return new ICopyAggregateFunction() {
private AMutableInt32 result = new AMutableInt32(-1);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<AInt32> int32Serde = AqlSerializerDeserializerProvider.INSTANCE
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/GlobalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/GlobalAvgAggregateDescriptor.java
index f1d6fbd..172cd62 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/GlobalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/GlobalAvgAggregateDescriptor.java
@@ -30,10 +30,10 @@
import edu.uci.ics.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory.ClosedRecordConstructorEval;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.comm.io.ByteArrayAccessibleOutputStream;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -59,7 +59,7 @@
}
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
List<IAType> unionList = new ArrayList<IAType>();
unionList.add(BuiltinType.ANULL);
@@ -67,18 +67,18 @@
final ARecordType recType = new ARecordType(null, new String[] { "sum", "count" }, new IAType[] {
new AUnionType(unionList, "OptionalDouble"), BuiltinType.AINT32 }, false);
- return new IAggregateFunctionFactory() {
+ return new ICopyAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+ public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
throws AlgebricksException {
- return new IAggregateFunction() {
+ return new ICopyAggregateFunction() {
private DataOutput out = provider.getDataOutput();
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
private double globalSum;
private int globalCount;
private AMutableDouble aDouble = new AMutableDouble(0);
@@ -89,10 +89,10 @@
private DataOutput sumBytesOutput = new DataOutputStream(sumBytes);
private ByteArrayAccessibleOutputStream countBytes = new ByteArrayAccessibleOutputStream();
private DataOutput countBytesOutput = new DataOutputStream(countBytes);
- private IEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
- private IEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
+ private ICopyEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
+ private ICopyEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
private ClosedRecordConstructorEval recordEval = new ClosedRecordConstructorEval(recType,
- new IEvaluator[] { evalSum, evalCount }, avgBytes, out);
+ new ICopyEvaluator[] { evalSum, evalCount }, avgBytes, out);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<AInt32> intSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -116,7 +116,7 @@
public void step(IFrameTupleReference tuple) throws AlgebricksException {
inputVal.reset();
eval.evaluate(tuple);
- byte[] serBytes = inputVal.getBytes();
+ byte[] serBytes = inputVal.getByteArray();
if (serBytes[0] == SER_NULL_TYPE_TAG)
metNull = true;
if (serBytes[0] != SER_RECORD_TYPE_TAG) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/LocalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/LocalAvgAggregateDescriptor.java
index 88d917f..f58a084 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/LocalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/LocalAvgAggregateDescriptor.java
@@ -34,10 +34,10 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.comm.io.ByteArrayAccessibleOutputStream;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -61,14 +61,14 @@
}
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new IAggregateFunctionFactory() {
+ return new ICopyAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+ public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
throws AlgebricksException {
List<IAType> unionList = new ArrayList<IAType>();
@@ -77,11 +77,11 @@
final ARecordType recType = new ARecordType(null, new String[] { "sum", "count" }, new IAType[] {
new AUnionType(unionList, "OptionalDouble"), BuiltinType.AINT32 }, false);
- return new IAggregateFunction() {
+ return new ICopyAggregateFunction() {
private DataOutput out = provider.getDataOutput();
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
private double sum;
private int count;
@@ -90,10 +90,10 @@
private DataOutput sumBytesOutput = new DataOutputStream(sumBytes);
private ByteArrayAccessibleOutputStream countBytes = new ByteArrayAccessibleOutputStream();
private DataOutput countBytesOutput = new DataOutputStream(countBytes);
- private IEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
- private IEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
+ private ICopyEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
+ private ICopyEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
private ClosedRecordConstructorEval recordEval = new ClosedRecordConstructorEval(recType,
- new IEvaluator[] { evalSum, evalCount }, avgBytes, out);
+ new ICopyEvaluator[] { evalSum, evalCount }, avgBytes, out);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ADouble> doubleSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ADOUBLE);
@@ -121,35 +121,35 @@
if (inputVal.getLength() > 0) {
++count;
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
- .deserialize(inputVal.getBytes()[0]);
+ .deserialize(inputVal.getByteArray()[0]);
switch (typeTag) {
case INT8: {
- byte val = AInt8SerializerDeserializer.getByte(inputVal.getBytes(), 1);
+ byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT16: {
- short val = AInt16SerializerDeserializer.getShort(inputVal.getBytes(), 1);
+ short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT32: {
- int val = AInt32SerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT64: {
- long val = AInt64SerializerDeserializer.getLong(inputVal.getBytes(), 1);
+ long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
sum += val;
break;
}
case FLOAT: {
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getBytes(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
sum += val;
break;
}
case DOUBLE: {
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getBytes(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
sum += val;
break;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MaxAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MaxAggregateDescriptor.java
index 6f7ac58..2fcca4c 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MaxAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MaxAggregateDescriptor.java
@@ -26,10 +26,10 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -53,20 +53,20 @@
@SuppressWarnings("unchecked")
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new IAggregateFunctionFactory() {
+ return new ICopyAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+ public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
throws AlgebricksException {
- return new IAggregateFunction() {
+ return new ICopyAggregateFunction() {
private DataOutput out = provider.getDataOutput();
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
private boolean metInt8s, metInt16s, metInt32s, metInt64s, metFloats, metDoubles, metNull;
private short shortVal = Short.MIN_VALUE;
@@ -106,7 +106,7 @@
eval.evaluate(tuple);
if (inputVal.getLength() > 0) {
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
- .deserialize(inputVal.getBytes()[0]);
+ .deserialize(inputVal.getByteArray()[0]);
switch (typeTag) {
case INT8: {
metInt8s = true;
@@ -114,35 +114,35 @@
}
case INT16: {
metInt16s = true;
- short val = AInt16SerializerDeserializer.getShort(inputVal.getBytes(), 1);
+ short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
if (val > shortVal)
shortVal = val;
throw new NotImplementedException("no implementation for int16's comparator");
}
case INT32: {
metInt32s = true;
- int val = AInt32SerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
if (val > intVal)
intVal = val;
break;
}
case INT64: {
metInt64s = true;
- long val = AInt64SerializerDeserializer.getLong(inputVal.getBytes(), 1);
+ long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
if (val > longVal)
longVal = val;
break;
}
case FLOAT: {
metFloats = true;
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getBytes(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
if (val > floatVal)
floatVal = val;
break;
}
case DOUBLE: {
metDoubles = true;
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getBytes(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
if (val > doubleVal)
doubleVal = val;
break;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MinAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MinAggregateDescriptor.java
index 2b36918..8abf8b5 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MinAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MinAggregateDescriptor.java
@@ -26,10 +26,10 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -53,20 +53,20 @@
@SuppressWarnings("unchecked")
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new IAggregateFunctionFactory() {
+ return new ICopyAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+ public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
throws AlgebricksException {
- return new IAggregateFunction() {
+ return new ICopyAggregateFunction() {
private DataOutput out = provider.getDataOutput();
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
private boolean metInt8s, metInt16s, metInt32s, metInt64s, metFloats, metDoubles, metNull;
private short shortVal = Short.MAX_VALUE;
@@ -106,7 +106,7 @@
eval.evaluate(tuple);
if (inputVal.getLength() > 0) {
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
- .deserialize(inputVal.getBytes()[0]);
+ .deserialize(inputVal.getByteArray()[0]);
switch (typeTag) {
case INT8: {
metInt8s = true;
@@ -114,35 +114,35 @@
}
case INT16: {
metInt16s = true;
- short val = AInt16SerializerDeserializer.getShort(inputVal.getBytes(), 1);
+ short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
if (val < shortVal)
shortVal = val;
throw new NotImplementedException("no implementation for int16's comparator");
}
case INT32: {
metInt32s = true;
- int val = AInt32SerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
if (val < intVal)
intVal = val;
break;
}
case INT64: {
metInt64s = true;
- long val = AInt64SerializerDeserializer.getLong(inputVal.getBytes(), 1);
+ long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
if (val < longVal)
longVal = val;
break;
}
case FLOAT: {
metFloats = true;
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getBytes(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
if (val < floatVal)
floatVal = val;
break;
}
case DOUBLE: {
metDoubles = true;
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getBytes(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
if (val < doubleVal)
doubleVal = val;
break;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/SumAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/SumAggregateDescriptor.java
index e51badd..197878b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/SumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/SumAggregateDescriptor.java
@@ -28,10 +28,10 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -55,20 +55,20 @@
@SuppressWarnings("unchecked")
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new IAggregateFunctionFactory() {
+ return new ICopyAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+ public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
throws AlgebricksException {
- return new IAggregateFunction() {
+ return new ICopyAggregateFunction() {
private DataOutput out = provider.getDataOutput();
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
private boolean metInt8s, metInt16s, metInt32s, metInt64s, metFloats, metDoubles, metNull;
private double sum;
private AMutableDouble aDouble = new AMutableDouble(0);
@@ -98,41 +98,41 @@
eval.evaluate(tuple);
if (inputVal.getLength() > 0) {
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
- .deserialize(inputVal.getBytes()[0]);
+ .deserialize(inputVal.getByteArray()[0]);
switch (typeTag) {
case INT8: {
metInt8s = true;
- byte val = AInt8SerializerDeserializer.getByte(inputVal.getBytes(), 1);
+ byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT16: {
metInt16s = true;
- short val = AInt16SerializerDeserializer.getShort(inputVal.getBytes(), 1);
+ short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT32: {
metInt32s = true;
- int val = AInt32SerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
sum += val;
break;
}
case INT64: {
metInt64s = true;
- long val = AInt64SerializerDeserializer.getLong(inputVal.getBytes(), 1);
+ long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
sum += val;
break;
}
case FLOAT: {
metFloats = true;
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getBytes(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
sum += val;
break;
}
case DOUBLE: {
metDoubles = true;
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getBytes(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
sum += val;
break;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/stream/NonEmptyStreamAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/stream/NonEmptyStreamAggregateDescriptor.java
index 3afc3c0..a48a99f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/stream/NonEmptyStreamAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/stream/NonEmptyStreamAggregateDescriptor.java
@@ -11,9 +11,9 @@
import edu.uci.ics.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -32,17 +32,17 @@
};
@Override
- public IAggregateFunctionFactory createAggregateFunctionFactory(IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new IAggregateFunctionFactory() {
+ return new ICopyAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+ public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
throws AlgebricksException {
- return new IAggregateFunction() {
+ return new ICopyAggregateFunction() {
private DataOutput out = provider.getDataOutput();
@SuppressWarnings("rawtypes")
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/AsterixTupleFilter.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/AsterixTupleFilter.java
index 8bb0b9f..da006bd 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/AsterixTupleFilter.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/AsterixTupleFilter.java
@@ -17,28 +17,28 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.data.IBinaryBooleanInspector;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.primitive.VoidPointable;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
import edu.uci.ics.hyracks.storage.am.common.api.ITupleFilter;
public class AsterixTupleFilter implements ITupleFilter {
-
- private final IBinaryBooleanInspector boolInspector;
- private final IEvaluator eval;
- private final ArrayBackedValueStorage evalOut = new ArrayBackedValueStorage();
-
- public AsterixTupleFilter(IEvaluatorFactory evalFactory,
- IBinaryBooleanInspector boolInspector) throws AlgebricksException {
- this.boolInspector = boolInspector;
- eval = evalFactory.createEvaluator(evalOut);
- }
-
- @Override
- public boolean accept(IFrameTupleReference tuple) throws Exception {
- evalOut.reset();
- eval.evaluate(tuple);
- return boolInspector.getBooleanValue(evalOut.getBytes(), 0, 2);
- }
+
+ private final IBinaryBooleanInspector boolInspector;
+ private final IScalarEvaluator eval;
+ private final IPointable p = VoidPointable.FACTORY.createPointable();
+
+ public AsterixTupleFilter(IScalarEvaluatorFactory evalFactory, IBinaryBooleanInspector boolInspector)
+ throws AlgebricksException {
+ this.boolInspector = boolInspector;
+ eval = evalFactory.createScalarEvaluator();
+ }
+
+ @Override
+ public boolean accept(IFrameTupleReference tuple) throws Exception {
+ eval.evaluate(tuple, p);
+ return boolInspector.getBooleanValue(p.getByteArray(), p.getStartOffset(), p.getLength());
+ }
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/AsterixTupleFilterFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/AsterixTupleFilterFactory.java
index ce5cefd..1495b72 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/AsterixTupleFilterFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/AsterixTupleFilterFactory.java
@@ -17,23 +17,23 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.data.IBinaryBooleanInspector;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
import edu.uci.ics.hyracks.storage.am.common.api.ITupleFilter;
import edu.uci.ics.hyracks.storage.am.common.api.ITupleFilterFactory;
public class AsterixTupleFilterFactory implements ITupleFilterFactory {
private static final long serialVersionUID = 1L;
-
+
private final IBinaryBooleanInspector boolInspector;
- private final IEvaluatorFactory evalFactory;
-
- public AsterixTupleFilterFactory(IEvaluatorFactory evalFactory,
- IBinaryBooleanInspector boolInspector) throws AlgebricksException {
+ private final IScalarEvaluatorFactory evalFactory;
+
+ public AsterixTupleFilterFactory(IScalarEvaluatorFactory evalFactory, IBinaryBooleanInspector boolInspector)
+ throws AlgebricksException {
this.evalFactory = evalFactory;
this.boolInspector = boolInspector;
}
-
+
@Override
public ITupleFilter createTupleFilter() throws Exception {
return new AsterixTupleFilter(evalFactory, boolInspector);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IAggregateFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IAggregateFunctionDynamicDescriptor.java
index bb87e723..95c604a 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IAggregateFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IAggregateFunctionDynamicDescriptor.java
@@ -2,10 +2,10 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public interface IAggregateFunctionDynamicDescriptor extends IFunctionDescriptor {
- public IAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IRunningAggregateFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IRunningAggregateFunctionDynamicDescriptor.java
index 58fae4b..7ab7261 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IRunningAggregateFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IRunningAggregateFunctionDynamicDescriptor.java
@@ -3,10 +3,10 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IRunningAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
public interface IRunningAggregateFunctionDynamicDescriptor extends IFunctionDescriptor {
- public IRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IScalarFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IScalarFunctionDynamicDescriptor.java
index 5c9a6bd..8e4353e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IScalarFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IScalarFunctionDynamicDescriptor.java
@@ -3,8 +3,8 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public interface IScalarFunctionDynamicDescriptor extends IFunctionDescriptor {
- public IEvaluatorFactory createEvaluatorFactory(IEvaluatorFactory[] args) throws AlgebricksException;
+ public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/ISerializableAggregateFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/ISerializableAggregateFunctionDynamicDescriptor.java
index 7250ef4..810af16 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/ISerializableAggregateFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/ISerializableAggregateFunctionDynamicDescriptor.java
@@ -2,10 +2,10 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
public interface ISerializableAggregateFunctionDynamicDescriptor extends IFunctionDescriptor {
- public ISerializableAggregateFunctionFactory createAggregateFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IUnnestingFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IUnnestingFunctionDynamicDescriptor.java
index 959b025..3f55539 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IUnnestingFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IUnnestingFunctionDynamicDescriptor.java
@@ -2,10 +2,10 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
public interface IUnnestingFunctionDynamicDescriptor extends IFunctionDescriptor {
- public IUnnestingFunctionFactory createUnnestingFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AccessibleByteArrayEval.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AccessibleByteArrayEval.java
index 8e69515..deb40eb 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AccessibleByteArrayEval.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AccessibleByteArrayEval.java
@@ -5,11 +5,11 @@
import java.io.IOException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
import edu.uci.ics.hyracks.dataflow.common.comm.io.ByteArrayAccessibleOutputStream;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public class AccessibleByteArrayEval implements IEvaluator {
+public class AccessibleByteArrayEval implements ICopyEvaluator {
private DataOutput out;
private ByteArrayAccessibleOutputStream baaos;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/ClosedRecordConstructorEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/ClosedRecordConstructorEvalFactory.java
index 15ab112..069b8a3 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/ClosedRecordConstructorEvalFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/ClosedRecordConstructorEvalFactory.java
@@ -8,28 +8,28 @@
import edu.uci.ics.asterix.om.types.ARecordType;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public class ClosedRecordConstructorEvalFactory implements IEvaluatorFactory {
+public class ClosedRecordConstructorEvalFactory implements ICopyEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory[] args;
+ private ICopyEvaluatorFactory[] args;
private ARecordType recType;
- public ClosedRecordConstructorEvalFactory(IEvaluatorFactory[] args, ARecordType recType) {
+ public ClosedRecordConstructorEvalFactory(ICopyEvaluatorFactory[] args, ARecordType recType) {
this.args = args;
this.recType = recType;
}
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
int n = args.length / 2;
- IEvaluator[] evalFields = new IEvaluator[n];
+ ICopyEvaluator[] evalFields = new ICopyEvaluator[n];
ArrayBackedValueStorage fieldValueBuffer = new ArrayBackedValueStorage();
for (int i = 0; i < n; i++) {
evalFields[i] = args[2 * i + 1].createEvaluator(fieldValueBuffer);
@@ -38,9 +38,9 @@
return new ClosedRecordConstructorEval(recType, evalFields, fieldValueBuffer, out);
}
- public static class ClosedRecordConstructorEval implements IEvaluator {
+ public static class ClosedRecordConstructorEval implements ICopyEvaluator {
- private IEvaluator[] evalFields;
+ private ICopyEvaluator[] evalFields;
private DataOutput out;
private IARecordBuilder recBuilder = new RecordBuilder();
private ARecordType recType;
@@ -48,7 +48,7 @@
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
private boolean first = true;
- public ClosedRecordConstructorEval(ARecordType recType, IEvaluator[] evalFields,
+ public ClosedRecordConstructorEval(ARecordType recType, ICopyEvaluator[] evalFields,
ArrayBackedValueStorage fieldValueBuffer, DataOutput out) {
this.evalFields = evalFields;
this.fieldValueBuffer = fieldValueBuffer;
@@ -67,7 +67,7 @@
for (int i = 0; i < evalFields.length; i++) {
fieldValueBuffer.reset();
evalFields[i].evaluate(tuple);
- if (fieldValueBuffer.getBytes()[0] != SER_NULL_TYPE_TAG) {
+ if (fieldValueBuffer.getByteArray()[0] != SER_NULL_TYPE_TAG) {
recBuilder.addField(i, fieldValueBuffer);
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/CreateMBREvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
index d7404bb..ed7b9bb 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
@@ -16,31 +16,31 @@
import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public class CreateMBREvalFactory implements IEvaluatorFactory {
+public class CreateMBREvalFactory implements ICopyEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory recordEvalFactory;
- private IEvaluatorFactory dimensionEvalFactory;
- private IEvaluatorFactory coordinateEvalFactory;
+ private ICopyEvaluatorFactory recordEvalFactory;
+ private ICopyEvaluatorFactory dimensionEvalFactory;
+ private ICopyEvaluatorFactory coordinateEvalFactory;
- public CreateMBREvalFactory(IEvaluatorFactory recordEvalFactory, IEvaluatorFactory dimensionEvalFactory,
- IEvaluatorFactory coordinateEvalFactory) {
+ public CreateMBREvalFactory(ICopyEvaluatorFactory recordEvalFactory, ICopyEvaluatorFactory dimensionEvalFactory,
+ ICopyEvaluatorFactory coordinateEvalFactory) {
this.recordEvalFactory = recordEvalFactory;
this.dimensionEvalFactory = dimensionEvalFactory;
this.coordinateEvalFactory = coordinateEvalFactory;
}
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
@@ -48,9 +48,9 @@
private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput2 = new ArrayBackedValueStorage();
- private IEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
- private IEvaluator eval1 = dimensionEvalFactory.createEvaluator(outInput1);
- private IEvaluator eval2 = coordinateEvalFactory.createEvaluator(outInput2);
+ private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
+ private ICopyEvaluator eval1 = dimensionEvalFactory.createEvaluator(outInput1);
+ private ICopyEvaluator eval2 = coordinateEvalFactory.createEvaluator(outInput2);
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -63,11 +63,11 @@
try {
- int dimension = AInt32SerializerDeserializer.getInt(outInput1.getBytes(), 1);
- int coordinate = AInt32SerializerDeserializer.getInt(outInput2.getBytes(), 1);
+ int dimension = AInt32SerializerDeserializer.getInt(outInput1.getByteArray(), 1);
+ int coordinate = AInt32SerializerDeserializer.getInt(outInput2.getByteArray(), 1);
double value;
if (dimension == 2) {
- ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getBytes()[0]);
+ ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0]);
switch (tag) {
case POINT:
switch (coordinate) {
@@ -75,7 +75,7 @@
// for
// max x, and 3 for max y
case 2: {
- double x = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double x = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
value = x;
@@ -83,7 +83,7 @@
break;
case 1:
case 3: {
- double y = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double y = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
value = y;
@@ -101,9 +101,9 @@
case 0: {
value = Double.MAX_VALUE;
double startX = ADoubleSerializerDeserializer
- .getDouble(outInput0.getBytes(), ALineSerializerDeserializer
+ .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
- double endX = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double endX = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
value = Math.min(Math.min(startX, endX), value);
@@ -112,9 +112,9 @@
case 1: {
value = Double.MAX_VALUE;
double startY = ADoubleSerializerDeserializer
- .getDouble(outInput0.getBytes(), ALineSerializerDeserializer
+ .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
- double endY = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double endY = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
value = Math.min(Math.min(startY, endY), value);
@@ -123,9 +123,9 @@
case 2: {
value = Double.MIN_VALUE;
double startX = ADoubleSerializerDeserializer
- .getDouble(outInput0.getBytes(), ALineSerializerDeserializer
+ .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
- double endX = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double endX = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
value = Math.max(Math.min(startX, endX), value);
@@ -134,9 +134,9 @@
case 3: {
value = Double.MIN_VALUE;
double startY = ADoubleSerializerDeserializer
- .getDouble(outInput0.getBytes(), ALineSerializerDeserializer
+ .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
- double endY = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double endY = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
value = Math.max(Math.min(startY, endY), value);
@@ -149,14 +149,14 @@
}
break;
case POLYGON:
- int numOfPoints = AInt16SerializerDeserializer.getShort(outInput0.getBytes(),
+ int numOfPoints = AInt16SerializerDeserializer.getShort(outInput0.getByteArray(),
APolygonSerializerDeserializer.getNumberOfPointsOffset());
switch (coordinate) {
case 0: {
value = Double.MAX_VALUE;
for (int i = 0; i < numOfPoints; i++) {
double x = ADoubleSerializerDeserializer
- .getDouble(outInput0.getBytes(), APolygonSerializerDeserializer
+ .getDouble(outInput0.getByteArray(), APolygonSerializerDeserializer
.getCoordinateOffset(i, Coordinate.X));
value = Math.min(x, value);
}
@@ -166,7 +166,7 @@
value = Double.MAX_VALUE;
for (int i = 0; i < numOfPoints; i++) {
double y = ADoubleSerializerDeserializer
- .getDouble(outInput0.getBytes(), APolygonSerializerDeserializer
+ .getDouble(outInput0.getByteArray(), APolygonSerializerDeserializer
.getCoordinateOffset(i, Coordinate.Y));
value = Math.min(y, value);
}
@@ -176,7 +176,7 @@
value = Double.MIN_VALUE;
for (int i = 0; i < numOfPoints; i++) {
double x = ADoubleSerializerDeserializer
- .getDouble(outInput0.getBytes(), APolygonSerializerDeserializer
+ .getDouble(outInput0.getByteArray(), APolygonSerializerDeserializer
.getCoordinateOffset(i, Coordinate.X));
value = Math.max(x, value);
}
@@ -186,7 +186,7 @@
value = Double.MIN_VALUE;
for (int i = 0; i < numOfPoints; i++) {
double y = ADoubleSerializerDeserializer
- .getDouble(outInput0.getBytes(), APolygonSerializerDeserializer
+ .getDouble(outInput0.getByteArray(), APolygonSerializerDeserializer
.getCoordinateOffset(i, Coordinate.Y));
value = Math.max(y, value);
}
@@ -201,10 +201,10 @@
case CIRCLE:
switch (coordinate) {
case 0: {
- double x = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double x = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.X));
- double radius = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double radius = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.X));
@@ -212,10 +212,10 @@
}
break;
case 1: {
- double y = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double y = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.Y));
- double radius = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double radius = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.Y));
@@ -223,10 +223,10 @@
}
break;
case 2: {
- double x = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double x = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.X));
- double radius = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double radius = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.X));
@@ -234,10 +234,10 @@
}
break;
case 3: {
- double y = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double y = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.Y));
- double radius = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double radius = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.Y));
@@ -254,25 +254,25 @@
value = Double.MAX_VALUE;
switch (coordinate) {
case 0: {
- value = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ value = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ARectangleSerializerDeserializer
.getBottomLeftCoordinateOffset(Coordinate.X));
}
break;
case 1: {
- value = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ value = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ARectangleSerializerDeserializer
.getBottomLeftCoordinateOffset(Coordinate.Y));
}
break;
case 2: {
- value = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ value = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ARectangleSerializerDeserializer
.getUpperRightCoordinateOffset(Coordinate.X));
}
break;
case 3: {
- value = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ value = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
ARectangleSerializerDeserializer
.getUpperRightCoordinateOffset(Coordinate.Y));
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/EditDistanceEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
index 0f8be91..613417d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
@@ -11,22 +11,22 @@
import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.fuzzyjoin.similarity.SimilarityMetricEditDistance;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public class EditDistanceEvaluator implements IEvaluator {
+public class EditDistanceEvaluator implements ICopyEvaluator {
// assuming type indicator in serde format
protected final int typeIndicatorSize = 1;
protected final DataOutput out;
protected final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- protected final IEvaluator firstStringEval;
- protected final IEvaluator secondStringEval;
+ protected final ICopyEvaluator firstStringEval;
+ protected final ICopyEvaluator secondStringEval;
protected final SimilarityMetricEditDistance ed = new SimilarityMetricEditDistance();
protected final AsterixOrderedListIterator firstOrdListIter = new AsterixOrderedListIterator();
protected final AsterixOrderedListIterator secondOrdListIter = new AsterixOrderedListIterator();
@@ -42,7 +42,7 @@
protected ATypeTag firstTypeTag;
protected ATypeTag secondTypeTag;
- public EditDistanceEvaluator(IEvaluatorFactory[] args, IDataOutputProvider output) throws AlgebricksException {
+ public EditDistanceEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output) throws AlgebricksException {
out = output.getDataOutput();
firstStringEval = args[0].createEvaluator(argOut);
secondStringEval = args[1].createEvaluator(argOut);
@@ -56,15 +56,15 @@
if (!checkArgTypes(firstTypeTag, secondTypeTag))
return;
- itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[firstStart + 1]);
+ itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart + 1]);
if (itemTypeTag == ATypeTag.ANY)
throw new AlgebricksException("\n Edit Distance can only be called on homogenous lists");
- itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[secondStart + 1]);
+ itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart + 1]);
if (itemTypeTag == ATypeTag.ANY)
throw new AlgebricksException("\n Edit Distance can only be called on homogenous lists");
- editDistance = computeResult(argOut.getBytes(), firstStart, secondStart, firstTypeTag);
+ editDistance = computeResult(argOut.getByteArray(), firstStart, secondStart, firstTypeTag);
try {
writeResult(editDistance);
@@ -81,8 +81,8 @@
secondStart = argOut.getLength();
secondStringEval.evaluate(tuple);
- firstTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[firstStart]);
- secondTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[secondStart]);
+ firstTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart]);
+ secondTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart]);
}
protected int computeResult(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessByIndexEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessByIndexEvalFactory.java
index 06bcedf..604bb68 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessByIndexEvalFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessByIndexEvalFactory.java
@@ -16,26 +16,26 @@
import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
-public class FieldAccessByIndexEvalFactory implements IEvaluatorFactory {
+public class FieldAccessByIndexEvalFactory implements ICopyEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory recordEvalFactory;
- private IEvaluatorFactory fieldIndexEvalFactory;
+ private ICopyEvaluatorFactory recordEvalFactory;
+ private ICopyEvaluatorFactory fieldIndexEvalFactory;
private int nullBitmapSize;
private ARecordType recordType;
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
- public FieldAccessByIndexEvalFactory(IEvaluatorFactory recordEvalFactory, IEvaluatorFactory fieldIndexEvalFactory,
+ public FieldAccessByIndexEvalFactory(ICopyEvaluatorFactory recordEvalFactory, ICopyEvaluatorFactory fieldIndexEvalFactory,
ARecordType recordType) {
this.recordEvalFactory = recordEvalFactory;
this.fieldIndexEvalFactory = fieldIndexEvalFactory;
@@ -48,15 +48,15 @@
}
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
- private IEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
- private IEvaluator eval1 = fieldIndexEvalFactory.createEvaluator(outInput1);
+ private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
+ private ICopyEvaluator eval1 = fieldIndexEvalFactory.createEvaluator(outInput1);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
@@ -73,7 +73,7 @@
eval0.evaluate(tuple);
outInput1.reset();
eval1.evaluate(tuple);
- byte[] serRecord = outInput0.getBytes();
+ byte[] serRecord = outInput0.getByteArray();
if (serRecord[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, out);
@@ -85,7 +85,7 @@
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
}
- fieldIndex = IntegerSerializerDeserializer.getInt(outInput1.getBytes(), 1);
+ fieldIndex = IntegerSerializerDeserializer.getInt(outInput1.getByteArray(), 1);
fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetById(serRecord, fieldIndex,
nullBitmapSize, recordType.isOpen());
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/GramTokensEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/GramTokensEvaluator.java
index 4713c38..606b47f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/GramTokensEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/GramTokensEvaluator.java
@@ -12,24 +12,24 @@
import edu.uci.ics.fuzzyjoin.tokenizer.IToken;
import edu.uci.ics.fuzzyjoin.tokenizer.NGramUTF8StringBinaryTokenizer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.BooleanSerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
-public class GramTokensEvaluator implements IEvaluator {
+public class GramTokensEvaluator implements ICopyEvaluator {
// assuming type indicator in serde format
private final int typeIndicatorSize = 1;
protected final DataOutput out;
protected final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- protected final IEvaluator stringEval;
- protected final IEvaluator gramLengthEval;
- protected final IEvaluator prePostEval;
+ protected final ICopyEvaluator stringEval;
+ protected final ICopyEvaluator gramLengthEval;
+ protected final ICopyEvaluator prePostEval;
private final NGramUTF8StringBinaryTokenizer tokenizer;
@@ -40,7 +40,7 @@
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
private BuiltinType itemType;
- public GramTokensEvaluator(IEvaluatorFactory[] args, IDataOutputProvider output, IBinaryTokenizer tokenizer,
+ public GramTokensEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output, IBinaryTokenizer tokenizer,
BuiltinType itemType) throws AlgebricksException {
out = output.getDataOutput();
stringEval = args[0].createEvaluator(argOut);
@@ -59,7 +59,7 @@
int prePostOff = argOut.getLength();
prePostEval.evaluate(tuple);
- byte[] bytes = argOut.getBytes();
+ byte[] bytes = argOut.getByteArray();
int gramLength = IntegerSerializerDeserializer.getInt(bytes, gramLengthOff + typeIndicatorSize);
tokenizer.setGramlength(gramLength);
boolean prePost = BooleanSerializerDeserializer.getBoolean(bytes, prePostOff + typeIndicatorSize);
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 932036e..a73cc72 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
@@ -11,8 +11,8 @@
import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.fuzzyjoin.similarity.SimilarityMetricJaccard;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -20,15 +20,15 @@
// assumes that both arguments are sorted by the same ordering
-public class SimilarityJaccardEvaluator implements IEvaluator {
+public class SimilarityJaccardEvaluator implements ICopyEvaluator {
// assuming type indicator in serde format
protected final int typeIndicatorSize = 1;
protected final DataOutput out;
protected final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- protected final IEvaluator firstOrdListEval;
- protected final IEvaluator secondOrdListEval;
+ protected final ICopyEvaluator firstOrdListEval;
+ protected final ICopyEvaluator secondOrdListEval;
protected final AsterixOrderedListIterator fstOrdListIter = new AsterixOrderedListIterator();
protected final AsterixOrderedListIterator sndOrdListIter = new AsterixOrderedListIterator();
@@ -52,7 +52,7 @@
protected int secondStart = -1;
protected float jaccSim = 0.0f;
- public SimilarityJaccardEvaluator(IEvaluatorFactory[] args, IDataOutputProvider output) throws AlgebricksException {
+ public SimilarityJaccardEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output) throws AlgebricksException {
out = output.getDataOutput();
firstOrdListEval = args[0].createEvaluator(argOut);
secondOrdListEval = args[1].createEvaluator(argOut);
@@ -63,7 +63,7 @@
runArgEvals(tuple);
if (!checkArgTypes(firstTypeTag, secondTypeTag))
return;
- jaccSim = computeResult(argOut.getBytes(), firstStart, secondStart, firstTypeTag);
+ jaccSim = computeResult(argOut.getByteArray(), firstStart, secondStart, firstTypeTag);
try {
writeResult(jaccSim);
} catch (IOException e) {
@@ -79,8 +79,8 @@
secondStart = argOut.getLength();
secondOrdListEval.evaluate(tuple);
- firstTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[firstStart]);
- secondTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[secondStart]);
+ firstTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart]);
+ secondTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart]);
}
protected float computeResult(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardPrefixEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardPrefixEvaluator.java
index 4884806..3b527d9 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardPrefixEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardPrefixEvaluator.java
@@ -18,26 +18,26 @@
import edu.uci.ics.fuzzyjoin.similarity.SimilarityFiltersJaccard;
import edu.uci.ics.fuzzyjoin.similarity.SimilarityMetric;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
-public class SimilarityJaccardPrefixEvaluator implements IEvaluator {
+public class SimilarityJaccardPrefixEvaluator implements ICopyEvaluator {
// assuming type indicator in serde format
protected final int typeIndicatorSize = 1;
protected final DataOutput out;
protected final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- protected final IEvaluator evalLen1;
- protected final IEvaluator evalTokens1;
- protected final IEvaluator evalLen2;
- protected final IEvaluator evalTokens2;
- protected final IEvaluator evalTokenPrefix;
- protected final IEvaluator evalThreshold;
+ protected final ICopyEvaluator evalLen1;
+ protected final ICopyEvaluator evalTokens1;
+ protected final ICopyEvaluator evalLen2;
+ protected final ICopyEvaluator evalTokens2;
+ protected final ICopyEvaluator evalTokenPrefix;
+ protected final ICopyEvaluator evalThreshold;
protected float similarityThresholdCache;
protected SimilarityFiltersJaccard similarityFilters;
@@ -57,7 +57,7 @@
protected final ISerializerDeserializer<AFloat> reusSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.AFLOAT);
- public SimilarityJaccardPrefixEvaluator(IEvaluatorFactory[] args, IDataOutputProvider output)
+ public SimilarityJaccardPrefixEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
throws AlgebricksException {
out = output.getDataOutput();
evalLen1 = args[0].createEvaluator(inputVal);
@@ -74,7 +74,7 @@
sim = 0;
inputVal.reset();
evalThreshold.evaluate(tuple);
- float similarityThreshold = AFloatSerializerDeserializer.getFloat(inputVal.getBytes(), 1);
+ float similarityThreshold = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
if (similarityThreshold != similarityThresholdCache || similarityFilters == null) {
similarityFilters = new SimilarityFiltersJaccard(similarityThreshold);
@@ -83,11 +83,11 @@
inputVal.reset();
evalLen1.evaluate(tuple);
- int length1 = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int length1 = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
inputVal.reset();
evalLen2.evaluate(tuple);
- int length2 = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int length2 = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
//
// -- - length filter - --
@@ -100,7 +100,7 @@
inputVal.reset();
evalTokens1.evaluate(tuple);
- byte[] serList = inputVal.getBytes();
+ byte[] serList = inputVal.getByteArray();
if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
throw new AlgebricksException("Scan collection is not defined for values of type"
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
@@ -108,7 +108,7 @@
int lengthTokens1;
if (serList[0] == SER_ORDEREDLIST_TYPE_TAG) {
- lengthTokens1 = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getBytes());
+ lengthTokens1 = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
// read tokens
for (i = 0; i < lengthTokens1; i++) {
int itemOffset;
@@ -120,7 +120,7 @@
tokens1.add(IntegerSerializerDeserializer.getInt(serList, itemOffset));
}
} else {
- lengthTokens1 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getBytes());
+ lengthTokens1 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
// read tokens
for (i = 0; i < lengthTokens1; i++) {
int itemOffset;
@@ -142,7 +142,7 @@
inputVal.reset();
evalTokens2.evaluate(tuple);
- serList = inputVal.getBytes();
+ serList = inputVal.getByteArray();
if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
throw new AlgebricksException("Scan collection is not defined for values of type"
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
@@ -150,7 +150,7 @@
int lengthTokens2;
if (serList[0] == SER_ORDEREDLIST_TYPE_TAG) {
- lengthTokens2 = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getBytes());
+ lengthTokens2 = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
// read tokens
for (i = 0; i < lengthTokens2; i++) {
int itemOffset;
@@ -162,7 +162,7 @@
tokens2.add(IntegerSerializerDeserializer.getInt(serList, itemOffset));
}
} else {
- lengthTokens2 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getBytes());
+ lengthTokens2 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
// read tokens
for (i = 0; i < lengthTokens2; i++) {
int itemOffset;
@@ -182,7 +182,7 @@
// -- - token prefix - --
inputVal.reset();
evalTokenPrefix.evaluate(tuple);
- int tokenPrefix = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int tokenPrefix = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
//
// -- - position filter - --
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/WordTokensEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/WordTokensEvaluator.java
index 800c4ee..377a116 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/WordTokensEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/WordTokensEvaluator.java
@@ -11,16 +11,16 @@
import edu.uci.ics.fuzzyjoin.tokenizer.IBinaryTokenizer;
import edu.uci.ics.fuzzyjoin.tokenizer.IToken;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public class WordTokensEvaluator implements IEvaluator {
+public class WordTokensEvaluator implements ICopyEvaluator {
protected final DataOutput out;
protected final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- protected final IEvaluator stringEval;
+ protected final ICopyEvaluator stringEval;
protected final IBinaryTokenizer tokenizer;
@@ -31,7 +31,7 @@
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
private BuiltinType itemType;
- public WordTokensEvaluator(IEvaluatorFactory[] args, IDataOutputProvider output, IBinaryTokenizer tokenizer,
+ public WordTokensEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output, IBinaryTokenizer tokenizer,
BuiltinType itemType) throws AlgebricksException {
out = output.getDataOutput();
stringEval = args[0].createEvaluator(argOut);
@@ -43,7 +43,7 @@
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
argOut.reset();
stringEval.evaluate(tuple);
- byte[] bytes = argOut.getBytes();
+ byte[] bytes = argOut.getByteArray();
tokenizer.reset(bytes, 0, argOut.getLength());
tokenBuffer.reset();
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
index 958b04b..6e1cea4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
@@ -17,8 +17,8 @@
import edu.uci.ics.asterix.om.types.BuiltinType;
import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -26,7 +26,7 @@
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.FloatSerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
-public abstract class AbstractComparisonEvaluator implements IEvaluator {
+public abstract class AbstractComparisonEvaluator implements ICopyEvaluator {
protected enum ComparisonResult {
LESS_THAN,
@@ -38,8 +38,8 @@
protected DataOutput out;
protected ArrayBackedValueStorage outLeft = new ArrayBackedValueStorage();
protected ArrayBackedValueStorage outRight = new ArrayBackedValueStorage();
- protected IEvaluator evalLeft;
- protected IEvaluator evalRight;
+ protected ICopyEvaluator evalLeft;
+ protected ICopyEvaluator evalRight;
@SuppressWarnings("unchecked")
protected ISerializerDeserializer<ABoolean> serde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
@@ -51,8 +51,8 @@
protected IBinaryComparator dateTimeBinaryComp = ADateTimeAscBinaryComparatorFactory.INSTANCE
.createBinaryComparator();
- public AbstractComparisonEvaluator(DataOutput out, IEvaluatorFactory evalLeftFactory,
- IEvaluatorFactory evalRightFactory) throws AlgebricksException {
+ public AbstractComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
+ ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
this.out = out;
this.evalLeft = evalLeftFactory.createEvaluator(outLeft);
this.evalRight = evalRightFactory.createEvaluator(outRight);
@@ -74,7 +74,7 @@
if (outLeft.getLength() == 0) {
isLeftNull = true;
} else {
- typeTag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outLeft.getBytes()[0]);
+ typeTag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outLeft.getByteArray()[0]);
if (typeTag1 == ATypeTag.NULL) {
isLeftNull = true;
}
@@ -82,7 +82,7 @@
if (outRight.getLength() == 0) {
isRightNull = true;
} else {
- typeTag2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outRight.getBytes()[0]);
+ typeTag2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outRight.getByteArray()[0]);
if (typeTag2 == ATypeTag.NULL) {
isRightNull = true;
}
@@ -130,8 +130,8 @@
if (typeTag2 == ATypeTag.NULL) {
return ComparisonResult.GREATER_THAN;
} else if (typeTag2 == ATypeTag.DATETIME) {
- int result = dateTimeBinaryComp.compare(outLeft.getBytes(), 1, outLeft.getLength() - 1,
- outRight.getBytes(), 1, outRight.getLength() - 1);
+ int result = dateTimeBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+ outRight.getByteArray(), 1, outRight.getLength() - 1);
if (result == 0)
return ComparisonResult.EQUAL;
else if (result < 0)
@@ -144,8 +144,8 @@
private ComparisonResult compareBooleanWithArg(ATypeTag typeTag2) throws AlgebricksException {
if (typeTag2 == ATypeTag.BOOLEAN) {
- byte b0 = outLeft.getBytes()[1];
- byte b1 = outRight.getBytes()[1];
+ byte b0 = outLeft.getByteArray()[1];
+ byte b1 = outRight.getByteArray()[1];
return compareByte(b0, b1);
}
throw new AlgebricksException("Comparison is undefined between types ABoolean and " + typeTag2 + " .");
@@ -153,7 +153,7 @@
private ComparisonResult compareStringWithArg(ATypeTag typeTag2) throws AlgebricksException {
if (typeTag2 == ATypeTag.STRING) {
- int result = strBinaryComp.compare(outLeft.getBytes(), 1, outLeft.getLength() - 1, outRight.getBytes(), 1,
+ int result = strBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1, outRight.getByteArray(), 1,
outRight.getLength() - 1);
if (result == 0)
return ComparisonResult.EQUAL;
@@ -166,30 +166,30 @@
}
private ComparisonResult compareDoubleWithArg(ATypeTag typeTag2) throws AlgebricksException {
- double s = ADoubleSerializerDeserializer.getDouble(outLeft.getBytes(), 1);
+ double s = ADoubleSerializerDeserializer.getDouble(outLeft.getByteArray(), 1);
switch (typeTag2) {
case INT8: {
- byte v2 = AInt8SerializerDeserializer.getByte(outRight.getBytes(), 1);
+ byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
case INT16: {
- short v2 = AInt16SerializerDeserializer.getShort(outRight.getBytes(), 1);
+ short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
case INT32: {
- int v2 = AInt32SerializerDeserializer.getInt(outRight.getBytes(), 1);
+ int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
case INT64: {
- long v2 = AInt64SerializerDeserializer.getLong(outRight.getBytes(), 1);
+ long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
case FLOAT: {
- float v2 = AFloatSerializerDeserializer.getFloat(outRight.getBytes(), 1);
+ float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
case DOUBLE: {
- double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getBytes(), 1);
+ double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
default: {
@@ -199,30 +199,30 @@
}
private ComparisonResult compareFloatWithArg(ATypeTag typeTag2) throws AlgebricksException {
- float s = FloatSerializerDeserializer.getFloat(outLeft.getBytes(), 1);
+ float s = FloatSerializerDeserializer.getFloat(outLeft.getByteArray(), 1);
switch (typeTag2) {
case INT8: {
- byte v2 = AInt8SerializerDeserializer.getByte(outRight.getBytes(), 1);
+ byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
return compareFloat(s, v2);
}
case INT16: {
- short v2 = AInt16SerializerDeserializer.getShort(outRight.getBytes(), 1);
+ short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
return compareFloat(s, v2);
}
case INT32: {
- int v2 = AInt32SerializerDeserializer.getInt(outRight.getBytes(), 1);
+ int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
return compareFloat(s, v2);
}
case INT64: {
- long v2 = AInt64SerializerDeserializer.getLong(outRight.getBytes(), 1);
+ long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
return compareFloat(s, v2);
}
case FLOAT: {
- float v2 = AFloatSerializerDeserializer.getFloat(outRight.getBytes(), 1);
+ float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
return compareFloat(s, v2);
}
case DOUBLE: {
- double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getBytes(), 1);
+ double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
default: {
@@ -232,30 +232,30 @@
}
private ComparisonResult compareInt64WithArg(ATypeTag typeTag2) throws AlgebricksException {
- long s = AInt64SerializerDeserializer.getLong(outLeft.getBytes(), 1);
+ long s = AInt64SerializerDeserializer.getLong(outLeft.getByteArray(), 1);
switch (typeTag2) {
case INT8: {
- byte v2 = AInt8SerializerDeserializer.getByte(outRight.getBytes(), 1);
+ byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
return compareLong(s, v2);
}
case INT16: {
- short v2 = AInt16SerializerDeserializer.getShort(outRight.getBytes(), 1);
+ short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
return compareLong(s, v2);
}
case INT32: {
- int v2 = AInt32SerializerDeserializer.getInt(outRight.getBytes(), 1);
+ int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
return compareLong(s, v2);
}
case INT64: {
- long v2 = AInt64SerializerDeserializer.getLong(outRight.getBytes(), 1);
+ long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
return compareLong(s, v2);
}
case FLOAT: {
- float v2 = AFloatSerializerDeserializer.getFloat(outRight.getBytes(), 1);
+ float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
return compareFloat(s, v2);
}
case DOUBLE: {
- double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getBytes(), 1);
+ double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
default: {
@@ -265,30 +265,30 @@
}
private ComparisonResult compareInt32WithArg(ATypeTag typeTag2) throws AlgebricksException {
- int s = IntegerSerializerDeserializer.getInt(outLeft.getBytes(), 1);
+ int s = IntegerSerializerDeserializer.getInt(outLeft.getByteArray(), 1);
switch (typeTag2) {
case INT8: {
- byte v2 = AInt8SerializerDeserializer.getByte(outRight.getBytes(), 1);
+ byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
return compareInt(s, v2);
}
case INT16: {
- short v2 = AInt16SerializerDeserializer.getShort(outRight.getBytes(), 1);
+ short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
return compareInt(s, v2);
}
case INT32: {
- int v2 = AInt32SerializerDeserializer.getInt(outRight.getBytes(), 1);
+ int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
return compareInt(s, v2);
}
case INT64: {
- long v2 = AInt64SerializerDeserializer.getLong(outRight.getBytes(), 1);
+ long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
return compareLong(s, v2);
}
case FLOAT: {
- float v2 = AFloatSerializerDeserializer.getFloat(outRight.getBytes(), 1);
+ float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
return compareFloat(s, v2);
}
case DOUBLE: {
- double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getBytes(), 1);
+ double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
default: {
@@ -298,30 +298,30 @@
}
private ComparisonResult compareInt16WithArg(ATypeTag typeTag2) throws AlgebricksException {
- short s = AInt16SerializerDeserializer.getShort(outLeft.getBytes(), 1);
+ short s = AInt16SerializerDeserializer.getShort(outLeft.getByteArray(), 1);
switch (typeTag2) {
case INT8: {
- byte v2 = AInt8SerializerDeserializer.getByte(outRight.getBytes(), 1);
+ byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
return compareShort(s, v2);
}
case INT16: {
- short v2 = AInt16SerializerDeserializer.getShort(outRight.getBytes(), 1);
+ short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
return compareShort(s, v2);
}
case INT32: {
- int v2 = AInt32SerializerDeserializer.getInt(outRight.getBytes(), 1);
+ int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
return compareInt(s, v2);
}
case INT64: {
- long v2 = AInt64SerializerDeserializer.getLong(outRight.getBytes(), 1);
+ long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
return compareLong(s, v2);
}
case FLOAT: {
- float v2 = AFloatSerializerDeserializer.getFloat(outRight.getBytes(), 1);
+ float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
return compareFloat(s, v2);
}
case DOUBLE: {
- double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getBytes(), 1);
+ double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
default: {
@@ -331,30 +331,30 @@
}
private ComparisonResult compareInt8WithArg(ATypeTag typeTag2) throws AlgebricksException {
- byte s = AInt8SerializerDeserializer.getByte(outLeft.getBytes(), 1);
+ byte s = AInt8SerializerDeserializer.getByte(outLeft.getByteArray(), 1);
switch (typeTag2) {
case INT8: {
- byte v2 = AInt8SerializerDeserializer.getByte(outRight.getBytes(), 1);
+ byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
return compareByte(s, v2);
}
case INT16: {
- short v2 = AInt16SerializerDeserializer.getShort(outRight.getBytes(), 1);
+ short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
return compareShort(s, v2);
}
case INT32: {
- int v2 = AInt32SerializerDeserializer.getInt(outRight.getBytes(), 1);
+ int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
return compareInt(s, v2);
}
case INT64: {
- long v2 = AInt64SerializerDeserializer.getLong(outRight.getBytes(), 1);
+ long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
return compareLong(s, v2);
}
case FLOAT: {
- float v2 = AFloatSerializerDeserializer.getFloat(outRight.getBytes(), 1);
+ float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
return compareFloat(s, v2);
}
case DOUBLE: {
- double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getBytes(), 1);
+ double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
return compareDouble(s, v2);
}
default: {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java
index 5f3675c..c971929 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java
@@ -6,21 +6,21 @@
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions.ComparisonKind;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public class ComparisonEvalFactory implements IEvaluatorFactory {
+public class ComparisonEvalFactory implements ICopyEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory evalLeftFactory;
- private IEvaluatorFactory evalRightFactory;
+ private ICopyEvaluatorFactory evalLeftFactory;
+ private ICopyEvaluatorFactory evalRightFactory;
private ComparisonKind comparisonKind;
- public ComparisonEvalFactory(IEvaluatorFactory evalLeftFactory, IEvaluatorFactory evalRightFactory,
+ public ComparisonEvalFactory(ICopyEvaluatorFactory evalLeftFactory, ICopyEvaluatorFactory evalRightFactory,
ComparisonKind comparisonKind) {
this.evalLeftFactory = evalLeftFactory;
this.evalRightFactory = evalRightFactory;
@@ -28,7 +28,7 @@
}
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
DataOutput out = output.getDataOutput();
switch (comparisonKind) {
// Should we do any normalization?
@@ -57,8 +57,8 @@
}
static class EqualityComparisonEvaluator extends AbstractComparisonEvaluator {
- public EqualityComparisonEvaluator(DataOutput out, IEvaluatorFactory evalLeftFactory,
- IEvaluatorFactory evalRightFactory) throws AlgebricksException {
+ public EqualityComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
+ ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
super(out, evalLeftFactory, evalRightFactory);
}
@@ -85,8 +85,8 @@
}
static class InequalityComparisonEvaluator extends AbstractComparisonEvaluator {
- public InequalityComparisonEvaluator(DataOutput out, IEvaluatorFactory evalLeftFactory,
- IEvaluatorFactory evalRightFactory) throws AlgebricksException {
+ public InequalityComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
+ ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
super(out, evalLeftFactory, evalRightFactory);
}
@@ -113,8 +113,8 @@
}
static class GreaterThanOrEqualComparisonEvaluator extends AbstractComparisonEvaluator {
- public GreaterThanOrEqualComparisonEvaluator(DataOutput out, IEvaluatorFactory evalLeftFactory,
- IEvaluatorFactory evalRightFactory) throws AlgebricksException {
+ public GreaterThanOrEqualComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
+ ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
super(out, evalLeftFactory, evalRightFactory);
}
@@ -142,8 +142,8 @@
}
static class GreaterThanComparisonEvaluator extends AbstractComparisonEvaluator {
- public GreaterThanComparisonEvaluator(DataOutput out, IEvaluatorFactory evalLeftFactory,
- IEvaluatorFactory evalRightFactory) throws AlgebricksException {
+ public GreaterThanComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
+ ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
super(out, evalLeftFactory, evalRightFactory);
}
@@ -170,8 +170,8 @@
}
static class LessThanOrEqualComparisonEvaluator extends AbstractComparisonEvaluator {
- public LessThanOrEqualComparisonEvaluator(DataOutput out, IEvaluatorFactory evalLeftFactory,
- IEvaluatorFactory evalRightFactory) throws AlgebricksException {
+ public LessThanOrEqualComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
+ ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
super(out, evalLeftFactory, evalRightFactory);
}
@@ -199,8 +199,8 @@
}
static class LessThanComparisonEvaluator extends AbstractComparisonEvaluator {
- public LessThanComparisonEvaluator(DataOutput out, IEvaluatorFactory evalLeftFactory,
- IEvaluatorFactory evalRightFactory) throws AlgebricksException {
+ public LessThanComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
+ ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
super(out, evalLeftFactory, evalRightFactory);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
index 701c20a..1617dc0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -37,17 +37,17 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of boolean";
private final byte[] TRUE = { 0, 4, 't', 'r', 'u', 'e' };
private final byte[] FALSE = { 0, 5, 'f', 'a', 'l', 's', 'e' };
@@ -66,7 +66,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), TRUE, 0, 6) == 0) {
booleanSerde.serialize(ABoolean.TRUE, out);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
index 3e64b56..dd4f9ef 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,18 +36,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of circle";
private AMutablePoint aPoint = new AMutablePoint(0, 0);
private AMutableCircle aCircle = new AMutableCircle(null, 0);
@@ -64,7 +64,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
int commaIndex = s.indexOf(',');
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
index 1a21227..3a28805 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,18 +36,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private int offset;
private String errorMessage = "This can not be an instance of date";
private AMutableDate aDate = new AMutableDate(0);
@@ -66,7 +66,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
int length = ((serString[1] & 0xff) << 8) + ((serString[2] & 0xff) << 0) + 3;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
index 9b08bda..2c711a5 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -37,18 +37,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private int offset;
private String errorMessage = "This can not be an instance of datetime";
private AMutableDateTime aDateTime = new AMutableDateTime(0L);
@@ -67,7 +67,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
int length = ((serString[1] & 0xff) << 8) + ((serString[2] & 0xff) << 0) + 3;
offset = 3;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
index 6a89def..eea58651 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -38,18 +38,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of double";
private final byte[] POSITIVE_INF = { 0, 3, 'I', 'N', 'F' };
private final byte[] NEGATIVE_INF = { 0, 4, '-', 'I', 'N', 'F' };
@@ -77,7 +77,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
if (utf8BinaryComparator
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
index 1255317..58a26ba 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,18 +36,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private int offset;
private int value = 0, hour = 0, minute = 0, second = 0, millisecond = 0, year = 0, month = 0,
day = 0;
@@ -68,7 +68,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
offset = 3;
if (serString[offset] == '-') {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
index 6cb6306..852b6d4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -37,17 +37,17 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of float";
private final byte[] POSITIVE_INF = { 0, 3, 'I', 'N', 'F' };
private final byte[] NEGATIVE_INF = { 0, 4, '-', 'I', 'N', 'F' };
@@ -76,7 +76,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
if (utf8BinaryComparator
.compare(serString, 1, outInput.getLength(), POSITIVE_INF, 0, 5) == 0) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
index c1ac181..46e6987 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -35,18 +35,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private short value;
private int offset;
private boolean positive;
@@ -65,7 +65,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
offset = 3;
value = 0;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
index 2edfbdd..a8befc7 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -35,18 +35,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private int value, offset;
private boolean positive;
private String errorMessage = "This can not be an instance of int32";
@@ -64,7 +64,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
offset = 3;
value = 0;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
index 5fd7a3a..a3b635d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -35,18 +35,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private long value;
private int offset;
private boolean positive;
@@ -65,7 +65,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
offset = 3;
value = 0;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
index 6719fbf..0e6e94d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -35,18 +35,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private byte value;
private int offset;
private boolean positive;
@@ -65,7 +65,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
offset = 3;
value = 0;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
index 87063c3..c64f745 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,18 +36,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of line";
private AMutableLine aLine = new AMutableLine(null, null);
private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
@@ -64,7 +64,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
int commaIndex = s.indexOf(',');
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
index 963e95d..ff76339 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
@@ -14,8 +14,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -34,17 +34,17 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of null";
private final byte[] NULL = { 0, 4, 'n', 'u', 'l', 'l' };
IBinaryComparator utf8BinaryComparator = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
@@ -59,7 +59,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NULL, 0, 6) == 0) {
nullSerde.serialize(ANull.NULL, out);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
index 1c0962c..0434a5f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,18 +36,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of point3d";
private AMutablePoint3D aPoint3D = new AMutablePoint3D(0, 0, 0);
@SuppressWarnings("unchecked")
@@ -63,7 +63,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
int firstCommaIndex = s.indexOf(',');
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
index 378e619..840f141 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -35,18 +35,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of point";
private AMutablePoint aPoint = new AMutablePoint(0, 0);
@SuppressWarnings("unchecked")
@@ -62,7 +62,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
aPoint.setValue(Double.parseDouble(s.substring(0, s.indexOf(','))),
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
index 8a88c0e..705ae78 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
@@ -14,8 +14,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,18 +36,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of polygon";
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -59,7 +59,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
String[] points = s.split(" ");
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
index c2b98f9..5f5b3b3 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -37,18 +37,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of rectangle";
private AMutableRectangle aRectangle = new AMutableRectangle(null, null);
private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
@@ -65,7 +65,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
int commaIndex = s.indexOf(',');
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
index 982871d..abe1743 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
@@ -13,8 +13,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -34,17 +34,17 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private String errorMessage = "This can not be an instance of string";
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -56,9 +56,9 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
- out.write(outInput.getBytes(), outInput.getStartIndex(), outInput.getLength());
+ out.write(outInput.getByteArray(), outInput.getStartOffset(), outInput.getLength());
} else if (serString[0] == SER_NULL_TYPE_TAG)
nullSerde.serialize(ANull.NULL, out);
else
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
index 58c16890..a173ba7 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -37,18 +37,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(outInput);
+ private ICopyEvaluator eval = args[0].createEvaluator(outInput);
private int offset;
private String errorMessage = "This can not be an instance of time";
private AMutableTime aTime = new AMutableTime(0);
@@ -65,7 +65,7 @@
try {
outInput.reset();
eval.evaluate(tuple);
- byte[] serString = outInput.getBytes();
+ byte[] serString = outInput.getByteArray();
if (serString[0] == SER_STRING_TYPE_TAG) {
offset = 3;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java
index b0f4580..1920db4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java
@@ -6,27 +6,27 @@
import edu.uci.ics.asterix.om.base.ABoolean;
import edu.uci.ics.asterix.om.types.BuiltinType;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public abstract class AbstractStringContainsEval implements IEvaluator {
+public abstract class AbstractStringContainsEval implements ICopyEvaluator {
private DataOutput dout;
private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage array1 = new ArrayBackedValueStorage();
- private IEvaluator evalString;
- private IEvaluator evalPattern;
+ private ICopyEvaluator evalString;
+ private ICopyEvaluator evalPattern;
@SuppressWarnings("rawtypes")
private ISerializerDeserializer boolSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
- public AbstractStringContainsEval(DataOutput dout, IEvaluatorFactory evalStringFactory,
- IEvaluatorFactory evalPatternFactory) throws AlgebricksException {
+ public AbstractStringContainsEval(DataOutput dout, ICopyEvaluatorFactory evalStringFactory,
+ ICopyEvaluatorFactory evalPatternFactory) throws AlgebricksException {
this.dout = dout;
this.evalString = evalStringFactory.createEvaluator(array0);
this.evalPattern = evalPatternFactory.createEvaluator(array1);
@@ -39,8 +39,8 @@
evalPattern.evaluate(tuple);
array0.reset();
evalString.evaluate(tuple);
- byte[] b1 = array0.getBytes();
- byte[] b2 = array1.getBytes();
+ byte[] b1 = array0.getByteArray();
+ byte[] b2 = array1.getByteArray();
ABoolean res = findMatch(b1, b2) ? ABoolean.TRUE : ABoolean.FALSE;
try {
boolSerde.serialize(res, dout);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AndDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AndDescriptor.java
index 7e2877c..355d30e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AndDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AndDescriptor.java
@@ -12,8 +12,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -39,21 +39,21 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
// one temp. buffer re-used by all children
final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- final IEvaluator[] evals = new IEvaluator[args.length];
+ final ICopyEvaluator[] evals = new ICopyEvaluator[args.length];
for (int i = 0; i < evals.length; i++) {
evals[i] = args[i].createEvaluator(argOut);
}
- return new IEvaluator() {
+ return new ICopyEvaluator() {
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
@@ -70,11 +70,11 @@
for (int i = 0; i < n; i++) {
argOut.reset();
evals[i].evaluate(tuple);
- if (argOut.getBytes()[0] == SER_NULL_TYPE_TAG) {
+ if (argOut.getByteArray()[0] == SER_NULL_TYPE_TAG) {
metNull = true;
continue;
}
- boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getBytes(), 1);
+ boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getByteArray(), 1);
res = res && argResult;
}
if (metNull) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
index 055d94b..a71436c 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
@@ -18,8 +18,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -37,7 +37,7 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
return new AnyCollectionMemberEvalFactory(args[0]);
}
@@ -46,11 +46,11 @@
return FID;
}
- private static class AnyCollectionMemberEvalFactory implements IEvaluatorFactory {
+ private static class AnyCollectionMemberEvalFactory implements ICopyEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory listEvalFactory;
+ private ICopyEvaluatorFactory listEvalFactory;
private final static byte SER_ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
private final static byte SER_UNORDEREDLIST_TYPE_TAG = ATypeTag.UNORDEREDLIST.serialize();
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -58,17 +58,17 @@
private ATypeTag itemTag;
private boolean selfDescList = false;
- public AnyCollectionMemberEvalFactory(IEvaluatorFactory arg) {
+ public AnyCollectionMemberEvalFactory(ICopyEvaluatorFactory arg) {
this.listEvalFactory = arg;
}
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInputList = new ArrayBackedValueStorage();
- private IEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
+ private ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
@@ -81,7 +81,7 @@
try {
outInputList.reset();
evalList.evaluate(tuple);
- byte[] serList = outInputList.getBytes();
+ byte[] serList = outInputList.getByteArray();
if (serList[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, out);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CastRecordDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CastRecordDescriptor.java
index 705efab..a9f25f4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CastRecordDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CastRecordDescriptor.java
@@ -1,19 +1,21 @@
package edu.uci.ics.asterix.runtime.evaluators.functions;
import java.io.DataOutput;
-import java.io.IOException;
import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import edu.uci.ics.asterix.runtime.util.ARecordAccessor;
-import edu.uci.ics.asterix.runtime.util.ARecordCaster;
+import edu.uci.ics.asterix.runtime.pointables.PointableAllocator;
+import edu.uci.ics.asterix.runtime.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.runtime.pointables.cast.ACastVisitor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -43,31 +45,37 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- final IEvaluatorFactory recordEvalFactory = args[0];
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ final ICopyEvaluatorFactory recordEvalFactory = args[0];
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
final DataOutput out = output.getDataOutput();
final ArrayBackedValueStorage recordBuffer = new ArrayBackedValueStorage();
- final IEvaluator recEvaluator = recordEvalFactory.createEvaluator(recordBuffer);
+ final ICopyEvaluator recEvaluator = recordEvalFactory.createEvaluator(recordBuffer);
- return new IEvaluator() {
- final ARecordAccessor recAccessor = new ARecordAccessor(inputType);
- final ARecordCaster caster = new ARecordCaster();
+ return new ICopyEvaluator() {
+ // pointable allocator
+ private PointableAllocator allocator = new PointableAllocator();
+ final IVisitablePointable recAccessor = allocator.allocateRecordValue(inputType);
+ final IVisitablePointable resultAccessor = allocator.allocateRecordValue(reqType);
+ final ACastVisitor castVisitor = new ACastVisitor();
+ final Triple<IVisitablePointable, IAType, Boolean> arg = new Triple<IVisitablePointable, IAType, Boolean>(
+ resultAccessor, reqType, Boolean.FALSE);
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
try {
recordBuffer.reset();
recEvaluator.evaluate(tuple);
- recAccessor.reset(recordBuffer.getBytes(), recordBuffer.getStartIndex(),
- recordBuffer.getLength());
- caster.castRecord(recAccessor, reqType, out);
- } catch (IOException ioe) {
+ recAccessor.set(recordBuffer);
+ recAccessor.accept(castVisitor, arg);
+ out.write(resultAccessor.getByteArray(), resultAccessor.getStartOffset(),
+ resultAccessor.getLength());
+ } catch (Exception ioe) {
throw new AlgebricksException(ioe);
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ClosedRecordConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ClosedRecordConstructorDescriptor.java
index d9afbc9..980a6c8 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ClosedRecordConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ClosedRecordConstructorDescriptor.java
@@ -7,7 +7,7 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class ClosedRecordConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -33,7 +33,7 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
return new ClosedRecordConstructorEvalFactory(args, recType);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ContainsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ContainsDescriptor.java
index 71213c7..ab4fb3a 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ContainsDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ContainsDescriptor.java
@@ -8,8 +8,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -25,13 +25,13 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
DataOutput dout = output.getDataOutput();
@@ -39,8 +39,8 @@
@Override
protected boolean findMatch(byte[] strBytes, byte[] patternBytes) {
- int utflen1 = UTF8StringPointable.getUTFLen(strBytes, 1);
- int utflen2 = UTF8StringPointable.getUTFLen(patternBytes, 1);
+ int utflen1 = UTF8StringPointable.getUTFLength(strBytes, 1);
+ int utflen2 = UTF8StringPointable.getUTFLength(patternBytes, 1);
int s1Start = 3;
int s2Start = 3;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
index 9cdecde..c8f3447 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
@@ -13,8 +13,8 @@
import edu.uci.ics.fuzzyjoin.tokenizer.NGramUTF8StringBinaryTokenizer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
public class CountHashedGramTokensDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -34,12 +34,12 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
ITokenFactory tokenFactory = new HashedUTF8NGramTokenFactory(ATypeTag.INT32.serialize(),
ATypeTag.INT32.serialize());
NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(3, true, false, true,
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
index 0cfdfc3..4c96ca0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
@@ -14,8 +14,8 @@
import edu.uci.ics.fuzzyjoin.tokenizer.ITokenFactory;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
public class CountHashedWordTokensDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -35,12 +35,12 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
ITokenFactory tokenFactory = new HashedUTF8WordTokenFactory(ATypeTag.INT32.serialize(),
ATypeTag.INT32.serialize());
IBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(false, true, tokenFactory);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
index 463dfd2..e8c57c4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
@@ -17,8 +17,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,20 +36,20 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
- private IEvaluator eval0 = args[0].createEvaluator(outInput0);
- private IEvaluator eval1 = args[1].createEvaluator(outInput1);
+ private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
+ private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
private AMutablePoint aPoint = new AMutablePoint(0, 0);
private AMutableCircle aCircle = new AMutableCircle(null, 0);
@SuppressWarnings("unchecked")
@@ -64,11 +64,11 @@
eval1.evaluate(tuple);
try {
- aPoint.setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ aPoint.setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
- aCircle.setValue(aPoint, ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(), 1));
+ aCircle.setValue(aPoint, ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(), 1));
circleSerde.serialize(aCircle, out);
} catch (IOException e1) {
throw new AlgebricksException(e1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateLineDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
index fab060d..a6ca67b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
@@ -17,8 +17,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,20 +36,20 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
- private IEvaluator eval0 = args[0].createEvaluator(outInput0);
- private IEvaluator eval1 = args[1].createEvaluator(outInput1);
+ private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
+ private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
private AMutableLine aLine = new AMutableLine(null, null);
private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
@SuppressWarnings("unchecked")
@@ -64,13 +64,13 @@
eval1.evaluate(tuple);
try {
- aPoint[0].setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ aPoint[0].setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
- aPoint[1].setValue(ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(),
+ aPoint[1].setValue(ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(),
+ ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
aLine.setValue(aPoint[0], aPoint[1]);
lineSerde.serialize(aLine, out);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
index 0974c39..cd3790c 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
@@ -7,7 +7,7 @@
import edu.uci.ics.asterix.runtime.evaluators.common.CreateMBREvalFactory;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class CreateMBRDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -21,7 +21,7 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
return new CreateMBREvalFactory(args[0], args[1], args[2]);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePointDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
index f7d284c..82d1013 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
@@ -14,8 +14,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -33,20 +33,20 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
- private IEvaluator eval0 = args[0].createEvaluator(outInput0);
- private IEvaluator eval1 = args[1].createEvaluator(outInput1);
+ private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
+ private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
private AMutablePoint aPoint = new AMutablePoint(0, 0);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<APoint> pointSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -60,8 +60,8 @@
eval1.evaluate(tuple);
try {
- aPoint.setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(), 1),
- ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(), 1));
+ aPoint.setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(), 1),
+ ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(), 1));
pointSerde.serialize(aPoint, out);
} catch (IOException e1) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
index e0b424f..a095111 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
@@ -10,8 +10,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -28,17 +28,17 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
private DataOutput out;
private ArrayBackedValueStorage outInput;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- final IEvaluator[] argEvals = new IEvaluator[args.length];
+ final ICopyEvaluator[] argEvals = new ICopyEvaluator[args.length];
out = output.getDataOutput();
outInput = new ArrayBackedValueStorage();
@@ -47,7 +47,7 @@
argEvals[i] = args[i].createEvaluator(outInput);
}
- return new IEvaluator() {
+ return new ICopyEvaluator() {
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -62,7 +62,7 @@
outInput.reset();
argEvals[i].evaluate(tuple);
try {
- out.write(outInput.getBytes(), outInput.getStartIndex() + 1, outInput.getLength() - 1);
+ out.write(outInput.getByteArray(), outInput.getStartOffset() + 1, outInput.getLength() - 1);
} catch (IOException e) {
throw new AlgebricksException(e);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
index 1e4a98a..d7945fa 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
@@ -17,8 +17,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,19 +36,19 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
- private IEvaluator eval0 = args[0].createEvaluator(outInput0);
- private IEvaluator eval1 = args[1].createEvaluator(outInput1);
+ private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
+ private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
private AMutableRectangle aRectangle = new AMutableRectangle(null, null);
private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
@SuppressWarnings("unchecked")
@@ -63,13 +63,13 @@
eval1.evaluate(tuple);
try {
- aPoint[0].setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ aPoint[0].setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
- aPoint[1].setValue(ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(),
+ aPoint[1].setValue(ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(),
+ ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
if (aPoint[0].getX() > aPoint[1].getX() || aPoint[0].getY() > aPoint[1].getY()) {
throw new IllegalArgumentException(
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
index cb89147..1c1dae3 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.asterix.runtime.evaluators.common.EditDistanceEvaluator;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,12 +36,12 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
return new EditDistanceCheckEvaluator(args, output);
}
};
@@ -54,7 +54,7 @@
private static class EditDistanceCheckEvaluator extends EditDistanceEvaluator {
- private final IEvaluator edThreshEval;
+ private final ICopyEvaluator edThreshEval;
private int edThresh = -1;
private IAOrderedListBuilder listBuilder;
private ArrayBackedValueStorage inputVal;
@@ -62,7 +62,7 @@
private final ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
- public EditDistanceCheckEvaluator(IEvaluatorFactory[] args, IDataOutputProvider output)
+ public EditDistanceCheckEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
throws AlgebricksException {
super(args, output);
edThreshEval = args[2].createEvaluator(argOut);
@@ -75,7 +75,7 @@
super.runArgEvals(tuple);
int edThreshStart = argOut.getLength();
edThreshEval.evaluate(tuple);
- edThresh = IntegerSerializerDeserializer.getInt(argOut.getBytes(), edThreshStart + typeIndicatorSize);
+ edThresh = IntegerSerializerDeserializer.getInt(argOut.getByteArray(), edThreshStart + typeIndicatorSize);
}
@Override
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
index 9efa9f5..a7246fc 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
@@ -8,8 +8,8 @@
import edu.uci.ics.asterix.runtime.evaluators.common.EditDistanceEvaluator;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
public class EditDistanceDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -24,12 +24,12 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
return new EditDistanceEvaluator(args, output);
}
};
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EmbedTypeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EmbedTypeDescriptor.java
index cef79b0..26bfea4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EmbedTypeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EmbedTypeDescriptor.java
@@ -7,8 +7,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -31,15 +31,15 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
// TODO Auto-generated method stub
- return new IEvaluator() {
+ return new ICopyEvaluator() {
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EndsWithDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EndsWithDescriptor.java
index 669c480..19a3be7 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EndsWithDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EndsWithDescriptor.java
@@ -8,8 +8,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -25,13 +25,13 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
DataOutput dout = output.getDataOutput();
@@ -39,8 +39,8 @@
@Override
protected boolean findMatch(byte[] strBytes, byte[] patternBytes) {
- int utflen1 = UTF8StringPointable.getUTFLen(strBytes, 1);
- int utflen2 = UTF8StringPointable.getUTFLen(patternBytes, 1);
+ int utflen1 = UTF8StringPointable.getUTFLength(strBytes, 1);
+ int utflen2 = UTF8StringPointable.getUTFLength(patternBytes, 1);
int s1Start = 3;
int s2Start = 3;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByIndexDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByIndexDescriptor.java
index 92e1040..a0c1ad2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByIndexDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByIndexDescriptor.java
@@ -7,7 +7,7 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.common.FieldAccessByIndexEvalFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class FieldAccessByIndexDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -32,7 +32,7 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(IEvaluatorFactory[] args) {
+ public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
return new FieldAccessByIndexEvalFactory(args[0], args[1], recType);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java
index 67a8dfa..2ac483b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java
@@ -17,8 +17,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -41,35 +41,35 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(IEvaluatorFactory[] args) {
+ public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
return new FieldAccessByNameEvalFactory(args[0], args[1]);
}
- private static class FieldAccessByNameEvalFactory implements IEvaluatorFactory {
+ private static class FieldAccessByNameEvalFactory implements ICopyEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory recordEvalFactory;
- private IEvaluatorFactory fldNameEvalFactory;
+ private ICopyEvaluatorFactory recordEvalFactory;
+ private ICopyEvaluatorFactory fldNameEvalFactory;
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
- public FieldAccessByNameEvalFactory(IEvaluatorFactory recordEvalFactory, IEvaluatorFactory fldNameEvalFactory) {
+ public FieldAccessByNameEvalFactory(ICopyEvaluatorFactory recordEvalFactory, ICopyEvaluatorFactory fldNameEvalFactory) {
this.recordEvalFactory = recordEvalFactory;
this.fldNameEvalFactory = fldNameEvalFactory;
}
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
- private IEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
- private IEvaluator eval1 = fldNameEvalFactory.createEvaluator(outInput1);
+ private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
+ private ICopyEvaluator eval1 = fldNameEvalFactory.createEvaluator(outInput1);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
@@ -85,7 +85,7 @@
eval0.evaluate(tuple);
outInput1.reset();
eval1.evaluate(tuple);
- byte[] serRecord = outInput0.getBytes();
+ byte[] serRecord = outInput0.getByteArray();
if (serRecord[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, out);
@@ -97,7 +97,7 @@
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
}
- byte[] serFldName = outInput1.getBytes();
+ byte[] serFldName = outInput1.getByteArray();
fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetByName(serRecord, serFldName);
if (fieldValueOffset < 0) {
out.writeByte(ATypeTag.NULL.serialize());
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FuzzyEqDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FuzzyEqDescriptor.java
index 4551704..623783e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FuzzyEqDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FuzzyEqDescriptor.java
@@ -7,7 +7,7 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
public class FuzzyEqDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -21,7 +21,7 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
throw new NotImplementedException();
}
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 4ce843b..f8470b0 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
@@ -17,8 +17,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -37,7 +37,7 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
return new GetItemEvalFactory(args);
}
@@ -46,32 +46,32 @@
return FID;
}
- private static class GetItemEvalFactory implements IEvaluatorFactory {
+ private static class GetItemEvalFactory implements ICopyEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory listEvalFactory;
- private IEvaluatorFactory indexEvalFactory;
+ private ICopyEvaluatorFactory listEvalFactory;
+ private ICopyEvaluatorFactory indexEvalFactory;
private final static byte SER_ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
private byte serItemTypeTag;
private ATypeTag itemTag;
private boolean selfDescList = false;
- public GetItemEvalFactory(IEvaluatorFactory[] args) {
+ public GetItemEvalFactory(ICopyEvaluatorFactory[] args) {
this.listEvalFactory = args[0];
this.indexEvalFactory = args[1];
}
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInputList = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInputIdx = new ArrayBackedValueStorage();
- private IEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
- private IEvaluator evalIdx = indexEvalFactory.createEvaluator(outInputIdx);
+ private ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
+ private ICopyEvaluator evalIdx = indexEvalFactory.createEvaluator(outInputIdx);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
@@ -87,7 +87,7 @@
evalList.evaluate(tuple);
outInputIdx.reset();
evalIdx.evaluate(tuple);
- byte[] serOrderedList = outInputList.getBytes();
+ byte[] serOrderedList = outInputList.getByteArray();
if (serOrderedList[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, out);
@@ -99,7 +99,7 @@
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]));
}
- itemIndex = IntegerSerializerDeserializer.getInt(outInputIdx.getBytes(), 1);
+ itemIndex = IntegerSerializerDeserializer.getInt(outInputIdx.getByteArray(), 1);
if (itemIndex >= AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList)) {
out.writeByte(SER_NULL_TYPE_TAG);
return;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GramTokensDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GramTokensDescriptor.java
index 50c4283..3d1fce6 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GramTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GramTokensDescriptor.java
@@ -12,8 +12,8 @@
import edu.uci.ics.fuzzyjoin.tokenizer.UTF8NGramTokenFactory;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
public class GramTokensDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -33,12 +33,12 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
ITokenFactory tokenFactory = new UTF8NGramTokenFactory(ATypeTag.STRING.serialize(),
ATypeTag.INT32.serialize());
NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(3, true, true, true,
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/HashedGramTokensDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/HashedGramTokensDescriptor.java
index a240636..df6bc7b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/HashedGramTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/HashedGramTokensDescriptor.java
@@ -12,8 +12,8 @@
import edu.uci.ics.fuzzyjoin.tokenizer.NGramUTF8StringBinaryTokenizer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
public class HashedGramTokensDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -33,12 +33,12 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
ITokenFactory tokenFactory = new HashedUTF8NGramTokenFactory(ATypeTag.INT32.serialize(),
ATypeTag.INT32.serialize());
NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(3, true, true, true,
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/HashedWordTokensDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/HashedWordTokensDescriptor.java
index c0b7253..ac756f2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/HashedWordTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/HashedWordTokensDescriptor.java
@@ -14,8 +14,8 @@
import edu.uci.ics.fuzzyjoin.tokenizer.ITokenFactory;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
public class HashedWordTokensDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -35,12 +35,12 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
ITokenFactory tokenFactory = new HashedUTF8WordTokenFactory(ATypeTag.INT32.serialize(),
ATypeTag.INT32.serialize());
IBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(true, true, tokenFactory);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java
index 478316f..abd3ae5 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java
@@ -11,8 +11,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -34,20 +34,20 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- final IEvaluator[] evals = new IEvaluator[args.length];
+ final ICopyEvaluator[] evals = new ICopyEvaluator[args.length];
evals[0] = args[0].createEvaluator(argOut);
evals[1] = args[1].createEvaluator(argOut);
- return new IEvaluator() {
+ return new ICopyEvaluator() {
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -55,9 +55,9 @@
// evaluator the failure condition
argOut.reset();
evals[1].evaluate(tuple);
- ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[0]);
+ ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
if (typeTag == ATypeTag.BOOLEAN) {
- boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getBytes(), 1);
+ boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getByteArray(), 1);
if (argResult)
throw new AlgebricksException("Injecting a intended failure");
}
@@ -65,7 +65,7 @@
// evaluate the real evaluator
argOut.reset();
evals[0].evaluate(tuple);
- output.getDataOutput().write(argOut.getBytes(), argOut.getStartIndex(), argOut.getLength());
+ output.getDataOutput().write(argOut.getByteArray(), argOut.getStartOffset(), argOut.getLength());
} catch (IOException e) {
throw new AlgebricksException(e);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/IsNullDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/IsNullDescriptor.java
index 59bce2d..5e3b7ab 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/IsNullDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/IsNullDescriptor.java
@@ -11,8 +11,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -32,24 +32,24 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(argOut);
+ private ICopyEvaluator eval = args[0].createEvaluator(argOut);
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
argOut.reset();
eval.evaluate(tuple);
- boolean isNull = argOut.getBytes()[argOut.getStartIndex()] == SER_NULL_TYPE_TAG;
+ boolean isNull = argOut.getByteArray()[argOut.getStartOffset()] == SER_NULL_TYPE_TAG;
ABoolean res = isNull ? ABoolean.TRUE : ABoolean.FALSE;
try {
AObjectSerializerDeserializer.INSTANCE.serialize(res, out);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LenDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LenDescriptor.java
index 769fdb7..0e15a18 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LenDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LenDescriptor.java
@@ -17,8 +17,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -39,19 +39,19 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private final DataOutput out = output.getDataOutput();
private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private final IEvaluator evalList = args[0].createEvaluator(inputVal);
+ private final ICopyEvaluator evalList = args[0].createEvaluator(inputVal);
// result
private final AMutableInt32 res = new AMutableInt32(0);
@@ -67,7 +67,7 @@
inputVal.reset();
evalList.evaluate(tuple);
- byte[] serList = inputVal.getBytes();
+ byte[] serList = inputVal.getByteArray();
if (serList[0] == SER_NULL_TYPE_TAG) {
try {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LikeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LikeDescriptor.java
index 1090742..1b43441 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LikeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LikeDescriptor.java
@@ -21,8 +21,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
@@ -53,22 +53,22 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
final DataOutput dout = output.getDataOutput();
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private boolean first = true;
private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
- private IEvaluator evalString = args[0].createEvaluator(array0);
- private IEvaluator evalPattern = args[1].createEvaluator(array0);
+ private ICopyEvaluator evalString = args[0].createEvaluator(array0);
+ private ICopyEvaluator evalPattern = args[1].createEvaluator(array0);
private ByteArrayAccessibleOutputStream lastPattern = new ByteArrayAccessibleOutputStream();
private UTF8CharSequence carSeq = new UTF8CharSequence();
private IBinaryComparator strComp = AqlBinaryComparatorFactoryProvider.INSTANCE
@@ -91,7 +91,7 @@
try {
array0.reset();
evalPattern.evaluate(tuple);
- if (array0.getBytes()[0] == SER_NULL_TYPE_TAG) {
+ if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, dout);
return;
}
@@ -100,7 +100,7 @@
first = false;
newPattern = true;
} else {
- int c = strComp.compare(array0.getBytes(), array0.getStartIndex(), array0.getLength(),
+ int c = strComp.compare(array0.getByteArray(), array0.getStartOffset(), array0.getLength(),
lastPattern.getByteArray(), 0, lastPattern.size());
if (c != 0) {
newPattern = true;
@@ -108,7 +108,7 @@
}
if (newPattern) {
lastPattern.reset();
- lastPattern.write(array0.getBytes(), array0.getStartIndex(), array0.getLength());
+ lastPattern.write(array0.getByteArray(), array0.getStartOffset(), array0.getLength());
// ! object creation !
DataInputStream di = new DataInputStream(new ByteArrayInputStream(
lastPattern.getByteArray()));
@@ -118,7 +118,7 @@
}
array0.reset();
evalString.evaluate(tuple);
- if (array0.getBytes()[0] == SER_NULL_TYPE_TAG) {
+ if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, dout);
return;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotDescriptor.java
index 1e4cb3e..abb4e25 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotDescriptor.java
@@ -14,8 +14,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -42,18 +42,18 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
final DataOutput out = output.getDataOutput();
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(argOut);
+ private ICopyEvaluator eval = args[0].createEvaluator(argOut);
private String errorMessage = "Not() can only be applied on boolean";
@SuppressWarnings("unchecked")
@@ -68,11 +68,11 @@
argOut.reset();
eval.evaluate(tuple);
try {
- if (argOut.getBytes()[0] == SER_BOOLEAN_TYPE_TAG) {
- boolean argRes = ABooleanSerializerDeserializer.getBoolean(argOut.getBytes(), 1);
+ if (argOut.getByteArray()[0] == SER_BOOLEAN_TYPE_TAG) {
+ boolean argRes = ABooleanSerializerDeserializer.getBoolean(argOut.getByteArray(), 1);
ABoolean aResult = argRes ? (ABoolean.FALSE) : (ABoolean.TRUE);
booleanSerde.serialize(aResult, out);
- } else if (argOut.getBytes()[0] == SER_NULL_TYPE_TAG)
+ } else if (argOut.getByteArray()[0] == SER_NULL_TYPE_TAG)
nullSerde.serialize(ANull.NULL, out);
else
throw new AlgebricksException(errorMessage);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAddDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAddDescriptor.java
index 405a006..baa20cd 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAddDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAddDescriptor.java
@@ -26,8 +26,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -51,19 +51,19 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
// one temp. buffer re-used by both children
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- private IEvaluator evalLeft = args[0].createEvaluator(argOut);
- private IEvaluator evalRight = args[1].createEvaluator(argOut);
+ private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut);
+ private ICopyEvaluator evalRight = args[1].createEvaluator(argOut);
private double[] operands = new double[args.length];
private boolean metInt8 = false, metInt16 = false, metInt32 = false, metInt64 = false,
metFloat = false, metDouble = false;
@@ -88,36 +88,36 @@
evalLeft.evaluate(tuple);
else
evalRight.evaluate(tuple);
- typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[0]);
+ typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
switch (typeTag) {
case INT8: {
metInt8 = true;
- operands[i] = AInt8SerializerDeserializer.getByte(argOut.getBytes(), 1);
+ operands[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
break;
}
case INT16: {
metInt16 = true;
- operands[i] = AInt16SerializerDeserializer.getShort(argOut.getBytes(), 1);
+ operands[i] = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
break;
}
case INT32: {
metInt32 = true;
- operands[i] = AInt32SerializerDeserializer.getInt(argOut.getBytes(), 1);
+ operands[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
break;
}
case INT64: {
metInt64 = true;
- operands[i] = AInt64SerializerDeserializer.getLong(argOut.getBytes(), 1);
+ operands[i] = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
break;
}
case FLOAT: {
metFloat = true;
- operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getBytes(), 1);
+ operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
break;
}
case DOUBLE: {
metDouble = true;
- operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getBytes(), 1);
+ operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
break;
}
case NULL: {
@@ -131,7 +131,7 @@
: "Right"
+ " Operand of Addition can not be "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
- .getBytes()[0]));
+ .getByteArray()[0]));
}
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericDivideDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericDivideDescriptor.java
index a6d0f47..b226ad7 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericDivideDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericDivideDescriptor.java
@@ -26,8 +26,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -51,19 +51,19 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
// one temp. buffer re-used by both children
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- private IEvaluator evalLeft = args[0].createEvaluator(argOut);
- private IEvaluator evalRight = args[1].createEvaluator(argOut);
+ private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut);
+ private ICopyEvaluator evalRight = args[1].createEvaluator(argOut);
private double[] operands = new double[args.length];
private boolean metInt8 = false, metInt16 = false, metInt32 = false, metInt64 = false,
metFloat = false, metDouble = false;
@@ -88,36 +88,36 @@
evalLeft.evaluate(tuple);
else
evalRight.evaluate(tuple);
- typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[0]);
+ typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
switch (typeTag) {
case INT8: {
metInt8 = true;
- operands[i] = AInt8SerializerDeserializer.getByte(argOut.getBytes(), 1);
+ operands[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
break;
}
case INT16: {
metInt16 = true;
- operands[i] = AInt16SerializerDeserializer.getShort(argOut.getBytes(), 1);
+ operands[i] = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
break;
}
case INT32: {
metInt32 = true;
- operands[i] = AInt32SerializerDeserializer.getInt(argOut.getBytes(), 1);
+ operands[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
break;
}
case INT64: {
metInt64 = true;
- operands[i] = AInt64SerializerDeserializer.getLong(argOut.getBytes(), 1);
+ operands[i] = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
break;
}
case FLOAT: {
metFloat = true;
- operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getBytes(), 1);
+ operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
break;
}
case DOUBLE: {
metDouble = true;
- operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getBytes(), 1);
+ operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
break;
}
case NULL: {
@@ -131,7 +131,7 @@
: "Right"
+ " Operand of Division can not be "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
- .getBytes()[0]));
+ .getByteArray()[0]));
}
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericMultiplyDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericMultiplyDescriptor.java
index 33a1a90..aa5eaaa 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericMultiplyDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericMultiplyDescriptor.java
@@ -26,8 +26,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -51,19 +51,19 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
// one temp. buffer re-used by both children
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- private IEvaluator evalLeft = args[0].createEvaluator(argOut);
- private IEvaluator evalRight = args[1].createEvaluator(argOut);
+ private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut);
+ private ICopyEvaluator evalRight = args[1].createEvaluator(argOut);
private double[] operands = new double[args.length];
private boolean metInt8 = false, metInt16 = false, metInt32 = false, metInt64 = false,
metFloat = false, metDouble = false;
@@ -88,36 +88,36 @@
evalLeft.evaluate(tuple);
else
evalRight.evaluate(tuple);
- typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[0]);
+ typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
switch (typeTag) {
case INT8: {
metInt8 = true;
- operands[i] = AInt8SerializerDeserializer.getByte(argOut.getBytes(), 1);
+ operands[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
break;
}
case INT16: {
metInt16 = true;
- operands[i] = AInt16SerializerDeserializer.getShort(argOut.getBytes(), 1);
+ operands[i] = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
break;
}
case INT32: {
metInt32 = true;
- operands[i] = AInt32SerializerDeserializer.getInt(argOut.getBytes(), 1);
+ operands[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
break;
}
case INT64: {
metInt64 = true;
- operands[i] = AInt64SerializerDeserializer.getLong(argOut.getBytes(), 1);
+ operands[i] = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
break;
}
case FLOAT: {
metFloat = true;
- operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getBytes(), 1);
+ operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
break;
}
case DOUBLE: {
metDouble = true;
- operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getBytes(), 1);
+ operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
break;
}
case NULL: {
@@ -131,7 +131,7 @@
: "Right"
+ " Operand of Multiplication can not be "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
- .getBytes()[0]));
+ .getByteArray()[0]));
}
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java
index ffed14e..0b53f18 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java
@@ -26,8 +26,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -51,19 +51,19 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
// one temp. buffer re-used by both children
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- private IEvaluator evalLeft = args[0].createEvaluator(argOut);
- private IEvaluator evalRight = args[1].createEvaluator(argOut);
+ private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut);
+ private ICopyEvaluator evalRight = args[1].createEvaluator(argOut);
private double[] operands = new double[args.length];
private boolean metInt8 = false, metInt16 = false, metInt32 = false, metInt64 = false,
metFloat = false, metDouble = false;
@@ -88,36 +88,36 @@
evalLeft.evaluate(tuple);
else
evalRight.evaluate(tuple);
- typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[0]);
+ typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
switch (typeTag) {
case INT8: {
metInt8 = true;
- operands[i] = AInt8SerializerDeserializer.getByte(argOut.getBytes(), 1);
+ operands[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
break;
}
case INT16: {
metInt16 = true;
- operands[i] = AInt16SerializerDeserializer.getShort(argOut.getBytes(), 1);
+ operands[i] = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
break;
}
case INT32: {
metInt32 = true;
- operands[i] = AInt32SerializerDeserializer.getInt(argOut.getBytes(), 1);
+ operands[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
break;
}
case INT64: {
metInt64 = true;
- operands[i] = AInt64SerializerDeserializer.getLong(argOut.getBytes(), 1);
+ operands[i] = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
break;
}
case FLOAT: {
metFloat = true;
- operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getBytes(), 1);
+ operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
break;
}
case DOUBLE: {
metDouble = true;
- operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getBytes(), 1);
+ operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
break;
}
case NULL: {
@@ -131,7 +131,7 @@
: "Right"
+ " Operand of Substraction can not be "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
- .getBytes()[0]));
+ .getByteArray()[0]));
}
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
index cd234cb..7998618 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
@@ -26,8 +26,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -46,18 +46,18 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(argOut);
+ private ICopyEvaluator eval = args[0].createEvaluator(argOut);
private byte serNullTypeTag = ATypeTag.NULL.serialize();
private byte serInt8TypeTag = ATypeTag.INT8.serialize();
private byte serInt16TypeTag = ATypeTag.INT16.serialize();
@@ -80,44 +80,44 @@
argOut.reset();
eval.evaluate(tuple);
try {
- if (argOut.getBytes()[0] == serNullTypeTag) {
+ if (argOut.getByteArray()[0] == serNullTypeTag) {
serde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
serde.serialize(ANull.NULL, out);
return;
- } else if (argOut.getBytes()[0] == serInt8TypeTag) {
+ } else if (argOut.getByteArray()[0] == serInt8TypeTag) {
serde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.AINT8);
- aInt8.setValue((byte) -AInt8SerializerDeserializer.getByte(argOut.getBytes(), 1));
+ aInt8.setValue((byte) -AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1));
serde.serialize(aInt8, out);
- } else if (argOut.getBytes()[0] == serInt16TypeTag) {
+ } else if (argOut.getByteArray()[0] == serInt16TypeTag) {
serde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.AINT16);
- aInt16.setValue((short) -AInt16SerializerDeserializer.getShort(argOut.getBytes(), 1));
+ aInt16.setValue((short) -AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1));
serde.serialize(aInt16, out);
- } else if (argOut.getBytes()[0] == serInt32TypeTag) {
+ } else if (argOut.getByteArray()[0] == serInt32TypeTag) {
serde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.AINT32);
- aInt32.setValue(-AInt32SerializerDeserializer.getInt(argOut.getBytes(), 1));
+ aInt32.setValue(-AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1));
serde.serialize(aInt32, out);
- } else if (argOut.getBytes()[0] == serInt64TypeTag) {
+ } else if (argOut.getByteArray()[0] == serInt64TypeTag) {
serde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.AINT64);
- aInt64.setValue(-AInt64SerializerDeserializer.getLong(argOut.getBytes(), 1));
+ aInt64.setValue(-AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1));
serde.serialize(aInt64, out);
- } else if (argOut.getBytes()[0] == serFloatTypeTag) {
+ } else if (argOut.getByteArray()[0] == serFloatTypeTag) {
serde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.AFLOAT);
- aFloat.setValue(-AFloatSerializerDeserializer.getFloat(argOut.getBytes(), 1));
+ aFloat.setValue(-AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1));
serde.serialize(aFloat, out);
- } else if (argOut.getBytes()[0] == serDoubleTypeTag) {
+ } else if (argOut.getByteArray()[0] == serDoubleTypeTag) {
serde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ADOUBLE);
- aDouble.setValue(-ADoubleSerializerDeserializer.getDouble(argOut.getBytes(), 1));
+ aDouble.setValue(-ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1));
serde.serialize(aDouble, out);
} else {
throw new NotImplementedException("Unary minus is not implemented for "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getBytes()[0]));
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OpenRecordConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OpenRecordConstructorDescriptor.java
index aeb6b15..f3681f2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OpenRecordConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OpenRecordConstructorDescriptor.java
@@ -12,8 +12,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -43,15 +43,15 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
int n = args.length / 2;
- final IEvaluator[] evalNames = new IEvaluator[n];
- final IEvaluator[] evalFields = new IEvaluator[n];
+ final ICopyEvaluator[] evalNames = new ICopyEvaluator[n];
+ final ICopyEvaluator[] evalFields = new ICopyEvaluator[n];
final ArrayBackedValueStorage fieldNameBuffer = new ArrayBackedValueStorage();
final ArrayBackedValueStorage fieldValueBuffer = new ArrayBackedValueStorage();
for (int i = 0; i < n; i++) {
@@ -59,7 +59,7 @@
evalFields[i] = args[2 * i + 1].createEvaluator(fieldValueBuffer);
}
final DataOutput out = output.getDataOutput();
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private RecordBuilder recBuilder = new RecordBuilder();
private int closedFieldId;
private boolean first = true;
@@ -81,7 +81,7 @@
evalNames[i].evaluate(tuple);
recBuilder.addField(fieldNameBuffer, fieldValueBuffer);
} else {
- if (fieldValueBuffer.getBytes()[0] != ATypeTag.NULL.serialize()) {
+ if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL.serialize()) {
recBuilder.addField(closedFieldId, fieldValueBuffer);
}
closedFieldId++;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OrDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OrDescriptor.java
index 837d54a..8349c97 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OrDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OrDescriptor.java
@@ -12,8 +12,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -38,21 +38,21 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
// one temp. buffer re-used by all children
final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- final IEvaluator[] evals = new IEvaluator[args.length];
+ final ICopyEvaluator[] evals = new ICopyEvaluator[args.length];
for (int i = 0; i < evals.length; i++) {
evals[i] = args[i].createEvaluator(argOut);
}
- return new IEvaluator() {
+ return new ICopyEvaluator() {
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
@@ -69,11 +69,11 @@
for (int i = 0; i < n; i++) {
argOut.reset();
evals[i].evaluate(tuple);
- if (argOut.getBytes()[0] == SER_NULL_TYPE_TAG) {
+ if (argOut.getByteArray()[0] == SER_NULL_TYPE_TAG) {
metNull = true;
continue;
}
- boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getBytes(), 1);
+ boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getByteArray(), 1);
if (argResult == true) {
res = true;
break;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java
index 5b327ca..b9e341d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java
@@ -12,8 +12,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -41,20 +41,20 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
return new OrderedListConstructorEvaluatorFactory(args, oltype);
}
- private static class OrderedListConstructorEvaluatorFactory implements IEvaluatorFactory {
+ private static class OrderedListConstructorEvaluatorFactory implements ICopyEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory[] args;
+ private ICopyEvaluatorFactory[] args;
private boolean selfDescList = false;
private AOrderedListType orderedlistType;
- public OrderedListConstructorEvaluatorFactory(IEvaluatorFactory[] args, AOrderedListType type) {
+ public OrderedListConstructorEvaluatorFactory(ICopyEvaluatorFactory[] args, AOrderedListType type) {
this.args = args;
this.orderedlistType = type;
@@ -64,15 +64,15 @@
}
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
final DataOutput out = output.getDataOutput();
final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- final IEvaluator[] argEvals = new IEvaluator[args.length];
+ final ICopyEvaluator[] argEvals = new ICopyEvaluator[args.length];
for (int i = 0; i < args.length; i++) {
argEvals[i] = args[i].createEvaluator(inputVal);
}
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private OrderedListBuilder builder = new OrderedListBuilder();
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
index 880e84e..57b7acd 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
@@ -16,8 +16,8 @@
import edu.uci.ics.fuzzyjoin.similarity.SimilarityFilters;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,21 +36,21 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private final DataOutput out = output.getDataOutput();
private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private final IEvaluator evalLen = args[0].createEvaluator(inputVal);
- private final IEvaluator evalSimilarity = args[1].createEvaluator(inputVal);
- private final IEvaluator evalThreshold = args[2].createEvaluator(inputVal);
+ private final ICopyEvaluator evalLen = args[0].createEvaluator(inputVal);
+ private final ICopyEvaluator evalSimilarity = args[1].createEvaluator(inputVal);
+ private final ICopyEvaluator evalThreshold = args[2].createEvaluator(inputVal);
private final SimilarityFiltersCache similarityFiltersCache = new SimilarityFiltersCache();
@@ -65,19 +65,19 @@
// length
inputVal.reset();
evalLen.evaluate(tuple);
- int length = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int length = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
// similarity threshold
inputVal.reset();
evalThreshold.evaluate(tuple);
float similarityThreshold = (float) ADoubleSerializerDeserializer.getDouble(
- inputVal.getBytes(), 1);
+ inputVal.getByteArray(), 1);
// similarity name
inputVal.reset();
evalSimilarity.evaluate(tuple);
SimilarityFilters similarityFilters = similarityFiltersCache.get(similarityThreshold,
- inputVal.getBytes());
+ inputVal.getByteArray());
int prefixLength = similarityFilters.getPrefixLength(length);
res.setValue(prefixLength);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
index ab95a36..2612583 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.fuzzyjoin.similarity.SimilarityFiltersJaccard;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -35,20 +35,20 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private final DataOutput out = output.getDataOutput();
private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private final IEvaluator evalLen = args[0].createEvaluator(inputVal);
- private final IEvaluator evalThreshold = args[1].createEvaluator(inputVal);
+ private final ICopyEvaluator evalLen = args[0].createEvaluator(inputVal);
+ private final ICopyEvaluator evalThreshold = args[1].createEvaluator(inputVal);
private float similarityThresholdCache;
private SimilarityFiltersJaccard similarityFilters;
@@ -64,12 +64,12 @@
// length
inputVal.reset();
evalLen.evaluate(tuple);
- int length = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int length = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
// similarity threshold
inputVal.reset();
evalThreshold.evaluate(tuple);
- float similarityThreshold = (float) AFloatSerializerDeserializer.getFloat(inputVal.getBytes(),
+ float similarityThreshold = (float) AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(),
1);
if (similarityThreshold != similarityThresholdCache || similarityFilters == null) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RegExpDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RegExpDescriptor.java
index 2a415e4..1815085 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RegExpDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RegExpDescriptor.java
@@ -20,8 +20,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
@@ -53,22 +53,22 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
final DataOutput dout = output.getDataOutput();
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private boolean first = true;
private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
- private IEvaluator evalString = args[0].createEvaluator(array0);
- private IEvaluator evalPattern = args[1].createEvaluator(array0);
+ private ICopyEvaluator evalString = args[0].createEvaluator(array0);
+ private ICopyEvaluator evalPattern = args[1].createEvaluator(array0);
private ByteArrayAccessibleOutputStream lastPattern = new ByteArrayAccessibleOutputStream();
private UTF8CharSequence carSeq = new UTF8CharSequence();
private IBinaryComparator strComp = AqlBinaryComparatorFactoryProvider.INSTANCE
@@ -91,7 +91,7 @@
try {
array0.reset();
evalPattern.evaluate(tuple);
- if (array0.getBytes()[0] == SER_NULL_TYPE_TAG) {
+ if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, dout);
return;
}
@@ -100,7 +100,7 @@
first = false;
newPattern = true;
} else {
- int c = strComp.compare(array0.getBytes(), array0.getStartIndex(), array0.getLength(),
+ int c = strComp.compare(array0.getByteArray(), array0.getStartOffset(), array0.getLength(),
lastPattern.getByteArray(), 0, lastPattern.size());
if (c != 0) {
newPattern = true;
@@ -108,7 +108,7 @@
}
if (newPattern) {
lastPattern.reset();
- lastPattern.write(array0.getBytes(), array0.getStartIndex(), array0.getLength());
+ lastPattern.write(array0.getByteArray(), array0.getStartOffset(), array0.getLength());
// ! object creation !
DataInputStream di = new DataInputStream(new ByteArrayInputStream(
lastPattern.getByteArray()));
@@ -118,7 +118,7 @@
}
array0.reset();
evalString.evaluate(tuple);
- if (array0.getBytes()[0] == SER_NULL_TYPE_TAG) {
+ if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, dout);
return;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
index 85adfe1..d3218ff 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
@@ -24,8 +24,8 @@
import edu.uci.ics.fuzzyjoin.similarity.SimilarityMetric;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -47,25 +47,25 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private final DataOutput out = output.getDataOutput();
private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private final IEvaluator evalLen1 = args[0].createEvaluator(inputVal);
- private final IEvaluator evalTokens1 = args[1].createEvaluator(inputVal);
- private final IEvaluator evalLen2 = args[2].createEvaluator(inputVal);
- private final IEvaluator evalTokens2 = args[3].createEvaluator(inputVal);
- private final IEvaluator evalTokenPrefix = args[4].createEvaluator(inputVal);
- private final IEvaluator evalSimilarity = args[5].createEvaluator(inputVal);
- private final IEvaluator evalThreshold = args[6].createEvaluator(inputVal);
+ private final ICopyEvaluator evalLen1 = args[0].createEvaluator(inputVal);
+ private final ICopyEvaluator evalTokens1 = args[1].createEvaluator(inputVal);
+ private final ICopyEvaluator evalLen2 = args[2].createEvaluator(inputVal);
+ private final ICopyEvaluator evalTokens2 = args[3].createEvaluator(inputVal);
+ private final ICopyEvaluator evalTokenPrefix = args[4].createEvaluator(inputVal);
+ private final ICopyEvaluator evalSimilarity = args[5].createEvaluator(inputVal);
+ private final ICopyEvaluator evalThreshold = args[6].createEvaluator(inputVal);
private final SimilarityFiltersCache similarityFiltersCache = new SimilarityFiltersCache();
@@ -85,21 +85,21 @@
inputVal.reset();
evalThreshold.evaluate(tuple);
float similarityThreshold = (float) ADoubleSerializerDeserializer.getDouble(
- inputVal.getBytes(), 1);
+ inputVal.getByteArray(), 1);
// similarity name
inputVal.reset();
evalSimilarity.evaluate(tuple);
SimilarityFilters similarityFilters = similarityFiltersCache.get(similarityThreshold,
- inputVal.getBytes());
+ inputVal.getByteArray());
inputVal.reset();
evalLen1.evaluate(tuple);
- int length1 = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int length1 = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
inputVal.reset();
evalLen2.evaluate(tuple);
- int length2 = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int length2 = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
float sim = 0;
@@ -114,7 +114,7 @@
inputVal.reset();
evalTokens1.evaluate(tuple);
- byte[] serList = inputVal.getBytes();
+ byte[] serList = inputVal.getByteArray();
if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
throw new AlgebricksException("Scan collection is not defined for values of type"
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
@@ -123,7 +123,7 @@
int lengthTokens1;
if (serList[0] == SER_ORDEREDLIST_TYPE_TAG) {
lengthTokens1 = AOrderedListSerializerDeserializer
- .getNumberOfItems(inputVal.getBytes());
+ .getNumberOfItems(inputVal.getByteArray());
// read tokens
for (i = 0; i < lengthTokens1; i++) {
int itemOffset;
@@ -136,7 +136,7 @@
}
} else {
lengthTokens1 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal
- .getBytes());
+ .getByteArray());
// read tokens
for (i = 0; i < lengthTokens1; i++) {
int itemOffset;
@@ -158,7 +158,7 @@
inputVal.reset();
evalTokens2.evaluate(tuple);
- serList = inputVal.getBytes();
+ serList = inputVal.getByteArray();
if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
throw new AlgebricksException("Scan collection is not defined for values of type"
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
@@ -167,7 +167,7 @@
int lengthTokens2;
if (serList[0] == SER_ORDEREDLIST_TYPE_TAG) {
lengthTokens2 = AOrderedListSerializerDeserializer
- .getNumberOfItems(inputVal.getBytes());
+ .getNumberOfItems(inputVal.getByteArray());
// read tokens
for (i = 0; i < lengthTokens2; i++) {
int itemOffset;
@@ -180,7 +180,7 @@
}
} else {
lengthTokens2 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal
- .getBytes());
+ .getByteArray());
// read tokens
for (i = 0; i < lengthTokens2; i++) {
int itemOffset;
@@ -200,7 +200,7 @@
// -- - token prefix - --
inputVal.reset();
evalTokenPrefix.evaluate(tuple);
- int tokenPrefix = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ int tokenPrefix = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
//
// -- - position filter - --
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardCheckDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardCheckDescriptor.java
index 3021717..296916d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardCheckDescriptor.java
@@ -17,8 +17,8 @@
import edu.uci.ics.asterix.runtime.evaluators.common.SimilarityJaccardEvaluator;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -38,12 +38,12 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
return new SimilarityJaccardCheckEvaluator(args, output);
}
};
@@ -56,7 +56,7 @@
private static class SimilarityJaccardCheckEvaluator extends SimilarityJaccardEvaluator {
- private final IEvaluator jaccThreshEval;
+ private final ICopyEvaluator jaccThreshEval;
private float jaccThresh = -1f;
private IAOrderedListBuilder listBuilder;
@@ -66,7 +66,7 @@
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
private final AOrderedListType listType = new AOrderedListType(BuiltinType.ANY, "list");
- public SimilarityJaccardCheckEvaluator(IEvaluatorFactory[] args, IDataOutputProvider output)
+ public SimilarityJaccardCheckEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
throws AlgebricksException {
super(args, output);
jaccThreshEval = args[2].createEvaluator(argOut);
@@ -79,7 +79,7 @@
super.runArgEvals(tuple);
int jaccThreshStart = argOut.getLength();
jaccThreshEval.evaluate(tuple);
- jaccThresh = (float) AFloatSerializerDeserializer.getFloat(argOut.getBytes(), jaccThreshStart
+ jaccThresh = (float) AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), jaccThreshStart
+ typeIndicatorSize);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardDescriptor.java
index eb7fe6d..c3c6ca0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardDescriptor.java
@@ -7,8 +7,8 @@
import edu.uci.ics.asterix.runtime.evaluators.common.SimilarityJaccardEvaluator;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
//assumes that both arguments are sorted by the same ordering
@@ -25,12 +25,12 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
return new SimilarityJaccardEvaluator(args, output);
}
};
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
index f1af62a..4008419 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
@@ -17,8 +17,8 @@
import edu.uci.ics.asterix.runtime.evaluators.common.SimilarityJaccardPrefixEvaluator;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -36,12 +36,12 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
return new SimilarityJaccardPrefixCheckEvaluator(args, output);
}
};
@@ -66,7 +66,7 @@
private final AOrderedListType listType = new AOrderedListType(BuiltinType.ANY, "list");
- public SimilarityJaccardPrefixCheckEvaluator(IEvaluatorFactory[] args, IDataOutputProvider output)
+ public SimilarityJaccardPrefixCheckEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
throws AlgebricksException {
super(args, output);
listBuilder = new OrderedListBuilder();
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixDescriptor.java
index 62e1b06..4d9c528 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixDescriptor.java
@@ -7,8 +7,8 @@
import edu.uci.ics.asterix.runtime.evaluators.common.SimilarityJaccardPrefixEvaluator;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
public class SimilarityJaccardPrefixDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -23,12 +23,12 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
return new SimilarityJaccardPrefixEvaluator(args, output);
}
};
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
index 91496fd..644e89d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
@@ -18,8 +18,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -37,17 +37,17 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- private IEvaluator eval = args[0].createEvaluator(argOut);
+ private ICopyEvaluator eval = args[0].createEvaluator(argOut);
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -55,36 +55,36 @@
eval.evaluate(tuple);
try {
- byte[] bytes = argOut.getBytes();
+ byte[] bytes = argOut.getByteArray();
ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]);
double area = 0.0;
switch (tag) {
case POLYGON:
- int numOfPoints = AInt16SerializerDeserializer.getShort(argOut.getBytes(), 1);
+ int numOfPoints = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
if (numOfPoints < 3) {
throw new AlgebricksException("Polygon must have at least 3 points");
}
- area = Math.abs(SpatialUtils.polygonArea(argOut.getBytes(), numOfPoints));
+ area = Math.abs(SpatialUtils.polygonArea(argOut.getByteArray(), numOfPoints));
break;
case CIRCLE:
- double radius = ADoubleSerializerDeserializer.getDouble(argOut.getBytes(),
+ double radius = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
ACircleSerializerDeserializer.getRadiusOffset());
area = SpatialUtils.pi() * radius * radius;
break;
case RECTANGLE:
- double x1 = ADoubleSerializerDeserializer.getDouble(argOut.getBytes(),
+ double x1 = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
ARectangleSerializerDeserializer
.getBottomLeftCoordinateOffset(Coordinate.X));
- double y1 = ADoubleSerializerDeserializer.getDouble(argOut.getBytes(),
+ double y1 = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
ARectangleSerializerDeserializer
.getBottomLeftCoordinateOffset(Coordinate.Y));
- double x2 = ADoubleSerializerDeserializer.getDouble(argOut.getBytes(),
+ double x2 = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
ARectangleSerializerDeserializer
.getUpperRightCoordinateOffset(Coordinate.X));
- double y2 = ADoubleSerializerDeserializer.getDouble(argOut.getBytes(),
+ double y2 = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
ARectangleSerializerDeserializer
.getUpperRightCoordinateOffset(Coordinate.Y));
area = (x2 - x1) * (y2 - y1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
index 85586d8..0fe63f5 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
@@ -20,8 +20,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -39,13 +39,13 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
@@ -53,10 +53,10 @@
private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput2 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput3 = new ArrayBackedValueStorage();
- private IEvaluator eval0 = args[0].createEvaluator(outInput0);
- private IEvaluator eval1 = args[1].createEvaluator(outInput1);
- private IEvaluator eval2 = args[2].createEvaluator(outInput2);
- private IEvaluator eval3 = args[3].createEvaluator(outInput3);
+ private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
+ private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
+ private ICopyEvaluator eval2 = args[2].createEvaluator(outInput2);
+ private ICopyEvaluator eval3 = args[3].createEvaluator(outInput3);
private AMutableRectangle aRectangle = new AMutableRectangle(null, null);
private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
@SuppressWarnings("unchecked")
@@ -75,20 +75,20 @@
eval3.evaluate(tuple);
try {
- ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getBytes()[0]);
+ ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0]);
if (tag == ATypeTag.POINT) {
- double xLoc = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double xLoc = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
- double yLoc = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double yLoc = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
- double xOrigin = ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(),
+ double xOrigin = ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
- double yOrigin = ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(),
+ double yOrigin = ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
- double xInc = ADoubleSerializerDeserializer.getDouble(outInput2.getBytes(), 1);
- double yInc = ADoubleSerializerDeserializer.getDouble(outInput3.getBytes(), 1);
+ double xInc = ADoubleSerializerDeserializer.getDouble(outInput2.getByteArray(), 1);
+ double yInc = ADoubleSerializerDeserializer.getDouble(outInput3.getByteArray(), 1);
double x = xOrigin + (Math.floor((xLoc - xOrigin) / xInc)) * xInc;
double y = yOrigin + (Math.floor((yLoc - yOrigin) / yInc)) * yInc;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
index 3ea1994..97e70b2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -34,19 +34,19 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
- private IEvaluator eval0 = args[0].createEvaluator(outInput0);
- private IEvaluator eval1 = args[1].createEvaluator(outInput1);
+ private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
+ private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -56,20 +56,20 @@
eval1.evaluate(tuple);
try {
- byte[] bytes0 = outInput0.getBytes();
- byte[] bytes1 = outInput1.getBytes();
+ byte[] bytes0 = outInput0.getByteArray();
+ byte[] bytes1 = outInput1.getByteArray();
ATypeTag tag0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[0]);
ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[0]);
double distance = 0.0;
if (tag0 == ATypeTag.POINT) {
if (tag1 == ATypeTag.POINT) {
- double x1 = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double x1 = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
- double y1 = ADoubleSerializerDeserializer.getDouble(outInput0.getBytes(),
+ double y1 = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
- double x2 = ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(),
+ double x2 = ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
- double y2 = ADoubleSerializerDeserializer.getDouble(outInput1.getBytes(),
+ double y2 = ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
} else {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
index 272e7e0..be31eed 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
@@ -25,8 +25,8 @@
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -45,19 +45,19 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private final DataOutput out = output.getDataOutput();
private final ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
private final ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
- private final IEvaluator eval0 = args[0].createEvaluator(outInput0);
- private final IEvaluator eval1 = args[1].createEvaluator(outInput1);
+ private final ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
+ private final ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
private final IBinaryComparator ascDoubleComp = AqlBinaryComparatorFactoryProvider.DOUBLE_POINTABLE_INSTANCE
.createBinaryComparator();
private final SpatialUtils spatialUtils = new SpatialUtils();
@@ -751,20 +751,20 @@
try {
boolean res = false;
- ATypeTag tag0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getBytes()[0]);
- ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getBytes()[0]);
+ ATypeTag tag0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0]);
+ ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getByteArray()[0]);
switch (tag0) {
case POINT:
switch (tag1) {
case POINT:
- if (ascDoubleComp.compare(outInput0.getBytes(),
+ if (ascDoubleComp.compare(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X), 8,
- outInput1.getBytes(),
+ outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X), 8) == 0) {
- if (ascDoubleComp.compare(outInput0.getBytes(),
+ if (ascDoubleComp.compare(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y),
- 8, outInput1.getBytes(),
+ 8, outInput1.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y),
8) == 0) {
res = true;
@@ -772,16 +772,16 @@
}
break;
case LINE:
- res = pointOnLine(outInput1.getBytes(), outInput0.getBytes());
+ res = pointOnLine(outInput1.getByteArray(), outInput0.getByteArray());
break;
case POLYGON:
- res = pointInPolygon(outInput0.getBytes(), outInput1.getBytes());
+ res = pointInPolygon(outInput0.getByteArray(), outInput1.getByteArray());
break;
case CIRCLE:
- res = pointInCircle(outInput0.getBytes(), outInput1.getBytes());
+ res = pointInCircle(outInput0.getByteArray(), outInput1.getByteArray());
break;
case RECTANGLE:
- res = pointInRectangle(outInput0.getBytes(), outInput1.getBytes());
+ res = pointInRectangle(outInput0.getByteArray(), outInput1.getByteArray());
break;
case NULL:
res = false;
@@ -796,45 +796,45 @@
case LINE:
switch (tag1) {
case POINT:
- res = pointOnLine(outInput0.getBytes(), outInput1.getBytes());
+ res = pointOnLine(outInput0.getByteArray(), outInput1.getByteArray());
break;
case LINE:
double startX1 = ADoubleSerializerDeserializer.getDouble(outInput0
- .getBytes(), ALineSerializerDeserializer
+ .getByteArray(), ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
double startY1 = ADoubleSerializerDeserializer.getDouble(outInput0
- .getBytes(), ALineSerializerDeserializer
+ .getByteArray(), ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
double endX1 = ADoubleSerializerDeserializer.getDouble(
- outInput0.getBytes(), ALineSerializerDeserializer
+ outInput0.getByteArray(), ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.X));
double endY1 = ADoubleSerializerDeserializer.getDouble(
- outInput0.getBytes(), ALineSerializerDeserializer
+ outInput0.getByteArray(), ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.Y));
double startX2 = ADoubleSerializerDeserializer.getDouble(outInput1
- .getBytes(), ALineSerializerDeserializer
+ .getByteArray(), ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
double startY2 = ADoubleSerializerDeserializer.getDouble(outInput1
- .getBytes(), ALineSerializerDeserializer
+ .getByteArray(), ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
double endX2 = ADoubleSerializerDeserializer.getDouble(
- outInput1.getBytes(), ALineSerializerDeserializer
+ outInput1.getByteArray(), ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.X));
double endY2 = ADoubleSerializerDeserializer.getDouble(
- outInput1.getBytes(), ALineSerializerDeserializer
+ outInput1.getByteArray(), ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.Y));
res = lineLineIntersection(startX1, startY1, endX1, endY1, startX2,
startY2, endX2, endY2);
break;
case POLYGON:
- res = linePolygonIntersection(outInput0.getBytes(), outInput1.getBytes());
+ res = linePolygonIntersection(outInput0.getByteArray(), outInput1.getByteArray());
break;
case CIRCLE:
- res = lineCircleIntersection(outInput0.getBytes(), outInput1.getBytes());
+ res = lineCircleIntersection(outInput0.getByteArray(), outInput1.getByteArray());
break;
case RECTANGLE:
- res = lineRectangleIntersection(outInput0.getBytes(), outInput1.getBytes());
+ res = lineRectangleIntersection(outInput0.getByteArray(), outInput1.getByteArray());
break;
case NULL:
res = false;
@@ -849,26 +849,26 @@
case POLYGON:
switch (tag1) {
case POINT:
- res = pointInPolygon(outInput1.getBytes(), outInput0.getBytes());
+ res = pointInPolygon(outInput1.getByteArray(), outInput0.getByteArray());
break;
case LINE:
- res = linePolygonIntersection(outInput1.getBytes(), outInput0.getBytes());
+ res = linePolygonIntersection(outInput1.getByteArray(), outInput0.getByteArray());
break;
case POLYGON:
int numOfPoints0 = AInt16SerializerDeserializer.getShort(
- outInput0.getBytes(),
+ outInput0.getByteArray(),
APolygonSerializerDeserializer.getNumberOfPointsOffset());
int numOfPoints1 = AInt16SerializerDeserializer.getShort(
- outInput1.getBytes(),
+ outInput1.getByteArray(),
APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints0 < 3 || numOfPoints1 < 3) {
throw new AlgebricksException("Polygon must have at least 3 points.");
}
- getCounterClockWisePolygon(outInput0.getBytes(), pointsOffsets0,
+ getCounterClockWisePolygon(outInput0.getByteArray(), pointsOffsets0,
numOfPoints0);
- getCounterClockWisePolygon(outInput1.getBytes(), pointsOffsets1,
+ getCounterClockWisePolygon(outInput1.getByteArray(), pointsOffsets1,
numOfPoints1);
int nonSimplePolygonDetection0 = 2 * numOfPoints0;
int nonSimplePolygonDetection1 = 2 * numOfPoints1;
@@ -880,7 +880,7 @@
trianglesX1.reset();
trianglesY1.reset();
while (true) {
- middleVertex1 = triangulatePolygon(outInput1.getBytes(), numOfPoints1,
+ middleVertex1 = triangulatePolygon(outInput1.getByteArray(), numOfPoints1,
pointsOffsets1, trianglesX1, trianglesY1, numOfTriangles1,
nonSimplePolygonDetection1, middleVertex1);
@@ -896,7 +896,7 @@
trianglesX0.reset();
trianglesY0.reset();
while (true) {
- middleVertex0 = triangulatePolygon(outInput0.getBytes(), numOfPoints0,
+ middleVertex0 = triangulatePolygon(outInput0.getByteArray(), numOfPoints0,
pointsOffsets0, trianglesX0, trianglesY0, numOfTriangles0,
nonSimplePolygonDetection0, middleVertex0);
@@ -929,11 +929,11 @@
}
break;
case CIRCLE:
- res = polygonCircleIntersection(outInput0.getBytes(), outInput1.getBytes());
+ res = polygonCircleIntersection(outInput0.getByteArray(), outInput1.getByteArray());
break;
case RECTANGLE:
- res = rectanglePolygonIntersection(outInput1.getBytes(),
- outInput0.getBytes());
+ res = rectanglePolygonIntersection(outInput1.getByteArray(),
+ outInput0.getByteArray());
break;
case NULL:
res = false;
@@ -948,20 +948,20 @@
case CIRCLE:
switch (tag1) {
case POINT:
- res = pointInCircle(outInput1.getBytes(), outInput0.getBytes());
+ res = pointInCircle(outInput1.getByteArray(), outInput0.getByteArray());
break;
case LINE:
- res = lineCircleIntersection(outInput1.getBytes(), outInput0.getBytes());
+ res = lineCircleIntersection(outInput1.getByteArray(), outInput0.getByteArray());
break;
case POLYGON:
- res = polygonCircleIntersection(outInput1.getBytes(), outInput0.getBytes());
+ res = polygonCircleIntersection(outInput1.getByteArray(), outInput0.getByteArray());
break;
case CIRCLE:
- res = circleCircleIntersection(outInput0.getBytes(), outInput1.getBytes());
+ res = circleCircleIntersection(outInput0.getByteArray(), outInput1.getByteArray());
break;
case RECTANGLE:
- res = rectangleCircleIntersection(outInput1.getBytes(),
- outInput0.getBytes());
+ res = rectangleCircleIntersection(outInput1.getByteArray(),
+ outInput0.getByteArray());
break;
case NULL:
res = false;
@@ -976,22 +976,22 @@
case RECTANGLE:
switch (tag1) {
case POINT:
- res = pointInRectangle(outInput1.getBytes(), outInput0.getBytes());
+ res = pointInRectangle(outInput1.getByteArray(), outInput0.getByteArray());
break;
case LINE:
- res = lineRectangleIntersection(outInput1.getBytes(), outInput0.getBytes());
+ res = lineRectangleIntersection(outInput1.getByteArray(), outInput0.getByteArray());
break;
case POLYGON:
- res = rectanglePolygonIntersection(outInput0.getBytes(),
- outInput1.getBytes());
+ res = rectanglePolygonIntersection(outInput0.getByteArray(),
+ outInput1.getByteArray());
break;
case CIRCLE:
- res = rectangleCircleIntersection(outInput0.getBytes(),
- outInput1.getBytes());
+ res = rectangleCircleIntersection(outInput0.getByteArray(),
+ outInput1.getByteArray());
break;
case RECTANGLE:
- triangulateRectangle(outInput0.getBytes(), trianglesX0, trianglesY0);
- triangulateRectangle(outInput1.getBytes(), trianglesX1, trianglesY1);
+ triangulateRectangle(outInput0.getByteArray(), trianglesX0, trianglesY0);
+ triangulateRectangle(outInput1.getByteArray(), trianglesX1, trianglesY1);
boolean intersect = false;
// 2 triangles in a rectangle
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StartsWithDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StartsWithDescriptor.java
index 2896e5a..2405ad9 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StartsWithDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StartsWithDescriptor.java
@@ -8,8 +8,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -25,13 +25,13 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
DataOutput dout = output.getDataOutput();
@@ -39,8 +39,8 @@
@Override
protected boolean findMatch(byte[] strBytes, byte[] patternBytes) {
- int utflen1 = UTF8StringPointable.getUTFLen(strBytes, 1);
- int utflen2 = UTF8StringPointable.getUTFLen(patternBytes, 1);
+ int utflen1 = UTF8StringPointable.getUTFLength(strBytes, 1);
+ int utflen2 = UTF8StringPointable.getUTFLength(patternBytes, 1);
int s1Start = 3;
int s2Start = 3;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringDescriptor.java
index c2678b5..c6d0627 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringDescriptor.java
@@ -10,8 +10,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -30,34 +30,34 @@
};
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
- return new IEvaluator() {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ return new ICopyEvaluator() {
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- private IEvaluator evalString = args[0].createEvaluator(argOut);
- private IEvaluator evalStart = args[1].createEvaluator(argOut);
- private IEvaluator evalLen = args[2].createEvaluator(argOut);
+ private ICopyEvaluator evalString = args[0].createEvaluator(argOut);
+ private ICopyEvaluator evalStart = args[1].createEvaluator(argOut);
+ private ICopyEvaluator evalLen = args[2].createEvaluator(argOut);
private final byte stt = ATypeTag.STRING.serialize();
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
argOut.reset();
evalStart.evaluate(tuple);
- int start = IntegerSerializerDeserializer.getInt(argOut.getBytes(), 1) - 1;
+ int start = IntegerSerializerDeserializer.getInt(argOut.getByteArray(), 1) - 1;
argOut.reset();
evalLen.evaluate(tuple);
- int len = IntegerSerializerDeserializer.getInt(argOut.getBytes(), 1);
+ int len = IntegerSerializerDeserializer.getInt(argOut.getByteArray(), 1);
argOut.reset();
evalString.evaluate(tuple);
- byte[] bytes = argOut.getBytes();
- int utflen = UTF8StringPointable.getUTFLen(bytes, 1);
+ byte[] bytes = argOut.getByteArray();
+ int utflen = UTF8StringPointable.getUTFLength(bytes, 1);
int sStart = 3;
int c = 0;
int idxPos1 = 0;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SwitchCaseDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SwitchCaseDescriptor.java
index 1c1ca13..29fbb7f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SwitchCaseDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SwitchCaseDescriptor.java
@@ -8,8 +8,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -32,18 +32,18 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
final ArrayBackedValueStorage condOut = new ArrayBackedValueStorage();
final ArrayBackedValueStorage caseOut = new ArrayBackedValueStorage();
final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
- final IEvaluator[] evals = new IEvaluator[args.length];
+ final ICopyEvaluator[] evals = new ICopyEvaluator[args.length];
// condition
evals[0] = args[0].createEvaluator(condOut);
// case value
@@ -57,7 +57,7 @@
// default expression
evals[evals.length - 1] = args[evals.length - 1].createEvaluator(argOut);
- return new IEvaluator() {
+ return new ICopyEvaluator() {
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -71,7 +71,7 @@
if (equals(condOut, caseOut)) {
argOut.reset();
evals[i + 1].evaluate(tuple);
- output.getDataOutput().write(argOut.getBytes(), argOut.getStartIndex(),
+ output.getDataOutput().write(argOut.getByteArray(), argOut.getStartOffset(),
argOut.getLength());
return;
}
@@ -79,7 +79,7 @@
// the default case
argOut.reset();
evals[n - 1].evaluate(tuple);
- output.getDataOutput().write(argOut.getBytes(), argOut.getStartIndex(), argOut.getLength());
+ output.getDataOutput().write(argOut.getByteArray(), argOut.getStartOffset(), argOut.getLength());
} catch (HyracksDataException hde) {
throw new AlgebricksException(hde);
} catch (IOException ioe) {
@@ -88,11 +88,11 @@
}
private boolean equals(ArrayBackedValueStorage out1, ArrayBackedValueStorage out2) {
- if (out1.getStartIndex() != out2.getStartIndex() || out1.getLength() != out2.getLength())
+ if (out1.getStartOffset() != out2.getStartOffset() || out1.getLength() != out2.getLength())
return false;
- byte[] data1 = out1.getBytes();
- byte[] data2 = out2.getBytes();
- for (int i = out1.getStartIndex(); i < out1.getLength(); i++) {
+ byte[] data1 = out1.getByteArray();
+ byte[] data2 = out2.getByteArray();
+ for (int i = out1.getStartOffset(); i < out1.getLength(); i++) {
if (data1[i] != data2[i]) {
return false;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java
index f49ef3c..ea0765e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java
@@ -12,8 +12,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -41,20 +41,20 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
return new UnorderedListConstructorEvaluatorFactory(args, ultype);
}
- private static class UnorderedListConstructorEvaluatorFactory implements IEvaluatorFactory {
+ private static class UnorderedListConstructorEvaluatorFactory implements ICopyEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory[] args;
+ private ICopyEvaluatorFactory[] args;
private boolean selfDescList = false;
private boolean homoList = false;
private AUnorderedListType unorderedlistType;
- public UnorderedListConstructorEvaluatorFactory(IEvaluatorFactory[] args, AUnorderedListType type) {
+ public UnorderedListConstructorEvaluatorFactory(ICopyEvaluatorFactory[] args, AUnorderedListType type) {
this.args = args;
this.unorderedlistType = type;
if (type == null || type.getItemType() == null || type.getItemType().getTypeTag() == ATypeTag.ANY)
@@ -64,15 +64,15 @@
}
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
final DataOutput out = output.getDataOutput();
final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- final IEvaluator[] argEvals = new IEvaluator[args.length];
+ final ICopyEvaluator[] argEvals = new ICopyEvaluator[args.length];
for (int i = 0; i < args.length; i++) {
argEvals[i] = args[i].createEvaluator(inputVal);
}
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private UnorderedListBuilder builder = new UnorderedListBuilder();
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/WordTokensDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/WordTokensDescriptor.java
index ab659fc..75a211f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/WordTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/WordTokensDescriptor.java
@@ -13,8 +13,8 @@
import edu.uci.ics.fuzzyjoin.tokenizer.UTF8WordTokenFactory;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
public class WordTokensDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -34,12 +34,12 @@
}
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) throws AlgebricksException {
- return new IEvaluatorFactory() {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
ITokenFactory tokenFactory = new UTF8WordTokenFactory(ATypeTag.STRING.serialize(),
ATypeTag.INT32.serialize());
IBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(true, true, tokenFactory);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/YearDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/YearDescriptor.java
index 65be0bd..b95fbfa 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/YearDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/YearDescriptor.java
@@ -15,8 +15,8 @@
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
@@ -47,18 +47,18 @@
*/
@Override
- public IEvaluatorFactory createEvaluatorFactory(final IEvaluatorFactory[] args) {
+ public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
- return new IEvaluatorFactory() {
+ return new ICopyEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
final DataOutput out = output.getDataOutput();
- return new IEvaluator() {
+ return new ICopyEvaluator() {
private ArrayBackedValueStorage out1 = new ArrayBackedValueStorage();
- private IEvaluator eval1 = args[0].createEvaluator(out1);
+ private ICopyEvaluator eval1 = args[0].createEvaluator(out1);
private AMutableInt32 m = new AMutableInt32(0);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<AInt32> int32Serde = AqlSerializerDeserializerProvider.INSTANCE
@@ -72,7 +72,7 @@
try {
out1.reset();
eval1.evaluate(tuple);
- byte[] dateArray = out1.getBytes();
+ byte[] dateArray = out1.getByteArray();
if (dateArray[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, out);
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 0fa62aa..e16b384 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
@@ -159,7 +159,7 @@
import edu.uci.ics.hyracks.algebricks.data.IPrinterFactoryProvider;
import edu.uci.ics.hyracks.algebricks.data.ISerializerDeserializerProvider;
import edu.uci.ics.hyracks.algebricks.data.ITypeTraitProvider;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
import edu.uci.ics.hyracks.algebricks.runtime.evaluators.ConstantEvalFactory;
import edu.uci.ics.hyracks.api.dataflow.value.INullWriterFactory;
@@ -350,13 +350,13 @@
@SuppressWarnings("unchecked")
@Override
- public IEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, String fldName, int recordColumn)
+ public ICopyEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, String fldName, int recordColumn)
throws AlgebricksException {
String[] names = recType.getFieldNames();
int n = names.length;
for (int i = 0; i < n; i++) {
if (names[i].equals(fldName)) {
- IEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(recordColumn);
+ ICopyEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(recordColumn);
ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
DataOutput dos = abvs.getDataOutput();
try {
@@ -366,9 +366,9 @@
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
}
- IEvaluatorFactory fldIndexEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs.getBytes(),
+ ICopyEvaluatorFactory fldIndexEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs.getByteArray(),
abvs.getLength()));
- IEvaluatorFactory evalFactory = new FieldAccessByIndexEvalFactory(recordEvalFactory,
+ ICopyEvaluatorFactory evalFactory = new FieldAccessByIndexEvalFactory(recordEvalFactory,
fldIndexEvalFactory, recType);
return evalFactory;
}
@@ -378,11 +378,11 @@
@SuppressWarnings("unchecked")
@Override
- public IEvaluatorFactory[] createMBRFactory(ARecordType recType, String fldName, int recordColumn, int dimension)
+ public ICopyEvaluatorFactory[] createMBRFactory(ARecordType recType, String fldName, int recordColumn, int dimension)
throws AlgebricksException {
- IEvaluatorFactory evalFactory = getFieldAccessEvaluatorFactory(recType, fldName, recordColumn);
+ ICopyEvaluatorFactory evalFactory = getFieldAccessEvaluatorFactory(recType, fldName, recordColumn);
int numOfFields = dimension * 2;
- IEvaluatorFactory[] evalFactories = new IEvaluatorFactory[numOfFields];
+ ICopyEvaluatorFactory[] evalFactories = new ICopyEvaluatorFactory[numOfFields];
ArrayBackedValueStorage abvs1 = new ArrayBackedValueStorage();
DataOutput dos1 = abvs1.getDataOutput();
@@ -392,7 +392,7 @@
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
}
- IEvaluatorFactory dimensionEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs1.getBytes(),
+ ICopyEvaluatorFactory dimensionEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs1.getByteArray(),
abvs1.getLength()));
for (int i = 0; i < numOfFields; i++) {
@@ -404,7 +404,7 @@
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
}
- IEvaluatorFactory coordinateEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs2.getBytes(),
+ ICopyEvaluatorFactory coordinateEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs2.getByteArray(),
abvs2.getLength()));
evalFactories[i] = new CreateMBREvalFactory(evalFactory, dimensionEvalFactory, coordinateEvalFactory);
@@ -414,13 +414,13 @@
@SuppressWarnings("unchecked")
@Override
- public Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
+ public Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
ARecordType recType, String fldName) throws AlgebricksException {
String[] names = recType.getFieldNames();
int n = names.length;
for (int i = 0; i < n; i++) {
if (names[i].equals(fldName)) {
- IEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(
+ ICopyEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(
GlobalConfig.DEFAULT_INPUT_DATA_COLUMN);
ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
DataOutput dos = abvs.getDataOutput();
@@ -431,9 +431,9 @@
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
}
- IEvaluatorFactory fldIndexEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs.getBytes(),
+ ICopyEvaluatorFactory fldIndexEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs.getByteArray(),
abvs.getLength()));
- IEvaluatorFactory evalFactory = new FieldAccessByIndexEvalFactory(recordEvalFactory,
+ ICopyEvaluatorFactory evalFactory = new FieldAccessByIndexEvalFactory(recordEvalFactory,
fldIndexEvalFactory, recType);
IFunctionInfo finfoAccess = AsterixBuiltinFunctions
.getAsterixFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_BY_INDEX);
@@ -442,7 +442,7 @@
new MutableObject<ILogicalExpression>(new VariableReferenceExpression(METADATA_DUMMY_VAR)),
new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(
new AInt32(i)))));
- return new Triple<IEvaluatorFactory, ScalarFunctionCallExpression, IAType>(evalFactory, partitionFun,
+ return new Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>(evalFactory, partitionFun,
recType.getFieldTypes()[i]);
}
}
@@ -550,7 +550,7 @@
@SuppressWarnings("unchecked")
@Override
- public IEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException {
+ public ICopyEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException {
IAObject obj = null;
if (value.isNull()) {
obj = ANull.NULL;
@@ -569,7 +569,7 @@
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
}
- return new ConstantEvalFactory(Arrays.copyOf(abvs.getBytes(), abvs.getLength()));
+ return new ConstantEvalFactory(Arrays.copyOf(abvs.getByteArray(), abvs.getLength()));
}
@Override
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmSchemafullRecordParserFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmSchemafullRecordParserFactory.java
index 46d1ba3..43556f2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmSchemafullRecordParserFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmSchemafullRecordParserFactory.java
@@ -25,8 +25,8 @@
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ALineSerializerDeserializer;
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.APointSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.APoint3DSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.APointSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.APolygonSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ARectangleSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
@@ -793,11 +793,11 @@
token = nextToken();
this.admFromLexerStream(token, fieldType, fieldValueBuffer.getDataOutput(), false);
if (openRecordField) {
- if (fieldValueBuffer.getBytes()[0] != ATypeTag.NULL.serialize())
+ if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL.serialize())
recBuilder.addField(fieldNameBuffer, fieldValueBuffer);
} else if (recType.getFieldTypes()[fieldId].getTypeTag() == ATypeTag.UNION) {
if (NonTaggedFormatUtil.isOptionalField((AUnionType) recType.getFieldTypes()[fieldId])) {
- if (fieldValueBuffer.getBytes()[0] != ATypeTag.NULL.serialize()) {
+ if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL.serialize()) {
recBuilder.addField(fieldId, fieldValueBuffer);
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmTupleParser.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmTupleParser.java
index 3b52315..573eb78 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmTupleParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmTupleParser.java
@@ -468,14 +468,14 @@
this.admFromLexerStream(token, fieldType,
fieldValueBuffer.getDataOutput(), false);
if (openRecordField) {
- if (fieldValueBuffer.getBytes()[0] != ATypeTag.NULL
+ if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL
.serialize())
recBuilder.addField(fieldNameBuffer, fieldValueBuffer);
} else if (recType.getFieldTypes()[fieldId].getTypeTag() == ATypeTag.UNION) {
if (NonTaggedFormatUtil
.isOptionalField((AUnionType) recType
.getFieldTypes()[fieldId])) {
- if (fieldValueBuffer.getBytes()[0] != ATypeTag.NULL
+ if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL
.serialize()) {
recBuilder.addField(fieldId, fieldValueBuffer);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/AFlatValuePointable.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/AFlatValuePointable.java
new file mode 100644
index 0000000..a3547a4
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/AFlatValuePointable.java
@@ -0,0 +1,81 @@
+/*
+ * 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.runtime.pointables;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.runtime.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.runtime.pointables.visitor.IVisitablePointableVisitor;
+import edu.uci.ics.asterix.runtime.util.container.IObjectFactory;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
+
+/**
+ * This class represents a flat field, e.g., int field, string field, and
+ * so on, based on a binary representation.
+ */
+public class AFlatValuePointable extends AbstractVisitablePointable {
+
+ /**
+ * DO NOT allow to create AFlatValuePointable object arbitrarily, force to
+ * use object pool based allocator. The factory is not public so that it
+ * cannot called in other places than PointableAllocator.
+ */
+ static IObjectFactory<IVisitablePointable, IAType> FACTORY = new IObjectFactory<IVisitablePointable, IAType>() {
+ public AFlatValuePointable create(IAType type) {
+ return new AFlatValuePointable();
+ }
+ };
+
+ /**
+ * private constructor, to prevent arbitrary creation
+ */
+ private AFlatValuePointable() {
+
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof IValueReference))
+ return false;
+
+ // get right raw data
+ IValueReference ivf = (IValueReference) o;
+ byte[] odata = ivf.getByteArray();
+ int ostart = ivf.getStartOffset();
+ int olen = ivf.getLength();
+
+ // get left raw data
+ byte[] data = getByteArray();
+ int start = getStartOffset();
+ int len = getLength();
+
+ // bytes length should be equal
+ if (len != olen)
+ return false;
+
+ // check each byte
+ for (int i = 0; i < len; i++) {
+ if (data[start + i] != odata[ostart + i])
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public <R, T> R accept(IVisitablePointableVisitor<R, T> vistor, T tag) throws AsterixException {
+ return vistor.visit(this, tag);
+ }
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/AListPointable.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/AListPointable.java
new file mode 100644
index 0000000..6f85694
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/AListPointable.java
@@ -0,0 +1,171 @@
+/*
+ * 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.runtime.pointables;
+
+import java.io.DataOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AbstractCollectionType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.asterix.runtime.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.runtime.pointables.visitor.IVisitablePointableVisitor;
+import edu.uci.ics.asterix.runtime.util.ResettableByteArrayOutputStream;
+import edu.uci.ics.asterix.runtime.util.container.IObjectFactory;
+
+/**
+ * This class interprets the binary data representation of a list, one can
+ * call getItems and getItemTags to get pointable objects for items and item
+ * type tags.
+ *
+ */
+public class AListPointable extends AbstractVisitablePointable {
+
+ /**
+ * DO NOT allow to create AListPointable object arbitrarily, force to use
+ * object pool based allocator, in order to have object reuse.
+ */
+ static IObjectFactory<IVisitablePointable, IAType> FACTORY = new IObjectFactory<IVisitablePointable, IAType>() {
+ public IVisitablePointable create(IAType type) {
+ return new AListPointable((AbstractCollectionType) type);
+ }
+ };
+
+ private final List<IVisitablePointable> items = new ArrayList<IVisitablePointable>();
+ private final List<IVisitablePointable> itemTags = new ArrayList<IVisitablePointable>();
+ private final PointableAllocator allocator = new PointableAllocator();
+
+ private final ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
+ private final DataOutputStream dataDos = new DataOutputStream(dataBos);
+
+ private IAType itemType;
+ private ATypeTag itemTag;
+ private boolean typedItemList = false;
+
+ /**
+ * private constructor, to prevent constructing it arbitrarily
+ *
+ * @param inputType
+ */
+ private AListPointable(AbstractCollectionType inputType) {
+ if (inputType != null && inputType.getItemType() != null) {
+ itemType = inputType.getItemType();
+ if (itemType.getTypeTag() == ATypeTag.ANY) {
+ typedItemList = false;
+ } else {
+ typedItemList = true;
+ itemTag = inputType.getItemType().getTypeTag();
+ }
+ } else {
+ this.typedItemList = false;
+ }
+ }
+
+ private void reset() {
+ allocator.reset();
+ items.clear();
+ itemTags.clear();
+ dataBos.reset();
+ }
+
+ @Override
+ public void set(byte[] b, int s, int len) {
+ reset();
+
+ int numberOfitems = AInt32SerializerDeserializer.getInt(b, s + 6);
+ int itemOffset;
+ if (typedItemList) {
+ switch (itemTag) {
+ case STRING:
+ case RECORD:
+ case ORDEREDLIST:
+ case UNORDEREDLIST:
+ case ANY:
+ itemOffset = s + 10 + (numberOfitems * 4);
+ break;
+ default:
+ itemOffset = s + 10;
+ }
+ } else {
+ itemOffset = s + 10 + (numberOfitems * 4);
+ }
+ int itemLength = 0;
+ try {
+ if (typedItemList) {
+ for (int i = 0; i < numberOfitems; i++) {
+ itemLength = NonTaggedFormatUtil.getFieldValueLength(b, itemOffset, itemTag, false);
+ IVisitablePointable tag = allocator.allocateEmpty();
+ IVisitablePointable item = allocator.allocateFieldValue(itemType);
+
+ // set item type tag
+ int start = dataBos.size();
+ dataDos.writeByte(itemTag.serialize());
+ int end = dataBos.size();
+ tag.set(dataBos.getByteArray(), start, end - start);
+ itemTags.add(tag);
+
+ // set item value
+ start = dataBos.size();
+ dataDos.writeByte(itemTag.serialize());
+ dataDos.write(b, itemOffset, itemLength);
+ end = dataBos.size();
+ item.set(dataBos.getByteArray(), start, end - start);
+ itemOffset += itemLength;
+ items.add(item);
+ }
+ } else {
+ for (int i = 0; i < numberOfitems; i++) {
+ itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[itemOffset]);
+ itemLength = NonTaggedFormatUtil.getFieldValueLength(b, itemOffset, itemTag, true) + 1;
+ IVisitablePointable tag = allocator.allocateEmpty();
+ IVisitablePointable item = allocator.allocateFieldValue(itemType);
+
+ // set item type tag
+ int start = dataBos.size();
+ dataDos.writeByte(itemTag.serialize());
+ int end = dataBos.size();
+ tag.set(dataBos.getByteArray(), start, end - start);
+ itemTags.add(tag);
+
+ // open part field already include the type tag
+ item.set(b, itemOffset, itemLength);
+ itemOffset += itemLength;
+ items.add(item);
+ }
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ @Override
+ public <R, T> R accept(IVisitablePointableVisitor<R, T> vistor, T tag) throws AsterixException {
+ return vistor.visit(this, tag);
+ }
+
+ public List<IVisitablePointable> getItems() {
+ return items;
+ }
+
+ public List<IVisitablePointable> getItemTags() {
+ return itemTags;
+ }
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/ARecordPointable.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/ARecordPointable.java
new file mode 100644
index 0000000..5904170
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/ARecordPointable.java
@@ -0,0 +1,285 @@
+/*
+ * 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.runtime.pointables;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.dataflow.data.nontagged.AqlNullWriterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+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.EnumDeserializer;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.asterix.runtime.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.runtime.pointables.visitor.IVisitablePointableVisitor;
+import edu.uci.ics.asterix.runtime.util.ResettableByteArrayOutputStream;
+import edu.uci.ics.asterix.runtime.util.container.IObjectFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.INullWriter;
+
+/**
+ * This class interprets the binary data representation of a record. One can
+ * call getFieldNames, getFieldTypeTags and getFieldValues to get pointable
+ * objects for field names, field type tags, and field values.
+ *
+ */
+public class ARecordPointable extends AbstractVisitablePointable {
+
+ /**
+ * DO NOT allow to create ARecordPointable object arbitrarily, force to use
+ * object pool based allocator, in order to have object reuse
+ */
+ static IObjectFactory<IVisitablePointable, IAType> FACTORY = new IObjectFactory<IVisitablePointable, IAType>() {
+ public IVisitablePointable create(IAType type) {
+ return new ARecordPointable((ARecordType) type);
+ }
+ };
+
+ // access results: field names, field types, and field values
+ private final List<IVisitablePointable> fieldNames = new ArrayList<IVisitablePointable>();
+ private final List<IVisitablePointable> fieldTypeTags = new ArrayList<IVisitablePointable>();
+ private final List<IVisitablePointable> fieldValues = new ArrayList<IVisitablePointable>();
+
+ // pointable allocator
+ private final PointableAllocator allocator = new PointableAllocator();
+
+ private final ResettableByteArrayOutputStream typeBos = new ResettableByteArrayOutputStream();
+ private final DataOutputStream typeDos = new DataOutputStream(typeBos);
+
+ private final ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
+ private final DataOutputStream dataDos = new DataOutputStream(dataBos);
+
+ private final ARecordType inputRecType;
+
+ private final int numberOfSchemaFields;
+ private final int[] fieldOffsets;
+ private final IVisitablePointable nullReference = AFlatValuePointable.FACTORY.create(null);
+
+ private int closedPartTypeInfoSize = 0;
+ private int offsetArrayOffset;
+ private ATypeTag typeTag;
+
+ /**
+ * private constructor, to prevent constructing it arbitrarily
+ *
+ * @param inputType
+ */
+ private ARecordPointable(ARecordType inputType) {
+ this.inputRecType = inputType;
+ IAType[] fieldTypes = inputType.getFieldTypes();
+ String[] fieldNameStrs = inputType.getFieldNames();
+ numberOfSchemaFields = fieldTypes.length;
+
+ // initialize the buffer for closed parts(fieldName bytes+ type bytes) +
+ // constant(null bytes)
+ typeBos.reset();
+ try {
+ for (int i = 0; i < numberOfSchemaFields; i++) {
+ ATypeTag ftypeTag = fieldTypes[i].getTypeTag();
+
+ if (fieldTypes[i].getTypeTag() == ATypeTag.UNION
+ && NonTaggedFormatUtil.isOptionalField((AUnionType) fieldTypes[i]))
+ // optional field: add the embedded non-null type tag
+ ftypeTag = ((AUnionType) fieldTypes[i]).getUnionList()
+ .get(NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
+
+ // add type tag Reference
+ int tagStart = typeBos.size();
+ typeDos.writeByte(ftypeTag.serialize());
+ int tagEnd = typeBos.size();
+ IVisitablePointable typeTagReference = AFlatValuePointable.FACTORY.create(null);
+ typeTagReference.set(typeBos.getByteArray(), tagStart, tagEnd - tagStart);
+ fieldTypeTags.add(typeTagReference);
+
+ // add type name Reference (including a astring type tag)
+ int nameStart = typeBos.size();
+ typeDos.writeByte(ATypeTag.STRING.serialize());
+ typeDos.writeUTF(fieldNameStrs[i]);
+ int nameEnd = typeBos.size();
+ IVisitablePointable typeNameReference = AFlatValuePointable.FACTORY.create(null);
+ typeNameReference.set(typeBos.getByteArray(), nameStart, nameEnd - nameStart);
+ fieldNames.add(typeNameReference);
+ }
+
+ // initialize a constant: null value bytes reference
+ int nullFieldStart = typeBos.size();
+ INullWriter nullWriter = AqlNullWriterFactory.INSTANCE.createNullWriter();
+ nullWriter.writeNull(typeDos);
+ int nullFieldEnd = typeBos.size();
+ nullReference.set(typeBos.getByteArray(), nullFieldStart, nullFieldEnd - nullFieldStart);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ closedPartTypeInfoSize = typeBos.size();
+ fieldOffsets = new int[numberOfSchemaFields];
+ }
+
+ private void reset() {
+ typeBos.reset(closedPartTypeInfoSize);
+ dataBos.reset(0);
+ // reset the allocator
+ allocator.reset();
+
+ // clean up the returned containers
+ for (int i = fieldNames.size() - 1; i >= numberOfSchemaFields; i--)
+ fieldNames.remove(i);
+ for (int i = fieldTypeTags.size() - 1; i >= numberOfSchemaFields; i--)
+ fieldTypeTags.remove(i);
+ fieldValues.clear();
+ }
+
+ @Override
+ public void set(byte[] b, int start, int len) {
+ // clear the previous states
+ reset();
+ super.set(b, start, len);
+
+ boolean isExpanded = false;
+ int openPartOffset = 0;
+ int s = start;
+ int recordOffset = s;
+ if (inputRecType == null) {
+ openPartOffset = s + AInt32SerializerDeserializer.getInt(b, s + 6);
+ s += 8;
+ isExpanded = true;
+ } else {
+ if (inputRecType.isOpen()) {
+ isExpanded = b[s + 5] == 1 ? true : false;
+ if (isExpanded) {
+ openPartOffset = s + AInt32SerializerDeserializer.getInt(b, s + 6);
+ s += 10;
+ } else {
+ s += 6;
+ }
+ } else {
+ s += 5;
+ }
+ }
+ try {
+ if (numberOfSchemaFields > 0) {
+ s += 4;
+ int nullBitMapOffset = 0;
+ boolean hasNullableFields = NonTaggedFormatUtil.hasNullableField(inputRecType);
+ if (hasNullableFields) {
+ nullBitMapOffset = s;
+ offsetArrayOffset = s
+ + (this.numberOfSchemaFields % 8 == 0 ? numberOfSchemaFields / 8
+ : numberOfSchemaFields / 8 + 1);
+ } else {
+ offsetArrayOffset = s;
+ }
+ for (int i = 0; i < numberOfSchemaFields; i++) {
+ fieldOffsets[i] = AInt32SerializerDeserializer.getInt(b, offsetArrayOffset) + recordOffset;
+ offsetArrayOffset += 4;
+ }
+ for (int fieldNumber = 0; fieldNumber < numberOfSchemaFields; fieldNumber++) {
+ if (hasNullableFields) {
+ byte b1 = b[nullBitMapOffset + fieldNumber / 8];
+ int p = 1 << (7 - (fieldNumber % 8));
+ if ((b1 & p) == 0) {
+ // set null value (including type tag inside)
+ fieldValues.add(nullReference);
+ continue;
+ }
+ }
+ IAType[] fieldTypes = inputRecType.getFieldTypes();
+ int fieldValueLength = 0;
+
+ IAType fieldType = fieldTypes[fieldNumber];
+ if (fieldTypes[fieldNumber].getTypeTag() == ATypeTag.UNION) {
+ if (NonTaggedFormatUtil.isOptionalField((AUnionType) fieldTypes[fieldNumber])) {
+ fieldType = ((AUnionType) fieldTypes[fieldNumber]).getUnionList().get(
+ NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+ typeTag = fieldType.getTypeTag();
+ fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffsets[fieldNumber],
+ typeTag, false);
+ }
+ } else {
+ typeTag = fieldTypes[fieldNumber].getTypeTag();
+ fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffsets[fieldNumber],
+ typeTag, false);
+ }
+ // set field value (including the type tag)
+ int fstart = dataBos.size();
+ dataDos.writeByte(typeTag.serialize());
+ dataDos.write(b, fieldOffsets[fieldNumber], fieldValueLength);
+ int fend = dataBos.size();
+ IVisitablePointable fieldValue = allocator.allocateFieldValue(fieldType);
+ fieldValue.set(dataBos.getByteArray(), fstart, fend - fstart);
+ fieldValues.add(fieldValue);
+ }
+ }
+ if (isExpanded) {
+ int numberOfOpenFields = AInt32SerializerDeserializer.getInt(b, openPartOffset);
+ int fieldOffset = openPartOffset + 4 + (8 * numberOfOpenFields);
+ for (int i = 0; i < numberOfOpenFields; i++) {
+ // set the field name (including a type tag, which is
+ // astring)
+ int fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffset, ATypeTag.STRING,
+ false);
+ int fnstart = dataBos.size();
+ dataDos.writeByte(ATypeTag.STRING.serialize());
+ dataDos.write(b, fieldOffset, fieldValueLength);
+ int fnend = dataBos.size();
+ IVisitablePointable fieldName = allocator.allocateEmpty();
+ fieldName.set(dataBos.getByteArray(), fnstart, fnend - fnstart);
+ fieldNames.add(fieldName);
+ fieldOffset += fieldValueLength;
+
+ // set the field type tag
+ IVisitablePointable fieldTypeTag = allocator.allocateEmpty();
+ fieldTypeTag.set(b, fieldOffset, 1);
+ fieldTypeTags.add(fieldTypeTag);
+ typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[fieldOffset]);
+
+ // set the field value (already including type tag)
+ fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffset, typeTag, true) + 1;
+
+ // allocate
+ IVisitablePointable fieldValueAccessor = allocator.allocateFieldValue(typeTag);
+ fieldValueAccessor.set(b, fieldOffset, fieldValueLength);
+ fieldValues.add(fieldValueAccessor);
+ fieldOffset += fieldValueLength;
+ }
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ public List<IVisitablePointable> getFieldNames() {
+ return fieldNames;
+ }
+
+ public List<IVisitablePointable> getFieldTypeTags() {
+ return fieldTypeTags;
+ }
+
+ public List<IVisitablePointable> getFieldValues() {
+ return fieldValues;
+ }
+
+ @Override
+ public <R, T> R accept(IVisitablePointableVisitor<R, T> vistor, T tag) throws AsterixException {
+ return vistor.visit(this, tag);
+ }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/AbstractVisitablePointable.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/AbstractVisitablePointable.java
new file mode 100644
index 0000000..8cfe661
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/AbstractVisitablePointable.java
@@ -0,0 +1,59 @@
+/*
+ * 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.runtime.pointables;
+
+import edu.uci.ics.asterix.runtime.pointables.base.IVisitablePointable;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
+
+/**
+ * This class implements several "routine" methods in IVisitablePointable
+ * interface, so that subclasses do not need to repeat the same code.
+ *
+ */
+public abstract class AbstractVisitablePointable implements IVisitablePointable {
+
+ private byte[] data;
+ private int start;
+ private int len;
+
+ @Override
+ public byte[] getByteArray() {
+ return data;
+ }
+
+ @Override
+ public int getLength() {
+ return len;
+ }
+
+ @Override
+ public int getStartOffset() {
+ return start;
+ }
+
+ @Override
+ public void set(byte[] b, int start, int len) {
+ this.data = b;
+ this.start = start;
+ this.len = len;
+ }
+
+ @Override
+ public void set(IValueReference ivf) {
+ set(ivf.getByteArray(), ivf.getStartOffset(), ivf.getLength());
+ }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/PointableAllocator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/PointableAllocator.java
new file mode 100644
index 0000000..b6116be
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/PointableAllocator.java
@@ -0,0 +1,91 @@
+/*
+ * 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.runtime.pointables;
+
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.runtime.pointables.base.DefaultOpenFieldType;
+import edu.uci.ics.asterix.runtime.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.runtime.util.container.IObjectPool;
+import edu.uci.ics.asterix.runtime.util.container.ListObjectPool;
+
+/**
+ * This class is the ONLY place to create IVisitablePointable object instances,
+ * to enforce use of an object pool.
+ */
+public class PointableAllocator {
+
+ private IObjectPool<IVisitablePointable, IAType> flatValueAllocator = new ListObjectPool<IVisitablePointable, IAType>(
+ AFlatValuePointable.FACTORY);
+ private IObjectPool<IVisitablePointable, IAType> recordValueAllocator = new ListObjectPool<IVisitablePointable, IAType>(
+ ARecordPointable.FACTORY);
+ private IObjectPool<IVisitablePointable, IAType> listValueAllocator = new ListObjectPool<IVisitablePointable, IAType>(
+ AListPointable.FACTORY);
+
+ public IVisitablePointable allocateEmpty() {
+ return flatValueAllocator.allocate(null);
+ }
+
+ /**
+ * allocate closed part value pointable
+ *
+ * @param type
+ * @return the pointable object
+ */
+ public IVisitablePointable allocateFieldValue(IAType type) {
+ if (type == null)
+ return flatValueAllocator.allocate(null);
+ else if (type.getTypeTag().equals(ATypeTag.RECORD))
+ return recordValueAllocator.allocate(type);
+ else if (type.getTypeTag().equals(ATypeTag.UNORDEREDLIST) || type.getTypeTag().equals(ATypeTag.ORDEREDLIST))
+ return listValueAllocator.allocate(type);
+ else
+ return flatValueAllocator.allocate(null);
+ }
+
+ /**
+ * allocate open part value pointable
+ *
+ * @param typeTag
+ * @return the pointable object
+ */
+ public IVisitablePointable allocateFieldValue(ATypeTag typeTag) {
+ if (typeTag == null)
+ return flatValueAllocator.allocate(null);
+ else if (typeTag.equals(ATypeTag.RECORD))
+ return recordValueAllocator.allocate(DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE);
+ else if (typeTag.equals(ATypeTag.UNORDEREDLIST))
+ return listValueAllocator.allocate(DefaultOpenFieldType.NESTED_OPEN_AUNORDERED_LIST_TYPE);
+ else if (typeTag.equals(ATypeTag.ORDEREDLIST))
+ return listValueAllocator.allocate(DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE);
+ else
+ return flatValueAllocator.allocate(null);
+ }
+
+ public IVisitablePointable allocateListValue(IAType type) {
+ return listValueAllocator.allocate(type);
+ }
+
+ public IVisitablePointable allocateRecordValue(IAType type) {
+ return recordValueAllocator.allocate(type);
+ }
+
+ public void reset() {
+ flatValueAllocator.reset();
+ recordValueAllocator.reset();
+ listValueAllocator.reset();
+ }
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/base/DefaultOpenFieldType.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/base/DefaultOpenFieldType.java
new file mode 100644
index 0000000..987ac02
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/base/DefaultOpenFieldType.java
@@ -0,0 +1,57 @@
+/*
+ * 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.runtime.pointables.base;
+
+import edu.uci.ics.asterix.om.types.AOrderedListType;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnorderedListType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+
+/**
+ * This class serves as the repository for the default record type and list type
+ * fields in the open part, e.g., a "record" (nested) field in the open part is
+ * always a fully open one, and a "list" field in the open part is always a list
+ * of "ANY".
+ *
+ */
+public class DefaultOpenFieldType {
+
+ // nested open field rec type
+ public static ARecordType NESTED_OPEN_RECORD_TYPE = new ARecordType("nested-open", new String[] {},
+ new IAType[] {}, true);
+
+ // nested open list type
+ public static AOrderedListType NESTED_OPEN_AORDERED_LIST_TYPE = new AOrderedListType(BuiltinType.ANY,
+ "nested-ordered-list");
+
+ // nested open list type
+ public static AUnorderedListType NESTED_OPEN_AUNORDERED_LIST_TYPE = new AUnorderedListType(BuiltinType.ANY,
+ "nested-unordered-list");
+
+ public static IAType getDefaultOpenFieldType(ATypeTag tag) {
+ if (tag.equals(ATypeTag.RECORD))
+ return NESTED_OPEN_RECORD_TYPE;
+ if (tag.equals(ATypeTag.ORDEREDLIST))
+ return NESTED_OPEN_AORDERED_LIST_TYPE;
+ if (tag.equals(ATypeTag.UNORDEREDLIST))
+ return NESTED_OPEN_AUNORDERED_LIST_TYPE;
+ else
+ return null;
+ }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/base/IVisitablePointable.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/base/IVisitablePointable.java
new file mode 100644
index 0000000..28c61c2
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/base/IVisitablePointable.java
@@ -0,0 +1,29 @@
+/*
+ * 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.runtime.pointables.base;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.runtime.pointables.visitor.IVisitablePointableVisitor;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+
+/**
+ * This interface extends IPointable with a visitor interface in order to ease
+ * programming for recursive record structures.
+ */
+public interface IVisitablePointable extends IPointable {
+
+ public <R, T> R accept(IVisitablePointableVisitor<R, T> vistor, T tag) throws AsterixException;
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/cast/ACastVisitor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/cast/ACastVisitor.java
new file mode 100644
index 0000000..822e37c
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/cast/ACastVisitor.java
@@ -0,0 +1,89 @@
+/*
+ * 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.runtime.pointables.cast;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.AbstractCollectionType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.runtime.pointables.AFlatValuePointable;
+import edu.uci.ics.asterix.runtime.pointables.AListPointable;
+import edu.uci.ics.asterix.runtime.pointables.ARecordPointable;
+import edu.uci.ics.asterix.runtime.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.runtime.pointables.visitor.IVisitablePointableVisitor;
+import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
+
+/**
+ * This class is a IVisitablePointableVisitor implementation which recursively
+ * visit a given record, list or flat value of a given type, and cast it to a
+ * specified type. For example:
+ *
+ * A record { "hobby": {{"music", "coding"}}, "id": "001", "name":
+ * "Person Three"} which confirms to closed type ( id: string, name: string,
+ * hobby: {{string}}? ) can be casted to a open type (id: string )
+ *
+ * Since the open/closed part of a record has a completely different underlying
+ * memory/storage layout, the visitor will change the layout as specified at
+ * runtime.
+ */
+public class ACastVisitor implements IVisitablePointableVisitor<Void, Triple<IVisitablePointable, IAType, Boolean>> {
+
+ private final Map<IVisitablePointable, ARecordCaster> raccessorToCaster = new HashMap<IVisitablePointable, ARecordCaster>();
+ private final Map<IVisitablePointable, AListCaster> laccessorToCaster = new HashMap<IVisitablePointable, AListCaster>();
+
+ @Override
+ public Void visit(AListPointable accessor, Triple<IVisitablePointable, IAType, Boolean> arg)
+ throws AsterixException {
+ AListCaster caster = laccessorToCaster.get(accessor);
+ if (caster == null) {
+ caster = new AListCaster();
+ laccessorToCaster.put(accessor, caster);
+ }
+ try {
+ caster.castList(accessor, arg.first, (AbstractCollectionType) arg.second, this);
+ } catch (Exception e) {
+ throw new AsterixException(e);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(ARecordPointable accessor, Triple<IVisitablePointable, IAType, Boolean> arg)
+ throws AsterixException {
+ ARecordCaster caster = raccessorToCaster.get(accessor);
+ if (caster == null) {
+ caster = new ARecordCaster();
+ raccessorToCaster.put(accessor, caster);
+ }
+ try {
+ caster.castRecord(accessor, arg.first, (ARecordType) arg.second, this);
+ } catch (Exception e) {
+ throw new AsterixException(e);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(AFlatValuePointable accessor, Triple<IVisitablePointable, IAType, Boolean> arg) {
+ // set the pointer for result
+ arg.first.set(accessor);
+ return null;
+ }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/cast/AListCaster.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/cast/AListCaster.java
new file mode 100644
index 0000000..e10fb72
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/cast/AListCaster.java
@@ -0,0 +1,107 @@
+/*
+ * 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.runtime.pointables.cast;
+
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.List;
+
+import edu.uci.ics.asterix.builders.OrderedListBuilder;
+import edu.uci.ics.asterix.builders.UnorderedListBuilder;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.types.AOrderedListType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnorderedListType;
+import edu.uci.ics.asterix.om.types.AbstractCollectionType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.runtime.pointables.AListPointable;
+import edu.uci.ics.asterix.runtime.pointables.PointableAllocator;
+import edu.uci.ics.asterix.runtime.pointables.base.DefaultOpenFieldType;
+import edu.uci.ics.asterix.runtime.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.runtime.util.ResettableByteArrayOutputStream;
+import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
+
+/**
+ * This class is to do the runtime type cast for a list. It is ONLY visible to
+ * ACastVisitor.
+ */
+class AListCaster {
+ // pointable allocator
+ private final PointableAllocator allocator = new PointableAllocator();
+
+ // for storing the cast result
+ private final IVisitablePointable itemTempReference = allocator.allocateEmpty();
+ private final Triple<IVisitablePointable, IAType, Boolean> itemVisitorArg = new Triple<IVisitablePointable, IAType, Boolean>(
+ itemTempReference, null, null);
+
+ private final UnorderedListBuilder unOrderedListBuilder = new UnorderedListBuilder();
+ private final OrderedListBuilder orderedListBuilder = new OrderedListBuilder();
+
+ private final ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
+ private final DataOutput dataDos = new DataOutputStream(dataBos);
+ private IAType reqItemType;
+
+ public AListCaster() {
+
+ }
+
+ public void castList(AListPointable listAccessor, IVisitablePointable resultAccessor,
+ AbstractCollectionType reqType, ACastVisitor visitor) throws IOException, AsterixException {
+ if (reqType.getTypeTag().equals(ATypeTag.UNORDEREDLIST)) {
+ unOrderedListBuilder.reset((AUnorderedListType) reqType);
+ }
+ if (reqType.getTypeTag().equals(ATypeTag.ORDEREDLIST)) {
+ orderedListBuilder.reset((AOrderedListType) reqType);
+ }
+ dataBos.reset();
+
+ List<IVisitablePointable> itemTags = listAccessor.getItemTags();
+ List<IVisitablePointable> items = listAccessor.getItems();
+
+ int start = dataBos.size();
+ for (int i = 0; i < items.size(); i++) {
+ IVisitablePointable itemTypeTag = itemTags.get(i);
+ IVisitablePointable item = items.get(i);
+ ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(itemTypeTag.getByteArray()[itemTypeTag
+ .getStartOffset()]);
+ if (reqItemType == null || reqItemType.getTypeTag().equals(ATypeTag.ANY)) {
+ itemVisitorArg.second = DefaultOpenFieldType.getDefaultOpenFieldType(typeTag);
+ item.accept(visitor, itemVisitorArg);
+ } else {
+ if (typeTag != reqItemType.getTypeTag())
+ throw new AsterixException("mismatched item type");
+ itemVisitorArg.second = reqItemType;
+ item.accept(visitor, itemVisitorArg);
+ }
+ if (reqType.getTypeTag().equals(ATypeTag.ORDEREDLIST)) {
+ orderedListBuilder.addItem(itemVisitorArg.first);
+ }
+ if (reqType.getTypeTag().equals(ATypeTag.UNORDEREDLIST)) {
+ unOrderedListBuilder.addItem(itemVisitorArg.first);
+ }
+ }
+ if (reqType.getTypeTag().equals(ATypeTag.ORDEREDLIST)) {
+ orderedListBuilder.write(dataDos, true);
+ }
+ if (reqType.getTypeTag().equals(ATypeTag.UNORDEREDLIST)) {
+ unOrderedListBuilder.write(dataDos, true);
+ }
+ int end = dataBos.size();
+ resultAccessor.set(dataBos.getByteArray(), start, end - start);
+ }
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ARecordCaster.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/cast/ARecordCaster.java
similarity index 61%
rename from asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ARecordCaster.java
rename to asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/cast/ARecordCaster.java
index 505e769..50c8b37 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ARecordCaster.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/cast/ARecordCaster.java
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-package edu.uci.ics.asterix.runtime.util;
+package edu.uci.ics.asterix.runtime.pointables.cast;
import java.io.DataOutput;
import java.io.DataOutputStream;
@@ -22,19 +22,58 @@
import java.util.List;
import edu.uci.ics.asterix.builders.RecordBuilder;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.dataflow.data.nontagged.AqlNullWriterFactory;
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.EnumDeserializer;
import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.asterix.runtime.pointables.ARecordPointable;
+import edu.uci.ics.asterix.runtime.pointables.PointableAllocator;
+import edu.uci.ics.asterix.runtime.pointables.base.DefaultOpenFieldType;
+import edu.uci.ics.asterix.runtime.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.runtime.util.ResettableByteArrayOutputStream;
+import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
import edu.uci.ics.hyracks.api.dataflow.value.INullWriter;
import edu.uci.ics.hyracks.data.std.accessors.PointableBinaryComparatorFactory;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
+import edu.uci.ics.hyracks.dataflow.common.comm.io.ByteArrayAccessibleOutputStream;
-public class ARecordCaster {
+/**
+ * This class is to do the runtime type cast for a record. It is ONLY visible to
+ * ACastVisitor.
+ */
+class ARecordCaster {
+
+ // pointable allocator
+ private final PointableAllocator allocator = new PointableAllocator();
+
+ private final List<IVisitablePointable> reqFieldNames = new ArrayList<IVisitablePointable>();
+ private final List<IVisitablePointable> reqFieldTypeTags = new ArrayList<IVisitablePointable>();
+ private ARecordType cachedReqType = null;
+
+ private final ResettableByteArrayOutputStream bos = new ResettableByteArrayOutputStream();
+ private final DataOutputStream dos = new DataOutputStream(bos);
+
+ private final RecordBuilder recBuilder = new RecordBuilder();
+ private final IVisitablePointable nullReference = allocator.allocateEmpty();
+ private final IVisitablePointable nullTypeTag = allocator.allocateEmpty();
+
+ private final IBinaryComparator fieldNameComparator = PointableBinaryComparatorFactory.of(
+ UTF8StringPointable.FACTORY).createBinaryComparator();
+
+ private final ByteArrayAccessibleOutputStream outputBos = new ByteArrayAccessibleOutputStream();
+ private final DataOutputStream outputDos = new DataOutputStream(outputBos);
+
+ private final IVisitablePointable fieldTempReference = allocator.allocateEmpty();
+ private final Triple<IVisitablePointable, IAType, Boolean> nestedVisitorArg = new Triple<IVisitablePointable, IAType, Boolean>(
+ fieldTempReference, null, null);
+
+ private int numInputFields = 0;
// describe closed fields in the required type
private int[] fieldPermutation;
@@ -43,46 +82,31 @@
// describe fields (open or not) in the input records
private boolean[] openFields;
private int[] fieldNamesSortedIndex;
-
- private List<SimpleValueReference> reqFieldNames = new ArrayList<SimpleValueReference>();
private int[] reqFieldNamesSortedIndex;
- private List<SimpleValueReference> reqFieldTypeTags = new ArrayList<SimpleValueReference>();
- private ARecordType cachedReqType = null;
-
- private byte[] buffer = new byte[32768];
- private ResettableByteArrayOutputStream bos = new ResettableByteArrayOutputStream();
- private DataOutputStream dos = new DataOutputStream(bos);
-
- private RecordBuilder recBuilder = new RecordBuilder();
- private SimpleValueReference nullReference = new SimpleValueReference();
- private SimpleValueReference nullTypeTag = new SimpleValueReference();
-
- private int numInputFields = 0;
- private IBinaryComparator fieldNameComparator = PointableBinaryComparatorFactory.of(UTF8StringPointable.FACTORY)
- .createBinaryComparator();
public ARecordCaster() {
try {
- bos.setByteArray(buffer, 0);
+ bos.reset();
int start = bos.size();
INullWriter nullWriter = AqlNullWriterFactory.INSTANCE.createNullWriter();
nullWriter.writeNull(dos);
int end = bos.size();
- nullReference.reset(buffer, start, end - start);
+ nullReference.set(bos.getByteArray(), start, end - start);
start = bos.size();
dos.write(ATypeTag.NULL.serialize());
end = bos.size();
- nullTypeTag.reset(buffer, start, end);
+ nullTypeTag.set(bos.getByteArray(), start, end);
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
- public void castRecord(ARecordAccessor recordAccessor, ARecordType reqType, DataOutput output) throws IOException {
- List<SimpleValueReference> fieldNames = recordAccessor.getFieldNames();
- List<SimpleValueReference> fieldTypeTags = recordAccessor.getFieldTypeTags();
- List<SimpleValueReference> fieldValues = recordAccessor.getFieldValues();
- numInputFields = recordAccessor.getCursor() + 1;
+ public void castRecord(ARecordPointable recordAccessor, IVisitablePointable resultAccessor, ARecordType reqType,
+ ACastVisitor visitor) throws IOException, AsterixException {
+ List<IVisitablePointable> fieldNames = recordAccessor.getFieldNames();
+ List<IVisitablePointable> fieldTypeTags = recordAccessor.getFieldTypeTags();
+ List<IVisitablePointable> fieldValues = recordAccessor.getFieldValues();
+ numInputFields = fieldNames.size();
if (openFields == null || numInputFields > openFields.length) {
openFields = new boolean[numInputFields];
@@ -95,7 +119,8 @@
// clear the previous states
reset();
matchClosedPart(fieldNames, fieldTypeTags, fieldValues);
- writeOutput(fieldNames, fieldTypeTags, fieldValues, output);
+ writeOutput(fieldNames, fieldTypeTags, fieldValues, outputDos, visitor);
+ resultAccessor.set(outputBos.getByteArray(), 0, outputBos.size());
}
private void reset() {
@@ -105,6 +130,7 @@
fieldPermutation[i] = -1;
for (int i = 0; i < numInputFields; i++)
fieldNamesSortedIndex[i] = i;
+ outputBos.reset();
}
private void loadRequiredType(ARecordType reqType) throws IOException {
@@ -120,7 +146,7 @@
for (int i = 0; i < optionalFields.length; i++)
optionalFields[i] = false;
- bos.setByteArray(buffer, nullReference.getStartIndex() + nullReference.getLength());
+ bos.reset(nullReference.getStartOffset() + nullReference.getLength());
for (int i = 0; i < numSchemaFields; i++) {
ATypeTag ftypeTag = fieldTypes[i].getTypeTag();
String fname = fieldNames[i];
@@ -136,8 +162,8 @@
int tagStart = bos.size();
dos.writeByte(ftypeTag.serialize());
int tagEnd = bos.size();
- SimpleValueReference typeTagPointable = new SimpleValueReference();
- typeTagPointable.reset(buffer, tagStart, tagEnd - tagStart);
+ IVisitablePointable typeTagPointable = allocator.allocateEmpty();
+ typeTagPointable.set(bos.getByteArray(), tagStart, tagEnd - tagStart);
reqFieldTypeTags.add(typeTagPointable);
// add type name pointable (including a string type tag)
@@ -145,8 +171,8 @@
dos.write(ATypeTag.STRING.serialize());
dos.writeUTF(fname);
int nameEnd = bos.size();
- SimpleValueReference typeNamePointable = new SimpleValueReference();
- typeNamePointable.reset(buffer, nameStart, nameEnd - nameStart);
+ IVisitablePointable typeNamePointable = allocator.allocateEmpty();
+ typeNamePointable.set(bos.getByteArray(), nameStart, nameEnd - nameStart);
reqFieldNames.add(typeNamePointable);
}
@@ -157,8 +183,8 @@
quickSort(reqFieldNamesSortedIndex, reqFieldNames, 0, reqFieldNamesSortedIndex.length - 1);
}
- private void matchClosedPart(List<SimpleValueReference> fieldNames, List<SimpleValueReference> fieldTypeTags,
- List<SimpleValueReference> fieldValues) {
+ private void matchClosedPart(List<IVisitablePointable> fieldNames, List<IVisitablePointable> fieldTypeTags,
+ List<IVisitablePointable> fieldValues) {
// sort-merge based match
quickSort(fieldNamesSortedIndex, fieldNames, 0, numInputFields - 1);
int fnStart = 0;
@@ -168,8 +194,8 @@
int reqFnPos = reqFieldNamesSortedIndex[reqFnStart];
int c = compare(fieldNames.get(fnPos), reqFieldNames.get(reqFnPos));
if (c == 0) {
- SimpleValueReference fieldTypeTag = fieldTypeTags.get(fnPos);
- SimpleValueReference reqFieldTypeTag = reqFieldTypeTags.get(reqFnPos);
+ IVisitablePointable fieldTypeTag = fieldTypeTags.get(fnPos);
+ IVisitablePointable reqFieldTypeTag = reqFieldTypeTags.get(reqFnPos);
if (fieldTypeTag.equals(reqFieldTypeTag) || (
// match the null type of optional field
optionalFields[reqFnPos] && fieldTypeTag.equals(nullTypeTag))) {
@@ -203,8 +229,9 @@
}
}
- private void writeOutput(List<SimpleValueReference> fieldNames, List<SimpleValueReference> fieldTypeTags,
- List<SimpleValueReference> fieldValues, DataOutput output) throws IOException {
+ private void writeOutput(List<IVisitablePointable> fieldNames, List<IVisitablePointable> fieldTypeTags,
+ List<IVisitablePointable> fieldValues, DataOutput output, ACastVisitor visitor) throws IOException,
+ AsterixException {
// reset the states of the record builder
recBuilder.reset(cachedReqType);
recBuilder.init();
@@ -212,27 +239,43 @@
// write the closed part
for (int i = 0; i < fieldPermutation.length; i++) {
int pos = fieldPermutation[i];
- SimpleValueReference field;
+ IVisitablePointable field;
if (pos >= 0) {
field = fieldValues.get(pos);
} else {
field = nullReference;
}
- recBuilder.addField(i, field);
+ IAType fType = cachedReqType.getFieldTypes()[i];
+ nestedVisitorArg.second = fType;
+
+ // 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);
+ }
+ field.accept(visitor, nestedVisitorArg);
+ recBuilder.addField(i, nestedVisitorArg.first);
}
// write the open part
for (int i = 0; i < numInputFields; i++) {
if (openFields[i]) {
- SimpleValueReference name = fieldNames.get(i);
- SimpleValueReference field = fieldValues.get(i);
- recBuilder.addField(name, field);
+ IVisitablePointable name = fieldNames.get(i);
+ IVisitablePointable field = fieldValues.get(i);
+ IVisitablePointable fieldTypeTag = fieldTypeTags.get(i);
+
+ ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+ .deserialize(fieldTypeTag.getByteArray()[fieldTypeTag.getStartOffset()]);
+ nestedVisitorArg.second = DefaultOpenFieldType.getDefaultOpenFieldType(typeTag);
+ field.accept(visitor, nestedVisitorArg);
+ recBuilder.addField(name, nestedVisitorArg.first);
}
}
recBuilder.write(output, true);
}
- private void quickSort(int[] index, List<SimpleValueReference> names, int start, int end) {
+ private void quickSort(int[] index, List<IVisitablePointable> names, int start, int end) {
if (end <= start)
return;
int i = partition(index, names, start, end);
@@ -240,7 +283,7 @@
quickSort(index, names, i + 1, end);
}
- private int partition(int[] index, List<SimpleValueReference> names, int left, int right) {
+ private int partition(int[] index, List<IVisitablePointable> names, int left, int right) {
int i = left - 1;
int j = right;
while (true) {
@@ -269,7 +312,7 @@
private int compare(IValueReference a, IValueReference b) {
// start+1 and len-1 due to the type tag
- return fieldNameComparator.compare(a.getBytes(), a.getStartIndex() + 1, a.getLength() - 1, b.getBytes(),
- b.getStartIndex() + 1, b.getLength() - 1);
+ return fieldNameComparator.compare(a.getByteArray(), a.getStartOffset() + 1, a.getLength() - 1,
+ b.getByteArray(), b.getStartOffset() + 1, b.getLength() - 1);
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/visitor/IVisitablePointableVisitor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/visitor/IVisitablePointableVisitor.java
new file mode 100644
index 0000000..669e3fc
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/pointables/visitor/IVisitablePointableVisitor.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.runtime.pointables.visitor;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.runtime.pointables.AFlatValuePointable;
+import edu.uci.ics.asterix.runtime.pointables.AListPointable;
+import edu.uci.ics.asterix.runtime.pointables.ARecordPointable;
+
+/**
+ * This interface is a visitor for all the three different IVisitablePointable
+ * (Note that right now we have three pointable implementations for type
+ * casting) implementations.
+ */
+public interface IVisitablePointableVisitor<R, T> {
+
+ public R visit(AListPointable accessor, T arg) throws AsterixException;
+
+ public R visit(ARecordPointable accessor, T arg) throws AsterixException;
+
+ public R visit(AFlatValuePointable accessor, T arg) throws AsterixException;
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
index bbebe50..69e823b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
@@ -12,9 +12,9 @@
import edu.uci.ics.asterix.runtime.runningaggregates.base.AbstractRunningAggregateFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IRunningAggregateFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IRunningAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -31,21 +31,21 @@
};
@Override
- public IRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(IEvaluatorFactory[] args)
+ public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new IRunningAggregateFunctionFactory() {
+ return new ICopyRunningAggregateFunctionFactory() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
@Override
- public IRunningAggregateFunction createRunningAggregateFunction(IDataOutputProvider provider)
+ public ICopyRunningAggregateFunction createRunningAggregateFunction(IDataOutputProvider provider)
throws AlgebricksException {
final DataOutput out = provider.getDataOutput();
- return new IRunningAggregateFunction() {
+ return new ICopyRunningAggregateFunction() {
int cnt;
ISerializerDeserializer<AInt32> serde = AqlSerializerDeserializerProvider.INSTANCE
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
index d3b965f..fb7f8f0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
@@ -11,10 +11,10 @@
import edu.uci.ics.asterix.runtime.unnestingfunctions.base.AbstractUnnestingFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
@@ -39,24 +39,24 @@
}
@Override
- public IUnnestingFunctionFactory createUnnestingFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new IUnnestingFunctionFactory() {
+ return new ICopyUnnestingFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IUnnestingFunction createUnnestingFunction(final IDataOutputProvider provider)
+ public ICopyUnnestingFunction createUnnestingFunction(final IDataOutputProvider provider)
throws AlgebricksException {
- return new IUnnestingFunction() {
+ return new ICopyUnnestingFunction() {
private DataOutput out = provider.getDataOutput();
@SuppressWarnings("rawtypes")
private ISerializerDeserializer serde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.AINT32);
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator eval0 = args[0].createEvaluator(inputVal);
- private IEvaluator eval1 = args[1].createEvaluator(inputVal);
+ private ICopyEvaluator eval0 = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator eval1 = args[1].createEvaluator(inputVal);
private AMutableInt32 aInt32 = new AMutableInt32(0);
private int current;
private int max;
@@ -65,10 +65,10 @@
public void init(IFrameTupleReference tuple) throws AlgebricksException {
inputVal.reset();
eval0.evaluate(tuple);
- current = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ current = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
inputVal.reset();
eval1.evaluate(tuple);
- max = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ max = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
}
@SuppressWarnings("unchecked")
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
index 6bf5420..bfd23eb 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
@@ -18,10 +18,10 @@
import edu.uci.ics.asterix.runtime.unnestingfunctions.base.AbstractUnnestingFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -44,15 +44,15 @@
}
@Override
- public IUnnestingFunctionFactory createUnnestingFunctionFactory(final IEvaluatorFactory[] args) {
+ public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args) {
return new ScanCollectionUnnestingFunctionFactory(args[0]);
}
- private static class ScanCollectionUnnestingFunctionFactory implements IUnnestingFunctionFactory {
+ private static class ScanCollectionUnnestingFunctionFactory implements ICopyUnnestingFunctionFactory {
private static final long serialVersionUID = 1L;
- private IEvaluatorFactory listEvalFactory;
+ private ICopyEvaluatorFactory listEvalFactory;
private final static byte SER_ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
private final static byte SER_UNORDEREDLIST_TYPE_TAG = ATypeTag.UNORDEREDLIST.serialize();
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -60,19 +60,19 @@
private byte serItemTypeTag;
private boolean selfDescList = false;
- public ScanCollectionUnnestingFunctionFactory(IEvaluatorFactory arg) {
+ public ScanCollectionUnnestingFunctionFactory(ICopyEvaluatorFactory arg) {
this.listEvalFactory = arg;
}
@Override
- public IUnnestingFunction createUnnestingFunction(IDataOutputProvider provider) throws AlgebricksException {
+ public ICopyUnnestingFunction createUnnestingFunction(IDataOutputProvider provider) throws AlgebricksException {
final DataOutput out = provider.getDataOutput();
- return new IUnnestingFunction() {
+ return new ICopyUnnestingFunction() {
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator argEval = listEvalFactory.createEvaluator(inputVal);
+ private ICopyEvaluator argEval = listEvalFactory.createEvaluator(inputVal);
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
@@ -87,7 +87,7 @@
try {
inputVal.reset();
argEval.evaluate(tuple);
- byte[] serList = inputVal.getBytes();
+ byte[] serList = inputVal.getByteArray();
if (serList[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, out);
@@ -99,12 +99,12 @@
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
}
- serListTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getBytes()[0])
+ serListTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0])
.serialize();
if (serListTag == SER_ORDEREDLIST_TYPE_TAG)
- numItems = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getBytes());
+ numItems = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
else
- numItems = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getBytes());
+ numItems = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[1]);
if (itemTag == ATypeTag.ANY)
@@ -123,7 +123,7 @@
try {
if (pos < numItems) {
- byte[] serList = inputVal.getBytes();
+ byte[] serList = inputVal.getByteArray();
try {
if (serListTag == SER_ORDEREDLIST_TYPE_TAG) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
index a045344..cd69f5b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
@@ -18,10 +18,10 @@
import edu.uci.ics.asterix.runtime.unnestingfunctions.base.AbstractUnnestingFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingFunction;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunction;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ArrayBackedValueStorage;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.IDataOutputProvider;
@@ -45,24 +45,24 @@
};
@Override
- public IUnnestingFunctionFactory createUnnestingFunctionFactory(final IEvaluatorFactory[] args)
+ public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args)
throws AlgebricksException {
- return new IUnnestingFunctionFactory() {
+ return new ICopyUnnestingFunctionFactory() {
private static final long serialVersionUID = 1L;
@Override
- public IUnnestingFunction createUnnestingFunction(IDataOutputProvider provider) throws AlgebricksException {
+ public ICopyUnnestingFunction createUnnestingFunction(IDataOutputProvider provider) throws AlgebricksException {
final DataOutput out = provider.getDataOutput();
- return new IUnnestingFunction() {
+ return new ICopyUnnestingFunction() {
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private IEvaluator evalList = args[0].createEvaluator(inputVal);
- private IEvaluator evalStart = args[1].createEvaluator(inputVal);
- private IEvaluator evalLen = args[2].createEvaluator(inputVal);
+ private ICopyEvaluator evalList = args[0].createEvaluator(inputVal);
+ private ICopyEvaluator evalStart = args[1].createEvaluator(inputVal);
+ private ICopyEvaluator evalLen = args[2].createEvaluator(inputVal);
private int numItems;
private int numItemsMax;
private int posStart;
@@ -75,16 +75,16 @@
try {
inputVal.reset();
evalStart.evaluate(tuple);
- posStart = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ posStart = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
inputVal.reset();
evalLen.evaluate(tuple);
- numItems = IntegerSerializerDeserializer.getInt(inputVal.getBytes(), 1);
+ numItems = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
inputVal.reset();
evalList.evaluate(tuple);
- byte[] serList = inputVal.getBytes();
+ byte[] serList = inputVal.getByteArray();
if (serList[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, out);
@@ -113,7 +113,7 @@
@Override
public boolean step() throws AlgebricksException {
if (posCrt < posStart + numItems && posCrt < numItemsMax) {
- byte[] serList = inputVal.getBytes();
+ byte[] serList = inputVal.getByteArray();
int itemLength = 0;
try {
int itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, posCrt);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ARecordAccessor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ARecordAccessor.java
deleted file mode 100644
index d45b4ac..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ARecordAccessor.java
+++ /dev/null
@@ -1,284 +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.runtime.util;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import edu.uci.ics.asterix.dataflow.data.nontagged.AqlNullWriterFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
-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.EnumDeserializer;
-import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
-import edu.uci.ics.hyracks.api.dataflow.value.INullWriter;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
-
-public class ARecordAccessor implements IValueReference {
-
- private List<SimpleValueReference> fieldNames = new ArrayList<SimpleValueReference>();
- private List<SimpleValueReference> fieldTypeTags = new ArrayList<SimpleValueReference>();
- private List<SimpleValueReference> fieldValues = new ArrayList<SimpleValueReference>();
-
- private byte[] typeBuffer = new byte[32768];
- private ResettableByteArrayOutputStream typeBos = new ResettableByteArrayOutputStream();
- private DataOutputStream typeDos = new DataOutputStream(typeBos);
-
- private byte[] dataBuffer = new byte[32768];
- private ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
- private DataOutputStream dataDos = new DataOutputStream(dataBos);
-
- private int closedPartTypeInfoSize = 0;
- private ARecordType inputRecType;
-
- private int numberOfSchemaFields;
- private int offsetArrayOffset;
- private int[] fieldOffsets;
- private int fieldCursor = -1;
- private ATypeTag typeTag;
- private SimpleValueReference nullReference = new SimpleValueReference();
-
- private byte[] data;
- private int start;
- private int len;
-
- public ARecordAccessor(ARecordType inputType) {
- this.inputRecType = inputType;
- IAType[] fieldTypes = inputType.getFieldTypes();
- String[] fieldNameStrs = inputType.getFieldNames();
- numberOfSchemaFields = fieldTypes.length;
-
- // initialize the buffer for closed parts(fieldName bytes+ type bytes) +
- // constant(null bytes)
- typeBos.setByteArray(typeBuffer, 0);
- try {
- for (int i = 0; i < numberOfSchemaFields; i++) {
- ATypeTag ftypeTag = fieldTypes[i].getTypeTag();
-
- // add type tag Reference
- int tagStart = typeBos.size();
- typeDos.writeByte(ftypeTag.serialize());
- int tagEnd = typeBos.size();
- SimpleValueReference typeTagReference = new SimpleValueReference();
- typeTagReference.reset(typeBuffer, tagStart, tagEnd - tagStart);
- fieldTypeTags.add(typeTagReference);
-
- // add type name Reference (including a astring type tag)
- int nameStart = typeBos.size();
- typeDos.writeByte(ATypeTag.STRING.serialize());
- typeDos.writeUTF(fieldNameStrs[i]);
- int nameEnd = typeBos.size();
- SimpleValueReference typeNameReference = new SimpleValueReference();
- typeNameReference.reset(typeBuffer, nameStart, nameEnd - nameStart);
- fieldNames.add(typeNameReference);
- }
-
- // initialize a constant: null value bytes reference
- int nullFieldStart = typeBos.size();
- INullWriter nullWriter = AqlNullWriterFactory.INSTANCE.createNullWriter();
- nullWriter.writeNull(typeDos);
- int nullFieldEnd = typeBos.size();
- nullReference.reset(typeBuffer, nullFieldStart, nullFieldEnd - nullFieldStart);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
- closedPartTypeInfoSize = typeBos.size();
- fieldOffsets = new int[numberOfSchemaFields];
- }
-
- private void reset() {
- typeBos.setByteArray(typeBuffer, closedPartTypeInfoSize);
- dataBos.setByteArray(dataBuffer, 0);
- fieldCursor = -1;
- }
-
- public void reset(byte[] b, int start, int len) {
- // clear the previous states
- reset();
- this.data = b;
- this.start = start;
- this.len = len;
-
- boolean isExpanded = false;
- int openPartOffset = 0;
- int s = start;
- int recordOffset = s;
- if (inputRecType == null) {
- openPartOffset = s + AInt32SerializerDeserializer.getInt(b, s + 6);
- s += 8;
- isExpanded = true;
- } else {
- if (inputRecType.isOpen()) {
- isExpanded = b[s + 5] == 1 ? true : false;
- if (isExpanded) {
- openPartOffset = s + AInt32SerializerDeserializer.getInt(b, s + 6);
- s += 10;
- } else
- s += 6;
- } else
- s += 5;
- }
- try {
- if (numberOfSchemaFields > 0) {
- s += 4;
- int nullBitMapOffset = 0;
- boolean hasNullableFields = NonTaggedFormatUtil.hasNullableField(inputRecType);
- if (hasNullableFields) {
- nullBitMapOffset = s;
- offsetArrayOffset = s
- + (this.numberOfSchemaFields % 8 == 0 ? numberOfSchemaFields / 8
- : numberOfSchemaFields / 8 + 1);
- } else {
- offsetArrayOffset = s;
- }
- for (int i = 0; i < numberOfSchemaFields; i++) {
- fieldOffsets[i] = AInt32SerializerDeserializer.getInt(b, offsetArrayOffset) + recordOffset;
- offsetArrayOffset += 4;
- }
- for (int fieldNumber = 0; fieldNumber < numberOfSchemaFields; fieldNumber++) {
- next();
- if (hasNullableFields) {
- byte b1 = b[nullBitMapOffset + fieldNumber / 8];
- int p = 1 << (7 - (fieldNumber % 8));
- if ((b1 & p) == 0) {
- // set null value (including type tag inside)
- nextFieldValue().reset(nullReference);
- continue;
- }
- }
- IAType[] fieldTypes = inputRecType.getFieldTypes();
- int fieldValueLength = 0;
-
- if (fieldTypes[fieldNumber].getTypeTag() == ATypeTag.UNION) {
- if (NonTaggedFormatUtil.isOptionalField((AUnionType) fieldTypes[fieldNumber])) {
- typeTag = ((AUnionType) fieldTypes[fieldNumber]).getUnionList()
- .get(NonTaggedFormatUtil.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
- fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffsets[fieldNumber],
- typeTag, false);
- }
- } else {
- typeTag = fieldTypes[fieldNumber].getTypeTag();
- fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffsets[fieldNumber],
- typeTag, false);
- }
- // set field value (including the type tag)
- int fstart = dataBos.size();
- dataDos.writeByte(typeTag.serialize());
- dataDos.write(b, fieldOffsets[fieldNumber], fieldValueLength);
- int fend = dataBos.size();
- nextFieldValue().reset(dataBuffer, fstart, fend - fstart);
- }
- }
- if (isExpanded) {
- int numberOfOpenFields = AInt32SerializerDeserializer.getInt(b, openPartOffset);
- int fieldOffset = openPartOffset + 4 + (8 * numberOfOpenFields);
- for (int i = 0; i < numberOfOpenFields; i++) {
- next();
- // set the field name (including a type tag, which is
- // astring)
- int fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffset, ATypeTag.STRING,
- false);
- int fnstart = dataBos.size();
- dataDos.writeByte(ATypeTag.STRING.serialize());
- dataDos.write(b, fieldOffset, fieldValueLength);
- int fnend = dataBos.size();
- nextFieldName().reset(dataBuffer, fnstart, fnend - fnstart);
- fieldOffset += fieldValueLength;
-
- // set the field type tag
- nextFieldType().reset(b, fieldOffset, 1);
- typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[fieldOffset]);
-
- // set the field value (already including type tag)
- fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffset, typeTag, true) + 1;
- nextFieldValue().reset(b, fieldOffset, fieldValueLength);
- fieldOffset += fieldValueLength;
- }
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- private void next() {
- fieldCursor++;
- }
-
- private SimpleValueReference nextFieldName() {
- if (fieldCursor < fieldNames.size()) {
- return fieldNames.get(fieldCursor);
- } else {
- SimpleValueReference fieldNameReference = new SimpleValueReference();
- fieldNames.add(fieldNameReference);
- return fieldNameReference;
- }
- }
-
- private SimpleValueReference nextFieldType() {
- if (fieldCursor < fieldTypeTags.size()) {
- return fieldTypeTags.get(fieldCursor);
- } else {
- SimpleValueReference fieldTypeReference = new SimpleValueReference();
- fieldTypeTags.add(fieldTypeReference);
- return fieldTypeReference;
- }
- }
-
- private SimpleValueReference nextFieldValue() {
- if (fieldCursor < fieldValues.size()) {
- return fieldValues.get(fieldCursor);
- } else {
- SimpleValueReference fieldValueReference = new SimpleValueReference();
- fieldValues.add(fieldValueReference);
- return fieldValueReference;
- }
- }
-
- public int getCursor() {
- return fieldCursor;
- }
-
- public List<SimpleValueReference> getFieldNames() {
- return fieldNames;
- }
-
- public List<SimpleValueReference> getFieldTypeTags() {
- return fieldTypeTags;
- }
-
- public List<SimpleValueReference> getFieldValues() {
- return fieldValues;
- }
-
- @Override
- public byte[] getBytes() {
- return data;
- }
-
- @Override
- public int getStartIndex() {
- return start;
- }
-
- @Override
- public int getLength() {
- return len;
- }
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ResettableByteArrayInputStream.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ResettableByteArrayInputStream.java
deleted file mode 100644
index af18133..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ResettableByteArrayInputStream.java
+++ /dev/null
@@ -1,61 +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.runtime.util;
-
-import java.io.ByteArrayInputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class ResettableByteArrayInputStream extends ByteArrayInputStream {
- private static final Logger LOGGER = Logger.getLogger(ResettableByteArrayInputStream.class.getName());
-
- private byte[] data;
- private int position;
-
- public ResettableByteArrayInputStream(byte[] data) {
- super(data);
- }
-
- public void setByteArray(byte[] data, int position) {
- this.data = data;
- this.position = position;
- }
-
- @Override
- public int read() {
- int remaining = data.length - position;
- int value = remaining > 0 ? (data[position++] & 0xff) : -1;
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest("read(): value: " + value + " remaining: " + remaining + " position: " + position);
- }
- return value;
- }
-
- @Override
- public int read(byte[] bytes, int offset, int length) {
- int remaining = data.length - position;
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest("read(bytes[], int, int): remaining: " + remaining + " offset: " + offset + " length: "
- + length + " position: " + position);
- }
- if (remaining == 0) {
- return -1;
- }
- int l = Math.min(length, remaining);
- System.arraycopy(data, position, bytes, offset, l);
- position += l;
- return l;
- }
-}
\ No newline at end of file
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ResettableByteArrayOutputStream.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ResettableByteArrayOutputStream.java
index 62db3a9..5aecd08 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ResettableByteArrayOutputStream.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/ResettableByteArrayOutputStream.java
@@ -1,63 +1,15 @@
-/*
- * 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.runtime.util;
-import java.io.ByteArrayOutputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import edu.uci.ics.hyracks.dataflow.common.comm.io.ByteArrayAccessibleOutputStream;
-public class ResettableByteArrayOutputStream extends ByteArrayOutputStream {
- private static final Logger LOGGER = Logger.getLogger(ResettableByteArrayOutputStream.class.getName());
+/**
+ * This class extends ByteArrayAccessibleOutputStream to allow reset to a given
+ * size.
+ *
+ */
+public class ResettableByteArrayOutputStream extends ByteArrayAccessibleOutputStream {
- private byte[] data;
- private int position;
-
- public ResettableByteArrayOutputStream() {
+ public void reset(int size) {
+ count = size;
}
-
- public void setByteArray(byte[] data, int position) {
- this.data = data;
- this.position = position;
- }
-
- @Override
- public void write(int b) {
- int remaining = data.length - position;
- if (position + 1 > data.length - 1)
- throw new IndexOutOfBoundsException();
- data[position] = (byte) b;
- position++;
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest("write(): value: " + b + " remaining: " + remaining + " position: " + position);
- }
- }
-
- @Override
- public void write(byte[] bytes, int offset, int length) {
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest("write(bytes[], int, int) offset: " + offset + " length: " + length + " position: "
- + position);
- }
- if (position + length > data.length - 1)
- throw new IndexOutOfBoundsException();
- System.arraycopy(bytes, offset, data, position, length);
- position += length;
- }
-
- @Override
- public int size(){
- return position;
- }
-}
\ No newline at end of file
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/SimpleValueReference.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/SimpleValueReference.java
deleted file mode 100644
index e49218a..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/SimpleValueReference.java
+++ /dev/null
@@ -1,70 +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.runtime.util;
-
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IValueReference;
-
-public class SimpleValueReference implements IValueReference {
-
- private byte[] data;
- private int start;
- private int len;
-
- public void reset(byte[] data, int start, int len) {
- this.data = data;
- this.start = start;
- this.len = len;
- }
-
- public void reset(IValueReference ivf) {
- this.data = ivf.getBytes();
- this.start = ivf.getStartIndex();
- this.len = ivf.getLength();
- }
-
- @Override
- public byte[] getBytes() {
- return data;
- }
-
- @Override
- public int getStartIndex() {
- return start;
- }
-
- @Override
- public int getLength() {
- return len;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof IValueReference))
- return false;
- IValueReference ivf = (IValueReference) o;
- byte[] odata = ivf.getBytes();
- int ostart = ivf.getStartIndex();
- int olen = ivf.getLength();
-
- if (len != olen)
- return false;
- for (int i = 0; i < len; i++) {
- if (data[start + i] != odata[ostart + i])
- return false;
- }
- return true;
- }
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/container/IObjectFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/container/IObjectFactory.java
new file mode 100644
index 0000000..85f0fa3
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/container/IObjectFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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.runtime.util.container;
+
+/**
+ * A factory interface to create objects.
+ */
+public interface IObjectFactory<E, T> {
+
+ /**
+ * create an element of type E
+ *
+ * @param arg
+ * @return an E element
+ */
+ public E create(T arg);
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/container/IObjectPool.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/container/IObjectPool.java
new file mode 100644
index 0000000..dd2c3bf
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/container/IObjectPool.java
@@ -0,0 +1,36 @@
+/*
+ * 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.runtime.util.container;
+
+/**
+ * A reusable object pool interface.
+ */
+public interface IObjectPool<E, T> {
+
+ /**
+ * Give client an E instance
+ *
+ * @param arg
+ * the argument to create E
+ * @return an E instance
+ */
+ public E allocate(T arg);
+
+ /**
+ * Mark all instances in the pool as unused
+ */
+ public void reset();
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/container/ListObjectPool.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/container/ListObjectPool.java
new file mode 100644
index 0000000..b8f8e3a
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/util/container/ListObjectPool.java
@@ -0,0 +1,82 @@
+/*
+ * 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.runtime.util.container;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.List;
+
+/**
+ * Object pool backed by a list.
+ *
+ * The argument for creating E instances could be different. This class also
+ * considers arguments in object reusing, e.g., it reuses an E instances ONLY
+ * when the construction argument is "equal".
+ */
+public class ListObjectPool<E, T> implements IObjectPool<E, T> {
+
+ private IObjectFactory<E, T> factory;
+
+ /**
+ * cache of objects
+ */
+ private List<E> pool = new ArrayList<E>();
+
+ /**
+ * args that are used to create each element in the pool
+ */
+ private List<T> args = new ArrayList<T>();
+
+ /**
+ * bits indicating which element is in use
+ */
+ private BitSet usedBits = new BitSet();
+
+ public ListObjectPool(IObjectFactory<E, T> factory) {
+ this.factory = factory;
+ }
+
+ @Override
+ public E allocate(T arg) {
+ int freeSlot = -1;
+ while (freeSlot + 1 < pool.size()) {
+ freeSlot = usedBits.nextClearBit(freeSlot + 1);
+ if (freeSlot >= pool.size())
+ break;
+
+ // the two cases where an element in the pool is a match
+ if ((arg == null && args.get(freeSlot) == null)
+ || (arg != null && args.get(freeSlot) != null && arg.equals(args.get(freeSlot)))) {
+ // the element is not used and the arg is the same as
+ // input arg
+ usedBits.set(freeSlot);
+ return pool.get(freeSlot);
+ }
+ }
+
+ // if we do not find a reusable object, allocate a new one
+ E element = factory.create(arg);
+ pool.add(element);
+ args.add(arg);
+ usedBits.set(pool.size() - 1);
+ return element;
+ }
+
+ @Override
+ public void reset() {
+ usedBits.clear();
+ }
+}