public SignatureBuilder operatorType(OperatorType operatorType) { this.name = mangleOperatorName(requireNonNull(operatorType, "operatorType is null")); this.kind = SCALAR; return this; }
private ScalarImplementationHeader(OperatorType operatorType, ScalarHeader header) { this.name = mangleOperatorName(operatorType); this.operatorType = Optional.of(operatorType); this.header = requireNonNull(header); }
protected SqlOperator(OperatorType operatorType, List<TypeVariableConstraint> typeVariableConstraints, List<LongVariableConstraint> longVariableConstraints, TypeSignature returnType, List<TypeSignature> argumentTypes) { // TODO This should take Signature! super(new Signature( mangleOperatorName(operatorType), FunctionKind.SCALAR, typeVariableConstraints, longVariableConstraints, returnType, argumentTypes, false)); }
public static Signature internalOperator(String name, TypeSignature returnType, List<TypeSignature> argumentTypes) { return internalScalarFunction(mangleOperatorName(name), returnType, argumentTypes); }
public static Signature internalOperator(String name, TypeSignature returnType, TypeSignature... argumentTypes) { return internalScalarFunction(mangleOperatorName(name), returnType, ImmutableList.copyOf(argumentTypes)); }
public static String mangleOperatorName(OperatorType operatorType) { return mangleOperatorName(operatorType.name()); }
private static boolean isOperator(Signature signature) { for (OperatorType operator : OperatorType.values()) { if (signature.getName().equals(FunctionRegistry.mangleOperatorName(operator))) { return true; } } return false; }
public static Signature internalOperator(OperatorType operator, TypeSignature returnType, List<TypeSignature> argumentTypes) { return internalScalarFunction(mangleOperatorName(operator.name()), returnType, argumentTypes); }
public static Signature internalOperator(OperatorType operator, Type returnType, List<? extends Type> argumentTypes) { return internalScalarFunction(mangleOperatorName(operator.name()), returnType.getTypeSignature(), argumentTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())); }
protected void assertOperator(OperatorType operator, String value, Type expectedType, Object expected) { functionAssertions.assertFunction(format("\"%s\"(%s)", mangleOperatorName(operator), value), expectedType, expected); }
if (callName.equals(mangleOperatorName(EQUAL)) || callName.equals(mangleOperatorName(NOT_EQUAL)) || callName.equals(mangleOperatorName(IS_DISTINCT_FROM))) { if (callName.equals(mangleOperatorName(GREATER_THAN)) || callName.equals(mangleOperatorName(GREATER_THAN_OR_EQUAL))) { callName.equals(mangleOperatorName(GREATER_THAN)) ? mangleOperatorName(LESS_THAN) : mangleOperatorName(LESS_THAN_OR_EQUAL), SCALAR, call.getSignature().getTypeVariableConstraints(),
public Signature resolveOperator(OperatorType operatorType, List<? extends Type> argumentTypes) throws OperatorNotFoundException { try { return resolveFunction(QualifiedName.of(mangleOperatorName(operatorType)), fromTypes(argumentTypes)); } catch (PrestoException e) { if (e.getErrorCode().getCode() == FUNCTION_NOT_FOUND.toErrorCode().getCode()) { throw new OperatorNotFoundException( operatorType, argumentTypes.stream() .map(Type::getTypeSignature) .collect(toImmutableList())); } else { throw e; } } }
@Test public void testIdentityCast() { TypeRegistry typeManager = new TypeRegistry(); FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); Signature exactOperator = registry.getCoercion(HYPER_LOG_LOG, HYPER_LOG_LOG); assertEquals(exactOperator.getName(), mangleOperatorName(OperatorType.CAST.name())); assertEquals(transform(exactOperator.getArgumentTypes(), Functions.toStringFunction()), ImmutableList.of(StandardTypes.HYPER_LOG_LOG)); assertEquals(exactOperator.getReturnType().getBase(), StandardTypes.HYPER_LOG_LOG); }
protected SqlOperator(OperatorType operatorType, TypeSignature returnType, List<TypeSignature> argumentTypes, Set<String> literalParameters) { super(mangleOperatorName(operatorType), returnType, argumentTypes, literalParameters); }
protected SqlOperator(OperatorType operatorType, List<TypeParameterRequirement> typeParameterRequirements, String returnType, List<String> argumentTypes) { super(mangleOperatorName(operatorType), typeParameterRequirements, returnType, argumentTypes); }
public static Signature internalOperator(String name, TypeSignature returnType, TypeSignature... argumentTypes) { return internalScalarFunction(mangleOperatorName(name), returnType, ImmutableList.copyOf(argumentTypes)); }
public static String mangleOperatorName(OperatorType operatorType) { return mangleOperatorName(operatorType.name()); }
public static Signature internalOperator(OperatorType operator, String returnType, List<String> argumentTypes) { return internalScalarFunction(mangleOperatorName(operator.name()), returnType, argumentTypes); }
public static Signature internalOperator(OperatorType operator, Type returnType, List<? extends Type> argumentTypes) { return internalScalarFunction(mangleOperatorName(operator.name()), returnType.getTypeSignature(), argumentTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())); }
@Test public void testIdentityCast() { TypeRegistry typeManager = new TypeRegistry(); FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), true); Signature exactOperator = registry.getCoercion(HYPER_LOG_LOG, HYPER_LOG_LOG); assertEquals(exactOperator.getName(), mangleOperatorName(OperatorType.CAST.name())); assertEquals(transform(exactOperator.getArgumentTypes(), Functions.toStringFunction()), ImmutableList.of(StandardTypes.HYPER_LOG_LOG)); assertEquals(exactOperator.getReturnType().getBase(), StandardTypes.HYPER_LOG_LOG); }