Jackie-Jiang commented on a change in pull request #7707:
URL: https://github.com/apache/pinot/pull/7707#discussion_r744008672
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java
##########
@@ -128,64 +122,88 @@ public Dictionary getDictionary() {
@Override
public int[] transformToIntValuesSV(ProjectionBlock projectionBlock) {
- if (_intResult == null) {
- _intResult = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
+ int numDocs = projectionBlock.getNumDocs();
+ Object ref = _result;
+ if (!(ref instanceof int[]) || ((int[]) ref).length < numDocs) {
Review comment:
The check itself is not causing the problem. The problem is that if the
behavior changes, we might end up filling the array again and again, and
causing performance degradation. E.g. if a function always read the literal as
both INT and LONG for each block, we will keep creating new arrays and fill
them.
So I'd suggest guarding this potential misuse of the function by throwing an
exception.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]