Package com.foundationdb.server.types.value

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


            if (keys == null) {
                begun = json.writeRows(cursor, appender, "\n", rowWriter, options);
            } else {
                for (List<Object> key : keys) {
                    for (int i = 0; i < key.size(); i++) {
                        ValueSource value = ValueSources.fromObject(key.get(i), null).value();
                        queryBindings.setValue(i, value);
                    }
                    if (json.writeRows(cursor, appender, begun ? ",\n" : "\n", rowWriter, options))
                        begun = true;
                }
View Full Code Here


                if (row != null)
                    expression.with(row);
                if (bindings != null)
                    expression.with(bindings);
                expression.evaluate();
                ValueSource columnValue = expression.resultValue();
                if (columnValue.isNull())
                    isNull = true;
                Value valueCopy = new Value(columnValue.getType());
                ValueTargets.copyFrom(columnValue, valueCopy);
                AkCollator collator = (collators != null) ? collators.get(i) : null;
                hashKey ^= ValueSources.hash(valueCopy, collator);
                values.add(valueCopy);
                i++;
View Full Code Here

        this(rowType, isMutable);
        int i = 0;
        while(initialValues.hasNext()) {
            if (i >= values.size())
                throw new IllegalArgumentException("too many initial values: reached limit of " + values.size());
            ValueSource nextValue = initialValues.next();
            TInstance nextValueType = nextValue.getType();
            TInstance expectedTInst = rowType.typeAt(i);
            if (TInstance.tClass(nextValueType) != TInstance.tClass(expectedTInst))
                throw new IllegalArgumentException(
                        "value at index " + i + " expected type " + expectedTInst
                                + ", but UnderlyingType was " + nextValueType + ": " + nextValue);
View Full Code Here

    }

    @Override
    protected Constantness constness(TPreptimeContext context, int inputIndex, LazyList<? extends TPreptimeValue> values) {
        assert inputIndex == 0 : inputIndex + " for " + values; // 0 should be enough to fully answer the question
        ValueSource indexVal = constSource(values, 0);
        if (indexVal == null)
            return Constantness.NOT_CONST;
        if (indexVal.isNull())
            return Constantness.CONST;
        int answerIndex = indexVal.getInt32();
        if (answerIndex < 1 || answerIndex >= values.size())
            return Constantness.CONST; // answer is null
        ValueSource answer = constSource(values, answerIndex);
        return answer == null ? Constantness.NOT_CONST : Constantness.CONST;
    }
View Full Code Here

    }

    @Override
    protected void doEvaluate(TExecutionContext context, LazyList<? extends ValueSource> inputs, ValueTarget output)
    {
        ValueSource sval = inputs.get(0);
        String str = sval.getString();
        int code = 0;
        if (str.length() == 0) {
            output.putInt32(0);
        }
        else {
View Full Code Here

            Operator delete = deleteGenerator.create(tableName);
            cursor = API.cursor(delete, context.queryContext, context.queryBindings);

            for (List<Object> key : pks) {
                for (int i = 0; i < key.size(); i++) {
                    ValueSource value = ValueSources.fromObject(key.get(i), null).value();
                    context.queryBindings.setValue(i, value);
                }
   
                cursor.openTopLevel();
                Row row;
View Full Code Here

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

    }

    @Override
    protected void doEvaluate(TExecutionContext context, LazyList<? extends ValueSource> inputs, ValueTarget output) {
        String result = context.inputTypeAt(0).toString();
        ValueSource input = inputs.get(0);
        result = ( (input== null) ? "variable " : "const ") + result;
        output.putString(result, null);
    }
View Full Code Here

                ExpressionNode key = field.getKey();
                TPreparedExpression expr = null;
                String constant = null;
                boolean isConstant = false;
                if (key.isConstant()) {
                    ValueSource valueSource = key.getPreptimeValue().value();
                    constant = (valueSource == null || valueSource.isNull()) ? null : valueSource.getString();
                    isConstant = true;
                }
                else {
                    expr = assembleExpression(key, null);
                }
View Full Code Here

            ExpressionNode thenExpr = expression.getThenExpression();
            ExpressionNode elseExpr = expression.getElseExpression();

            // constant-fold if the condition is constant
            if (conditions.size() == 1) {
                ValueSource conditionVal = pval(conditions.get(0));
                if (conditionVal != null) {
                    boolean conditionMet = conditionVal.getBoolean(false);
                    return conditionMet ? thenExpr : elseExpr;
                }
            }

            TInstance commonInstance = commonInstance(registry.getCastsResolver(), type(thenExpr), type(elseExpr));
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.