prestodb/presto · error · PrestoException
FUNCTION_IMPLEMENTATION_MISSING
FUNCTION_IMPLEMENTATION_MISSING
Error message
Unsupported array element type for array_normalize function: %s
What it means
Type guard in ArrayNormalizeFunction.normalizeArray: array_normalize only supports DOUBLE and REAL element types (numeric arrays with the required value accessors); any other element type reaching the shared normalize helper is rejected.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayNormalizeFunction.java:70
return normalizeArray(elementType, block, p, DOUBLE_VALUE_ACCESSOR);
}
@TypeParameter("T")
@TypeParameterSpecialization(name = "T", nativeContainerType = long.class)
@SqlType("array(T)")
@SqlNullable
public static Block normalizeRealArray(
@TypeParameter("T") Type elementType,
@SqlType("array(T)") Block block,
@SqlType("T") long p)
{
return normalizeArray(elementType, block, Float.intBitsToFloat((int) p), REAL_VALUE_ACCESSOR);
}
private static Block normalizeArray(Type elementType, Block block, double p, ValueAccessor valueAccessor)
{
if (!(elementType instanceof RealType) && !(elementType instanceof DoubleType)) {
throw new PrestoException(
FUNCTION_IMPLEMENTATION_MISSING,
format("Unsupported array element type for array_normalize function: %s", elementType.getDisplayName()));
}
checkCondition(p >= 0, INVALID_FUNCTION_ARGUMENT, "array_normalize only supports non-negative p: %s", p);
if (p == 0) {
return block;
}
int elementCount = block.getPositionCount();
double pNorm = 0;
for (int i = 0; i < elementCount; i++) {
if (block.isNull(i)) {
return null;
}
pNorm += Math.pow(Math.abs(valueAccessor.getValue(elementType, block, i)), p);
}
if (pNorm == 0) {View on GitHub (pinned to 55bb57d202)
Solutions
- Use array_normalize only on array(double) or array(real)
- Cast the array to array(double) before calling array_normalize
- Implement normalization manually with transform for other element types
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayNormalizeFunction.java:70 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/abe8e41495003543.
Report an issue: GitHub.