diff --git a/core/trino-main/src/main/java/io/trino/operator/scalar/ArrayHistogramFunction.java b/core/trino-main/src/main/java/io/trino/operator/scalar/ArrayHistogramFunction.java index ef4b9cc93a16..21d62c4da32f 100644 --- a/core/trino-main/src/main/java/io/trino/operator/scalar/ArrayHistogramFunction.java +++ b/core/trino-main/src/main/java/io/trino/operator/scalar/ArrayHistogramFunction.java @@ -74,7 +74,7 @@ public static SqlMap arrayHistogram( ValueBlock valueBlock = arrayBlock.getUnderlyingValueBlock(); for (int i = 0; i < arrayBlock.getPositionCount(); i++) { int position = arrayBlock.getUnderlyingValuePosition(i); - if (!arrayBlock.isNull(position)) { + if (!valueBlock.isNull(position)) { histogram.add(0, valueBlock, position, 1L); } }