Search in sources :

Example 16 with NotImplementedException

use of org.apache.hyracks.algebricks.common.exceptions.NotImplementedException in project asterixdb by apache.

the class RangeMapBuilder method parseLiteralToBytes.

@SuppressWarnings("unchecked")
private static void parseLiteralToBytes(Expression item, DataOutput out) throws CompilationException {
    AMutableDouble aDouble = new AMutableDouble(0);
    AMutableFloat aFloat = new AMutableFloat(0);
    AMutableInt64 aInt64 = new AMutableInt64(0);
    AMutableInt32 aInt32 = new AMutableInt32(0);
    AMutableString aString = new AMutableString("");
    @SuppressWarnings("rawtypes") ISerializerDeserializer serde;
    Literal l = ((LiteralExpr) item).getValue();
    try {
        switch(l.getLiteralType()) {
            case DOUBLE:
                DoubleLiteral dl = (DoubleLiteral) l;
                serde = SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADOUBLE);
                aDouble.setValue(dl.getValue());
                serde.serialize(aDouble, out);
                break;
            case FLOAT:
                FloatLiteral fl = (FloatLiteral) l;
                serde = SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AFLOAT);
                aFloat.setValue(fl.getValue());
                serde.serialize(aFloat, out);
                break;
            case INTEGER:
                IntegerLiteral il = (IntegerLiteral) l;
                serde = SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT32);
                aInt32.setValue(il.getValue());
                serde.serialize(aInt32, out);
                break;
            case LONG:
                LongIntegerLiteral lil = (LongIntegerLiteral) l;
                serde = SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT64);
                aInt64.setValue(lil.getValue());
                serde.serialize(aInt64, out);
                break;
            case STRING:
                StringLiteral sl = (StringLiteral) l;
                serde = SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ASTRING);
                aString.setValue(sl.getValue());
                serde.serialize(aString, out);
                break;
            default:
                throw new NotImplementedException("The range map builder has not been implemented for " + item.getKind() + " type of expressions.");
        }
    } catch (HyracksDataException e) {
        throw new CompilationException(e.getMessage());
    }
}
Also used : CompilationException(org.apache.asterix.common.exceptions.CompilationException) FloatLiteral(org.apache.asterix.lang.common.literal.FloatLiteral) NotImplementedException(org.apache.hyracks.algebricks.common.exceptions.NotImplementedException) AMutableString(org.apache.asterix.om.base.AMutableString) ISerializerDeserializer(org.apache.hyracks.api.dataflow.value.ISerializerDeserializer) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) StringLiteral(org.apache.asterix.lang.common.literal.StringLiteral) LongIntegerLiteral(org.apache.asterix.lang.common.literal.LongIntegerLiteral) AMutableDouble(org.apache.asterix.om.base.AMutableDouble) Literal(org.apache.asterix.lang.common.base.Literal) StringLiteral(org.apache.asterix.lang.common.literal.StringLiteral) IntegerLiteral(org.apache.asterix.lang.common.literal.IntegerLiteral) FloatLiteral(org.apache.asterix.lang.common.literal.FloatLiteral) DoubleLiteral(org.apache.asterix.lang.common.literal.DoubleLiteral) LongIntegerLiteral(org.apache.asterix.lang.common.literal.LongIntegerLiteral) LiteralExpr(org.apache.asterix.lang.common.expression.LiteralExpr) DoubleLiteral(org.apache.asterix.lang.common.literal.DoubleLiteral) AMutableInt64(org.apache.asterix.om.base.AMutableInt64) AMutableInt32(org.apache.asterix.om.base.AMutableInt32) AMutableFloat(org.apache.asterix.om.base.AMutableFloat) IntegerLiteral(org.apache.asterix.lang.common.literal.IntegerLiteral) LongIntegerLiteral(org.apache.asterix.lang.common.literal.LongIntegerLiteral)

Example 17 with NotImplementedException

