Package com.foundationdb.server.types.value

Examples of com.foundationdb.server.types.value.ValueSource


            public TInstance resultInstance(List<TPreptimeValue> inputs, TPreptimeContext context)
            {
                int strLength = inputs.get(0).type().attribute(StringAttribute.MAX_LENGTH);
                // usage: SUBSTR (<STRING> , <OFFSET> [, <LENGTH>] )
                int length = strLength;
                ValueSource lenArg;
                // check if <LENGTH> is available
                if (inputs.size() == 3 && (lenArg = inputs.get(2).value()) != null
                                       && !lenArg.isNull()) {
                    length = lenArg.getInt32();
                }
                return strType.instance(length > strLength ? strLength : length, anyContaminatingNulls(inputs));
            }
        });
    }
View Full Code Here


        return TOverloadResult.custom(new TCustomOverloadResult()
        {
            @Override
            public TInstance resultInstance(List<TPreptimeValue> inputs, TPreptimeContext context)
            {
                ValueSource length = inputs.get(0).value();
                if((length == null) || (length.isNull())) {
                    return stringType.instance(0, true);
                } else {
                    return stringType.instance(length.getInt32(), false);
                }
            }
        });
    }
View Full Code Here

    private final int fieldIndex;
   
    private static class Evaluation extends ContextualEvaluation<Row> {
        @Override
        protected void evaluate(Row context, ValueTarget target) {
            ValueSource rowSource = context.value(fieldIndex);
            ValueTargets.copyFrom(rowSource, target);
        }
View Full Code Here

        Space space = groupIndex.space();
        int firstSpatialColumn = groupIndex.firstSpatialArgument();
        boolean zNull = false;
        for(int d = 0; d < Spatial.LAT_LON_DIMENSIONS; d++) {
            if(!zNull) {
                ValueSource columnValue = row.value(irc.getFieldPosition(firstSpatialColumn + d));
                if (columnValue.isNull()) {
                    zNull = true;
                } else {
                    coords[d] = ((BigDecimalWrapper)columnValue.getObject()).asBigDecimal();
                }
            }
        }
        if (zNull) {
            zSource_t3.putNull();
View Full Code Here

        }

        @Override
        public void evaluate() {
            inputEval.evaluate();
            ValueSource inputVal = inputEval.resultValue();
            cast.evaluate(executionContext, inputVal, value);
        }
View Full Code Here

        @Override
        public void evaluate() {
            if (!value.hasAnyValue()) { // only need to compute this once
                TClass tClass = type.typeClass();
                ValueSource inSource = bindings.getValue(position);
                // TODO need a better execution context thinger
                TExecutionContext executionContext = new TExecutionContext(
                        null,
                        null,
                        type,
View Full Code Here

        }

        @Override
        protected void doEvaluate(TExecutionContext context, LazyList<? extends ValueSource> inputs, ValueTarget output) {
            TInstance lhsInstance = context.inputTypeAt(0);
            ValueSource lhsSource = inputs.get(0);
            for (int i=1, nInputs = inputs.size(); i < nInputs; ++i) {
                TInstance rhsInstance = context.inputTypeAt(i);
                ValueSource rhsSource = inputs.get(i);
                if (0 == doCompare(lhsInstance, lhsSource, rhsInstance, rhsSource)) {
                    output.putBool(true);
                    return;
                }
            }
View Full Code Here

    @Override
    public TPreptimeValue evaluateConstant(QueryContext queryContext) {
        // First check both sides. If either is a constant null, the result is null
        TPreptimeValue leftPrep = left.evaluateConstant(queryContext);
        ValueSource oneVal = leftPrep.value();
        if (oneVal != null && oneVal.isNull()) {
            TInstance type = AkBool.INSTANCE.instance(true);
            return new TPreptimeValue(ValueSources.getNullSource(type));
        }

        TPreptimeValue rightPrep = right.evaluateConstant(queryContext);
        ValueSource twoVal = rightPrep.value();
        if (twoVal != null && twoVal.isNull()) {
            TInstance type = AkBool.INSTANCE.instance(true);
            return new TPreptimeValue(ValueSources.getNullSource(type));
        }

        // Neither side is constant null. If both sides are constant, evaluate
        ValueSource resultSource = null;
        boolean nullable;
        if (oneVal != null && twoVal != null) {
            final boolean result = doEval(leftPrep.type(), oneVal, rightPrep.type(), twoVal);
            resultSource = new Value(AkBool.INSTANCE.instance(false), result);
            nullable = resultSource.isNull();
        }
        else {
            nullable = left.resultType().nullability() || right.resultType().nullability();
        }
        return new TPreptimeValue(MNumeric.INT.instance(nullable), resultSource);
View Full Code Here

        @Override
        public void evaluate() {
            if (value == null)
                value = new Value(AkBool.INSTANCE.instance(true));
            left.evaluate();
            ValueSource leftSource = left.resultValue();
            if (leftSource.isNull()) {
                value.putNull();
                return;
            }
            right.evaluate();
            ValueSource rightSource = right.resultValue();
            if (rightSource.isNull()) {
                value.putNull();
                return;
            }

            boolean result = doEval(leftInstance, leftSource, rightInstance, rightSource);
View Full Code Here

            this.context = context;
            resultValue = new Value(resultType);
            this.evaluations = overload.filterInputs(new LazyListBase<ValueSource>() {
                @Override
                public ValueSource get(int i) {
                    ValueSource value = inputValues[i];
                    if (value == null) {
                        TEvaluatableExpression inputExpr = inputs.get(i);
                        inputExpr.evaluate();
                        value = inputExpr.resultValue();
                        inputValues[i] = value;
View Full Code Here

TOP

Related Classes of com.foundationdb.server.types.value.ValueSource

Copyright © 2018 www.massapicom. 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.