Search in sources :

Example 86 with Type

use of com.facebook.presto.spi.type.Type in project presto by prestodb.

the class AddColumnTask method execute.

@Override
public ListenableFuture<?> execute(AddColumn statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) {
    Session session = stateMachine.getSession();
    QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getName());
    Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName);
    if (!tableHandle.isPresent()) {
        throw new SemanticException(MISSING_TABLE, statement, "Table '%s' does not exist", tableName);
    }
    accessControl.checkCanAddColumns(session.getRequiredTransactionId(), session.getIdentity(), tableName);
    Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle.get());
    ColumnDefinition element = statement.getColumn();
    Type type = metadata.getType(parseTypeSignature(element.getType()));
    if ((type == null) || type.equals(UNKNOWN)) {
        throw new SemanticException(TYPE_MISMATCH, element, "Unknown type for column '%s' ", element.getName());
    }
    if (columnHandles.containsKey(element.getName().toLowerCase(ENGLISH))) {
        throw new SemanticException(COLUMN_ALREADY_EXISTS, statement, "Column '%s' already exists", element.getName());
    }
    metadata.addColumn(session, tableHandle.get(), new ColumnMetadata(element.getName(), type));
    return immediateFuture(null);
}
Also used : ColumnHandle(com.facebook.presto.spi.ColumnHandle) Type(com.facebook.presto.spi.type.Type) ColumnMetadata(com.facebook.presto.spi.ColumnMetadata) TableHandle(com.facebook.presto.metadata.TableHandle) QualifiedObjectName(com.facebook.presto.metadata.QualifiedObjectName) MetadataUtil.createQualifiedObjectName(com.facebook.presto.metadata.MetadataUtil.createQualifiedObjectName) Session(com.facebook.presto.Session) SemanticException(com.facebook.presto.sql.analyzer.SemanticException) ColumnDefinition(com.facebook.presto.sql.tree.ColumnDefinition)

Example 87 with Type

use of com.facebook.presto.spi.type.Type in project presto by prestodb.

the class CreateTableTask method execute.

@Override
public ListenableFuture<?> execute(CreateTable statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) {
    checkArgument(!statement.getElements().isEmpty(), "no columns for table");
    Session session = stateMachine.getSession();
    QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getName());
    Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName);
    if (tableHandle.isPresent()) {
        if (!statement.isNotExists()) {
            throw new SemanticException(TABLE_ALREADY_EXISTS, statement, "Table '%s' already exists", tableName);
        }
        return immediateFuture(null);
    }
    List<ColumnMetadata> columns = new ArrayList<>();
    Map<String, Object> inheritedProperties = ImmutableMap.of();
    boolean includingProperties = false;
    for (TableElement element : statement.getElements()) {
        if (element instanceof ColumnDefinition) {
            ColumnDefinition column = (ColumnDefinition) element;
            Type type = metadata.getType(parseTypeSignature(column.getType()));
            if ((type == null) || type.equals(UNKNOWN)) {
                throw new SemanticException(TYPE_MISMATCH, column, "Unknown type for column '%s' ", column.getName());
            }
            columns.add(new ColumnMetadata(column.getName(), type, column.getComment().orElse(null), false));
        } else if (element instanceof LikeClause) {
            LikeClause likeClause = (LikeClause) element;
            QualifiedObjectName likeTableName = createQualifiedObjectName(session, statement, likeClause.getTableName());
            if (!metadata.getCatalogHandle(session, likeTableName.getCatalogName()).isPresent()) {
                throw new SemanticException(MISSING_CATALOG, statement, "LIKE table catalog '%s' does not exist", likeTableName.getCatalogName());
            }
            if (!tableName.getCatalogName().equals(likeTableName.getCatalogName())) {
                throw new SemanticException(NOT_SUPPORTED, statement, "LIKE table across catalogs is not supported");
            }
            TableHandle likeTable = metadata.getTableHandle(session, likeTableName).orElseThrow(() -> new SemanticException(MISSING_TABLE, statement, "LIKE table '%s' does not exist", likeTableName));
            TableMetadata likeTableMetadata = metadata.getTableMetadata(session, likeTable);
            Optional<LikeClause.PropertiesOption> propertiesOption = likeClause.getPropertiesOption();
            if (propertiesOption.isPresent() && propertiesOption.get().equals(LikeClause.PropertiesOption.INCLUDING)) {
                if (includingProperties) {
                    throw new SemanticException(NOT_SUPPORTED, statement, "Only one LIKE clause can specify INCLUDING PROPERTIES");
                }
                includingProperties = true;
                inheritedProperties = likeTableMetadata.getMetadata().getProperties();
            }
            likeTableMetadata.getColumns().stream().filter(column -> !column.isHidden()).forEach(columns::add);
        } else {
            throw new PrestoException(GENERIC_INTERNAL_ERROR, "Invalid TableElement: " + element.getClass().getName());
        }
    }
    accessControl.checkCanCreateTable(session.getRequiredTransactionId(), session.getIdentity(), tableName);
    ConnectorId connectorId = metadata.getCatalogHandle(session, tableName.getCatalogName()).orElseThrow(() -> new PrestoException(NOT_FOUND, "Catalog does not exist: " + tableName.getCatalogName()));
    Map<String, Object> properties = metadata.getTablePropertyManager().getProperties(connectorId, tableName.getCatalogName(), statement.getProperties(), session, metadata, parameters);
    Map<String, Object> finalProperties = combineProperties(statement.getProperties().keySet(), properties, inheritedProperties);
    ConnectorTableMetadata tableMetadata = new ConnectorTableMetadata(tableName.asSchemaTableName(), columns, finalProperties);
    metadata.createTable(session, tableName.getCatalogName(), tableMetadata);
    return immediateFuture(null);
}
Also used : LikeClause(com.facebook.presto.sql.tree.LikeClause) TableMetadata(com.facebook.presto.metadata.TableMetadata) ConnectorTableMetadata(com.facebook.presto.spi.ConnectorTableMetadata) ColumnMetadata(com.facebook.presto.spi.ColumnMetadata) Optional(java.util.Optional) ArrayList(java.util.ArrayList) PrestoException(com.facebook.presto.spi.PrestoException) QualifiedObjectName(com.facebook.presto.metadata.QualifiedObjectName) MetadataUtil.createQualifiedObjectName(com.facebook.presto.metadata.MetadataUtil.createQualifiedObjectName) TableElement(com.facebook.presto.sql.tree.TableElement) ColumnDefinition(com.facebook.presto.sql.tree.ColumnDefinition) Type(com.facebook.presto.spi.type.Type) TableHandle(com.facebook.presto.metadata.TableHandle) ConnectorTableMetadata(com.facebook.presto.spi.ConnectorTableMetadata) Session(com.facebook.presto.Session) SemanticException(com.facebook.presto.sql.analyzer.SemanticException) ConnectorId(com.facebook.presto.connector.ConnectorId)