use of org.apache.hyracks.algebricks.common.exceptions.NotImplementedException in project asterixdb by apache.

the class AObjectSerializerDeserializer method serialize.

@Override
public void serialize(IAObject instance, DataOutput out) throws HyracksDataException {
    IAType t = instance.getType();
    ATypeTag tag = t.getTypeTag();
    try {
        out.writeByte(tag.serialize());
    } catch (IOException e) {
        throw new HyracksDataException(e);
    }
    switch(tag) {
        case MISSING:
            AMissingSerializerDeserializer.INSTANCE.serialize((AMissing) instance, out);
            break;
        case NULL:
            ANullSerializerDeserializer.INSTANCE.serialize(instance, out);
            break;
        case BOOLEAN:
            ABooleanSerializerDeserializer.INSTANCE.serialize((ABoolean) instance, out);
            break;
        case TINYINT:
            AInt8SerializerDeserializer.INSTANCE.serialize((AInt8) instance, out);
            break;
        case SMALLINT:
            AInt16SerializerDeserializer.INSTANCE.serialize((AInt16) instance, out);
            break;
        case INTEGER:
            AInt32SerializerDeserializer.INSTANCE.serialize((AInt32) instance, out);
            break;
        case BIGINT:
            AInt64SerializerDeserializer.INSTANCE.serialize((AInt64) instance, out);
            break;
        case FLOAT:
            AFloatSerializerDeserializer.INSTANCE.serialize((AFloat) instance, out);
            break;
        case DOUBLE:
            ADoubleSerializerDeserializer.INSTANCE.serialize((ADouble) instance, out);
            break;
        case STRING:
            AStringSerializerDeserializer.INSTANCE.serialize((AString) instance, out);
            break;
        case BINARY:
            ABinarySerializerDeserializer.INSTANCE.serialize((ABinary) instance, out);
            break;
        case DATE:
            ADateSerializerDeserializer.INSTANCE.serialize((ADate) instance, out);
            break;
        case TIME:
            ATimeSerializerDeserializer.INSTANCE.serialize((ATime) instance, out);
            break;
        case DATETIME:
            ADateTimeSerializerDeserializer.INSTANCE.serialize((ADateTime) instance, out);
            break;
        case DURATION:
            ADurationSerializerDeserializer.INSTANCE.serialize((ADuration) instance, out);
            break;
        case INTERVAL:
            AIntervalSerializerDeserializer.INSTANCE.serialize((AInterval) instance, out);
            break;
        case POINT:
            APointSerializerDeserializer.INSTANCE.serialize((APoint) instance, out);
            break;
        case POINT3D:
            APoint3DSerializerDeserializer.INSTANCE.serialize((APoint3D) instance, out);
            break;
        case LINE:
            ALineSerializerDeserializer.INSTANCE.serialize((ALine) instance, out);
            break;
        case RECTANGLE:
            ARectangleSerializerDeserializer.INSTANCE.serialize((ARectangle) instance, out);
            break;
        case POLYGON:
            APolygonSerializerDeserializer.INSTANCE.serialize((APolygon) instance, out);
            break;
        case CIRCLE:
            ACircleSerializerDeserializer.INSTANCE.serialize((ACircle) instance, out);
            break;
        case OBJECT:
            ARecordSerializerDeserializer.SCHEMALESS_INSTANCE.serialize((ARecord) instance, out);
            break;
        case ARRAY:
            AOrderedListSerializerDeserializer.SCHEMALESS_INSTANCE.serialize((AOrderedList) instance, out);
            break;
        case MULTISET:
            AUnorderedListSerializerDeserializer.SCHEMALESS_INSTANCE.serialize((AUnorderedList) instance, out);
            break;
        case TYPE:
            ATypeSerializerDeserializer.INSTANCE.serialize((IAType) instance, out);
            break;
        default:
            throw new NotImplementedException("No serializer/deserializer implemented for type " + t.getTypeTag() + " .");
    }
}
Also used : ATypeTag(org.apache.asterix.om.types.ATypeTag) NotImplementedException(org.apache.hyracks.algebricks.common.exceptions.NotImplementedException) IOException(java.io.IOException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) IAType(org.apache.asterix.om.types.IAType)

