Search in sources :

Example 1 with TypeSignature

use of io.trino.spi.type.TypeSignature in project trino by trinodb.

the class MetadataManager method resolve.

@VisibleForTesting
public ResolvedFunction resolve(Session session, FunctionBinding functionBinding, FunctionMetadata functionMetadata, FunctionDependencyDeclaration declaration) {
    Map<TypeSignature, Type> dependentTypes = declaration.getTypeDependencies().stream().map(typeSignature -> applyBoundVariables(typeSignature, functionBinding)).collect(toImmutableMap(Function.identity(), typeManager::getType, (left, right) -> left));
    ImmutableSet.Builder<ResolvedFunction> functions = ImmutableSet.builder();
    declaration.getFunctionDependencies().stream().map(functionDependency -> {
        try {
            List<TypeSignature> argumentTypes = applyBoundVariables(functionDependency.getArgumentTypes(), functionBinding);
            return resolvedFunctionInternal(session, functionDependency.getName(), fromTypeSignatures(argumentTypes));
        } catch (TrinoException e) {
            if (functionDependency.isOptional()) {
                return null;
            }
            throw e;
        }
    }).filter(Objects::nonNull).forEach(functions::add);
    declaration.getOperatorDependencies().stream().map(operatorDependency -> {
        try {
            List<TypeSignature> argumentTypes = applyBoundVariables(operatorDependency.getArgumentTypes(), functionBinding);
            return resolvedFunctionInternal(session, QualifiedName.of(mangleOperatorName(operatorDependency.getOperatorType())), fromTypeSignatures(argumentTypes));
        } catch (TrinoException e) {
            if (operatorDependency.isOptional()) {
                return null;
            }
            throw e;
        }
    }).filter(Objects::nonNull).forEach(functions::add);
    declaration.getCastDependencies().stream().map(castDependency -> {
        try {
            Type fromType = typeManager.getType(applyBoundVariables(castDependency.getFromType(), functionBinding));
            Type toType = typeManager.getType(applyBoundVariables(castDependency.getToType(), functionBinding));
            return getCoercion(session, fromType, toType);
        } catch (TrinoException e) {
            if (castDependency.isOptional()) {
                return null;
            }
            throw e;
        }
    }).filter(Objects::nonNull).forEach(functions::add);
    return new ResolvedFunction(functionBinding.getBoundSignature(), functionBinding.getFunctionId(), functionMetadata.getKind(), functionMetadata.isDeterministic(), functionMetadata.getFunctionNullability(), dependentTypes, functions.build());
}
Also used : RedirectionAwareTableHandle.noRedirection(io.trino.metadata.RedirectionAwareTableHandle.noRedirection) TransactionManager(io.trino.transaction.TransactionManager) AggregateFunction(io.trino.spi.connector.AggregateFunction) TypeSignatureProvider.fromTypes(io.trino.sql.analyzer.TypeSignatureProvider.fromTypes) TypeOperators(io.trino.spi.type.TypeOperators) ConnectorTableExecuteHandle(io.trino.spi.connector.ConnectorTableExecuteHandle) Collections.singletonList(java.util.Collections.singletonList) NOT_SUPPORTED(io.trino.spi.StandardErrorCode.NOT_SUPPORTED) CatalogName(io.trino.connector.CatalogName) SystemSessionProperties.getRetryPolicy(io.trino.SystemSessionProperties.getRetryPolicy) ConnectorOutputTableHandle(io.trino.spi.connector.ConnectorOutputTableHandle) ConnectorTableHandle(io.trino.spi.connector.ConnectorTableHandle) Map(java.util.Map) ProjectionApplicationResult(io.trino.spi.connector.ProjectionApplicationResult) ENGLISH(java.util.Locale.ENGLISH) TABLE_REDIRECTION_ERROR(io.trino.spi.StandardErrorCode.TABLE_REDIRECTION_ERROR) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) MoreFutures.toListenableFuture(io.airlift.concurrent.MoreFutures.toListenableFuture) Set(java.util.Set) ConnectorExpressions(io.trino.sql.planner.ConnectorExpressions) LimitApplicationResult(io.trino.spi.connector.LimitApplicationResult) GuardedBy(javax.annotation.concurrent.GuardedBy) SchemaTableName(io.trino.spi.connector.SchemaTableName) MoreExecutors.directExecutor(com.google.common.util.concurrent.MoreExecutors.directExecutor) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) Stream(java.util.stream.Stream) TrinoPrincipal(io.trino.spi.security.TrinoPrincipal) ConnectorPartitioningHandle(io.trino.spi.connector.ConnectorPartitioningHandle) CatalogSchemaTableName(io.trino.spi.connector.CatalogSchemaTableName) SchemaTablePrefix(io.trino.spi.connector.SchemaTablePrefix) TableScanRedirectApplicationResult(io.trino.spi.connector.TableScanRedirectApplicationResult) FUNCTION_IMPLEMENTATION_MISSING(io.trino.spi.StandardErrorCode.FUNCTION_IMPLEMENTATION_MISSING) TableColumnsMetadata(io.trino.spi.connector.TableColumnsMetadata) INVALID_VIEW(io.trino.spi.StandardErrorCode.INVALID_VIEW) Session(io.trino.Session) Verify.verifyNotNull(com.google.common.base.Verify.verifyNotNull) ConnectorResolvedIndex(io.trino.spi.connector.ConnectorResolvedIndex) ConnectorInsertTableHandle(io.trino.spi.connector.ConnectorInsertTableHandle) JoinCondition(io.trino.spi.connector.JoinCondition) Slice(io.airlift.slice.Slice) ColumnMetadata(io.trino.spi.connector.ColumnMetadata) ConnectorTableMetadata(io.trino.spi.connector.ConnectorTableMetadata) QualifiedObjectName.convertFromSchemaTableName(io.trino.metadata.QualifiedObjectName.convertFromSchemaTableName) Variable(io.trino.spi.expression.Variable) TypeSignatureProvider.fromTypeSignatures(io.trino.sql.analyzer.TypeSignatureProvider.fromTypeSignatures) InMemoryTransactionManager.createTestTransactionManager(io.trino.transaction.InMemoryTransactionManager.createTestTransactionManager) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) OptionalLong(java.util.OptionalLong) Signature.mangleOperatorName(io.trino.metadata.Signature.mangleOperatorName) GrantInfo(io.trino.spi.security.GrantInfo) MaterializedViewFreshness(io.trino.spi.connector.MaterializedViewFreshness) Identity(io.trino.spi.security.Identity) ColumnHandle(io.trino.spi.connector.ColumnHandle) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) LinkedHashSet(java.util.LinkedHashSet) SCHEMA_NOT_FOUND(io.trino.spi.StandardErrorCode.SCHEMA_NOT_FOUND) ConstraintApplicationResult(io.trino.spi.connector.ConstraintApplicationResult) BlockTypeOperators(io.trino.type.BlockTypeOperators) ConnectorCapabilities(io.trino.spi.connector.ConnectorCapabilities) TESTING_TYPE_MANAGER(io.trino.type.InternalTypeManager.TESTING_TYPE_MANAGER) ConnectorSession(io.trino.spi.connector.ConnectorSession) RoleGrant(io.trino.spi.security.RoleGrant) OperatorType(io.trino.spi.function.OperatorType) Futures(com.google.common.util.concurrent.Futures) ConnectorExpression(io.trino.spi.expression.ConnectorExpression) TypeSignatureProvider(io.trino.sql.analyzer.TypeSignatureProvider) TableStatisticsMetadata(io.trino.spi.statistics.TableStatisticsMetadata) QueryId(io.trino.spi.QueryId) TypeNotFoundException(io.trino.spi.type.TypeNotFoundException) SortItem(io.trino.spi.connector.SortItem) SecurityManagement(io.trino.metadata.Catalog.SecurityManagement) TopNApplicationResult(io.trino.spi.connector.TopNApplicationResult) ConnectorMaterializedViewDefinition(io.trino.spi.connector.ConnectorMaterializedViewDefinition) RedirectionAwareTableHandle.withRedirectionTo(io.trino.metadata.RedirectionAwareTableHandle.withRedirectionTo) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) Locale(java.util.Locale) CatalogSchemaName(io.trino.spi.connector.CatalogSchemaName) ConnectorViewDefinition(io.trino.spi.connector.ConnectorViewDefinition) SignatureBinder.applyBoundVariables(io.trino.metadata.SignatureBinder.applyBoundVariables) SampleType(io.trino.spi.connector.SampleType) SampleApplicationResult(io.trino.spi.connector.SampleApplicationResult) TypeSignature(io.trino.spi.type.TypeSignature) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) FUNCTION_NOT_FOUND(io.trino.spi.StandardErrorCode.FUNCTION_NOT_FOUND) Collections.nCopies(java.util.Collections.nCopies) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ComputedStatistics(io.trino.spi.statistics.ComputedStatistics) PartitioningHandle(io.trino.sql.planner.PartitioningHandle) TrinoException(io.trino.spi.TrinoException) Streams(com.google.common.collect.Streams) AGGREGATE(io.trino.metadata.FunctionKind.AGGREGATE) ConnectorOutputMetadata(io.trino.spi.connector.ConnectorOutputMetadata) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) ConnectorTableSchema(io.trino.spi.connector.ConnectorTableSchema) Preconditions.checkState(com.google.common.base.Preconditions.checkState) Objects(java.util.Objects) SafeCaches.buildNonEvictableCache(io.trino.collect.cache.SafeCaches.buildNonEvictableCache) List(java.util.List) UNKNOWN(io.trino.client.NodeVersion.UNKNOWN) Assignment(io.trino.spi.connector.Assignment) BeginTableExecuteResult(io.trino.spi.connector.BeginTableExecuteResult) Entry(java.util.Map.Entry) Optional(java.util.Optional) CacheBuilder(com.google.common.cache.CacheBuilder) ConnectorMetadata(io.trino.spi.connector.ConnectorMetadata) SystemTable(io.trino.spi.connector.SystemTable) SYNTAX_ERROR(io.trino.spi.StandardErrorCode.SYNTAX_ERROR) Constraint(io.trino.spi.connector.Constraint) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Type(io.trino.spi.type.Type) HashMap(java.util.HashMap) Function(java.util.function.Function) ConnectorTableVersion(io.trino.spi.connector.ConnectorTableVersion) ConcurrentMap(java.util.concurrent.ConcurrentMap) Inject(javax.inject.Inject) JoinStatistics(io.trino.spi.connector.JoinStatistics) ImmutableList(com.google.common.collect.ImmutableList) JoinType(io.trino.spi.connector.JoinType) Verify.verify(com.google.common.base.Verify.verify) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) Objects.requireNonNull(java.util.Objects.requireNonNull) TableStatistics(io.trino.spi.statistics.TableStatistics) CacheUtils.uncheckedCacheGet(io.trino.collect.cache.CacheUtils.uncheckedCacheGet) NonEvictableCache(io.trino.collect.cache.NonEvictableCache) Privilege(io.trino.spi.security.Privilege) ResolvedFunctionDecoder(io.trino.metadata.ResolvedFunction.ResolvedFunctionDecoder) TupleDomain(io.trino.spi.predicate.TupleDomain) AggregationApplicationResult(io.trino.spi.connector.AggregationApplicationResult) QualifiedName(io.trino.sql.tree.QualifiedName) JoinApplicationResult(io.trino.spi.connector.JoinApplicationResult) FeaturesConfig(io.trino.FeaturesConfig) VisibleForTesting(com.google.common.annotations.VisibleForTesting) TypeManager(io.trino.spi.type.TypeManager) ConnectorTransactionHandle(io.trino.spi.connector.ConnectorTransactionHandle) TypeSignature(io.trino.spi.type.TypeSignature) OperatorType(io.trino.spi.function.OperatorType) SampleType(io.trino.spi.connector.SampleType) Type(io.trino.spi.type.Type) JoinType(io.trino.spi.connector.JoinType) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) ImmutableSet(com.google.common.collect.ImmutableSet) TrinoException(io.trino.spi.TrinoException) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 2 with TypeSignature