Example 88 with Type

use of com.facebook.presto.spi.type.Type in project presto by prestodb.

the class LocalFileRecordCursor method checkFieldType.

private void checkFieldType(int field, Type... expected) {
    Type actual = getType(field);
    for (Type type : expected) {
        if (actual.equals(type)) {
            return;
        }
    }
    String expectedTypes = Joiner.on(", ").join(expected);
    throw new IllegalArgumentException(format("Expected field %s to be type %s but is %s", field, expectedTypes, actual));
}
Also used : Type(com.facebook.presto.spi.type.Type) VarcharType.createUnboundedVarcharType(com.facebook.presto.spi.type.VarcharType.createUnboundedVarcharType)

Example 89 with Type

use of com.facebook.presto.spi.type.Type in project presto by prestodb.

the class FunctionRegistry method doGetSpecializedFunctionKey.

private SpecializedFunctionKey doGetSpecializedFunctionKey(Signature signature) {
    Iterable<SqlFunction> candidates = functions.get(QualifiedName.of(signature.getName()));
    // search for exact match
    Type returnType = typeManager.getType(signature.getReturnType());
    List<TypeSignatureProvider> argumentTypeSignatureProviders = fromTypeSignatures(signature.getArgumentTypes());
    for (SqlFunction candidate : candidates) {
        Optional<BoundVariables> boundVariables = new SignatureBinder(typeManager, candidate.getSignature(), false).bindVariables(argumentTypeSignatureProviders, returnType);
        if (boundVariables.isPresent()) {
            return new SpecializedFunctionKey(candidate, boundVariables.get(), argumentTypeSignatureProviders.size());
        }
    }
    // TODO: hack because there could be "type only" coercions (which aren't necessarily included as implicit casts),
    // so do a second pass allowing "type only" coercions
    List<Type> argumentTypes = resolveTypes(signature.getArgumentTypes(), typeManager);
    for (SqlFunction candidate : candidates) {
        SignatureBinder binder = new SignatureBinder(typeManager, candidate.getSignature(), true);
        Optional<BoundVariables> boundVariables = binder.bindVariables(argumentTypeSignatureProviders, returnType);
        if (!boundVariables.isPresent()) {
            continue;
        }
        Signature boundSignature = applyBoundVariables(candidate.getSignature(), boundVariables.get(), argumentTypes.size());
        if (!typeManager.isTypeOnlyCoercion(typeManager.getType(boundSignature.getReturnType()), returnType)) {
            continue;
        }
        boolean nonTypeOnlyCoercion = false;
        for (int i = 0; i < argumentTypes.size(); i++) {
            Type expectedType = typeManager.getType(boundSignature.getArgumentTypes().get(i));
            if (!typeManager.isTypeOnlyCoercion(argumentTypes.get(i), expectedType)) {
                nonTypeOnlyCoercion = true;
                break;
            }
        }
        if (nonTypeOnlyCoercion) {
            continue;
        }
        return new SpecializedFunctionKey(candidate, boundVariables.get(), argumentTypes.size());
    }
    // TODO: this is a hack and should be removed
    if (signature.getName().startsWith(MAGIC_LITERAL_FUNCTION_PREFIX)) {
        List<TypeSignature> parameterTypes = signature.getArgumentTypes();
        // extract type from function name
        String typeName = signature.getName().substring(MAGIC_LITERAL_FUNCTION_PREFIX.length());
        // lookup the type
        Type type = typeManager.getType(parseTypeSignature(typeName));
        requireNonNull(type, format("Type %s not registered", typeName));
        // verify we have one parameter of the proper type
        checkArgument(parameterTypes.size() == 1, "Expected one argument to literal function, but got %s", parameterTypes);
        Type parameterType = typeManager.getType(parameterTypes.get(0));
        requireNonNull(parameterType, format("Type %s not found", parameterTypes.get(0)));
        return new SpecializedFunctionKey(magicLiteralFunction, BoundVariables.builder().setTypeVariable("T", parameterType).setTypeVariable("R", type).build(), 1);
    }
    throw new PrestoException(FUNCTION_IMPLEMENTATION_MISSING, format("%s not found", signature));
}
Also used : PrestoException(com.facebook.presto.spi.PrestoException) TypeSignatureProvider(com.facebook.presto.sql.analyzer.TypeSignatureProvider) OperatorType(com.facebook.presto.spi.function.OperatorType) Type(com.facebook.presto.spi.type.Type) VarcharType(com.facebook.presto.spi.type.VarcharType) TypeSignature.parseTypeSignature(com.facebook.presto.spi.type.TypeSignature.parseTypeSignature) TypeSignature(com.facebook.presto.spi.type.TypeSignature) SignatureBinder.applyBoundVariables(com.facebook.presto.metadata.SignatureBinder.applyBoundVariables) TypeSignature.parseTypeSignature(com.facebook.presto.spi.type.TypeSignature.parseTypeSignature) TypeSignature(com.facebook.presto.spi.type.TypeSignature)

