Skip to content

Commit

Permalink
Rename internalFunction to internalScalarFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Oct 5, 2015
1 parent b94cb37 commit 3a925b7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
Expand Up @@ -96,30 +96,30 @@ public Signature(String name, TypeSignature returnType, TypeSignature... argumen

public static Signature internalOperator(String name, TypeSignature returnType, List<TypeSignature> argumentTypes)
{
return internalFunction(mangleOperatorName(name), returnType, argumentTypes);
return internalScalarFunction(mangleOperatorName(name), returnType, argumentTypes);
}

public static Signature internalOperator(String name, TypeSignature returnType, TypeSignature... argumentTypes)
{
return internalFunction(mangleOperatorName(name), returnType, ImmutableList.copyOf(argumentTypes));
return internalScalarFunction(mangleOperatorName(name), returnType, ImmutableList.copyOf(argumentTypes));
}

public static Signature internalFunction(String name, String returnType, String... argumentTypes)
public static Signature internalScalarFunction(String name, String returnType, String... argumentTypes)
{
return internalFunction(name, returnType, ImmutableList.copyOf(argumentTypes));
return internalScalarFunction(name, returnType, ImmutableList.copyOf(argumentTypes));
}

public static Signature internalFunction(String name, String returnType, List<String> argumentTypes)
public static Signature internalScalarFunction(String name, String returnType, List<String> argumentTypes)
{
return new Signature(name, ImmutableList.<TypeParameter>of(), returnType, argumentTypes, false, true);
}

public static Signature internalFunction(String name, TypeSignature returnType, TypeSignature... argumentTypes)
public static Signature internalScalarFunction(String name, TypeSignature returnType, TypeSignature... argumentTypes)
{
return internalFunction(name, returnType, ImmutableList.copyOf(argumentTypes));
return internalScalarFunction(name, returnType, ImmutableList.copyOf(argumentTypes));
}

public static Signature internalFunction(String name, TypeSignature returnType, List<TypeSignature> argumentTypes)
public static Signature internalScalarFunction(String name, TypeSignature returnType, List<TypeSignature> argumentTypes)
{
return new Signature(name, ImmutableList.<TypeParameter>of(), returnType, argumentTypes, false, true);
}
Expand Down
Expand Up @@ -47,6 +47,7 @@
import static com.facebook.presto.byteCode.Access.a;
import static com.facebook.presto.byteCode.Parameter.arg;
import static com.facebook.presto.byteCode.ParameterizedType.type;
import static com.facebook.presto.metadata.Signature.internalScalarFunction;
import static com.facebook.presto.metadata.Signature.orderableTypeParameter;
import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
import static com.facebook.presto.sql.gen.ByteCodeUtils.invoke;
Expand Down Expand Up @@ -106,7 +107,7 @@ public FunctionInfo specialize(Map<String, Type> types, int arity, TypeManager t
MethodHandle methodHandle = methodHandle(clazz, signature.getName(), javaTypes.toArray(new Class<?>[javaTypes.size()]));
List<Boolean> nullableParameters = ImmutableList.copyOf(Collections.nCopies(javaTypes.size(), false));

Signature specializedSignature = Signature.internalFunction(signature.getName(), type.getTypeSignature(), Collections.nCopies(arity, type.getTypeSignature()));
Signature specializedSignature = internalScalarFunction(signature.getName(), type.getTypeSignature(), Collections.nCopies(arity, type.getTypeSignature()));
return new FunctionInfo(specializedSignature, getDescription(), isHidden(), methodHandle, isDeterministic(), false, nullableParameters);
}

Expand Down
Expand Up @@ -51,7 +51,7 @@
import static com.facebook.presto.byteCode.expression.ByteCodeExpressions.add;
import static com.facebook.presto.byteCode.expression.ByteCodeExpressions.constantInt;
import static com.facebook.presto.byteCode.expression.ByteCodeExpressions.invokeStatic;
import static com.facebook.presto.metadata.Signature.internalFunction;
import static com.facebook.presto.metadata.Signature.internalScalarFunction;
import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
import static com.facebook.presto.sql.gen.CompilerUtils.defineClass;
Expand Down Expand Up @@ -101,7 +101,7 @@ public FunctionInfo specialize(Map<String, Type> types, int arity, TypeManager t
MethodHandle methodHandle = methodHandle(clazz, "concat", Collections.nCopies(arity, Slice.class).toArray(new Class<?>[arity]));
List<Boolean> nullableParameters = ImmutableList.copyOf(Collections.nCopies(arity, false));

Signature specializedSignature = internalFunction(SIGNATURE.getName(), VARCHAR.getTypeSignature(), Collections.nCopies(arity, VARCHAR.getTypeSignature()));
Signature specializedSignature = internalScalarFunction(SIGNATURE.getName(), VARCHAR.getTypeSignature(), Collections.nCopies(arity, VARCHAR.getTypeSignature()));
return new FunctionInfo(specializedSignature, getDescription(), isHidden(), methodHandle, isDeterministic(), false, nullableParameters);
}

Expand Down
Expand Up @@ -25,7 +25,7 @@
import java.lang.invoke.MethodHandle;
import java.util.Map;

import static com.facebook.presto.metadata.Signature.internalFunction;
import static com.facebook.presto.metadata.Signature.internalScalarFunction;
import static com.facebook.presto.metadata.Signature.typeParameter;
import static com.facebook.presto.type.UnknownType.UNKNOWN;
import static java.lang.invoke.MethodHandles.catchException;
Expand Down Expand Up @@ -86,7 +86,7 @@ public FunctionInfo specialize(Map<String, Type> types, int arity, TypeManager t
}

return new FunctionInfo(
internalFunction(SIGNATURE.getName(), toType.getTypeSignature(), ImmutableList.of(fromType.getTypeSignature())),
internalScalarFunction(SIGNATURE.getName(), toType.getTypeSignature(), ImmutableList.of(fromType.getTypeSignature())),
getDescription(),
isHidden(),
tryCastHandle,
Expand Down
Expand Up @@ -29,8 +29,8 @@

import static com.facebook.presto.metadata.FunctionRegistry.mangleOperatorName;
import static com.facebook.presto.metadata.OperatorType.SUBSCRIPT;
import static com.facebook.presto.metadata.Signature.internalFunction;
import static com.facebook.presto.metadata.Signature.internalOperator;
import static com.facebook.presto.metadata.Signature.internalScalarFunction;
import static com.facebook.presto.spi.type.TypeSignature.parseTypeSignature;
import static com.facebook.presto.sql.tree.ArrayConstructor.ARRAY_CONSTRUCTOR;

Expand Down Expand Up @@ -62,28 +62,28 @@ public static Signature betweenSignature(Type valueType, Type minType, Type maxT

public static Signature likeSignature()
{
return internalFunction("LIKE", StandardTypes.BOOLEAN, StandardTypes.VARCHAR, LikePatternType.NAME);
return internalScalarFunction("LIKE", StandardTypes.BOOLEAN, StandardTypes.VARCHAR, LikePatternType.NAME);
}

public static Signature likePatternSignature()
{
return internalFunction("LIKE_PATTERN", LikePatternType.NAME, StandardTypes.VARCHAR, StandardTypes.VARCHAR);
return internalScalarFunction("LIKE_PATTERN", LikePatternType.NAME, StandardTypes.VARCHAR, StandardTypes.VARCHAR);
}

public static Signature castSignature(Type returnType, Type valueType)
{
// Name has already been mangled, so don't use internalOperator
return internalFunction(CAST, returnType.getTypeSignature(), valueType.getTypeSignature());
return internalScalarFunction(CAST, returnType.getTypeSignature(), valueType.getTypeSignature());
}

public static Signature tryCastSignature(Type returnType, Type valueType)
{
return internalFunction(TRY_CAST, returnType.getTypeSignature(), valueType.getTypeSignature());
return internalScalarFunction(TRY_CAST, returnType.getTypeSignature(), valueType.getTypeSignature());
}

public static Signature logicalExpressionSignature(LogicalBinaryExpression.Type expressionType)
{
return internalFunction(expressionType.name(), StandardTypes.BOOLEAN, StandardTypes.BOOLEAN, StandardTypes.BOOLEAN);
return internalScalarFunction(expressionType.name(), StandardTypes.BOOLEAN, StandardTypes.BOOLEAN, StandardTypes.BOOLEAN);
}

public static Signature arithmeticNegationSignature(Type returnType, Type valueType)
Expand All @@ -103,12 +103,12 @@ public static Signature subscriptSignature(Type returnType, Type leftType, Type

public static Signature arrayConstructorSignature(Type returnType, List<? extends Type> argumentTypes)
{
return internalFunction(ARRAY_CONSTRUCTOR, returnType.getTypeSignature(), Lists.transform(argumentTypes, Type::getTypeSignature));
return internalScalarFunction(ARRAY_CONSTRUCTOR, returnType.getTypeSignature(), Lists.transform(argumentTypes, Type::getTypeSignature));
}

public static Signature arrayConstructorSignature(TypeSignature returnType, List<TypeSignature> argumentTypes)
{
return internalFunction(ARRAY_CONSTRUCTOR, returnType, argumentTypes);
return internalScalarFunction(ARRAY_CONSTRUCTOR, returnType, argumentTypes);
}

public static Signature comparisonExpressionSignature(ComparisonExpression.Type expressionType, Type leftType, Type rightType)
Expand All @@ -118,7 +118,7 @@ public static Signature comparisonExpressionSignature(ComparisonExpression.Type
return internalOperator(expressionType.name(), parseTypeSignature(StandardTypes.BOOLEAN), leftType.getTypeSignature(), rightType.getTypeSignature());
}
}
return internalFunction(expressionType.name(), parseTypeSignature(StandardTypes.BOOLEAN), leftType.getTypeSignature(), rightType.getTypeSignature());
return internalScalarFunction(expressionType.name(), parseTypeSignature(StandardTypes.BOOLEAN), leftType.getTypeSignature(), rightType.getTypeSignature());
}

// **************** special forms (lazy evaluation, etc) ****************
Expand All @@ -145,17 +145,17 @@ public static Signature whenSignature(Type returnType)
// **************** functions that require varargs and/or complex types (e.g., lists) ****************
public static Signature inSignature()
{
return internalFunction(IN, StandardTypes.BOOLEAN);
return internalScalarFunction(IN, StandardTypes.BOOLEAN);
}

// **************** functions that need to do special null handling ****************
public static Signature isNullSignature(Type argumentType)
{
return internalFunction(IS_NULL, parseTypeSignature(StandardTypes.BOOLEAN), argumentType.getTypeSignature());
return internalScalarFunction(IS_NULL, parseTypeSignature(StandardTypes.BOOLEAN), argumentType.getTypeSignature());
}

public static Signature coalesceSignature(Type returnType, List<Type> argumentTypes)
{
return internalFunction(COALESCE, returnType.getTypeSignature(), Lists.transform(argumentTypes, Type::getTypeSignature));
return internalScalarFunction(COALESCE, returnType.getTypeSignature(), Lists.transform(argumentTypes, Type::getTypeSignature));
}
}

0 comments on commit 3a925b7

Please sign in to comment.