use of io.trino.spi.type.TypeSignature in project trino by trinodb.

the class GlobalFunctionCatalog method checkNotSpecializedTypeOperator.

/**
 * Type operators are handled automatically by the engine, so custom operator implementations
 * cannot be registered for these.
 */
private static void checkNotSpecializedTypeOperator(Signature signature) {
    String name = signature.getName();
    if (!isOperatorName(name)) {
        return;
    }
    OperatorType operatorType = unmangleOperator(name);
    // The trick here is the Generic*Operator implementations implement these exact signatures,
    // so we only these exact signatures to be registered.  Since, only a single function with
    // a specific signature can be registered, it prevents others from being registered.
    Type expectedReturnType;
    TypeVariableConstraint typeParameter;
    switch(operatorType) {
        case EQUAL:
        case IS_DISTINCT_FROM:
        case INDETERMINATE:
            expectedReturnType = BOOLEAN;
            typeParameter = comparableTypeParameter("T");
            break;
        case HASH_CODE:
        case XX_HASH_64:
            expectedReturnType = BIGINT;
            typeParameter = comparableTypeParameter("T");
            break;
        case COMPARISON_UNORDERED_FIRST:
        case COMPARISON_UNORDERED_LAST:
            expectedReturnType = INTEGER;
            typeParameter = orderableTypeParameter("T");
            break;
        case LESS_THAN:
        case LESS_THAN_OR_EQUAL:
            expectedReturnType = BOOLEAN;
            typeParameter = orderableTypeParameter("T");
            break;
        default:
            return;
    }
    Signature expectedSignature = new Signature(signature.getName(), ImmutableList.of(typeParameter), ImmutableList.of(), expectedReturnType.getTypeSignature(), Collections.nCopies(operatorType.getArgumentCount(), new TypeSignature("T")), false);
    checkArgument(signature.equals(expectedSignature), "Can not register %s functionMetadata: %s", operatorType, signature);
}
Also used : Type(io.trino.spi.type.Type) OperatorType(io.trino.spi.function.OperatorType) TypeSignature(io.trino.spi.type.TypeSignature) TypeSignature(io.trino.spi.type.TypeSignature) OperatorType(io.trino.spi.function.OperatorType)

