Examples of VoidPointable


Examples of edu.uci.ics.hyracks.data.std.primitive.VoidPointable

        final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
        final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
        final AbstractValueComparisonOperation aOp = createValueComparisonOperation();
        final TaggedValuePointable tvpReturn = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        final TaggedValuePointable tvpNext = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        final VoidPointable p = (VoidPointable) VoidPointable.FACTORY.createPointable();
        final TypedPointables tp1 = new TypedPointables();
        final TypedPointables tp2 = new TypedPointables();

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                // TODO Update the results to be based on specs when different types in sequence.
                TaggedValuePointable tvp = args[0];
                if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
                    tvp.getValue(seqp);
                    int seqLen = seqp.getEntryCount();
                    if (seqLen == 0) {
                        XDMConstants.setEmptySequence(result);
                    } else {
                        for (int j = 0; j < seqLen; ++j) {
                            seqp.getEntry(j, p);
                            tvpNext.set(p.getByteArray(), p.getStartOffset(), p.getLength());
                            if (j == 0) {
                                // Init.
                                tvpReturn.set(tvpNext);
                            }
                            if (FunctionHelper.transformThenCompareMinMaxTaggedValues(aOp, tvpNext, tvpReturn, dCtx, tp1, tp2)) {
View Full Code Here

Examples of edu.uci.ics.hyracks.data.std.primitive.VoidPointable

        final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
        final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
        final DataOutput dOut = abvs.getDataOutput();
        final TaggedValuePointable tvpNext = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        final TaggedValuePointable tvpSum = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        final VoidPointable p = (VoidPointable) VoidPointable.FACTORY.createPointable();
        final AddOperation aOp = new AddOperation();
        final TypedPointables tp1 = new TypedPointables();
        final TypedPointables tp2 = new TypedPointables();

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                TaggedValuePointable tvp = args[0];
                if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
                    tvp.getValue(seqp);
                    int seqLen = seqp.getEntryCount();
                    if (seqLen == 0) {
                        // Default zero value as second argument.
                        if (args.length == 2) {
                            TaggedValuePointable tvp2 = args[1];
                            result.set(tvp2);
                        } else {
                            // No argument return an integer.
                            try {
                                abvs.reset();
                                dOut.write(ValueTag.XS_INTEGER_TAG);
                                dOut.writeLong(0);
                                result.set(abvs);
                            } catch (Exception e) {
                                throw new SystemException(ErrorCode.SYSE0001, e);
                            }
                        }
                    } else {
                        // Add up the sequence.
                        for (int j = 0; j < seqLen; ++j) {
                            seqp.getEntry(j, p);
                            tvpNext.set(p.getByteArray(), p.getStartOffset(), p.getLength());
                            if (j == 0) {
                                // Init.
                                tvpSum.set(tvpNext);
                            } else {
                                FunctionHelper.arithmeticOperation(aOp, dCtx, tvpNext, tvpSum, tvpSum, tp1, tp2);
View Full Code Here

Examples of edu.uci.ics.hyracks.data.std.primitive.VoidPointable

    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws AlgebricksException {
        final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
        final GrowableIntArray slots = new GrowableIntArray();
        final ArrayBackedValueStorage dataArea = new ArrayBackedValueStorage();
        final SequencePointable seq = (SequencePointable) SequencePointable.FACTORY.createPointable();
        final VoidPointable p = (VoidPointable) VoidPointable.FACTORY.createPointable();
        return new AbstractTaggedValueArgumentAggregateEvaluator(args) {
            @Override
            public void init() throws AlgebricksException {
                abvs.reset();
                slots.clear();
                dataArea.reset();
            }

            @Override
            public void finishPartial(IPointable result) throws AlgebricksException {
                finish(result);
            }

            @Override
            public void finish(IPointable result) throws AlgebricksException {
                if (slots.getSize() != 1) {
                    try {
                        assembleResult(abvs, slots, dataArea);
                    } catch (SystemException e) {
                        throw new AlgebricksException(e);
                    }
                    result.set(abvs);
                } else {
                    result.set(dataArea);
                }
            }

            @Override
            protected void step(TaggedValuePointable[] args) throws SystemException {
                TaggedValuePointable tvp = args[0];
                if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
                    tvp.getValue(seq);
                    int seqLen = seq.getEntryCount();
                    for (int j = 0; j < seqLen; ++j) {
                        seq.getEntry(j, p);
                        addItem(p);
                    }
                } else {
                    addItem(tvp);
                }
            }

            private void assembleResult(ArrayBackedValueStorage abvs, GrowableIntArray slots,
                    ArrayBackedValueStorage dataArea) throws SystemException {
                try {
                    DataOutput out = abvs.getDataOutput();
                    out.write(ValueTag.SEQUENCE_TAG);
                    int size = slots.getSize();
                    out.writeInt(size);
                    if (size > 0) {
                        int[] slotArray = slots.getArray();
                        for (int i = 0; i < size; ++i) {
                            out.writeInt(slotArray[i]);
                        }
                        out.write(dataArea.getByteArray(), dataArea.getStartOffset(), dataArea.getLength());
                    }
                } catch (IOException e) {
                    throw new SystemException(ErrorCode.SYSE0001, e);
                }
            }

            private void addItem(final IPointable p) throws SystemException {
                try {
                    dataArea.getDataOutput().write(p.getByteArray(), p.getStartOffset(), p.getLength());
                    slots.append(dataArea.getLength());
                } catch (IOException e) {
                    throw new SystemException(ErrorCode.SYSE0001, e);
                }
            }
View Full Code Here

Examples of edu.uci.ics.hyracks.data.std.primitive.VoidPointable

        final SequencePointable seq = new SequencePointable();
        final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
        final AbstractValueComparisonOperation aOp = new ValueEqComparisonOperation();
        final TaggedValuePointable tvpDistinct = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        final TaggedValuePointable tvpCheck = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        final VoidPointable p = (VoidPointable) VoidPointable.FACTORY.createPointable();
        final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
        final TypedPointables tp1 = new TypedPointables();
        final TypedPointables tp2 = new TypedPointables();

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                try {
                    abvs.reset();
                    sb.reset(abvs);
                    TaggedValuePointable tvp1 = args[0];
                    // Second  parameter is optional.
                    if (args.length > 1) {
                        TaggedValuePointable tvp2 = args[1];
                        if (tvp2.getTag() != ValueTag.XS_STRING_TAG) {
                            throw new SystemException(ErrorCode.FORG0006);
                        }
                        tvp2.getValue(stringp);
                    }
                    // TODO use the third value as collation

                    if (tvp1.getTag() == ValueTag.SEQUENCE_TAG) {
                        tvp1.getValue(seq);
                        int seqLen = seq.getEntryCount();

                        // Add remaining distinct item.
                        boolean found = false;
                        for (int j = 0; j < seqLen; ++j) {
                            seq.getEntry(j, p);
                            tvpDistinct.set(p.getByteArray(), p.getStartOffset(), p.getLength());

                            // Check if item is distinct.
                            if (j + 1 < seqLen) {
                                for (int k = j + 1; k < seqLen; ++k) {
                                    seq.getEntry(k, p);
                                    tvpCheck.set(p.getByteArray(), p.getStartOffset(), p.getLength());
                                    if (FunctionHelper.compareTaggedValues(aOp, tvpDistinct, tvpCheck, dCtx, tp1, tp2)) {
                                        found = true;
                                        break;
                                    }
                                }
View Full Code Here

Examples of edu.uci.ics.hyracks.data.std.primitive.VoidPointable

        final SequenceBuilder sb = new SequenceBuilder();
        final SequencePointable seq = (SequencePointable) SequencePointable.FACTORY.createPointable();
        final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
        final AbstractValueComparisonOperation aOp = new ValueEqComparisonOperation();
        final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        final VoidPointable p = (VoidPointable) VoidPointable.FACTORY.createPointable();
        final TypedPointables tp1 = new TypedPointables();
        final TypedPointables tp2 = new TypedPointables();

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                try {
                    abvs.reset();
                    sb.reset(abvs);
                    TaggedValuePointable tvp1 = args[0];
                    TaggedValuePointable tvp2 = args[1];

                    if (tvp1.getTag() == ValueTag.SEQUENCE_TAG) {
                        tvp1.getValue(seq);
                        int seqLen = seq.getEntryCount();
                        for (int j = 0; j < seqLen; ++j) {
                            seq.getEntry(j, p);
                            tvp.set(p.getByteArray(), p.getStartOffset(), p.getLength());
                            if (FunctionHelper.compareTaggedValues(aOp, tvp, tvp2, dCtx, tp1, tp2)) {
                                abvsInner.reset();
                                dOutInner.write(ValueTag.XS_INTEGER_TAG);
                                dOutInner.writeLong(j + 1);
                                sb.addItem(abvsInner);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.