Example 18 with NotImplementedException

use of org.apache.hyracks.algebricks.common.exceptions.NotImplementedException in project asterixdb by apache.

the class JoinMultiComparator method generateOptimizedHashJoinRuntime.

private IOperatorDescriptor generateOptimizedHashJoinRuntime(JobGenContext context, IOperatorSchema[] inputSchemas, int[] keysLeft, int[] keysRight, IBinaryHashFunctionFamily[] hashFunFamilies, IBinaryComparatorFactory[] comparatorFactories, IPredicateEvaluatorFactory predEvaluatorFactory, RecordDescriptor recDescriptor, IOperatorDescriptorRegistry spec) throws AlgebricksException {
    IOperatorDescriptor opDesc;
    try {
        switch(kind) {
            case INNER:
                opDesc = new OptimizedHybridHashJoinOperatorDescriptor(spec, getMemSizeInFrames(), maxInputBuildSizeInFrames, getFudgeFactor(), keysLeft, keysRight, hashFunFamilies, comparatorFactories, recDescriptor, new JoinMultiComparatorFactory(comparatorFactories, keysLeft, keysRight), new JoinMultiComparatorFactory(comparatorFactories, keysRight, keysLeft), predEvaluatorFactory);
                break;
            case LEFT_OUTER:
                IMissingWriterFactory[] nonMatchWriterFactories = new IMissingWriterFactory[inputSchemas[1].getSize()];
                for (int j = 0; j < nonMatchWriterFactories.length; j++) {
                    nonMatchWriterFactories[j] = context.getMissingWriterFactory();
                }
                opDesc = new OptimizedHybridHashJoinOperatorDescriptor(spec, getMemSizeInFrames(), maxInputBuildSizeInFrames, getFudgeFactor(), keysLeft, keysRight, hashFunFamilies, comparatorFactories, recDescriptor, new JoinMultiComparatorFactory(comparatorFactories, keysLeft, keysRight), new JoinMultiComparatorFactory(comparatorFactories, keysRight, keysLeft), predEvaluatorFactory, true, nonMatchWriterFactories);
                break;
            default:
                throw new NotImplementedException();
        }
    } catch (HyracksDataException e) {
        throw new AlgebricksException(e);
    }
    return opDesc;
}
Also used : OptimizedHybridHashJoinOperatorDescriptor(org.apache.hyracks.dataflow.std.join.OptimizedHybridHashJoinOperatorDescriptor) IOperatorDescriptor(org.apache.hyracks.api.dataflow.IOperatorDescriptor) IMissingWriterFactory(org.apache.hyracks.api.dataflow.value.IMissingWriterFactory) NotImplementedException(org.apache.hyracks.algebricks.common.exceptions.NotImplementedException) AlgebricksException(org.apache.hyracks.algebricks.common.exceptions.AlgebricksException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 19 with NotImplementedException

use of org.apache.hyracks.algebricks.common.exceptions.NotImplementedException in project asterixdb by apache.

the class DistributeResultPOperator method contributeRuntimeOperator.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException {
    DistributeResultOperator resultOp = (DistributeResultOperator) op;
    IMetadataProvider mp = context.getMetadataProvider();
    JobSpecification spec = builder.getJobSpec();
    int[] columns = new int[resultOp.getExpressions().size()];
    int i = 0;
    for (Mutable<ILogicalExpression> exprRef : resultOp.getExpressions()) {
        ILogicalExpression expr = exprRef.getValue();
        if (expr.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
            throw new NotImplementedException("Only writing variable expressions is supported.");
        }
        VariableReferenceExpression varRef = (VariableReferenceExpression) expr;
        LogicalVariable v = varRef.getVariableReference();
        columns[i++] = inputSchemas[0].findVariable(v);
    }
    RecordDescriptor inputDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas[0], context);
    IPrinterFactory[] pf = JobGenHelper.mkPrinterFactories(inputSchemas[0], context.getTypeEnvironment(op), context, columns);
    Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> runtimeAndConstraints = mp.getResultHandleRuntime(resultOp.getDataSink(), columns, pf, inputDesc, true, spec);
    builder.contributeHyracksOperator(resultOp, runtimeAndConstraints.first);
    ILogicalOperator src = resultOp.getInputs().get(0).getValue();
    builder.contributeGraphEdge(src, 0, resultOp, 0);
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) RecordDescriptor(org.apache.hyracks.api.dataflow.value.RecordDescriptor) NotImplementedException(org.apache.hyracks.algebricks.common.exceptions.NotImplementedException) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) IMetadataProvider(org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint) DistributeResultOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.DistributeResultOperator) ILogicalExpression(org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression) IPrinterFactory(org.apache.hyracks.algebricks.data.IPrinterFactory) VariableReferenceExpression(org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression) IOperatorDescriptor(org.apache.hyracks.api.dataflow.IOperatorDescriptor) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint) JobSpecification(org.apache.hyracks.api.job.JobSpecification)