Example 3 with TypeSignature

use of io.trino.spi.type.TypeSignature in project trino by trinodb.

the class ExtractSpatialJoins method addPartitioningNodes.

private static PlanNode addPartitioningNodes(PlannerContext plannerContext, Context context, PlanNode node, Symbol partitionSymbol, KdbTree kdbTree, Expression geometry, Optional<Expression> radius) {
    Assignments.Builder projections = Assignments.builder();
    for (Symbol outputSymbol : node.getOutputSymbols()) {
        projections.putIdentity(outputSymbol);
    }
    TypeSignature typeSignature = new TypeSignature(KDB_TREE_TYPENAME);
    FunctionCallBuilder spatialPartitionsCall = FunctionCallBuilder.resolve(context.getSession(), plannerContext.getMetadata()).setName(QualifiedName.of("spatial_partitions")).addArgument(typeSignature, new Cast(new StringLiteral(KdbTreeUtils.toJson(kdbTree)), toSqlType(plannerContext.getTypeManager().getType(typeSignature)))).addArgument(GEOMETRY_TYPE_SIGNATURE, geometry);
    radius.ifPresent(value -> spatialPartitionsCall.addArgument(DOUBLE, value));
    FunctionCall partitioningFunction = spatialPartitionsCall.build();
    Symbol partitionsSymbol = context.getSymbolAllocator().newSymbol(partitioningFunction, new ArrayType(INTEGER));
    projections.put(partitionsSymbol, partitioningFunction);
    return new UnnestNode(context.getIdAllocator().getNextId(), new ProjectNode(context.getIdAllocator().getNextId(), node, projections.build()), node.getOutputSymbols(), ImmutableList.of(new UnnestNode.Mapping(partitionsSymbol, ImmutableList.of(partitionSymbol))), Optional.empty(), INNER, Optional.empty());
}
Also used : Cast(io.trino.sql.tree.Cast) ArrayType(io.trino.spi.type.ArrayType) TypeSignature(io.trino.spi.type.TypeSignature) StringLiteral(io.trino.sql.tree.StringLiteral) UnnestNode(io.trino.sql.planner.plan.UnnestNode) Symbol(io.trino.sql.planner.Symbol) Assignments(io.trino.sql.planner.plan.Assignments) ProjectNode(io.trino.sql.planner.plan.ProjectNode) FunctionCall(io.trino.sql.tree.FunctionCall) FunctionCallBuilder(io.trino.sql.planner.FunctionCallBuilder)

