You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2016/02/13 03:15:52 UTC
[23/24] incubator-asterixdb git commit: Move to non-copy-based
evaluator interfaces for all function implementations,
including: - scalar functions, - aggregate functions,
- running aggregate functions, - unnesting functions
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
index 9475e6a..46dc73d 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
@@ -120,10 +120,6 @@ public class AUnorderedListSerializerDeserializer implements ISerializerDeserial
return AInt32SerializerDeserializer.getInt(serOrderedList, offset + 1);
}
- public static int getNumberOfItems(byte[] serOrderedList) {
- return getNumberOfItems(serOrderedList, 0);
- }
-
public static int getNumberOfItems(byte[] serOrderedList, int offset) {
if (serOrderedList[offset] == ATypeTag.UNORDEREDLIST.serialize())
// 6 = tag (1) + itemTag (1) + list size (4)
@@ -146,8 +142,4 @@ public class AUnorderedListSerializerDeserializer implements ISerializerDeserial
return -1;
}
- public static int getItemOffset(byte[] serOrderedList, int itemIndex) throws AsterixException {
- return getItemOffset(serOrderedList, 0, itemIndex);
- }
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java b/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
index 4872ede..01897d4 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
@@ -39,7 +39,7 @@ import org.apache.hyracks.algebricks.data.INormalizedKeyComputerFactoryProvider;
import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider;
import org.apache.hyracks.algebricks.data.ISerializerDeserializerProvider;
import org.apache.hyracks.algebricks.data.ITypeTraitProvider;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
import org.apache.hyracks.api.dataflow.value.INullWriterFactory;
import org.apache.hyracks.api.dataflow.value.IPredicateEvaluatorFactoryProvider;
@@ -69,18 +69,18 @@ public interface IDataFormat {
public INullWriterFactory getNullWriterFactory();
- public Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
+ public Triple<IScalarEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
ARecordType recType, List<String> fldName) throws AlgebricksException;
- public ICopyEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, List<String> fldName,
+ public IScalarEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, List<String> fldName,
int recordColumn) throws AlgebricksException;
public IFunctionDescriptor resolveFunction(ILogicalExpression expr, IVariableTypeEnvironment typeEnvironment)
throws AlgebricksException;
- public ICopyEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException;
+ public IScalarEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException;
- public ICopyEvaluatorFactory[] createMBRFactory(ARecordType recType, List<String> fldName, int recordColumn,
+ public IScalarEvaluatorFactory[] createMBRFactory(ARecordType recType, List<String> fldName, int recordColumn,
int dimension, List<String> filterFieldName) throws AlgebricksException;
public IExpressionEvalSizeComputer getExpressionEvalSizeComputer();
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-om/src/main/java/org/apache/asterix/om/functions/AbstractFunctionDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/functions/AbstractFunctionDescriptor.java b/asterix-om/src/main/java/org/apache/asterix/om/functions/AbstractFunctionDescriptor.java
index 99da847..c070719 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/functions/AbstractFunctionDescriptor.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/functions/AbstractFunctionDescriptor.java
@@ -22,11 +22,11 @@ import org.apache.asterix.common.functions.FunctionDescriptorTag;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
public abstract class AbstractFunctionDescriptor implements IFunctionDescriptor {
@@ -39,30 +39,30 @@ public abstract class AbstractFunctionDescriptor implements IFunctionDescriptor
public abstract FunctionDescriptorTag getFunctionDescriptorTag();
@Override
- public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
throw new NotImplementedException("Not Implemented");
}
@Override
- public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+ public IRunningAggregateEvaluatorFactory createRunningAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args)
throws AlgebricksException {
throw new NotImplementedException("Not Implemented");
}
@Override
- public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
- ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+ IScalarEvaluatorFactory[] args) throws AlgebricksException {
throw new NotImplementedException("Not Implemented");
}
@Override
- public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(ICopyEvaluatorFactory[] args)
+ public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(IScalarEvaluatorFactory[] args)
throws AlgebricksException {
throw new NotImplementedException("Not Implemented");
}
@Override
- public ICopyAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+ public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args)
throws AlgebricksException {
throw new NotImplementedException("Not Implemented");
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java b/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
index 01313cf..afdaaeb 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
@@ -23,29 +23,29 @@ import java.io.Serializable;
import org.apache.asterix.common.functions.FunctionDescriptorTag;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
public interface IFunctionDescriptor extends Serializable {
public FunctionIdentifier getIdentifier();
public FunctionDescriptorTag getFunctionDescriptorTag();
- public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException;
+ public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException;
- public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+ public IRunningAggregateEvaluatorFactory createRunningAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
throws AlgebricksException;
- public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
- final ICopyEvaluatorFactory[] args) throws AlgebricksException;
+ public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+ final IScalarEvaluatorFactory[] args) throws AlgebricksException;
- public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args)
+ public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final IScalarEvaluatorFactory[] args)
throws AlgebricksException;
- public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+ public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
throws AlgebricksException;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java b/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
index ac50312..e3e09d8 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
@@ -21,7 +21,6 @@ package org.apache.asterix.om.pointables.nonvisitor;
import java.io.DataOutput;
import java.io.IOException;
-import java.util.Arrays;
import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.om.types.ARecordType;
@@ -166,10 +165,6 @@ public class ARecordPointable extends AbstractPointable {
return (isOpen(recordType)) ? EXPANDED_SIZE : 0;
}
- public int getOpenPart(ARecordType recordType) {
- return IntegerPointable.getInteger(bytes, getOpenPartOffset(recordType));
- }
-
public int getOpenPartOffset(ARecordType recordType) {
return getExpendedOffset(recordType) + getExpandedSize(recordType);
}
@@ -190,13 +185,6 @@ public class ARecordPointable extends AbstractPointable {
return CLOSED_COUNT_SIZE;
}
- public byte[] getNullBitmap(ARecordType recordType) {
- if (getNullBitmapSize(recordType) > 0) {
- return Arrays.copyOfRange(bytes, getNullBitmapOffset(recordType), getNullBitmapSize(recordType));
- }
- return null;
- }
-
public int getNullBitmapOffset(ARecordType recordType) {
return getClosedFieldCountOffset(recordType) + getClosedFieldCountSize(recordType);
}
@@ -258,7 +246,7 @@ public class ARecordPointable extends AbstractPointable {
public int getClosedFieldOffset(ARecordType recordType, int fieldId) {
int offset = getNullBitmapOffset(recordType) + getNullBitmapSize(recordType) + fieldId * FIELD_OFFSET_SIZE;
- return IntegerPointable.getInteger(bytes, offset);
+ return start + IntegerPointable.getInteger(bytes, offset);
}
// -----------------------
@@ -274,7 +262,7 @@ public class ARecordPointable extends AbstractPointable {
}
public int getOpenFieldCountOffset(ARecordType recordType) {
- return getOpenPart(recordType);
+ return start + IntegerPointable.getInteger(bytes, getOpenPartOffset(recordType));
}
// -----------------------
@@ -327,7 +315,7 @@ public class ARecordPointable extends AbstractPointable {
}
public int getOpenFieldOffset(ARecordType recordType, int fieldId) {
- return IntegerPointable.getInteger(bytes, getOpenFieldOffsetOffset(recordType, fieldId));
+ return start + IntegerPointable.getInteger(bytes, getOpenFieldOffsetOffset(recordType, fieldId));
}
public int getOpenFieldOffsetOffset(ARecordType recordType, int fieldId) {
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java b/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
index 6196c60..641a6dd 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
@@ -95,6 +95,7 @@ public enum ATypeTag implements IEnumSerializer {
public static final byte SERIALIZED_INT16_TYPE_TAG = INT16.serialize();
public static final byte SERIALIZED_INT64_TYPE_TAG = INT64.serialize();
public static final byte SERIALIZED_FLOAT_TYPE_TAG = FLOAT.serialize();
+ public static final byte SERIALIZED_BINARY_TYPE_TAG = BINARY.serialize();
/*
* Serialized Tags end
*/
@@ -124,10 +125,8 @@ public enum ATypeTag implements IEnumSerializer {
}
public boolean isDerivedType() {
- if (this == ATypeTag.RECORD || this == ATypeTag.ORDEREDLIST || this == ATypeTag.UNORDEREDLIST
- || this == ATypeTag.UNION)
- return true;
- return false;
+ return this == ATypeTag.RECORD || this == ATypeTag.ORDEREDLIST || this == ATypeTag.UNORDEREDLIST
+ || this == ATypeTag.UNION;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java b/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
index 0b6b45d..f85aa50 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
@@ -125,10 +125,12 @@ public class ATypeHierarchy {
public static boolean isSameTypeDomain(ATypeTag tag1, ATypeTag tag2, boolean useListDomain) {
Domain tagHierarchy1 = hierarchyDomains.get(tag1);
Domain tagHierarchy2 = hierarchyDomains.get(tag2);
- if (tagHierarchy1 == null || tagHierarchy2 == null)
+ if (tagHierarchy1 == null || tagHierarchy2 == null) {
return false;
- if (useListDomain && tagHierarchy1 == Domain.LIST && tagHierarchy2 == Domain.LIST)
+ }
+ if (useListDomain && tagHierarchy1 == Domain.LIST && tagHierarchy2 == Domain.LIST) {
return true;
+ }
return tagHierarchy1.equals(tagHierarchy2) && !useListDomain;
}
@@ -189,24 +191,24 @@ public class ATypeHierarchy {
if (sourceTypeTag != targetTypeTag) {
switch (targetTypeTag) {
- //Target Field Type:INT64
+ //Target Field Type:INT64
case INT64:
// Change the Constant Type to INT64 Type
switch (sourceTypeTag) {
case INT8:
- asterixNewConstantValue = new AsterixConstantValue(new AInt64(
- (long) ((AInt8) sourceObject).getByteValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AInt64((long) ((AInt8) sourceObject).getByteValue()));
break;
case INT16:
- asterixNewConstantValue = new AsterixConstantValue(new AInt64(
- (long) ((AInt16) sourceObject).getShortValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AInt64((long) ((AInt16) sourceObject).getShortValue()));
break;
case INT32:
- asterixNewConstantValue = new AsterixConstantValue(new AInt64(
- (long) ((AInt32) sourceObject).getIntegerValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AInt64((long) ((AInt32) sourceObject).getIntegerValue()));
break;
case FLOAT:
@@ -235,13 +237,13 @@ public class ATypeHierarchy {
// Change the Constant Type to INT32 Type
switch (sourceTypeTag) {
case INT8:
- asterixNewConstantValue = new AsterixConstantValue(new AInt32(
- (int) ((AInt8) sourceObject).getByteValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AInt32(((AInt8) sourceObject).getByteValue()));
break;
case INT16:
- asterixNewConstantValue = new AsterixConstantValue(new AInt32(
- (int) ((AInt16) sourceObject).getShortValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AInt32(((AInt16) sourceObject).getShortValue()));
break;
case INT64:
@@ -321,8 +323,8 @@ public class ATypeHierarchy {
// Change the Constant Type to INT16 Type
switch (sourceTypeTag) {
case INT8:
- asterixNewConstantValue = new AsterixConstantValue(new AInt16(
- (short) ((AInt8) sourceObject).getByteValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AInt16(((AInt8) sourceObject).getByteValue()));
break;
case INT32:
@@ -363,23 +365,23 @@ public class ATypeHierarchy {
// Change the Constant Type to FLOAT Type
switch (sourceTypeTag) {
case INT8:
- asterixNewConstantValue = new AsterixConstantValue(new AFloat(
- (float) ((AInt8) sourceObject).getByteValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AFloat(((AInt8) sourceObject).getByteValue()));
break;
case INT16:
- asterixNewConstantValue = new AsterixConstantValue(new AFloat(
- (float) ((AInt16) sourceObject).getShortValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AFloat(((AInt16) sourceObject).getShortValue()));
break;
case INT32:
- asterixNewConstantValue = new AsterixConstantValue(new AFloat(
- (float) (int) ((AInt32) sourceObject).getIntegerValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AFloat(((AInt32) sourceObject).getIntegerValue()));
break;
case INT64:
- asterixNewConstantValue = new AsterixConstantValue(new AFloat(
- (float) ((AInt64) sourceObject).getLongValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new AFloat(((AInt64) sourceObject).getLongValue()));
break;
case DOUBLE:
@@ -399,28 +401,28 @@ public class ATypeHierarchy {
// Change the Constant Type to DOUBLE Type
switch (sourceTypeTag) {
case INT8:
- asterixNewConstantValue = new AsterixConstantValue(new ADouble(
- (double) ((AInt8) sourceObject).getByteValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new ADouble(((AInt8) sourceObject).getByteValue()));
break;
case INT16:
- asterixNewConstantValue = new AsterixConstantValue(new ADouble(
- (double) ((AInt16) sourceObject).getShortValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new ADouble(((AInt16) sourceObject).getShortValue()));
break;
case INT32:
- asterixNewConstantValue = new AsterixConstantValue(new ADouble(
- (double) (int) ((AInt32) sourceObject).getIntegerValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new ADouble(((AInt32) sourceObject).getIntegerValue()));
break;
case INT64:
- asterixNewConstantValue = new AsterixConstantValue(new ADouble(
- (double) ((AInt64) sourceObject).getLongValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new ADouble(((AInt64) sourceObject).getLongValue()));
break;
case FLOAT:
- asterixNewConstantValue = new AsterixConstantValue(new ADouble(
- (double) ((AFloat) sourceObject).getFloatValue()));
+ asterixNewConstantValue = new AsterixConstantValue(
+ new ADouble(((AFloat) sourceObject).getFloatValue()));
break;
default:
@@ -494,18 +496,18 @@ public class ATypeHierarchy {
case INT8:
return sourceObject;
case INT16:
- return new AInt16((short) ((AInt8) sourceObject).getByteValue());
+ return new AInt16(((AInt8) sourceObject).getByteValue());
case INT32:
- return new AInt32((int) ((AInt8) sourceObject).getByteValue());
+ return new AInt32(((AInt8) sourceObject).getByteValue());
case INT64:
return new AInt64((long) ((AInt8) sourceObject).getByteValue());
case FLOAT:
- return new AFloat((float) ((AInt8) sourceObject).getByteValue());
+ return new AFloat(((AInt8) sourceObject).getByteValue());
case DOUBLE:
- return new ADouble((double) ((AInt8) sourceObject).getByteValue());
+ return new ADouble(((AInt8) sourceObject).getByteValue());
default:
- throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
- + targetTypeTag + " type.");
+ throw new AsterixException(
+ "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
}
case INT16:
switch (targetTypeTag) {
@@ -515,37 +517,37 @@ public class ATypeHierarchy {
case INT16:
return sourceObject;
case INT32:
- return new AInt32((int) ((AInt16) sourceObject).getShortValue());
+ return new AInt32(((AInt16) sourceObject).getShortValue());
case INT64:
return new AInt64((long) ((AInt16) sourceObject).getShortValue());
case FLOAT:
- return new AFloat((float) ((AInt16) sourceObject).getShortValue());
+ return new AFloat(((AInt16) sourceObject).getShortValue());
case DOUBLE:
- return new ADouble((double) ((AInt16) sourceObject).getShortValue());
+ return new ADouble(((AInt16) sourceObject).getShortValue());
default:
- throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
- + targetTypeTag + " type.");
+ throw new AsterixException(
+ "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
}
case INT32:
switch (targetTypeTag) {
case INT8:
// an exception can happen because of a type demotion from INT32 to INT8
- return new AInt8((byte) ((AInt32) sourceObject).getIntegerValue().byteValue());
+ return new AInt8(((AInt32) sourceObject).getIntegerValue().byteValue());
case INT16:
// an exception can happen because of a type demotion from INT32 to INT16
- return new AInt16((short) ((AInt32) sourceObject).getIntegerValue().shortValue());
+ return new AInt16(((AInt32) sourceObject).getIntegerValue().shortValue());
case INT32:
return sourceObject;
case INT64:
return new AInt64((long) ((AInt32) sourceObject).getIntegerValue());
case FLOAT:
- return new AFloat((float) ((AInt32) sourceObject).getIntegerValue());
+ return new AFloat(((AInt32) sourceObject).getIntegerValue());
case DOUBLE:
- return new ADouble((double) ((AInt32) sourceObject).getIntegerValue());
+ return new ADouble(((AInt32) sourceObject).getIntegerValue());
default:
- throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
- + targetTypeTag + " type.");
+ throw new AsterixException(
+ "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
}
case INT64:
@@ -562,12 +564,12 @@ public class ATypeHierarchy {
case INT64:
return sourceObject;
case FLOAT:
- return new AFloat((float) ((AInt64) sourceObject).getLongValue());
+ return new AFloat(((AInt64) sourceObject).getLongValue());
case DOUBLE:
- return new ADouble((double) ((AInt64) sourceObject).getLongValue());
+ return new ADouble(((AInt64) sourceObject).getLongValue());
default:
- throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
- + targetTypeTag + " type.");
+ throw new AsterixException(
+ "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
}
case FLOAT:
switch (targetTypeTag) {
@@ -586,10 +588,10 @@ public class ATypeHierarchy {
case FLOAT:
return sourceObject;
case DOUBLE:
- return new ADouble((double) ((AFloat) sourceObject).getFloatValue());
+ return new ADouble(((AFloat) sourceObject).getFloatValue());
default:
- throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
- + targetTypeTag + " type.");
+ throw new AsterixException(
+ "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
}
case DOUBLE:
switch (targetTypeTag) {
@@ -611,8 +613,8 @@ public class ATypeHierarchy {
case DOUBLE:
return sourceObject;
default:
- throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
- + targetTypeTag + " type.");
+ throw new AsterixException(
+ "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
}
default:
throw new AsterixException("Source type is not a numeric type.");
@@ -636,7 +638,8 @@ public class ATypeHierarchy {
convertComputer = ATypeHierarchy.getTypeDemoteComputer(sourceTypeTag, targetTypeTag);;
convertComputer.convertType(sourceByteArray, s1 + 1, l1 - 1, out);
} else {
- throw new IOException("Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
+ throw new IOException(
+ "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
}
}
@@ -662,10 +665,10 @@ public class ATypeHierarchy {
value = IntegerPointable.getInteger(bytes, offset);
break;
case INT8:
- value = (int) bytes[offset];
+ value = bytes[offset];
break;
case INT16:
- value = (int) ShortPointable.getShort(bytes, offset);
+ value = ShortPointable.getShort(bytes, offset);
break;
case FLOAT:
value = (int) FloatPointable.getFloat(bytes, offset);
@@ -699,13 +702,13 @@ public class ATypeHierarchy {
value = LongPointable.getLong(bytes, offset);
break;
case INT32:
- value = (long) IntegerPointable.getInteger(bytes, offset);
+ value = IntegerPointable.getInteger(bytes, offset);
break;
case INT8:
- value = (long) bytes[offset];
+ value = bytes[offset];
break;
case INT16:
- value = (long) ShortPointable.getShort(bytes, offset);
+ value = ShortPointable.getShort(bytes, offset);
break;
case FLOAT:
value = (long) FloatPointable.getFloat(bytes, offset);
@@ -736,16 +739,16 @@ public class ATypeHierarchy {
switch (sourceTypeTag) {
case INT64:
- value = (float) LongPointable.getLong(bytes, offset);
+ value = LongPointable.getLong(bytes, offset);
break;
case INT32:
- value = (float) IntegerPointable.getInteger(bytes, offset);
+ value = IntegerPointable.getInteger(bytes, offset);
break;
case INT8:
- value = (float) bytes[offset];
+ value = bytes[offset];
break;
case INT16:
- value = (float) ShortPointable.getShort(bytes, offset);
+ value = ShortPointable.getShort(bytes, offset);
break;
case FLOAT:
value = FloatPointable.getFloat(bytes, offset);
@@ -776,19 +779,19 @@ public class ATypeHierarchy {
switch (sourceTypeTag) {
case INT64:
- value = (double) LongPointable.getLong(bytes, offset);
+ value = LongPointable.getLong(bytes, offset);
break;
case INT32:
- value = (double) IntegerPointable.getInteger(bytes, offset);
+ value = IntegerPointable.getInteger(bytes, offset);
break;
case INT8:
- value = (double) bytes[offset];
+ value = bytes[offset];
break;
case INT16:
- value = (double) ShortPointable.getShort(bytes, offset);
+ value = ShortPointable.getShort(bytes, offset);
break;
case FLOAT:
- value = (double) FloatPointable.getFloat(bytes, offset);
+ value = FloatPointable.getFloat(bytes, offset);
break;
case DOUBLE:
value = DoublePointable.getDouble(bytes, offset);
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
index b835988..aeb10a7 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
@@ -25,13 +25,14 @@ import org.apache.asterix.om.types.AOrderedListType;
import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
public class ListifyAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+ @Override
public IFunctionDescriptor createFunctionDescriptor() {
return new ListifyAggregateDescriptor();
}
@@ -49,7 +50,7 @@ public class ListifyAggregateDescriptor extends AbstractAggregateFunctionDynamic
}
@Override
- public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+ public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
throws AlgebricksException {
return new ListifyAggregateFunctionEvalFactory(args, oltype);
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
index a3f5df9..6a12423 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
@@ -18,40 +18,40 @@
*/
package org.apache.asterix.runtime.aggregates.collections;
-import java.io.DataOutput;
import java.io.IOException;
import org.apache.asterix.builders.OrderedListBuilder;
import org.apache.asterix.om.types.AOrderedListType;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public class ListifyAggregateFunctionEvalFactory implements ICopyAggregateFunctionFactory {
+public class ListifyAggregateFunctionEvalFactory implements IAggregateEvaluatorFactory {
private static final long serialVersionUID = 1L;
- private ICopyEvaluatorFactory[] args;
+ private IScalarEvaluatorFactory[] args;
private final AOrderedListType orderedlistType;
- public ListifyAggregateFunctionEvalFactory(ICopyEvaluatorFactory[] args, AOrderedListType type) {
+ public ListifyAggregateFunctionEvalFactory(IScalarEvaluatorFactory[] args, AOrderedListType type) {
this.args = args;
this.orderedlistType = type;
}
@Override
- public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
- throws AlgebricksException {
+ public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
- return new ICopyAggregateFunction() {
+ return new IAggregateEvaluator() {
- private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
- private DataOutput out = provider.getDataOutput();
+ private IPointable inputVal = new VoidPointable();
+ private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
+ private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
private OrderedListBuilder builder = new OrderedListBuilder();
@Override
@@ -62,8 +62,7 @@ public class ListifyAggregateFunctionEvalFactory implements ICopyAggregateFuncti
@Override
public void step(IFrameTupleReference tuple) throws AlgebricksException {
try {
- inputVal.reset();
- eval.evaluate(tuple);
+ eval.evaluate(tuple, inputVal);
builder.addItem(inputVal);
} catch (IOException e) {
throw new AlgebricksException(e);
@@ -71,17 +70,19 @@ public class ListifyAggregateFunctionEvalFactory implements ICopyAggregateFuncti
}
@Override
- public void finish() throws AlgebricksException {
+ public void finish(IPointable result) throws AlgebricksException {
+ resultStorage.reset();
try {
- builder.write(out, true);
+ builder.write(resultStorage.getDataOutput(), true);
} catch (IOException e) {
throw new AlgebricksException(e);
}
+ result.set(resultStorage);
}
@Override
- public void finishPartial() throws AlgebricksException {
- finish();
+ public void finishPartial(IPointable result) throws AlgebricksException {
+ finish(result);
}
};
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
index 55ed77b..eed79ac 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
@@ -27,39 +27,40 @@ import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicD
import org.apache.asterix.runtime.unnestingfunctions.std.ScanCollectionDescriptor.ScanCollectionUnnestingFunctionFactory;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
import org.apache.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
public abstract class AbstractScalarAggregateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
@Override
- public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+ public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+ throws AlgebricksException {
// The aggregate function will get a SingleFieldFrameTupleReference that points to the result of the ScanCollection.
// The list-item will always reside in the first field (column) of the SingleFieldFrameTupleReference.
- ICopyEvaluatorFactory[] aggFuncArgs = new ICopyEvaluatorFactory[1];
+ IScalarEvaluatorFactory[] aggFuncArgs = new IScalarEvaluatorFactory[1];
aggFuncArgs[0] = new ColumnAccessEvalFactory(0);
// Create aggregate function from this scalar version.
FunctionIdentifier fid = AsterixBuiltinFunctions.getAggregateFunction(getIdentifier());
IFunctionManager mgr = FunctionManagerHolder.getFunctionManager();
IFunctionDescriptor fd = mgr.lookupFunction(fid);
AbstractAggregateFunctionDynamicDescriptor aggFuncDesc = (AbstractAggregateFunctionDynamicDescriptor) fd;
- final ICopyAggregateFunctionFactory aggFuncFactory = aggFuncDesc.createAggregateFunctionFactory(aggFuncArgs);
+ final IAggregateEvaluatorFactory aggFuncFactory = aggFuncDesc.createAggregateEvaluatorFactory(aggFuncArgs);
- return new ICopyEvaluatorFactory() {
+ return new IScalarEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
// Use ScanCollection to iterate over list items.
ScanCollectionUnnestingFunctionFactory scanCollectionFactory = new ScanCollectionUnnestingFunctionFactory(
args[0]);
- return new GenericScalarAggregateFunction(aggFuncFactory.createAggregateFunction(output),
- scanCollectionFactory);
+ return new GenericScalarAggregateFunction(aggFuncFactory.createAggregateEvaluator(ctx),
+ scanCollectionFactory, ctx);
}
};
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
index 8ca3540..8e14473 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
@@ -20,41 +20,41 @@ package org.apache.asterix.runtime.aggregates.scalar;
import org.apache.asterix.runtime.aggregates.base.SingleFieldFrameTupleReference;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
/**
* Implements scalar aggregates by iterating over a collection with the ScanCollection unnesting function,
* and applying the corresponding ICopyAggregateFunction to each collection-item.
*/
-public class GenericScalarAggregateFunction implements ICopyEvaluator {
+public class GenericScalarAggregateFunction implements IScalarEvaluator {
- private final ArrayBackedValueStorage listItemOut = new ArrayBackedValueStorage();
- private final ICopyAggregateFunction aggFunc;
- private final ICopyUnnestingFunction scanCollection;
+ private final IPointable listItemOut = new VoidPointable();
+ private final IAggregateEvaluator aggFunc;
+ private final IUnnestingEvaluator scanCollection;
private final SingleFieldFrameTupleReference itemTuple = new SingleFieldFrameTupleReference();
- public GenericScalarAggregateFunction(ICopyAggregateFunction aggFunc,
- ICopyUnnestingFunctionFactory scanCollectionFactory) throws AlgebricksException {
+ public GenericScalarAggregateFunction(IAggregateEvaluator aggFunc, IUnnestingEvaluatorFactory scanCollectionFactory,
+ IHyracksTaskContext context) throws AlgebricksException {
this.aggFunc = aggFunc;
- this.scanCollection = scanCollectionFactory.createUnnestingFunction(listItemOut);
- listItemOut.reset();
+ this.scanCollection = scanCollectionFactory.createUnnestingEvaluator(context);
}
@Override
- public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
scanCollection.init(tuple);
aggFunc.init();
- while (scanCollection.step()) {
- itemTuple.reset(listItemOut.getByteArray(), 0, listItemOut.getLength());
+ while (scanCollection.step(listItemOut)) {
+ itemTuple.reset(listItemOut.getByteArray(), listItemOut.getStartOffset(), listItemOut.getLength());
aggFunc.step(itemTuple);
- listItemOut.reset();
}
- aggFunc.finish();
+ aggFunc.finish(result);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
index 24e6cb7..c3b9b47 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
@@ -46,15 +46,17 @@ import org.apache.asterix.runtime.evaluators.common.AccessibleByteArrayEval;
import org.apache.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory.ClosedRecordConstructorEval;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public abstract class AbstractSerializableAvgAggregateFunction implements ICopySerializableAggregateFunction {
+public abstract class AbstractSerializableAvgAggregateFunction implements ISerializedAggregateEvaluator {
private static final int SUM_FIELD_ID = 0;
private static final int COUNT_FIELD_ID = 1;
@@ -62,18 +64,18 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
private static final int COUNT_OFFSET = 8;
protected static final int AGG_TYPE_OFFSET = 16;
- private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private ICopyEvaluator eval;
+ private IPointable inputVal = new VoidPointable();
+ private IScalarEvaluator eval;
private AMutableDouble aDouble = new AMutableDouble(0);
private AMutableInt64 aInt64 = new AMutableInt64(0);
- private ArrayBackedValueStorage avgBytes = new ArrayBackedValueStorage();
+ private IPointable avgBytes = new VoidPointable();
private ByteArrayAccessibleOutputStream sumBytes = new ByteArrayAccessibleOutputStream();
private DataOutput sumBytesOutput = new DataOutputStream(sumBytes);
private ByteArrayAccessibleOutputStream countBytes = new ByteArrayAccessibleOutputStream();
private DataOutput countBytesOutput = new DataOutputStream(countBytes);
- private ICopyEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
- private ICopyEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
+ private IScalarEvaluator evalSum = new AccessibleByteArrayEval(sumBytes);
+ private IScalarEvaluator evalCount = new AccessibleByteArrayEval(countBytes);
private ClosedRecordConstructorEval recordEval;
@SuppressWarnings("unchecked")
@@ -86,8 +88,9 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
- public AbstractSerializableAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
- eval = args[0].createEvaluator(inputVal);
+ public AbstractSerializableAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+ throws AlgebricksException {
+ eval = args[0].createScalarEvaluator(context);
}
@Override
@@ -117,11 +120,13 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
if (skipStep(state, start)) {
return;
}
- inputVal.reset();
- eval.evaluate(tuple);
+ eval.evaluate(tuple, inputVal);
+ byte[] bytes = inputVal.getByteArray();
+ int offset = inputVal.getStartOffset();
+
double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
long count = BufferSerDeUtil.getLong(state, start + COUNT_OFFSET);
- ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+ ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
if (typeTag == ATypeTag.NULL) {
processNull(state, start);
@@ -137,32 +142,32 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
++count;
switch (typeTag) {
case INT8: {
- byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
+ byte val = AInt8SerializerDeserializer.getByte(bytes, offset + 1);
sum += val;
break;
}
case INT16: {
- short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
+ short val = AInt16SerializerDeserializer.getShort(bytes, offset + 1);
sum += val;
break;
}
case INT32: {
- int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
+ int val = AInt32SerializerDeserializer.getInt(bytes, offset + 1);
sum += val;
break;
}
case INT64: {
- long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
+ long val = AInt64SerializerDeserializer.getLong(bytes, offset + 1);
sum += val;
break;
}
case FLOAT: {
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(bytes, offset + 1);
sum += val;
break;
}
case DOUBLE: {
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1);
sum += val;
break;
}
@@ -170,7 +175,6 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
throw new NotImplementedException("Cannot compute AVG for values of type " + typeTag);
}
}
- inputVal.reset();
BufferSerDeUtil.writeDouble(sum, state, start + SUM_OFFSET);
BufferSerDeUtil.writeLong(count, state, start + COUNT_OFFSET);
state[start + AGG_TYPE_OFFSET] = aggType.serialize();
@@ -184,8 +188,7 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
if (recordEval == null) {
ARecordType recType = new ARecordType(null, new String[] { "sum", "count" },
new IAType[] { BuiltinType.ADOUBLE, BuiltinType.AINT64 }, false);
- recordEval = new ClosedRecordConstructorEval(recType, new ICopyEvaluator[] { evalSum, evalCount }, avgBytes,
- result);
+ recordEval = new ClosedRecordConstructorEval(recType, new IScalarEvaluator[] { evalSum, evalCount });
}
try {
@@ -203,7 +206,8 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
countBytes.reset();
aInt64.setValue(count);
longSerde.serialize(aInt64, countBytesOutput);
- recordEval.evaluate(null);
+ recordEval.evaluate(null, avgBytes);
+ result.write(avgBytes.getByteArray(), avgBytes.getStartOffset(), avgBytes.getLength());
}
} catch (IOException e) {
throw new AlgebricksException(e);
@@ -219,10 +223,11 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
long count = BufferSerDeUtil.getLong(state, start + COUNT_OFFSET);
ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
- inputVal.reset();
- eval.evaluate(tuple);
+ eval.evaluate(tuple, inputVal);
byte[] serBytes = inputVal.getByteArray();
- ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[0]);
+ int offset = inputVal.getStartOffset();
+
+ ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[offset]);
switch (typeTag) {
case NULL: {
processNull(state, start);
@@ -236,11 +241,11 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
// Expected.
aggType = ATypeTag.DOUBLE;
int nullBitmapSize = 0;
- int offset1 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, SUM_FIELD_ID, nullBitmapSize,
- false);
+ int offset1 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, offset, SUM_FIELD_ID,
+ nullBitmapSize, false);
sum += ADoubleSerializerDeserializer.getDouble(serBytes, offset1);
- int offset2 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, COUNT_FIELD_ID, nullBitmapSize,
- false);
+ int offset2 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, offset, COUNT_FIELD_ID,
+ nullBitmapSize, false);
count += AInt64SerializerDeserializer.getLong(serBytes, offset2);
BufferSerDeUtil.writeDouble(sum, state, start + SUM_OFFSET);
@@ -250,7 +255,7 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
}
default: {
throw new AlgebricksException("Global-Avg is not defined for values of type "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[0]));
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[offset]));
}
}
}
@@ -259,11 +264,10 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ICopyS
double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
long count = BufferSerDeUtil.getLong(state, start + COUNT_OFFSET);
ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
-
try {
- if (count == 0 || aggType == ATypeTag.NULL)
+ if (count == 0 || aggType == ATypeTag.NULL) {
nullSerde.serialize(ANull.NULL, result);
- else {
+ } else {
aDouble.setValue(sum / count);
doubleSerde.serialize(aDouble, result);
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
index aa67d0c..6270e78 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
@@ -29,17 +29,19 @@ import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.om.types.EnumDeserializer;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
/**
* count(NULL) returns NULL.
*/
-public abstract class AbstractSerializableCountAggregateFunction implements ICopySerializableAggregateFunction {
+public abstract class AbstractSerializableCountAggregateFunction implements ISerializedAggregateEvaluator {
private static final int MET_NULL_OFFSET = 0;
private static final int COUNT_OFFSET = 1;
@@ -50,11 +52,12 @@ public abstract class AbstractSerializableCountAggregateFunction implements ICop
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
- private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private ICopyEvaluator eval;
+ private IPointable inputVal = new VoidPointable();
+ private IScalarEvaluator eval;
- public AbstractSerializableCountAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
- eval = args[0].createEvaluator(inputVal);
+ public AbstractSerializableCountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+ throws AlgebricksException {
+ eval = args[0].createScalarEvaluator(context);
}
@Override
@@ -71,9 +74,9 @@ public abstract class AbstractSerializableCountAggregateFunction implements ICop
public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws AlgebricksException {
boolean metNull = BufferSerDeUtil.getBoolean(state, start);
long cnt = BufferSerDeUtil.getLong(state, start + 1);
- inputVal.reset();
- eval.evaluate(tuple);
- ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+ eval.evaluate(tuple, inputVal);
+ ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+ .deserialize(inputVal.getByteArray()[inputVal.getStartOffset()]);
if (typeTag == ATypeTag.NULL) {
processNull(state, start);
} else {
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
index 5e6ca46..03eb2d3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
@@ -41,19 +41,21 @@ import org.apache.asterix.om.types.EnumDeserializer;
import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-public abstract class AbstractSerializableSumAggregateFunction implements ICopySerializableAggregateFunction {
+public abstract class AbstractSerializableSumAggregateFunction implements ISerializedAggregateEvaluator {
protected static final int AGG_TYPE_OFFSET = 0;
private static final int SUM_OFFSET = 1;
- private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
- private ICopyEvaluator eval;
+ private IPointable inputVal = new VoidPointable();
+ private IScalarEvaluator eval;
private AMutableDouble aDouble = new AMutableDouble(0);
private AMutableFloat aFloat = new AMutableFloat(0);
private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -63,8 +65,9 @@ public abstract class AbstractSerializableSumAggregateFunction implements ICopyS
@SuppressWarnings("rawtypes")
public ISerializerDeserializer serde;
- public AbstractSerializableSumAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
- eval = args[0].createEvaluator(inputVal);
+ public AbstractSerializableSumAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+ throws AlgebricksException {
+ eval = args[0].createScalarEvaluator(context);
}
@Override
@@ -84,9 +87,11 @@ public abstract class AbstractSerializableSumAggregateFunction implements ICopyS
}
ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
- inputVal.reset();
- eval.evaluate(tuple);
- ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+ eval.evaluate(tuple, inputVal);
+ byte[] bytes = inputVal.getByteArray();
+ int offset = inputVal.getStartOffset();
+
+ ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
if (typeTag == ATypeTag.NULL) {
processNull(state, start);
return;
@@ -103,32 +108,32 @@ public abstract class AbstractSerializableSumAggregateFunction implements ICopyS
switch (typeTag) {
case INT8: {
- byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
+ byte val = AInt8SerializerDeserializer.getByte(bytes, offset + 1);
sum += val;
break;
}
case INT16: {
- short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
+ short val = AInt16SerializerDeserializer.getShort(bytes, offset + 1);
sum += val;
break;
}
case INT32: {
- int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
+ int val = AInt32SerializerDeserializer.getInt(bytes, offset + 1);
sum += val;
break;
}
case INT64: {
- long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
+ long val = AInt64SerializerDeserializer.getLong(bytes, offset + 1);
sum += val;
break;
}
case FLOAT: {
- float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
+ float val = AFloatSerializerDeserializer.getFloat(bytes, offset + 1);
sum += val;
break;
}
case DOUBLE: {
- double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
+ double val = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1);
sum += val;
break;
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
index 0459b7b..b05ff19 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
@@ -24,14 +24,16 @@ import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
public class SerializableAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+ @Override
public IFunctionDescriptor createFunctionDescriptor() {
return new SerializableAvgAggregateDescriptor();
}
@@ -43,14 +45,15 @@ public class SerializableAvgAggregateDescriptor extends AbstractSerializableAggr
}
@Override
- public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
- final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new ICopySerializableAggregateFunctionFactory() {
+ public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+ final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+ return new ISerializedAggregateEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
- return new SerializableAvgAggregateFunction(args);
+ public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+ throws AlgebricksException {
+ return new SerializableAvgAggregateFunction(args, ctx);
}
};
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
index 9773272..d8c7fe2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
@@ -23,13 +23,15 @@ import java.io.DataOutput;
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.EnumDeserializer;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
public class SerializableAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
- public SerializableAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
- super(args);
+ public SerializableAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+ throws AlgebricksException {
+ super(args, context);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
index 484ca9c..d60fb7f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
@@ -24,9 +24,10 @@ import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
/**
* count(NULL) returns NULL.
@@ -35,6 +36,7 @@ public class SerializableCountAggregateDescriptor extends AbstractSerializableAg
private static final long serialVersionUID = 1L;
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+ @Override
public IFunctionDescriptor createFunctionDescriptor() {
return new SerializableCountAggregateDescriptor();
}
@@ -46,14 +48,15 @@ public class SerializableCountAggregateDescriptor extends AbstractSerializableAg
}
@Override
- public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
- final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new ICopySerializableAggregateFunctionFactory() {
+ public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+ final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+ return new ISerializedAggregateEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
- return new SerializableCountAggregateFunction(args);
+ public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+ throws AlgebricksException {
+ return new SerializableCountAggregateFunction(args, ctx);
}
};
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
index 37afd58..2f6cadf 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
@@ -19,13 +19,15 @@
package org.apache.asterix.runtime.aggregates.serializable.std;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
/**
* count(NULL) returns NULL.
*/
public class SerializableCountAggregateFunction extends AbstractSerializableCountAggregateFunction {
- public SerializableCountAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
- super(args);
+ public SerializableCountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+ throws AlgebricksException {
+ super(args, context);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
index c98fe64..6f11b66 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
@@ -25,14 +25,16 @@ import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
public class SerializableGlobalAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+ @Override
public IFunctionDescriptor createFunctionDescriptor() {
return new SerializableGlobalAvgAggregateDescriptor();
}
@@ -44,14 +46,15 @@ public class SerializableGlobalAvgAggregateDescriptor extends AbstractSerializab
}
@Override
- public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
- final ICopyEvaluatorFactory[] args) throws AlgebricksException {
- return new ICopySerializableAggregateFunctionFactory() {
+ public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+ final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+ return new ISerializedAggregateEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
- public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
- return new SerializableGlobalAvgAggregateFunction(args);
+ public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+ throws AlgebricksException {
+ return new SerializableGlobalAvgAggregateFunction(args, ctx);
}
};
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
index 3a1298c..83a856c 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
@@ -24,13 +24,15 @@ import java.io.DataOutput;
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.EnumDeserializer;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
public class SerializableGlobalAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
- public SerializableGlobalAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
- super(args);
+ public SerializableGlobalAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+ throws AlgebricksException {
+ super(args, context);
}
@Override