Examples of TValidatedScalar


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

                functionName = column.getDefaultFunction();
                assert (functionName != null) : column;
                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);
            }
View Full Code Here

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

        ExpressionNode handleFunctionExpression(FunctionExpression expression) {
            List<ExpressionNode> operands = expression.getOperands();
            ExpressionNode result = resolve(expression, operands, registry.getScalarsResolver(), true);

            TValidatedScalar overload = expression.getResolved();
            TPreptimeContext context = expression.getPreptimeContext();

            final List<TPreptimeValue> operandValues = new ArrayList<>(operands.size());
            for (ExpressionNode operand : operands) {
                TPreptimeValue preptimeValue = operand.getPreptimeValue();
                operandValues.add(preptimeValue);
            }
            overload.finishPreptimePhase(context);

            // Put the preptime value, possibly including nullness, into the expression. The constant folder
            // will use it.
            LazyList<TPreptimeValue> lazyInputs = new LazyListBase<TPreptimeValue>() {
                @Override
                public TPreptimeValue get(int i) {
                    return operandValues.get(i);
                }

                @Override
                public int size() {
                    return operandValues.size();
                }
            };

            TPreptimeValue constantTpv = overload.evaluateConstant(context, overload.filterInputs(lazyInputs));
            if (constantTpv != null) {
                TPreptimeValue oldTpv = expression.getPreptimeValue();
                assert oldTpv.type().equals(constantTpv.type())
                        : oldTpv.type() + " != " + constantTpv.type();
                expression.setPreptimeValue(constantTpv);
View Full Code Here

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

            if (sequence != null) {
                expression = new TSequenceNextValueExpression(type, sequence);
            }
            else if (column.getDefaultFunction() != null) {
                OverloadResolver<TValidatedScalar> resolver = typesService.getScalarsResolver();
                TValidatedScalar overload = resolver.get(column.getDefaultFunction(),
                                                         Collections.<TPreptimeValue>emptyList()).getOverload();
                TInstance dinst = overload.resultStrategy().fixed(false);
                TPreparedExpression defExpr = new TPreparedFunction(overload,
                                                                    dinst,
                                                                    Collections.<TPreparedExpression>emptyList());
                if (!dinst.equals(type)) {
                    TCast tcast = typesService.getCastsResolver().cast(dinst.typeClass(), type.typeClass());
View Full Code Here

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

                                                 List<ExpressionNode> argumentNodes,
                                                 ColumnExpressionContext columnContext,
                                                 SubqueryOperatorAssembler subqueryAssembler) {

        List<TPreparedExpression> arguments = assembleExpressions(argumentNodes, columnContext, subqueryAssembler);
        TValidatedScalar overload;
        SparseArray<Object> preptimeValues = null;
        if (functionNode instanceof FunctionExpression) {
            FunctionExpression fexpr = (FunctionExpression) functionNode;
            overload = fexpr.getResolved();
            preptimeValues = fexpr.getPreptimeValues();
View Full Code Here

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

        // 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)
        );

        // Buffer, delete, insert scan
        final Operator update = insert_Returning(
            project_Table(
View Full Code Here

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

                castsResolver,
                TScalar.class,
                new Function<TScalar, TValidatedScalar>() {
                    @Override
                    public TValidatedScalar apply(TScalar input) {
                        return new TValidatedScalar(input);
                    }
                }, new Function<TValidatedScalar, TValidatedScalar>() {
                    @Override
                    public TValidatedScalar apply(TValidatedScalar input) {
                        return input.createCommuted();
View Full Code Here

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

        }
        else {
            // referencing WHERE fk IS NOT NULL AND...
            List<Column> referencingColumns = foreignKey.getReferencingColumns();
            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());
View Full Code Here

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

                return; // must have been the first call to start()
            }
            Collection<TValidatedScalar> overloads = new ArrayList<>();
            for (String overloadDef : overloadDefs) {
                TScalar scalar = parse(overloadDef);
                TValidatedScalar validated = new TValidatedScalar(scalar);
                overloads.add(validated);
            }
            OverloadsFolder.Result<TClass> foldToClass = ResolvablesRegistry.sameInputSets.fold(overloads);
            OverloadsFolder.Result<Boolean> foldResult = foldToClass.transform(notNull);
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.