Example 4 with TypeSignature

use of io.trino.spi.type.TypeSignature in project trino by trinodb.

the class SignatureBinder method checkNoLiteralVariableUsageAcrossTypes.

private static void checkNoLiteralVariableUsageAcrossTypes(TypeSignature typeSignature, Map<String, TypeSignature> existingUsages) {
    List<TypeSignatureParameter> variables = typeSignature.getParameters().stream().filter(TypeSignatureParameter::isVariable).collect(toList());
    for (TypeSignatureParameter variable : variables) {
        TypeSignature existing = existingUsages.get(variable.getVariable());
        if (existing != null && !existing.equals(typeSignature)) {
            throw new UnsupportedOperationException("Literal parameters may not be shared across different types");
        }
        existingUsages.put(variable.getVariable(), typeSignature);
    }
    for (TypeSignatureParameter parameter : typeSignature.getParameters()) {
        if (parameter.isLongLiteral() || parameter.isVariable()) {
            continue;
        }
        checkNoLiteralVariableUsageAcrossTypes(parameter.getTypeSignatureOrNamedTypeSignature().get(), existingUsages);
    }
}
Also used : NamedTypeSignature(io.trino.spi.type.NamedTypeSignature) TypeSignature(io.trino.spi.type.TypeSignature) TypeSignatureParameter(io.trino.spi.type.TypeSignatureParameter)

