public static RowType rowType(List<NamedTypeSignature> elementTypeSignatures) { return (RowType) TYPE_MANAGER.getParameterizedType( StandardTypes.ROW, ImmutableList.copyOf(elementTypeSignatures.stream() .map(TypeSignatureParameter::of) .collect(toList()))); }
public static RowType rowType(List<NamedTypeSignature> elementTypeSignatures) { return (RowType) TYPE_MANAGER.getParameterizedType( StandardTypes.ROW, ImmutableList.copyOf(elementTypeSignatures.stream() .map(TypeSignatureParameter::of) .collect(toList()))); }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type valueType = boundVariables.getTypeVariable("T"); QuantileDigestType outputType = (QuantileDigestType) typeManager.getParameterizedType(StandardTypes.QDIGEST, ImmutableList.of(TypeSignatureParameter.of(valueType.getTypeSignature()))); return generateAggregation(valueType, outputType); }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type valueType = boundVariables.getTypeVariable("V"); QuantileDigestType outputType = (QuantileDigestType) typeManager.getParameterizedType( StandardTypes.QDIGEST, ImmutableList.of(TypeSignatureParameter.of(valueType.getTypeSignature()))); return generateAggregation(valueType, outputType, arity); }
public static MapType mapType(Type keyType, Type valueType) { return (MapType) TYPE_MANAGER.getParameterizedType(StandardTypes.MAP, ImmutableList.of( TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature()))); } }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type valueType = boundVariables.getTypeVariable("T"); QuantileDigestType outputType = (QuantileDigestType) typeManager.getParameterizedType(StandardTypes.QDIGEST, ImmutableList.of(TypeSignatureParameter.of(valueType.getTypeSignature()))); return generateAggregation(valueType, outputType); }
private Type getTypeNullName(int numFields) { ImmutableList.Builder<TypeSignatureParameter> typeSignatureParameters = ImmutableList.builder(); for (int i = 0; i < numFields; i++) { typeSignatureParameters.add(TypeSignatureParameter.of(new NamedTypeSignature(Optional.empty(), TEST_DATA_TYPE.getTypeSignature()))); } return TYPE_MANAGER.getParameterizedType(StandardTypes.ROW, typeSignatureParameters.build()); } }
@Override protected Type visitArrayConstructor(ArrayConstructor node, StackableAstVisitorContext<Context> context) { Type type = coerceToSingleType(context, "All ARRAY elements must be the same type: %s", node.getValues()); Type arrayType = typeManager.getParameterizedType(ARRAY.getName(), ImmutableList.of(TypeSignatureParameter.of(type.getTypeSignature()))); return setExpressionType(node, arrayType); }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type keyType = boundVariables.getTypeVariable("K"); Type outputType = typeManager.getParameterizedType(StandardTypes.MAP, ImmutableList.of( TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(BIGINT.getTypeSignature()))); return generateAggregation(NAME, keyType, outputType, groupMode); }
private Type getTypeNullName(int numFields) { ImmutableList.Builder<TypeSignatureParameter> typeSignatureParameters = ImmutableList.builder(); for (int i = 0; i < numFields; i++) { typeSignatureParameters.add(TypeSignatureParameter.of(new NamedTypeSignature(Optional.empty(), TEST_DATA_TYPE.getTypeSignature()))); } return TYPE_MANAGER.getParameterizedType(StandardTypes.ROW, typeSignatureParameters.build()); } }
@Override public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type elementType = boundVariables.getTypeVariable("E"); Type arrayType = typeManager.getParameterizedType(StandardTypes.ARRAY, ImmutableList.of(TypeSignatureParameter.of(elementType.getTypeSignature()))); MethodHandle methodHandle = METHOD_HANDLE.bindTo(elementType).bindTo(arrayType); return new ScalarFunctionImplementation( false, ImmutableList.of(valueTypeArgumentProperty(RETURN_NULL_ON_NULL)), methodHandle, isDeterministic()); }
@Override public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type elementType = boundVariables.getTypeVariable("E"); Type arrayType = typeManager.getParameterizedType(StandardTypes.ARRAY, ImmutableList.of(TypeSignatureParameter.of(elementType.getTypeSignature()))); MethodHandle methodHandle = METHOD_HANDLE.bindTo(elementType).bindTo(arrayType); return new ScalarFunctionImplementation( false, ImmutableList.of(valueTypeArgumentProperty(RETURN_NULL_ON_NULL)), methodHandle, isDeterministic()); }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); MapType outputType = (MapType) typeManager.getParameterizedType(StandardTypes.MAP, ImmutableList.of( TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature()))); return generateAggregation(keyType, valueType, outputType); }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); MapType outputType = (MapType) typeManager.getParameterizedType(StandardTypes.MAP, ImmutableList.of( TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature()))); return generateAggregation(keyType, valueType, outputType); }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); MapType outputType = (MapType) typeManager.getParameterizedType(StandardTypes.MAP, ImmutableList.of( TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature()))); return generateAggregation(keyType, valueType, outputType); }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); Type outputType = typeManager.getParameterizedType(StandardTypes.MAP, ImmutableList.of( TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(new ArrayType(valueType).getTypeSignature()))); return generateAggregation(keyType, valueType, outputType); }
private Type getType(List<String> fieldNames) { ImmutableList.Builder<TypeSignatureParameter> typeSignatureParameters = ImmutableList.builder(); for (String fieldName : fieldNames) { typeSignatureParameters.add(TypeSignatureParameter.of(new NamedTypeSignature(Optional.of(new RowFieldName(fieldName, false)), TEST_DATA_TYPE.getTypeSignature()))); } return TYPE_MANAGER.getParameterizedType(StandardTypes.ROW, typeSignatureParameters.build()); }
@Override public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); Type outputType = typeManager.getParameterizedType(StandardTypes.MAP, ImmutableList.of( TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(new ArrayType(valueType).getTypeSignature()))); return generateAggregation(keyType, valueType, outputType); }
public static MapType mapType(Type keyType, Type valueType) { return (MapType) TYPE_MANAGER.getParameterizedType(StandardTypes.MAP, ImmutableList.of( TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature()))); }
public static MapType mapType(Type keyType, Type valueType) { return (MapType) TYPE_MANAGER.getParameterizedType(StandardTypes.MAP, ImmutableList.of( TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature()))); }