LakshSingla commented on code in PR #16800:
URL: https://github.com/apache/druid/pull/16800#discussion_r1716378542


##########
processing/src/main/java/org/apache/druid/query/operator/WindowOperatorQueryQueryToolChest.java:
##########
@@ -116,6 +128,36 @@ public Sequence<Object[]> resultsAsArrays(
     return (Sequence) resultSequence;
   }
 
+  @Override
+  public Optional<Sequence<FrameSignaturePair>> resultsAsFrames(
+      WindowOperatorQuery query,
+      Sequence<RowsAndColumns> resultSequence,
+      MemoryAllocatorFactory memoryAllocatorFactory,
+      boolean useNestedForUnknownTypes
+  )
+  {

Review Comment:
   There's the same trouble with the suggested resolution: There are two ways 
that a subquery's results can be materialized: 
   a. `resultsAsArrays`/List<Object[]> - For limiting the results by row number 
   b. `resultsAsFrames`/List<Frame> - For limiting the results by memory size
   
   (a) isn't required functionally, since Frames also contain the knowledge of 
the number of rows, however, at the time 2nd was added, we needed a way to:
   1. Fallback if we encounter any difficulty while materializing the results 
as frames, allowing the user to transition
   2. Allow the tool chests to transition gradually to `resultsAsFrames` - 
Since it is an extension point and not all tool chests would have implemented 
the functionality to materialize the results as frames.
   
   `subquery: true` doesn't contain all the information, if it needs to 
materialize the results as arrays or frames. For the former, the code is fine 
as is, however, with the latter we don't need to unravel. 
   
   I think one more mistake that the subquery materialization code made is 
overreliance on the generic type, which doesn't work here. 



-- 
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]

Reply via email to