shfshihuafeng commented on code in PR #2567:
URL: https://github.com/apache/drill/pull/2567#discussion_r3771229111


##########
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java:
##########
@@ -274,8 +338,10 @@ private void setValueCount(int count) {
       for (ComplexWriter writer : complexWriters) {
         writer.setValueCount(count);
       }
-    } else if (rsLoader != null) {
-      rsLoader.setTargetRowCount(count);
+    } else if (!CollectionUtils.isEmpty(rsLoaders)) {
+      for (ResultSetLoader loader : rsLoaders) {
+        loader.setTargetRowCount(count);

Review Comment:
   In my opinion, the loop body calling setTargetRowCount in 
ProjectRecordBatch.setValueCount() is dead code.
   
   Two cases exist:
   
   With a ComplexWriter function (convert_fromJSON, split, etc.): 
addComplexField() is called → complexWriters is non-null( 
initComplexWriters()->projectBatch.complexWriters = new ArrayList<>();) → 
complexWriters != null is true → enters the first branch, else if is 
short‑circuited.
   
   Without any ComplexWriter function (e.g. select *): complexWriters stays 
null → complexWriters != null is false → the else if condition is evaluated. 
But addLoader() is also not called → rsLoaders is null → 
!CollectionUtils.isEmpty(rsLoaders) is false → the loop body is not entered.



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

Reply via email to