diff --git a/velox/functions/prestosql/ArrayIntersectExcept.cpp b/velox/functions/prestosql/ArrayIntersectExcept.cpp index 36f80612822d2..8d6784fe47486 100644 --- a/velox/functions/prestosql/ArrayIntersectExcept.cpp +++ b/velox/functions/prestosql/ArrayIntersectExcept.cpp @@ -338,7 +338,7 @@ class ArrayIntersectExceptFunction : public exec::VectorFunction { auto leftElementsCount = countElements(rows, *decodedLeftArray); - vector_size_t rowCount = left->size(); + vector_size_t rowCount = rows.end(); // Allocate new vectors for indices, nulls, length and offsets. BufferPtr newIndices = allocateIndices(leftElementsCount, pool);