Example 20 with NotImplementedException

use of org.apache.hyracks.algebricks.common.exceptions.NotImplementedException in project asterixdb by apache.

the class NestedLoopJoinPOperator method computeDeliveredProperties.

@Override
public void computeDeliveredProperties(ILogicalOperator iop, IOptimizationContext context) {
    if (partitioningType != JoinPartitioningType.BROADCAST) {
        throw new NotImplementedException(partitioningType + " nested loop joins are not implemented.");
    }
    IPartitioningProperty pp;
    AbstractLogicalOperator op = (AbstractLogicalOperator) iop;
    if (op.getExecutionMode() == AbstractLogicalOperator.ExecutionMode.PARTITIONED) {
        AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(1).getValue();
        IPhysicalPropertiesVector pv1 = op2.getPhysicalOperator().getDeliveredProperties();
        if (pv1 == null) {
            pp = null;
        } else {
            pp = pv1.getPartitioningProperty();
        }
    } else {
        pp = IPartitioningProperty.UNPARTITIONED;
    }
    // Nested loop join cannot maintain the local structure property for the probe side
    // because of the I/O optimization for the build branch.
    this.deliveredProperties = new StructuralPropertiesVector(pp, null);
}
Also used : StructuralPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector) AbstractLogicalOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator) NotImplementedException(org.apache.hyracks.algebricks.common.exceptions.NotImplementedException) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) IPartitioningProperty(org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty)

Aggregations

NotImplementedException (org.apache.hyracks.algebricks.common.exceptions.NotImplementedException)22 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)9 AlgebricksException (org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)7 ILogicalExpression (org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression)6 LogicalVariable (org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable)6 IOperatorDescriptor (org.apache.hyracks.api.dataflow.IOperatorDescriptor)6 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)6 ATypeTag (org.apache.asterix.om.types.ATypeTag)5 IOException (java.io.IOException)4 List (java.util.List)4 Map (java.util.Map)4 IAType (org.apache.asterix.om.types.IAType)4 RecordDescriptor (org.apache.hyracks.api.dataflow.value.RecordDescriptor)4 ArrayList (java.util.ArrayList)3 AUnionType (org.apache.asterix.om.types.AUnionType)3 DataOutput (java.io.DataOutput)2 AsterixException (org.apache.asterix.common.exceptions.AsterixException)2 TypeMismatchException (org.apache.asterix.runtime.exceptions.TypeMismatchException)2 AlgebricksPartitionConstraint (org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint)2 Pair (org.apache.hyracks.algebricks.common.utils.Pair)2