Examples of TPreparedExpression


Examples of com.foundationdb.server.types.texpressions.TPreparedExpression

    private TPreparedExpression assembleCastExpression(CastExpression castExpression,
                                                       ColumnExpressionContext columnContext,
                                                       SubqueryOperatorAssembler subqueryAssembler) {
        TInstance toType = castExpression.getType();
        TPreparedExpression expr = assembleExpression(castExpression.getOperand(), columnContext, subqueryAssembler);
        if (toType == null)
            return expr;
        TInstance sourceInstance = expr.resultType();
        if (sourceInstance == null) // CAST(NULL as FOOTYPE)
        {
            toType = toType.withNullable(true);
            return new TNullExpression(toType);
        }
View Full Code Here

Examples of com.foundationdb.server.types.texpressions.TPreparedExpression

        }
        return expr;
    }

    private TPreparedExpression tryLiteral(ExpressionNode node) {
        TPreparedExpression result = null;
        TPreptimeValue tpv = node.getPreptimeValue();
        if (tpv != null) {
            TInstance type = tpv.type();
            ValueSource value = tpv.value();
            if (type != null && value != null)
View Full Code Here

Examples of com.foundationdb.server.types.texpressions.TPreparedExpression

    }

    public ConstantExpression evalNow(PlanContext planContext, ExpressionNode node) {
        if (node instanceof ConstantExpression)
            return (ConstantExpression)node;
        TPreparedExpression expr = assembleExpression(node, null, null);
        TPreptimeValue preptimeValue = expr.evaluateConstant(planContext.getQueryContext());
        if (preptimeValue == null)
            throw new AkibanInternalException("required constant expression: " + expr);
        ValueSource valueSource = preptimeValue.value();
        if (valueSource == null)
            throw new AkibanInternalException("required constant expression: " + expr);
View Full Code Here

Examples of com.foundationdb.server.types.texpressions.TPreparedExpression

            ),
            Arrays.asList(itemRowType)
        );

        // Build UPDATE-replacing project
        TPreparedExpression field0 = ExpressionGenerators.field(itemRowType, 0).getTPreparedExpression();
        TPreparedExpression field1 = ExpressionGenerators.field(itemRowType, 1).getTPreparedExpression();
        TPreparedExpression literal = ExpressionGenerators.literal(1000).getTPreparedExpression();
        TValidatedScalar plus = typesRegistryService().getScalarsResolver().get(
            "plus", asList(new TPreptimeValue(field0.resultType()), new TPreptimeValue(literal.resultType()))
        ).getOverload();
        TPreparedFunction prepFunc = new TPreparedFunction(
            plus, plus.resultType().fixed(false), Arrays.asList(field0, literal)
        );
View Full Code Here

Examples of com.foundationdb.server.types.texpressions.TPreparedExpression

            // OK, they're equal
        } else if (loValueSource.isNull() || hiValueSource.isNull()) {
            throw new IllegalArgumentException(String.format("lo: %s, hi: %s", loValueSource, hiValueSource));
        } else {
            TInstance type = types[f];
            TPreparedExpression loEQHi =
                    new TComparisonExpression(
                            new TPreparedLiteral(type, loValueSource),
                            Comparison.EQ,
                            new TPreparedLiteral(type, hiValueSource)
                    );
            TEvaluatableExpression eval = loEQHi.build();
            eval.evaluate();
            if (!eval.resultValue().getBoolean()) {
                throw new IllegalArgumentException();
            }
        }
View Full Code Here

Examples of com.foundationdb.server.types.texpressions.TPreparedExpression

    @Override
    public TPreparedExpression createComparison(TInstance type,
                                                ValueSource one,
                                                Comparison comparison,
                                                ValueSource two) {
        TPreparedExpression arg1 = new TPreparedLiteral(type, one);
        TPreparedExpression arg2 = new TPreparedLiteral(type, two);
        return new TComparisonExpression(arg1, comparison, arg2);
    }
View Full Code Here

Examples of com.foundationdb.server.types.texpressions.TPreparedExpression

            if(oldPosition == null) {
                projections.add(buildColumnDefault(newCol, typesRegistry, typesTranslator, origContext));
            } else {
                Column oldCol = origTable.getColumnsIncludingInternal().get(oldPosition);
                TInstance oldInst = oldCol.getType();
                TPreparedExpression pExp = new TPreparedField(oldInst, oldPosition);
                if(!oldInst.equalsExcludingNullable(newInst)) {
                    TCast cast = typesRegistry.getCastsResolver().cast(oldInst.typeClass(), newInst.typeClass());
                    pExp = new TCastExpression(pExp, cast, newInst);
                }
                projections.add(pExp);
View Full Code Here

Examples of com.foundationdb.server.types.texpressions.TPreparedExpression

            TPreptimeValue emptyTPV = new TPreptimeValue();
            TValidatedScalar isNull = typesRegistryService.getScalarsResolver().get("IsNull", Collections.nCopies(1, emptyTPV)).getOverload();
            TValidatedScalar not = typesRegistryService.getScalarsResolver().get("NOT", Collections.nCopies(1, emptyTPV)).getOverload();
            TValidatedScalar and = typesRegistryService.getScalarsResolver().get("AND", Collections.nCopies(2, emptyTPV)).getOverload();
            TInstance boolType = AkBool.INSTANCE.instance(false);
            TPreparedExpression predicate = null;
            for (int i = 0; i < plan.ncols; i++) {
                Column referencingColumn = referencingColumns.get(i);
                TPreparedField field = new TPreparedField(referencingColumn.getType(), referencingColumn.getPosition());
                TPreparedExpression clause = new TPreparedFunction(isNull, boolType, Arrays.asList(field));
                clause = new TPreparedFunction(not, boolType, Arrays.asList(clause));
                if (predicate == null) {
                    predicate = clause;
                }
                else {
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.