Skip to content

Commit 7497682

Browse files
authored
fix: Throw USER_ERROR instead of FUNCTION_IMPLEMENTATION_MISSING for unsupported parameters (prestodb#26553)
## Description Throwing proper error code for better error classification. ## Motivation and Context We see queries failing with `Unsupported type parameters (BoundVariables{typeVariables={T=array(varchar)}, longVariables={}}) for presto.default.approx_distinct<T>(T):bigint` where parmater isn't supported. This is simply user error (also the error message suggests so). Throwing user error code in this case reudce unnecessary retry, miscategorization and send proper signal to users. ## Impact None ## Test Plan Existing ``` == NO RELEASE NOTE == ```
1 parent b824c5b commit 7497682

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ParametricScalar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import static com.facebook.presto.metadata.SignatureBinder.applyBoundVariables;
3030
import static com.facebook.presto.spi.StandardErrorCode.AMBIGUOUS_FUNCTION_IMPLEMENTATION;
3131
import static com.facebook.presto.spi.StandardErrorCode.FUNCTION_IMPLEMENTATION_ERROR;
32-
import static com.facebook.presto.spi.StandardErrorCode.FUNCTION_IMPLEMENTATION_MISSING;
32+
import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED;
3333
import static com.facebook.presto.util.Failures.checkCondition;
3434
import static java.lang.String.format;
3535
import static java.util.Objects.requireNonNull;
@@ -119,6 +119,6 @@ public BuiltInScalarFunctionImplementation specialize(BoundVariables boundVariab
119119
return selectedImplementation;
120120
}
121121

122-
throw new PrestoException(FUNCTION_IMPLEMENTATION_MISSING, format("Unsupported type parameters (%s) for %s", boundVariables, getSignature()));
122+
throw new PrestoException(NOT_SUPPORTED, format("Unsupported type parameters (%s) for %s", boundVariables, getSignature()));
123123
}
124124
}

0 commit comments

Comments
 (0)