I am reviewing Hakim's patch for DRILL-3668 (first_value window function incorrect result). His code uses ValueVectorWriteExpression to set values in an internal batch which get re-used across different partitions of the window function. Ideally, we just want to zero out the vector rather than calling clear() since clear() will release the buffer.
However, currently zeroVectors() is only supported by FixedWidthVector, not VariableWidthVector. * Should there be such an interface for variable width ? * The implementation could zero out just the offset vector. In the absence of such an interface, Hakim has added a boolean flag witeNulls to ValueVectorWriteExpression (see https://github.com/adeneche/incubator-drill/commit/cab73cd1a50163dd25fe0f9c55c264780ea3616d) and is conditionally doing the null-ing out in the generated code. It won't affect the normal code path, it would get used for specific window functions. I am thinking of committing his patch and tracking the zeroVectors() enhancement separately (if people agree that it would be useful). Let me know... Aman
