Package com.foundationdb.server.types.texpressions

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


                                              final ExpressionGenerator right, final TCastResolver castResolver)
    {
        return new ExpressionGenerator() {
            @Override
            public TPreparedExpression getTPreparedExpression() {
                TPreparedExpression leftExpr = left.getTPreparedExpression();
                TPreparedExpression rightExpr = right.getTPreparedExpression();

                TInstance common = TypeResolver.commonInstance(
                        castResolver, leftExpr.resultType(), rightExpr.resultType());
                leftExpr = castTo(leftExpr, common, castResolver);
                rightExpr = castTo(rightExpr, common, castResolver);
                return new TComparisonExpression(leftExpr, comparison, rightExpr);
            }
View Full Code Here


    public static ExpressionGenerator toUpper(final ExpressionGenerator input)
    {
        return new ExpressionGenerator() {
            @Override
            public TPreparedExpression getTPreparedExpression() {
                final TPreparedExpression expr = input.getTPreparedExpression();
                return new TPreparedExpression() {
                   
                    @Override
                    public TPreptimeValue evaluateConstant(QueryContext queryContext) {
                        throw new UnsupportedOperationException();
                    }

                    @Override
                    public TInstance resultType() {
                        return expr.resultType();
                    }

                    @Override
                    public TEvaluatableExpression build() {
                        final TEvaluatableExpression eval = expr.build();
                        return new TEvaluatableExpression() {
                            @Override
                            public ValueSource resultValue() {
                                return value;
                            }
View Full Code Here

                    ExpressionGenerators.field(oType, 0, 2), // oid
                    ExpressionGenerators.field(iType, 0, 5// iid
                );
                Ordering ordering = API.ordering();
                for(int i = 0; i < expList.size(); ++i) {
                    TPreparedExpression prep = expList.get(i).getTPreparedExpression();
                    ordering.append(ExpressionGenerators.field(prep.resultType(), i), true);
                }
                Operator plan = API.groupScan_Default(cType.table().getGroup());
                plan = API.filter_Default(plan, Arrays.asList(cType, oType, iType));
                plan = API.flatten_HKeyOrdered(plan, cType, oType, JoinType.LEFT_JOIN);
                plan = API.flatten_HKeyOrdered(plan, plan.rowType(), iType, JoinType.LEFT_JOIN);
View Full Code Here

                    ExpressionGenerators.field(tableRowType, 0, 1), // x
                    ExpressionGenerators.field(tableRowType, 1, 0// id
                );
                Ordering ordering = API.ordering();
                for(int i = 0; i < expList.size(); ++i) {
                    TPreparedExpression prep = expList.get(i).getTPreparedExpression();
                    ordering.append(ExpressionGenerators.field(prep.resultType(), i), true);
                }
                Operator plan = API.groupScan_Default(tType.table().getGroup());
                plan = API.project_Default(plan, expList, tType);
                plan = API.sort_General(plan, plan.rowType(), ordering, SortOption.PRESERVE_DUPLICATES);
                return plan;
View Full Code Here

                input = Collections.<TPreptimeValue>emptyList();
                arguments = Collections.<TPreparedExpression>emptyList();
            }
            TValidatedScalar overload = registry.getScalarsResolver().get(functionName, input).getOverload();
            TInstance functionType = overload.resultStrategy().fixed(column.getNullable());
            TPreparedExpression expr = new TPreparedFunction(overload, functionType, arguments);
            if (!functionType.equals(columnType)) {
                TCast tcast = registry.getCastsResolver().cast(functionType.typeClass(), columnType.typeClass());
                expr = new TCastExpression(expr, tcast, columnType);
            }
            TEvaluatableExpression eval = expr.build();
            eval.with(queryContext);
            expressions[fi] = eval;
        }
        this.rowCreator = new RowDataCreator();
        this.inputStream = inputStream;
View Full Code Here

            return collators.get(i);
        }

        public void append(ExpressionGenerator expressionGenerator, boolean ascending)
        {
            TPreparedExpression newExpr;
            newExpr = expressionGenerator.getTPreparedExpression();
            append(newExpr, ascending);
        }
View Full Code Here

            append(tExpression, ascending, null);
        }
       
        public void append(ExpressionGenerator expression, boolean ascending, AkCollator collator)
        {
            TPreparedExpression newStyle;
            newStyle = expression.getTPreparedExpression();
            append(newStyle, ascending, collator);
        }
View Full Code Here

    @Override
    public Row evaluate(Row original, QueryContext context, QueryBindings bindings) {
        OverlayingRow result = new OverlayingRow(original);
        int nfields = rowType.nFields();
        for (int i = 0; i < nfields; i++) {
            TPreparedExpression expression = pExpressions.get(i);
            if (expression != null) {
                TEvaluatableExpression evaluation = expression.build();
                evaluation.with(original);
                evaluation.with(context);
                evaluation.with(bindings);
                evaluation.evaluate();
                result.overlay(i, evaluation.resultValue());
View Full Code Here

            return expressions.hasNext();
        }

        @Override
        public ValueSource next() {
            TPreparedExpression expression = expressions.next();
            TPreptimeValue ptv = expression.evaluateConstant(context);
            assert ptv != null && ptv.value() != null
                    : "not constant: " + expression + " with prepare-time value of " + ptv;
            return ptv.value();
        }
View Full Code Here

    @Override
    public Row evaluate(Row original, QueryContext context, QueryBindings bindings) {
        OverlayingRow result = new OverlayingRow(original);
        int nfields = rowType.nFields();
        for (int i = 0; i < nfields; i++) {
            TPreparedExpression expression = pExpressions.get(i);
            if (expression != null) {
                TEvaluatableExpression evaluation = expression.build();
                evaluation.with(original);
                evaluation.with(context);
                evaluation.with(bindings);
                evaluation.evaluate();
                result.overlay(i, evaluation.resultValue());
View Full Code Here

TOP

Related Classes of com.foundationdb.server.types.texpressions.TPreparedExpression

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.