Example 90 with Type

use of com.facebook.presto.spi.type.Type in project presto by prestodb.

the class FunctionRegistry method resolveFunction.

public Signature resolveFunction(QualifiedName name, List<TypeSignatureProvider> parameterTypes) {
    Collection<SqlFunction> allCandidates = functions.get(name);
    List<SqlFunction> exactCandidates = allCandidates.stream().filter(function -> function.getSignature().getTypeVariableConstraints().isEmpty()).collect(Collectors.toList());
    Optional<Signature> match = matchFunctionExact(exactCandidates, parameterTypes);
    if (match.isPresent()) {
        return match.get();
    }
    List<SqlFunction> genericCandidates = allCandidates.stream().filter(function -> !function.getSignature().getTypeVariableConstraints().isEmpty()).collect(Collectors.toList());
    match = matchFunctionExact(genericCandidates, parameterTypes);
    if (match.isPresent()) {
        return match.get();
    }
    match = matchFunctionWithCoercion(allCandidates, parameterTypes);
    if (match.isPresent()) {
        return match.get();
    }
    List<String> expectedParameters = new ArrayList<>();
    for (SqlFunction function : allCandidates) {
        expectedParameters.add(format("%s(%s) %s", name, Joiner.on(", ").join(function.getSignature().getArgumentTypes()), Joiner.on(", ").join(function.getSignature().getTypeVariableConstraints())));
    }
    String parameters = Joiner.on(", ").join(parameterTypes);
    String message = format("Function %s not registered", name);
    if (!expectedParameters.isEmpty()) {
        String expected = Joiner.on(", ").join(expectedParameters);
        message = format("Unexpected parameters (%s) for function %s. Expected: %s", parameters, name, expected);
    }
    if (name.getSuffix().startsWith(MAGIC_LITERAL_FUNCTION_PREFIX)) {
        // extract type from function name
        String typeName = name.getSuffix().substring(MAGIC_LITERAL_FUNCTION_PREFIX.length());
        // lookup the type
        Type type = typeManager.getType(parseTypeSignature(typeName));
        requireNonNull(type, format("Type %s not registered", typeName));
        // verify we have one parameter of the proper type
        checkArgument(parameterTypes.size() == 1, "Expected one argument to literal function, but got %s", parameterTypes);
        Type parameterType = typeManager.getType(parameterTypes.get(0).getTypeSignature());
        requireNonNull(parameterType, format("Type %s not found", parameterTypes.get(0)));
        return getMagicLiteralFunctionSignature(type);
    }
    throw new PrestoException(FUNCTION_NOT_FOUND, message);
}
Also used : INTEGER_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalCasts.INTEGER_TO_DECIMAL_CAST) ApproximateDoublePercentileArrayAggregations(com.facebook.presto.operator.aggregation.ApproximateDoublePercentileArrayAggregations) DECIMAL_TO_SMALLINT_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.DECIMAL_TO_SMALLINT_SATURATED_FLOOR_CAST) MapEqualOperator(com.facebook.presto.operator.scalar.MapEqualOperator) DECIMAL_SUBTRACT_OPERATOR(com.facebook.presto.type.DecimalOperators.DECIMAL_SUBTRACT_OPERATOR) TimeOperators(com.facebook.presto.type.TimeOperators) JsonFunctions(com.facebook.presto.operator.scalar.JsonFunctions) NTileFunction(com.facebook.presto.operator.window.NTileFunction) TimestampWithTimeZoneOperators(com.facebook.presto.type.TimestampWithTimeZoneOperators) ArrayContains(com.facebook.presto.operator.scalar.ArrayContains) DECIMAL_LESS_THAN_OR_EQUAL_OPERATOR(com.facebook.presto.type.DecimalInequalityOperators.DECIMAL_LESS_THAN_OR_EQUAL_OPERATOR) BOOLEAN(com.facebook.presto.spi.type.BooleanType.BOOLEAN) AverageAggregations(com.facebook.presto.operator.aggregation.AverageAggregations) Map(java.util.Map) MathFunctions(com.facebook.presto.operator.scalar.MathFunctions) ImmutableCollectors.toImmutableList(com.facebook.presto.util.ImmutableCollectors.toImmutableList) MAP_FILTER_FUNCTION(com.facebook.presto.operator.scalar.MapFilterFunction.MAP_FILTER_FUNCTION) CONCAT(com.facebook.presto.operator.scalar.ConcatFunction.CONCAT) SignatureBinder.applyBoundVariables(com.facebook.presto.metadata.SignatureBinder.applyBoundVariables) HyperLogLogOperators(com.facebook.presto.type.HyperLogLogOperators) WINDOW(com.facebook.presto.metadata.FunctionKind.WINDOW) InternalAggregationFunction(com.facebook.presto.operator.aggregation.InternalAggregationFunction) MAP_ELEMENT_AT(com.facebook.presto.operator.scalar.MapElementAtFunction.MAP_ELEMENT_AT) OperatorType(com.facebook.presto.spi.function.OperatorType) ArrayFunctions(com.facebook.presto.operator.scalar.ArrayFunctions) PercentRankFunction(com.facebook.presto.operator.window.PercentRankFunction) DECIMAL_MULTIPLY_OPERATOR(com.facebook.presto.type.DecimalOperators.DECIMAL_MULTIPLY_OPERATOR) Joiner(com.google.common.base.Joiner) MethodHandle(java.lang.invoke.MethodHandle) LagFunction(com.facebook.presto.operator.window.LagFunction) ApproximateCountDistinctAggregations(com.facebook.presto.operator.aggregation.ApproximateCountDistinctAggregations) ColorFunctions(com.facebook.presto.operator.scalar.ColorFunctions) DECIMAL_SUM_AGGREGATION(com.facebook.presto.operator.aggregation.DecimalSumAggregation.DECIMAL_SUM_AGGREGATION) VarbinaryOperators(com.facebook.presto.type.VarbinaryOperators) MAP_UNION(com.facebook.presto.operator.aggregation.MapUnionAggregation.MAP_UNION) ARRAY_TO_ARRAY_CAST(com.facebook.presto.operator.scalar.ArrayToArrayCast.ARRAY_TO_ARRAY_CAST) TimestampOperators(com.facebook.presto.type.TimestampOperators) ArrayPositionFunction(com.facebook.presto.operator.scalar.ArrayPositionFunction) CHECKSUM_AGGREGATION(com.facebook.presto.operator.aggregation.ChecksumAggregationFunction.CHECKSUM_AGGREGATION) DecimalOperators(com.facebook.presto.type.DecimalOperators) Type(com.facebook.presto.spi.type.Type) ARRAY_FLATTEN_FUNCTION(com.facebook.presto.operator.scalar.ArrayFlattenFunction.ARRAY_FLATTEN_FUNCTION) TRY_CAST(com.facebook.presto.operator.scalar.TryCastFunction.TRY_CAST) ArrayEqualOperator(com.facebook.presto.operator.scalar.ArrayEqualOperator) JoniRegexpFunctions(com.facebook.presto.operator.scalar.JoniRegexpFunctions) BitwiseAndAggregation(com.facebook.presto.operator.aggregation.BitwiseAndAggregation) ELEMENT_TO_ARRAY_CONCAT_FUNCTION(com.facebook.presto.operator.scalar.ElementToArrayConcatFunction.ELEMENT_TO_ARRAY_CONCAT_FUNCTION) AMBIGUOUS_FUNCTION_CALL(com.facebook.presto.spi.StandardErrorCode.AMBIGUOUS_FUNCTION_CALL) DECIMAL_GREATER_THAN_OPERATOR(com.facebook.presto.type.DecimalInequalityOperators.DECIMAL_GREATER_THAN_OPERATOR) ApproximateRealPercentileAggregations(com.facebook.presto.operator.aggregation.ApproximateRealPercentileAggregations) DECIMAL_TO_BIGINT_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.DECIMAL_TO_BIGINT_SATURATED_FLOOR_CAST) BIGINT_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalCasts.BIGINT_TO_DECIMAL_CAST) Throwables(com.google.common.base.Throwables) MAP_AGG(com.facebook.presto.operator.aggregation.MapAggregationFunction.MAP_AGG) GREATEST(com.facebook.presto.operator.scalar.Greatest.GREATEST) IDENTITY_CAST(com.facebook.presto.operator.scalar.IdentityCast.IDENTITY_CAST) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) ColorOperators(com.facebook.presto.type.ColorOperators) HISTOGRAM(com.facebook.presto.operator.aggregation.Histogram.HISTOGRAM) ArrayExceptFunction(com.facebook.presto.operator.scalar.ArrayExceptFunction) ARRAY_TO_ELEMENT_CONCAT_FUNCTION(com.facebook.presto.operator.scalar.ArrayToElementConcatFunction.ARRAY_TO_ELEMENT_CONCAT_FUNCTION) TINYINT_TO_DECIMAL_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.TINYINT_TO_DECIMAL_SATURATED_FLOOR_CAST) DoubleCovarianceAggregation(com.facebook.presto.operator.aggregation.DoubleCovarianceAggregation) CountIfAggregation(com.facebook.presto.operator.aggregation.CountIfAggregation) JSON_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalCasts.JSON_TO_DECIMAL_CAST) VarcharType(com.facebook.presto.spi.type.VarcharType) DECIMAL_DISTINCT_FROM_OPERATOR(com.facebook.presto.type.DecimalInequalityOperators.DECIMAL_DISTINCT_FROM_OPERATOR) TypeSignature.parseTypeSignature(com.facebook.presto.spi.type.TypeSignature.parseTypeSignature) DoubleRegressionAggregation(com.facebook.presto.operator.aggregation.DoubleRegressionAggregation) MAX_BY(com.facebook.presto.operator.aggregation.MaxBy.MAX_BY) DoubleSumAggregation(com.facebook.presto.operator.aggregation.DoubleSumAggregation) DECIMAL_NOT_EQUAL_OPERATOR(com.facebook.presto.type.DecimalInequalityOperators.DECIMAL_NOT_EQUAL_OPERATOR) IntegerOperators(com.facebook.presto.type.IntegerOperators) ArrayReverseFunction(com.facebook.presto.operator.scalar.ArrayReverseFunction) LastValueFunction(com.facebook.presto.operator.window.LastValueFunction) Block(com.facebook.presto.spi.block.Block) MAP_HASH_CODE(com.facebook.presto.operator.scalar.MapHashCodeOperator.MAP_HASH_CODE) RealGeometricMeanAggregations(com.facebook.presto.operator.aggregation.RealGeometricMeanAggregations) FUNCTION_NOT_FOUND(com.facebook.presto.spi.StandardErrorCode.FUNCTION_NOT_FOUND) ARBITRARY_AGGREGATION(com.facebook.presto.operator.aggregation.ArbitraryAggregationFunction.ARBITRARY_AGGREGATION) JSON_TO_ARRAY(com.facebook.presto.operator.scalar.JsonToArrayCast.JSON_TO_ARRAY) ARRAY_CONCAT_FUNCTION(com.facebook.presto.operator.scalar.ArrayConcatFunction.ARRAY_CONCAT_FUNCTION) Re2JCastToRegexpFunction.castCharToRe2JRegexp(com.facebook.presto.operator.scalar.Re2JCastToRegexpFunction.castCharToRe2JRegexp) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) BooleanAndAggregation(com.facebook.presto.operator.aggregation.BooleanAndAggregation) DateTimeOperators(com.facebook.presto.type.DateTimeOperators) MIN_BY(com.facebook.presto.operator.aggregation.MinBy.MIN_BY) ARRAY_TO_JSON(com.facebook.presto.operator.scalar.ArrayToJsonCast.ARRAY_TO_JSON) UNKNOWN(com.facebook.presto.type.UnknownType.UNKNOWN) RankFunction(com.facebook.presto.operator.window.RankFunction) MAP_TRANSFORM_VALUE_FUNCTION(com.facebook.presto.operator.scalar.MapTransformValueFunction.MAP_TRANSFORM_VALUE_FUNCTION) ArrayDistinctFunction(com.facebook.presto.operator.scalar.ArrayDistinctFunction) DECIMAL_MOD_FUNCTION(com.facebook.presto.operator.scalar.MathFunctions.DECIMAL_MOD_FUNCTION) NthValueFunction(com.facebook.presto.operator.window.NthValueFunction) MAX_BY_N_AGGREGATION(com.facebook.presto.operator.aggregation.MaxByNAggregationFunction.MAX_BY_N_AGGREGATION) ImmutableSet(com.google.common.collect.ImmutableSet) DECIMAL_LESS_THAN_OPERATOR(com.facebook.presto.type.DecimalInequalityOperators.DECIMAL_LESS_THAN_OPERATOR) Collection(java.util.Collection) CountAggregation(com.facebook.presto.operator.aggregation.CountAggregation) Collectors(java.util.stream.Collectors) ARRAY_REDUCE_FUNCTION(com.facebook.presto.operator.scalar.ArrayReduceFunction.ARRAY_REDUCE_FUNCTION) CacheLoader(com.google.common.cache.CacheLoader) DECIMAL_TO_BIGINT_CAST(com.facebook.presto.type.DecimalCasts.DECIMAL_TO_BIGINT_CAST) Re2JCastToRegexpFunction.castVarcharToRe2JRegexp(com.facebook.presto.operator.scalar.Re2JCastToRegexpFunction.castVarcharToRe2JRegexp) DECIMAL_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalToDecimalCasts.DECIMAL_TO_DECIMAL_CAST) WindowFunctionSupplier(com.facebook.presto.operator.window.WindowFunctionSupplier) AggregateWindowFunction.supplier(com.facebook.presto.operator.window.AggregateWindowFunction.supplier) QualifiedName(com.facebook.presto.sql.tree.QualifiedName) DECIMAL_ADD_OPERATOR(com.facebook.presto.type.DecimalOperators.DECIMAL_ADD_OPERATOR) DoubleHistogramAggregation(com.facebook.presto.operator.aggregation.DoubleHistogramAggregation) ROW_HASH_CODE(com.facebook.presto.operator.scalar.RowHashCodeOperator.ROW_HASH_CODE) JoniRegexpCasts(com.facebook.presto.operator.scalar.JoniRegexpCasts) UnknownOperators(com.facebook.presto.type.UnknownOperators) ArrayDistinctFromOperator(com.facebook.presto.operator.scalar.ArrayDistinctFromOperator) BooleanOperators(com.facebook.presto.type.BooleanOperators) BlockEncodingSerde(com.facebook.presto.spi.block.BlockEncodingSerde) Re2JRegexpFunctions(com.facebook.presto.operator.scalar.Re2JRegexpFunctions) ImmutableList(com.google.common.collect.ImmutableList) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) INTEGER_TO_DECIMAL_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.INTEGER_TO_DECIMAL_SATURATED_FLOOR_CAST) ArrayLessThanOperator(com.facebook.presto.operator.scalar.ArrayLessThanOperator) JsonOperators(com.facebook.presto.operator.scalar.JsonOperators) VARBINARY(com.facebook.presto.spi.type.VarbinaryType.VARBINARY) ArrayGreaterThanOrEqualOperator(com.facebook.presto.operator.scalar.ArrayGreaterThanOrEqualOperator) MAX_N_AGGREGATION(com.facebook.presto.operator.aggregation.MaxNAggregationFunction.MAX_N_AGGREGATION) DECIMAL_TO_INTEGER_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.DECIMAL_TO_INTEGER_SATURATED_FLOOR_CAST) RealCorrelationAggregation(com.facebook.presto.operator.aggregation.RealCorrelationAggregation) ArraySortFunction(com.facebook.presto.operator.scalar.ArraySortFunction) ArraySliceFunction(com.facebook.presto.operator.scalar.ArraySliceFunction) MAP_TO_JSON(com.facebook.presto.operator.scalar.MapToJsonCast.MAP_TO_JSON) HyperLogLogFunctions(com.facebook.presto.operator.scalar.HyperLogLogFunctions) RowNumberFunction(com.facebook.presto.operator.window.RowNumberFunction) JSON_TO_MAP(com.facebook.presto.operator.scalar.JsonToMapCast.JSON_TO_MAP) MAP_TRANSFORM_KEY_FUNCTION(com.facebook.presto.operator.scalar.MapTransformKeyFunction.MAP_TRANSFORM_KEY_FUNCTION) Ordering(com.google.common.collect.Ordering) ARRAY_SUBSCRIPT(com.facebook.presto.operator.scalar.ArraySubscriptOperator.ARRAY_SUBSCRIPT) BitwiseOrAggregation(com.facebook.presto.operator.aggregation.BitwiseOrAggregation) DECIMAL_TO_JSON_CAST(com.facebook.presto.type.DecimalCasts.DECIMAL_TO_JSON_CAST) EmptyMapConstructor(com.facebook.presto.operator.scalar.EmptyMapConstructor) ARRAY_JOIN(com.facebook.presto.operator.scalar.ArrayJoin.ARRAY_JOIN) DECIMAL_TO_VARCHAR_CAST(com.facebook.presto.type.DecimalCasts.DECIMAL_TO_VARCHAR_CAST) Arrays(java.util.Arrays) DECIMAL_TO_BOOLEAN_CAST(com.facebook.presto.type.DecimalCasts.DECIMAL_TO_BOOLEAN_CAST) LoadingCache(com.google.common.cache.LoadingCache) TypeManager(com.facebook.presto.spi.type.TypeManager) MapKeys(com.facebook.presto.operator.scalar.MapKeys) BIGINT_TO_DECIMAL_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.BIGINT_TO_DECIMAL_SATURATED_FLOOR_CAST) AGGREGATE(com.facebook.presto.metadata.FunctionKind.AGGREGATE) REAL_TO_DECIMAL_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.REAL_TO_DECIMAL_SATURATED_FLOOR_CAST) ROW_NOT_EQUAL(com.facebook.presto.operator.scalar.RowNotEqualOperator.ROW_NOT_EQUAL) BIGINT(com.facebook.presto.spi.type.BigintType.BIGINT) SmallintOperators(com.facebook.presto.type.SmallintOperators) ApproximateRealPercentileArrayAggregations(com.facebook.presto.operator.aggregation.ApproximateRealPercentileArrayAggregations) SqlWindowFunction(com.facebook.presto.operator.window.SqlWindowFunction) CharOperators(com.facebook.presto.type.CharOperators) MAP_CONSTRUCTOR(com.facebook.presto.operator.scalar.MapConstructor.MAP_CONSTRUCTOR) ArrayAggregationFunction(com.facebook.presto.operator.aggregation.ArrayAggregationFunction) MapCardinalityFunction(com.facebook.presto.operator.scalar.MapCardinalityFunction) LongSumAggregation(com.facebook.presto.operator.aggregation.LongSumAggregation) MapNotEqualOperator(com.facebook.presto.operator.scalar.MapNotEqualOperator) ROW_GREATER_THAN_OR_EQUAL(com.facebook.presto.operator.scalar.RowGreaterThanOrEqualOperator.ROW_GREATER_THAN_OR_EQUAL) LikeFunctions(com.facebook.presto.type.LikeFunctions) MethodHandles(java.lang.invoke.MethodHandles) TypeOfFunction(com.facebook.presto.operator.scalar.TypeOfFunction) Set(java.util.Set) RealSumAggregation(com.facebook.presto.operator.aggregation.RealSumAggregation) ThreadSafe(javax.annotation.concurrent.ThreadSafe) DECIMAL_TO_DOUBLE_CAST(com.facebook.presto.type.DecimalCasts.DECIMAL_TO_DOUBLE_CAST) ArrayGreaterThanOperator(com.facebook.presto.operator.scalar.ArrayGreaterThanOperator) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) MIN_AGGREGATION(com.facebook.presto.operator.aggregation.MinAggregationFunction.MIN_AGGREGATION) LEAST(com.facebook.presto.operator.scalar.Least.LEAST) DECIMAL_TO_INTEGER_CAST(com.facebook.presto.type.DecimalCasts.DECIMAL_TO_INTEGER_CAST) ApproximateLongPercentileArrayAggregations(com.facebook.presto.operator.aggregation.ApproximateLongPercentileArrayAggregations) DECIMAL_TO_TINYINT_CAST(com.facebook.presto.type.DecimalCasts.DECIMAL_TO_TINYINT_CAST) MergeHyperLogLogAggregation(com.facebook.presto.operator.aggregation.MergeHyperLogLogAggregation) IntervalYearMonthOperators(com.facebook.presto.type.IntervalYearMonthOperators) FUNCTION_IMPLEMENTATION_MISSING(com.facebook.presto.spi.StandardErrorCode.FUNCTION_IMPLEMENTATION_MISSING) ImmutableListMultimap(com.google.common.collect.ImmutableListMultimap) ArrayElementAtFunction(com.facebook.presto.operator.scalar.ArrayElementAtFunction) ROW_EQUAL(com.facebook.presto.operator.scalar.RowEqualOperator.ROW_EQUAL) BitwiseFunctions(com.facebook.presto.operator.scalar.BitwiseFunctions) RealOperators(com.facebook.presto.type.RealOperators) VarcharOperators(com.facebook.presto.type.VarcharOperators) MoreObjects.toStringHelper(com.google.common.base.MoreObjects.toStringHelper) SMALLINT_TO_DECIMAL_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.SMALLINT_TO_DECIMAL_SATURATED_FLOOR_CAST) Iterables(com.google.common.collect.Iterables) DOUBLE(com.facebook.presto.spi.type.DoubleType.DOUBLE) Slice(io.airlift.slice.Slice) ApproximateSetAggregation(com.facebook.presto.operator.aggregation.ApproximateSetAggregation) DoubleOperators(com.facebook.presto.type.DoubleOperators) MAX_AGGREGATION(com.facebook.presto.operator.aggregation.MaxAggregationFunction.MAX_AGGREGATION) DECIMAL_MODULUS_OPERATOR(com.facebook.presto.type.DecimalOperators.DECIMAL_MODULUS_OPERATOR) TypeSignatureProvider.fromTypes(com.facebook.presto.sql.analyzer.TypeSignatureProvider.fromTypes) DECIMAL_AVERAGE_AGGREGATION(com.facebook.presto.operator.aggregation.DecimalAverageAggregation.DECIMAL_AVERAGE_AGGREGATION) Multimaps(com.google.common.collect.Multimaps) ArrayList(java.util.ArrayList) MIN_N_AGGREGATION(com.facebook.presto.operator.aggregation.MinNAggregationFunction.MIN_N_AGGREGATION) REAL_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalCasts.REAL_TO_DECIMAL_CAST) RealAverageAggregation(com.facebook.presto.operator.aggregation.RealAverageAggregation) ArrayNotEqualOperator(com.facebook.presto.operator.scalar.ArrayNotEqualOperator) TimeWithTimeZoneOperators(com.facebook.presto.type.TimeWithTimeZoneOperators) DECIMAL_EQUAL_OPERATOR(com.facebook.presto.type.DecimalInequalityOperators.DECIMAL_EQUAL_OPERATOR) DECIMAL_DIVIDE_OPERATOR(com.facebook.presto.type.DecimalOperators.DECIMAL_DIVIDE_OPERATOR) ApproximateDoublePercentileAggregations(com.facebook.presto.operator.aggregation.ApproximateDoublePercentileAggregations) MIN_BY_N_AGGREGATION(com.facebook.presto.operator.aggregation.MinByNAggregationFunction.MIN_BY_N_AGGREGATION) DECIMAL_GREATER_THAN_OR_EQUAL_OPERATOR(com.facebook.presto.type.DecimalInequalityOperators.DECIMAL_GREATER_THAN_OR_EQUAL_OPERATOR) CAST_FROM_UNKNOWN(com.facebook.presto.operator.scalar.CastFromUnknownOperator.CAST_FROM_UNKNOWN) DenseRankFunction(com.facebook.presto.operator.window.DenseRankFunction) DECIMAL_TO_DECIMAL_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.DECIMAL_TO_DECIMAL_SATURATED_FLOOR_CAST) ArrayMaxFunction(com.facebook.presto.operator.scalar.ArrayMaxFunction) RealCovarianceAggregation(com.facebook.presto.operator.aggregation.RealCovarianceAggregation) ArrayLessThanOrEqualOperator(com.facebook.presto.operator.scalar.ArrayLessThanOrEqualOperator) BlockSerdeUtil(com.facebook.presto.block.BlockSerdeUtil) ArrayUnionFunction(com.facebook.presto.operator.scalar.ArrayUnionFunction) CumulativeDistributionFunction(com.facebook.presto.operator.window.CumulativeDistributionFunction) ARRAY_TRANSFORM_FUNCTION(com.facebook.presto.operator.scalar.ArrayTransformFunction.ARRAY_TRANSFORM_FUNCTION) SequenceFunction(com.facebook.presto.operator.scalar.SequenceFunction) RealRegressionAggregation(com.facebook.presto.operator.aggregation.RealRegressionAggregation) FailureFunction(com.facebook.presto.operator.scalar.FailureFunction) MapSubscriptOperator(com.facebook.presto.operator.scalar.MapSubscriptOperator) MULTIMAP_AGG(com.facebook.presto.operator.aggregation.MultimapAggregationFunction.MULTIMAP_AGG) BigintOperators(com.facebook.presto.type.BigintOperators) ARRAY_CONSTRUCTOR(com.facebook.presto.operator.scalar.ArrayConstructor.ARRAY_CONSTRUCTOR) ArraysOverlapFunction(com.facebook.presto.operator.scalar.ArraysOverlapFunction) ROW_GREATER_THAN(com.facebook.presto.operator.scalar.RowGreaterThanOperator.ROW_GREATER_THAN) GeometricMeanAggregations(com.facebook.presto.operator.aggregation.GeometricMeanAggregations) RealHistogramAggregation(com.facebook.presto.operator.aggregation.RealHistogramAggregation) BOOLEAN_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalCasts.BOOLEAN_TO_DECIMAL_CAST) ImmutableCollectors.toImmutableSet(com.facebook.presto.util.ImmutableCollectors.toImmutableSet) DECIMAL_BETWEEN_OPERATOR(com.facebook.presto.type.DecimalInequalityOperators.DECIMAL_BETWEEN_OPERATOR) DateTimeFunctions(com.facebook.presto.operator.scalar.DateTimeFunctions) BooleanOrAggregation(com.facebook.presto.operator.aggregation.BooleanOrAggregation) DOUBLE_TO_DECIMAL_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.DOUBLE_TO_DECIMAL_SATURATED_FLOOR_CAST) CharacterStringCasts(com.facebook.presto.operator.scalar.CharacterStringCasts) ZIP_FUNCTIONS(com.facebook.presto.operator.scalar.ZipFunction.ZIP_FUNCTIONS) IntervalDayTimeOperators(com.facebook.presto.type.IntervalDayTimeOperators) ApproximateLongPercentileAggregations(com.facebook.presto.operator.aggregation.ApproximateLongPercentileAggregations) MapDistinctFromOperator(com.facebook.presto.operator.scalar.MapDistinctFromOperator) FirstValueFunction(com.facebook.presto.operator.window.FirstValueFunction) String.format(java.lang.String.format) TypeUtils.resolveTypes(com.facebook.presto.type.TypeUtils.resolveTypes) Preconditions.checkState(com.google.common.base.Preconditions.checkState) TINYINT_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalCasts.TINYINT_TO_DECIMAL_CAST) List(java.util.List) ArrayShuffleFunction(com.facebook.presto.operator.scalar.ArrayShuffleFunction) ArrayIntersectFunction(com.facebook.presto.operator.scalar.ArrayIntersectFunction) ROW_TO_JSON(com.facebook.presto.operator.scalar.RowToJsonCast.ROW_TO_JSON) TypeSignatureProvider(com.facebook.presto.sql.analyzer.TypeSignatureProvider) Optional(java.util.Optional) MapToMapCast(com.facebook.presto.operator.scalar.MapToMapCast) CacheBuilder(com.google.common.cache.CacheBuilder) TypeSignature(com.facebook.presto.spi.type.TypeSignature) DOUBLE_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalCasts.DOUBLE_TO_DECIMAL_CAST) SMALLINT_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalCasts.SMALLINT_TO_DECIMAL_CAST) ScalarFunctionImplementation(com.facebook.presto.operator.scalar.ScalarFunctionImplementation) DateOperators(com.facebook.presto.type.DateOperators) PrestoException(com.facebook.presto.spi.PrestoException) Multimap(com.google.common.collect.Multimap) ZIP_WITH_FUNCTION(com.facebook.presto.operator.scalar.ZipWithFunction.ZIP_WITH_FUNCTION) StringFunctions(com.facebook.presto.operator.scalar.StringFunctions) DECIMAL_TO_TINYINT_SATURATED_FLOOR_CAST(com.facebook.presto.type.DecimalSaturatedFloorCasts.DECIMAL_TO_TINYINT_SATURATED_FLOOR_CAST) SCALAR(com.facebook.presto.metadata.FunctionKind.SCALAR) ROW_TO_ROW_CAST(com.facebook.presto.operator.scalar.RowToRowCast.ROW_TO_ROW_CAST) CombineHashFunction(com.facebook.presto.operator.scalar.CombineHashFunction) Objects.requireNonNull(java.util.Objects.requireNonNull) TypeSignatureProvider.fromTypeSignatures(com.facebook.presto.sql.analyzer.TypeSignatureProvider.fromTypeSignatures) COUNT_COLUMN(com.facebook.presto.operator.aggregation.CountColumn.COUNT_COLUMN) LeadFunction(com.facebook.presto.operator.window.LeadFunction) DoubleCorrelationAggregation(com.facebook.presto.operator.aggregation.DoubleCorrelationAggregation) DECIMAL_TO_REAL_CAST(com.facebook.presto.type.DecimalCasts.DECIMAL_TO_REAL_CAST) ArrayFilterFunction(com.facebook.presto.operator.scalar.ArrayFilterFunction) MapValues(com.facebook.presto.operator.scalar.MapValues) TinyintOperators(com.facebook.presto.type.TinyintOperators) Signature.internalOperator(com.facebook.presto.metadata.Signature.internalOperator) ArrayCardinalityFunction(com.facebook.presto.operator.scalar.ArrayCardinalityFunction) VarbinaryFunctions(com.facebook.presto.operator.scalar.VarbinaryFunctions) UrlFunctions(com.facebook.presto.operator.scalar.UrlFunctions) ARRAY_JOIN_WITH_NULL_REPLACEMENT(com.facebook.presto.operator.scalar.ArrayJoin.ARRAY_JOIN_WITH_NULL_REPLACEMENT) DECIMAL_TO_SMALLINT_CAST(com.facebook.presto.type.DecimalCasts.DECIMAL_TO_SMALLINT_CAST) VARCHAR_TO_DECIMAL_CAST(com.facebook.presto.type.DecimalCasts.VARCHAR_TO_DECIMAL_CAST) Primitives(com.google.common.primitives.Primitives) VarianceAggregation(com.facebook.presto.operator.aggregation.VarianceAggregation) ArrayRemoveFunction(com.facebook.presto.operator.scalar.ArrayRemoveFunction) MAP_CONCAT_FUNCTION(com.facebook.presto.operator.scalar.MapConcatFunction.MAP_CONCAT_FUNCTION) ROW_LESS_THAN_OR_EQUAL(com.facebook.presto.operator.scalar.RowLessThanOrEqualOperator.ROW_LESS_THAN_OR_EQUAL) ArrayHashCodeOperator(com.facebook.presto.operator.scalar.ArrayHashCodeOperator) ArrayMinFunction(com.facebook.presto.operator.scalar.ArrayMinFunction) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ROW_DISTINCT_FROM(com.facebook.presto.operator.scalar.RowDistinctFromOperator.ROW_DISTINCT_FROM) ROW_LESS_THAN(com.facebook.presto.operator.scalar.RowLessThanOperator.ROW_LESS_THAN) OperatorType(com.facebook.presto.spi.function.OperatorType) Type(com.facebook.presto.spi.type.Type) VarcharType(com.facebook.presto.spi.type.VarcharType) TypeSignature.parseTypeSignature(com.facebook.presto.spi.type.TypeSignature.parseTypeSignature) TypeSignature(com.facebook.presto.spi.type.TypeSignature) ArrayList(java.util.ArrayList) PrestoException(com.facebook.presto.spi.PrestoException)

Aggregations

Type (com.facebook.presto.spi.type.Type)392 Test (org.testng.annotations.Test)103 Block (com.facebook.presto.spi.block.Block)83 ImmutableList (com.google.common.collect.ImmutableList)79 ArrayType (com.facebook.presto.type.ArrayType)78 MapType (com.facebook.presto.type.MapType)72 Page (com.facebook.presto.spi.Page)68 PrestoException (com.facebook.presto.spi.PrestoException)51 List (java.util.List)50 VarcharType (com.facebook.presto.spi.type.VarcharType)48 DecimalType (com.facebook.presto.spi.type.DecimalType)44 BlockBuilder (com.facebook.presto.spi.block.BlockBuilder)40 MaterializedResult (com.facebook.presto.testing.MaterializedResult)40 ArrayList (java.util.ArrayList)40 MethodHandle (java.lang.invoke.MethodHandle)39 PlanNodeId (com.facebook.presto.sql.planner.plan.PlanNodeId)37 ImmutableMap (com.google.common.collect.ImmutableMap)36 Map (java.util.Map)36 Slice (io.airlift.slice.Slice)35 BlockBuilderStatus (com.facebook.presto.spi.block.BlockBuilderStatus)30