@Override public Type getType(TypeSignature signature) { return typeManager.getType(signature); }
@Override public Type resolve(BoundVariables boundVariables, TypeManager typeManager, FunctionRegistry functionRegistry) { return typeManager.getType(applyBoundVariables(signature, boundVariables)); }
@Override protected Type _deserialize(String value, DeserializationContext context) { return typeManager.getType(parseTypeSignature(value)); } }
@Override protected Type _deserialize(String value, DeserializationContext context) { Type type = typeManager.getType(parseTypeSignature(value)); checkArgument(type != null, "Unknown type %s", value); return type; } }
@Override protected Type _deserialize(String value, DeserializationContext context) { return typeManager.getType(parseTypeSignature(value)); } }
@Override protected Type _deserialize(String value, DeserializationContext context) { return typeManager.getType(parseTypeSignature(value)); } }
@Override protected Type _deserialize(String value, DeserializationContext context) { Type type = typeManager.getType(parseTypeSignature(value)); checkArgument(type != null, "Unknown type %s", value); return type; } }
@Override public Type getType(TypeSignature signature) { return typeManager.getType(signature); }
@Override protected Type _deserialize(String value, DeserializationContext context) { Type type = typeManager.getType(parseTypeSignature(value)); checkArgument(type != null, "Unknown type %s", value); return type; } }
private boolean returnTypeIsTheSame(List<ApplicableFunction> applicableFunctions) { Set<Type> returnTypes = applicableFunctions.stream() .map(function -> typeManager.getType(function.getBoundSignature().getReturnType())) .collect(Collectors.toSet()); return returnTypes.size() == 1; }
public static Optional<List<Type>> toTypes(List<TypeSignatureProvider> typeSignatureProviders, TypeManager typeManager) { ImmutableList.Builder<Type> resultBuilder = ImmutableList.builder(); for (TypeSignatureProvider typeSignatureProvider : typeSignatureProviders) { if (typeSignatureProvider.hasDependency()) { return Optional.empty(); } resultBuilder.add(typeManager.getType(typeSignatureProvider.getTypeSignature())); } return Optional.of(resultBuilder.build()); }
public ColumnMetadata toColumnMetadata(TypeManager typeManager) { return new ColumnMetadata( name, typeManager.getType(parseTypeSignature(type)), comment, hidden); }
private void verifyTypeSignature(Symbol symbol, TypeSignature expected, TypeSignature actual) { // UNKNOWN should be considered as a wildcard type, which matches all the other types TypeManager typeManager = metadata.getTypeManager(); if (!actual.equals(UNKNOWN.getTypeSignature()) && !typeManager.isTypeOnlyCoercion(typeManager.getType(actual), typeManager.getType(expected))) { checkArgument(expected.equals(actual), "type of symbol '%s' is expected to be %s, but the actual type is %s", symbol, expected, actual); } } }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type inputType = typeManager.getType(getOnlyElement(applyBoundVariables(getSignature().getArgumentTypes(), boundVariables))); Type outputType = typeManager.getType(applyBoundVariables(getSignature().getReturnType(), boundVariables)); return generateAggregation(inputType, outputType); }
private boolean satisfiesCoercion(boolean allowCoercion, Type fromType, TypeSignature toTypeSignature) { if (allowCoercion) { return typeManager.canCoerce(fromType, typeManager.getType(toTypeSignature)); } else { return fromType.getTypeSignature().equals(toTypeSignature); } }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type type = typeManager.getType(getOnlyElement(applyBoundVariables(getSignature().getArgumentTypes(), boundVariables))); return generateAggregation(type); }
private void checkPartitionTypesSupported(List<Column> partitionColumns) { for (Column partitionColumn : partitionColumns) { Type partitionType = typeManager.getType(partitionColumn.getType().getTypeSignature()); verifyPartitionTypeSupported(partitionColumn.getName(), partitionType); } }
@Override public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle tableHandle) { AtopTableHandle atopTableHandle = (AtopTableHandle) tableHandle; ImmutableList.Builder<ColumnMetadata> columns = ImmutableList.builder(); for (AtopColumn column : atopTableHandle.getTable().getColumns()) { columns.add(new ColumnMetadata(column.getName(), typeManager.getType(column.getType()))); } SchemaTableName schemaTableName = new SchemaTableName(atopTableHandle.getSchema(), atopTableHandle.getTable().getName()); return new ConnectorTableMetadata(schemaTableName, columns.build()); }
private MongoColumnHandle buildColumnHandle(Document columnMeta) { String name = columnMeta.getString(FIELDS_NAME_KEY); String typeString = columnMeta.getString(FIELDS_TYPE_KEY); boolean hidden = columnMeta.getBoolean(FIELDS_HIDDEN_KEY, false); Type type = typeManager.getType(TypeSignature.parseTypeSignature(typeString)); return new MongoColumnHandle(name, type, hidden); }
@Test public void testDisplayName() { TypeManager typeManager = new TypeRegistry(); Type function = typeManager.getType(TypeSignature.parseTypeSignature("function<row(field double),bigint>")); assertEquals(function.getDisplayName(), "function<row(field double),bigint>"); } }