Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,18 @@ protected SymbolStatsEstimate visitConstant(Constant node, Void context)
@Override
protected SymbolStatsEstimate visitCall(Call node, Void context)
{
if (node.function().getName().equals(builtinFunctionName(NEGATION))) {
if (node.function().name().equals(builtinFunctionName(NEGATION))) {
SymbolStatsEstimate stats = process(node.arguments().getFirst());
return SymbolStatsEstimate.buildFrom(stats)
.setLowValue(-stats.getHighValue())
.setHighValue(-stats.getLowValue())
.build();
}
else if (node.function().getName().equals(builtinFunctionName(ADD)) ||
node.function().getName().equals(builtinFunctionName(SUBTRACT)) ||
node.function().getName().equals(builtinFunctionName(MULTIPLY)) ||
node.function().getName().equals(builtinFunctionName(DIVIDE)) ||
node.function().getName().equals(builtinFunctionName(MODULUS))) {
else if (node.function().name().equals(builtinFunctionName(ADD)) ||
node.function().name().equals(builtinFunctionName(SUBTRACT)) ||
node.function().name().equals(builtinFunctionName(MULTIPLY)) ||
node.function().name().equals(builtinFunctionName(DIVIDE)) ||
node.function().name().equals(builtinFunctionName(MODULUS))) {
return processArithmetic(node);
}

Expand Down Expand Up @@ -214,11 +214,11 @@ protected SymbolStatsEstimate processArithmetic(Call node)
result.setLowValue(NaN)
.setHighValue(NaN);
}
else if (node.function().getName().equals(builtinFunctionName(DIVIDE)) && rightLow < 0 && rightHigh > 0) {
else if (node.function().name().equals(builtinFunctionName(DIVIDE)) && rightLow < 0 && rightHigh > 0) {
result.setLowValue(Double.NEGATIVE_INFINITY)
.setHighValue(Double.POSITIVE_INFINITY);
}
else if (node.function().getName().equals(builtinFunctionName(MODULUS))) {
else if (node.function().name().equals(builtinFunctionName(MODULUS))) {
double maxDivisor = max(abs(rightLow), abs(rightHigh));
if (leftHigh <= 0) {
result.setLowValue(max(-maxDivisor, leftLow))
Expand All @@ -234,10 +234,10 @@ else if (leftLow >= 0) {
}
}
else {
double v1 = operate(node.function().getName(), leftLow, rightLow);
double v2 = operate(node.function().getName(), leftLow, rightHigh);
double v3 = operate(node.function().getName(), leftHigh, rightLow);
double v4 = operate(node.function().getName(), leftHigh, rightHigh);
double v1 = operate(node.function().name(), leftLow, rightLow);
double v2 = operate(node.function().name(), leftLow, rightHigh);
double v3 = operate(node.function().name(), leftHigh, rightLow);
double v4 = operate(node.function().name(), leftHigh, rightHigh);
double lowValue = min(v1, v2, v3, v4);
double highValue = max(v1, v2, v3, v4);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private ResolvedOperatorAndCoercions resolveOperators(OperatorType operatorType,
return RESOLUTION_ERROR;
}

BoundSignature signature = operator.getSignature();
BoundSignature signature = operator.signature();

Optional<ResolvedFunction> leftCast = Optional.empty();
if (!signature.getArgumentTypes().get(0).equals(leftType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ protected List<Object> visitIrArithmeticBinary(IrArithmeticBinary node, PathEval
throw new PathEvaluationException(e);
}

return ImmutableList.of(TypedValue.fromValueAsObject(operators.getOperator().getSignature().getReturnType(), result));
return ImmutableList.of(TypedValue.fromValueAsObject(operators.getOperator().signature().getReturnType(), result));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ public ScalarFunctionImplementation getScalarFunctionImplementation(ResolvedFunc
private ScalarFunctionImplementation getScalarFunctionImplementationInternal(ResolvedFunction resolvedFunction, InvocationConvention invocationConvention)
{
ScalarFunctionImplementation scalarFunctionImplementation;
if (isTrinoSqlLanguageFunction(resolvedFunction.getFunctionId())) {
scalarFunctionImplementation = languageFunctionProvider.specialize(resolvedFunction.getFunctionId(), invocationConvention, this);
if (isTrinoSqlLanguageFunction(resolvedFunction.functionId())) {
scalarFunctionImplementation = languageFunctionProvider.specialize(resolvedFunction.functionId(), invocationConvention, this);
}
else {
FunctionDependencies functionDependencies = getFunctionDependencies(resolvedFunction);
scalarFunctionImplementation = getFunctionProvider(resolvedFunction).getScalarFunctionImplementation(
resolvedFunction.getFunctionId(),
resolvedFunction.getSignature(),
resolvedFunction.functionId(),
resolvedFunction.signature(),
functionDependencies,
invocationConvention);
}

verifyMethodHandleSignature(resolvedFunction.getSignature(), scalarFunctionImplementation, invocationConvention);
verifyMethodHandleSignature(resolvedFunction.signature(), scalarFunctionImplementation, invocationConvention);
return scalarFunctionImplementation;
}

Expand All @@ -132,8 +132,8 @@ private AggregationImplementation getAggregationImplementationInternal(ResolvedF
{
FunctionDependencies functionDependencies = getFunctionDependencies(resolvedFunction);
return getFunctionProvider(resolvedFunction).getAggregationImplementation(
resolvedFunction.getFunctionId(),
resolvedFunction.getSignature(),
resolvedFunction.functionId(),
resolvedFunction.signature(),
functionDependencies);
}

Expand All @@ -152,8 +152,8 @@ private WindowFunctionSupplier getWindowFunctionSupplierInternal(ResolvedFunctio
{
FunctionDependencies functionDependencies = getFunctionDependencies(resolvedFunction);
return getFunctionProvider(resolvedFunction).getWindowFunctionSupplier(
resolvedFunction.getFunctionId(),
resolvedFunction.getSignature(),
resolvedFunction.functionId(),
resolvedFunction.signature(),
functionDependencies);
}

Expand All @@ -175,17 +175,17 @@ public TableFunctionProcessorProvider getTableFunctionProcessorProvider(TableFun

private FunctionDependencies getFunctionDependencies(ResolvedFunction resolvedFunction)
{
return new InternalFunctionDependencies(this::getScalarFunctionImplementation, resolvedFunction.getTypeDependencies(), resolvedFunction.getFunctionDependencies());
return new InternalFunctionDependencies(this::getScalarFunctionImplementation, resolvedFunction.typeDependencies(), resolvedFunction.functionDependencies());
}

private FunctionProvider getFunctionProvider(ResolvedFunction resolvedFunction)
{
if (resolvedFunction.getCatalogHandle().equals(GlobalSystemConnector.CATALOG_HANDLE)) {
if (resolvedFunction.catalogHandle().equals(GlobalSystemConnector.CATALOG_HANDLE)) {
return globalFunctionCatalog;
}

FunctionProvider functionProvider = functionProviders.getService(resolvedFunction.getCatalogHandle());
checkArgument(functionProvider != null, "No function provider for catalog: '%s' (function '%s')", resolvedFunction.getCatalogHandle(), resolvedFunction.getSignature().getName());
FunctionProvider functionProvider = functionProviders.getService(resolvedFunction.catalogHandle());
checkArgument(functionProvider != null, "No function provider for catalog: '%s' (function '%s')", resolvedFunction.catalogHandle(), resolvedFunction.signature().getName());
return functionProvider;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public InternalFunctionDependencies(
this.specialization = specialization;
this.types = ImmutableMap.copyOf(typeDependencies);
this.functions = functionDependencies.stream()
.filter(function -> !isOperatorName(function.getSignature().getName().getFunctionName()))
.filter(function -> !isOperatorName(function.signature().getName().getFunctionName()))
.collect(toImmutableMap(FunctionKey::new, identity()));
this.operators = functionDependencies.stream()
.filter(InternalFunctionDependencies::isOperator)
Expand Down Expand Up @@ -91,7 +91,7 @@ public FunctionNullability getFunctionNullability(CatalogSchemaFunctionName name
if (resolvedFunction == null) {
throw new UndeclaredDependencyException(functionKey.toString());
}
return resolvedFunction.getFunctionNullability();
return resolvedFunction.functionNullability();
}

@Override
Expand All @@ -102,7 +102,7 @@ public FunctionNullability getOperatorNullability(OperatorType operatorType, Lis
if (resolvedFunction == null) {
throw new UndeclaredDependencyException(operatorKey.toString());
}
return resolvedFunction.getFunctionNullability();
return resolvedFunction.functionNullability();
}

@Override
Expand All @@ -113,7 +113,7 @@ public FunctionNullability getCastNullability(Type fromType, Type toType)
if (resolvedFunction == null) {
throw new UndeclaredDependencyException(castKey.toString());
}
return resolvedFunction.getFunctionNullability();
return resolvedFunction.functionNullability();
}

@Override
Expand Down Expand Up @@ -191,13 +191,13 @@ private static List<TypeSignature> toTypeSignatures(List<Type> types)

private static boolean isOperator(ResolvedFunction function)
{
CatalogSchemaFunctionName name = function.getSignature().getName();
CatalogSchemaFunctionName name = function.signature().getName();
return isBuiltinFunctionName(name) && isOperatorName(name.getFunctionName()) && unmangleOperator(name.getFunctionName()) != CAST;
}

private static boolean isCast(ResolvedFunction function)
{
CatalogSchemaFunctionName name = function.getSignature().getName();
CatalogSchemaFunctionName name = function.signature().getName();
return isBuiltinFunctionName(name) && isOperatorName(name.getFunctionName()) && unmangleOperator(name.getFunctionName()) == CAST;
}

Expand All @@ -208,8 +208,8 @@ public static final class FunctionKey

private FunctionKey(ResolvedFunction resolvedFunction)
{
name = resolvedFunction.getSignature().getName();
argumentTypes = resolvedFunction.getSignature().getArgumentTypes().stream()
name = resolvedFunction.signature().getName();
argumentTypes = resolvedFunction.signature().getArgumentTypes().stream()
.map(Type::getTypeSignature)
.collect(toImmutableList());
}
Expand Down Expand Up @@ -256,8 +256,8 @@ public static final class OperatorKey

private OperatorKey(ResolvedFunction resolvedFunction)
{
operatorType = unmangleOperator(resolvedFunction.getSignature().getName().getFunctionName());
argumentTypes = toTypeSignatures(resolvedFunction.getSignature().getArgumentTypes());
operatorType = unmangleOperator(resolvedFunction.signature().getName().getFunctionName());
argumentTypes = toTypeSignatures(resolvedFunction.signature().getArgumentTypes());
}

private OperatorKey(OperatorType operatorType, List<TypeSignature> argumentTypes)
Expand Down Expand Up @@ -302,8 +302,8 @@ private static final class CastKey

private CastKey(ResolvedFunction resolvedFunction)
{
fromType = resolvedFunction.getSignature().getArgumentTypes().get(0).getTypeSignature();
toType = resolvedFunction.getSignature().getReturnType().getTypeSignature();
fromType = resolvedFunction.signature().getArgumentTypes().get(0).getTypeSignature();
toType = resolvedFunction.signature().getReturnType().getTypeSignature();
}

private CastKey(TypeSignature fromType, TypeSignature toType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2564,15 +2564,15 @@ public AggregationFunctionMetadata getAggregationFunctionMetadata(Session sessio
{
Signature functionSignature;
AggregationFunctionMetadata aggregationFunctionMetadata;
if (resolvedFunction.getCatalogHandle().equals(GlobalSystemConnector.CATALOG_HANDLE)) {
functionSignature = functions.getFunctionMetadata(resolvedFunction.getFunctionId()).getSignature();
aggregationFunctionMetadata = functions.getAggregationFunctionMetadata(resolvedFunction.getFunctionId());
if (resolvedFunction.catalogHandle().equals(GlobalSystemConnector.CATALOG_HANDLE)) {
functionSignature = functions.getFunctionMetadata(resolvedFunction.functionId()).getSignature();
aggregationFunctionMetadata = functions.getAggregationFunctionMetadata(resolvedFunction.functionId());
}
else {
ConnectorSession connectorSession = session.toConnectorSession(resolvedFunction.getCatalogHandle());
ConnectorMetadata metadata = getMetadata(session, resolvedFunction.getCatalogHandle());
functionSignature = metadata.getFunctionMetadata(connectorSession, resolvedFunction.getFunctionId()).getSignature();
aggregationFunctionMetadata = metadata.getAggregationFunctionMetadata(connectorSession, resolvedFunction.getFunctionId());
ConnectorSession connectorSession = session.toConnectorSession(resolvedFunction.catalogHandle());
ConnectorMetadata metadata = getMetadata(session, resolvedFunction.catalogHandle());
functionSignature = metadata.getFunctionMetadata(connectorSession, resolvedFunction.functionId()).getSignature();
aggregationFunctionMetadata = metadata.getAggregationFunctionMetadata(connectorSession, resolvedFunction.functionId());
}

AggregationFunctionMetadataBuilder builder = AggregationFunctionMetadata.builder();
Expand All @@ -2581,7 +2581,7 @@ public AggregationFunctionMetadata getAggregationFunctionMetadata(Session sessio
}

if (!aggregationFunctionMetadata.getIntermediateTypes().isEmpty()) {
FunctionBinding functionBinding = toFunctionBinding(resolvedFunction.getFunctionId(), resolvedFunction.getSignature(), functionSignature);
FunctionBinding functionBinding = toFunctionBinding(resolvedFunction.functionId(), resolvedFunction.signature(), functionSignature);
aggregationFunctionMetadata.getIntermediateTypes().stream()
.map(typeSignature -> applyBoundVariables(typeSignature, functionBinding))
.forEach(builder::intermediateType);
Expand Down
Loading