Example 5 with TypeSignature

use of io.trino.spi.type.TypeSignature in project trino by trinodb.

the class HiveTypeTranslator method toTypeSignature.

public static TypeSignature toTypeSignature(TypeInfo typeInfo, HiveTimestampPrecision timestampPrecision) {
    switch(typeInfo.getCategory()) {
        case PRIMITIVE:
            Type primitiveType = fromPrimitiveType((PrimitiveTypeInfo) typeInfo, timestampPrecision);
            if (primitiveType == null) {
                break;
            }
            return primitiveType.getTypeSignature();
        case MAP:
            MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;
            return mapType(toTypeSignature(mapTypeInfo.getMapKeyTypeInfo(), timestampPrecision), toTypeSignature(mapTypeInfo.getMapValueTypeInfo(), timestampPrecision));
        case LIST:
            ListTypeInfo listTypeInfo = (ListTypeInfo) typeInfo;
            TypeSignature elementType = toTypeSignature(listTypeInfo.getListElementTypeInfo(), timestampPrecision);
            return arrayType(typeParameter(elementType));
        case STRUCT:
            StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
            List<TypeInfo> fieldTypes = structTypeInfo.getAllStructFieldTypeInfos();
            List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
            if (fieldTypes.size() != fieldNames.size()) {
                throw new TrinoException(HiveErrorCode.HIVE_INVALID_METADATA, format("Invalid Hive struct type: %s", typeInfo));
            }
            return rowType(Streams.zip(// TODO: This is a hack. Trino engine should be able to handle identifiers in a case insensitive way where necessary.
            fieldNames.stream().map(s -> s.toLowerCase(Locale.US)), fieldTypes.stream().map(type -> toTypeSignature(type, timestampPrecision)), TypeSignatureParameter::namedField).collect(Collectors.toList()));
        case UNION:
            // Use a row type to represent a union type in Hive for reading
            UnionTypeInfo unionTypeInfo = (UnionTypeInfo) typeInfo;
            List<TypeInfo> unionObjectTypes = unionTypeInfo.getAllUnionObjectTypeInfos();
            ImmutableList.Builder<TypeSignatureParameter> typeSignatures = ImmutableList.builder();
            typeSignatures.add(namedField("tag", TINYINT.getTypeSignature()));
            for (int i = 0; i < unionObjectTypes.size(); i++) {
                TypeInfo unionObjectType = unionObjectTypes.get(i);
                typeSignatures.add(namedField("field" + i, toTypeSignature(unionObjectType, timestampPrecision)));
            }
            return rowType(typeSignatures.build());
    }
    throw new TrinoException(NOT_SUPPORTED, format("Unsupported Hive type: %s", typeInfo));
}
Also used : NamedTypeSignature(io.trino.spi.type.NamedTypeSignature) HiveUtil.isMapType(io.trino.plugin.hive.util.HiveUtil.isMapType) TypeInfoFactory.getMapTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getMapTypeInfo) HIVE_BYTE(io.trino.plugin.hive.HiveType.HIVE_BYTE) CharType.createCharType(io.trino.spi.type.CharType.createCharType) HiveChar(org.apache.hadoop.hive.common.type.HiveChar) MapTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo) NOT_SUPPORTED(io.trino.spi.StandardErrorCode.NOT_SUPPORTED) HIVE_FLOAT(io.trino.plugin.hive.HiveType.HIVE_FLOAT) TimestampType.createTimestampType(io.trino.spi.type.TimestampType.createTimestampType) Locale(java.util.Locale) StructTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo) PrimitiveTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo) INTEGER(io.trino.spi.type.IntegerType.INTEGER) SMALLINT(io.trino.spi.type.SmallintType.SMALLINT) TypeSignature(io.trino.spi.type.TypeSignature) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) TrinoException(io.trino.spi.TrinoException) HIVE_DATE(io.trino.plugin.hive.HiveType.HIVE_DATE) Streams(com.google.common.collect.Streams) HiveTimestampPrecision(io.trino.plugin.hive.HiveTimestampPrecision) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) List(java.util.List) VarcharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo) BIGINT(io.trino.spi.type.BigintType.BIGINT) HiveErrorCode(io.trino.plugin.hive.HiveErrorCode) TypeInfoFactory.getListTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getListTypeInfo) TypeSignature.mapType(io.trino.spi.type.TypeSignature.mapType) DecimalType(io.trino.spi.type.DecimalType) TypeSignatureParameter(io.trino.spi.type.TypeSignatureParameter) DATE(io.trino.spi.type.DateType.DATE) REAL(io.trino.spi.type.RealType.REAL) HIVE_BINARY(io.trino.plugin.hive.HiveType.HIVE_BINARY) TypeInfoFactory.getCharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getCharTypeInfo) TypeInfoFactory.getStructTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getStructTypeInfo) HIVE_DOUBLE(io.trino.plugin.hive.HiveType.HIVE_DOUBLE) TypeInfoFactory.getVarcharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getVarcharTypeInfo) HiveUtil.isRowType(io.trino.plugin.hive.util.HiveUtil.isRowType) Type(io.trino.spi.type.Type) BOOLEAN(io.trino.spi.type.BooleanType.BOOLEAN) VarcharType.createUnboundedVarcharType(io.trino.spi.type.VarcharType.createUnboundedVarcharType) TimestampType(io.trino.spi.type.TimestampType) TypeSignatureParameter.typeParameter(io.trino.spi.type.TypeSignatureParameter.typeParameter) VarcharType(io.trino.spi.type.VarcharType) HiveVarchar(org.apache.hadoop.hive.common.type.HiveVarchar) ImmutableList(com.google.common.collect.ImmutableList) Objects.requireNonNull(java.util.Objects.requireNonNull) ListTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo) VARBINARY(io.trino.spi.type.VarbinaryType.VARBINARY) HIVE_TIMESTAMP(io.trino.plugin.hive.HiveType.HIVE_TIMESTAMP) Nullable(javax.annotation.Nullable) DEFAULT_PRECISION(io.trino.plugin.hive.HiveTimestampPrecision.DEFAULT_PRECISION) TypeSignature.arrayType(io.trino.spi.type.TypeSignature.arrayType) TypeSignatureParameter.namedField(io.trino.spi.type.TypeSignatureParameter.namedField) HIVE_SHORT(io.trino.plugin.hive.HiveType.HIVE_SHORT) HiveUtil.isArrayType(io.trino.plugin.hive.util.HiveUtil.isArrayType) DecimalType.createDecimalType(io.trino.spi.type.DecimalType.createDecimalType) HIVE_LONG(io.trino.plugin.hive.HiveType.HIVE_LONG) DecimalTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo) HIVE_STRING(io.trino.plugin.hive.HiveType.HIVE_STRING) TypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo) DOUBLE(io.trino.spi.type.DoubleType.DOUBLE) UnionTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.UnionTypeInfo) HIVE_INT(io.trino.plugin.hive.HiveType.HIVE_INT) HIVE_BOOLEAN(io.trino.plugin.hive.HiveType.HIVE_BOOLEAN) TypeSignature.rowType(io.trino.spi.type.TypeSignature.rowType) CharType(io.trino.spi.type.CharType) TINYINT(io.trino.spi.type.TinyintType.TINYINT) VarcharType.createVarcharType(io.trino.spi.type.VarcharType.createVarcharType) CharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) ImmutableList(com.google.common.collect.ImmutableList) StructTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo) TypeInfoFactory.getStructTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getStructTypeInfo) TypeInfoFactory.getMapTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getMapTypeInfo) MapTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo) StructTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo) PrimitiveTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo) VarcharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo) TypeInfoFactory.getListTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getListTypeInfo) TypeInfoFactory.getCharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getCharTypeInfo) TypeInfoFactory.getStructTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getStructTypeInfo) TypeInfoFactory.getVarcharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getVarcharTypeInfo) ListTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo) DecimalTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo) TypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo) UnionTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.UnionTypeInfo) CharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo) HiveUtil.isMapType(io.trino.plugin.hive.util.HiveUtil.isMapType) CharType.createCharType(io.trino.spi.type.CharType.createCharType) TimestampType.createTimestampType(io.trino.spi.type.TimestampType.createTimestampType) TypeSignature.mapType(io.trino.spi.type.TypeSignature.mapType) DecimalType(io.trino.spi.type.DecimalType) HiveUtil.isRowType(io.trino.plugin.hive.util.HiveUtil.isRowType) Type(io.trino.spi.type.Type) VarcharType.createUnboundedVarcharType(io.trino.spi.type.VarcharType.createUnboundedVarcharType) TimestampType(io.trino.spi.type.TimestampType) VarcharType(io.trino.spi.type.VarcharType) TypeSignature.arrayType(io.trino.spi.type.TypeSignature.arrayType) HiveUtil.isArrayType(io.trino.plugin.hive.util.HiveUtil.isArrayType) DecimalType.createDecimalType(io.trino.spi.type.DecimalType.createDecimalType) TypeSignature.rowType(io.trino.spi.type.TypeSignature.rowType) CharType(io.trino.spi.type.CharType) VarcharType.createVarcharType(io.trino.spi.type.VarcharType.createVarcharType) NamedTypeSignature(io.trino.spi.type.NamedTypeSignature) TypeSignature(io.trino.spi.type.TypeSignature) TypeSignatureParameter(io.trino.spi.type.TypeSignatureParameter) TypeInfoFactory.getListTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getListTypeInfo) ListTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo) TypeInfoFactory.getMapTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getMapTypeInfo) MapTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo) TrinoException(io.trino.spi.TrinoException) UnionTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.UnionTypeInfo)

Aggregations

TypeSignature (io.trino.spi.type.TypeSignature)78 Test (org.testng.annotations.Test)49 TypeSignatureTranslator.parseTypeSignature (io.trino.sql.analyzer.TypeSignatureTranslator.parseTypeSignature)35 ImmutableList (com.google.common.collect.ImmutableList)19 Signature (io.trino.metadata.Signature)17 NamedTypeSignature (io.trino.spi.type.NamedTypeSignature)17 Type (io.trino.spi.type.Type)15 ArrayType (io.trino.spi.type.ArrayType)14 List (java.util.List)13 BoundSignature (io.trino.metadata.BoundSignature)11 Optional (java.util.Optional)10 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)9 ImmutableSet (com.google.common.collect.ImmutableSet)9 TrinoException (io.trino.spi.TrinoException)9 DecimalType (io.trino.spi.type.DecimalType)9 TypeSignatureParameter (io.trino.spi.type.TypeSignatureParameter)9 Objects.requireNonNull (java.util.Objects.requireNonNull)9 BIGINT (io.trino.spi.type.BigintType.BIGINT)8 SqlScalarFunction (io.trino.metadata.SqlScalarFunction)7 ADD (io.trino.spi.function.OperatorType.ADD)7