Package com.facebook.presto.sql.analyzer

Examples of com.facebook.presto.sql.analyzer.Type


        // project methods
        //
        List<TupleInfo> tupleInfos = new ArrayList<>();
        int projectionIndex = 0;
        for (int i = 0; i < projections.size(); i++) {
            Type outputType = outputTypes.get(i);
            checkArgument(outputType != Type.NULL, "NULL output type is not supported");
            tupleInfos.add(new TupleInfo(outputType.getRawType()));

            // verify the compiled projection has the correct type
            Expression projection = projections.get(i);

            Class<?> type = generateProjectMethod(classDefinition, "project_" + projectionIndex, projection, inputTypes, true);
View Full Code Here


        // project methods
        //
        List<TupleInfo> tupleInfos = new ArrayList<>();
        int projectionIndex = 0;
        for (int i = 0; i < projections.size(); i++) {
            Type outputType = outputTypes.get(i);
            checkArgument(outputType != Type.NULL, "NULL output type is not supported");
            tupleInfos.add(new TupleInfo(outputType.getRawType()));

            // verify the compiled projection has the correct type
            Expression projection = projections.get(i);

            Class<?> type = generateProjectMethod(classDefinition, "project_" + projectionIndex, projection, inputTypes, true);
View Full Code Here

                    columns.add(tableScanNode.getAssignments().get(symbol));

                    Input input = new Input(channel);
                    sourceLayout.put(symbol, input);

                    Type type = checkNotNull(context.getTypes().get(symbol), "No type for symbol %s", symbol);
                    sourceTypes.put(input, type);

                    channel++;
                }
            }
View Full Code Here

            int channel = 0;
            for (Symbol symbol : node.getOutputSymbols()) {
                Input input = new Input(channel);
                outputMappings.put(symbol, input);

                Type type = checkNotNull(context.getTypes().get(symbol), "No type for symbol %s", symbol);
                outputTypes.add(new TupleInfo(type.getRawType()));

                channel++;
            }

            PageBuilder pageBuilder = new PageBuilder(outputTypes);
View Full Code Here

    @Override
    public TypedByteCodeNode visitInputReference(InputReference node, CompilerContext context)
    {
        Input input = node.getInput();
        int channel = input.getChannel();
        Type type = inputTypes.get(input);
        checkState(type != null, "No type for input %s", input);

        if (sourceIsCursor) {
            Block isNullCheck = new Block(context)
                    .setDescription(format("cursor.get%s(%d)", type, channel))
View Full Code Here

        List<Type> functionArguments = functionInfo.getArgumentTypes();
        if (parameterTypes.size() != functionArguments.size()) {
            return false;
        }
        for (int i = 0; i < functionArguments.size(); i++) {
            Type functionArgument = functionArguments.get(i);
            Type parameterType = parameterTypes.get(i);
            if (functionArgument != parameterType && !(functionArgument == DOUBLE && parameterType == BIGINT)) {
                return false;
            }
        }
        return true;
View Full Code Here

        public FunctionListBuilder scalar(String name, MethodHandle function, boolean deterministic, FunctionBinder functionBinder, String description)
        {
            name = name.toLowerCase();

            Type returnType = type(function.type().returnType());
            List<Type> argumentTypes = types(function);
            functions.add(new FunctionInfo(new Signature(name, returnType, argumentTypes, false), description, function, deterministic, functionBinder));
            return this;
        }
View Full Code Here

        List<Object> results = new ArrayList<>();

        // execute as standalone operator
        OperatorFactory operatorFactory = compileFilterProject(TRUE_LITERAL, projectionExpression);
        Type expressionType = Type.fromRaw(operatorFactory.getTupleInfos().get(0).getType());
        Object directOperatorValue = selectSingleValue(operatorFactory, session);
        results.add(directOperatorValue);

        // interpret
        Object interpretedValue = selectSingleValue(interpretedFilterProject(TRUE_LITERAL, projectionExpression, expressionType, session));
View Full Code Here

        List<Boolean> results = new ArrayList<>();

        // execute as standalone operator
        OperatorFactory operatorFactory = compileFilterProject(filterExpression, TRUE_LITERAL);
        Type expressionType = Type.fromRaw(operatorFactory.getTupleInfos().get(0).getType());
        results.add(executeFilter(operatorFactory, session));

        if (executeWithNoInputColumns) {
            // execute as standalone operator
            operatorFactory = compileFilterWithNoInputColumns(filterExpression);
View Full Code Here

        }
    }

    private OperatorFactory compileFilterProject(Expression filter, Expression projection)
    {
        Type projectionType = getExpressionType(projection);

        filter = ExpressionTreeRewriter.rewriteWith(new SymbolToInputRewriter(INPUT_MAPPING), filter);
        projection = ExpressionTreeRewriter.rewriteWith(new SymbolToInputRewriter(INPUT_MAPPING), projection);

        try {
View Full Code Here

TOP

Related Classes of com.facebook.presto.sql.analyzer.Type

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.