[ 
https://issues.apache.org/jira/browse/DRILL-8239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18104224#comment-18104224
 ] 

ASF GitHub Bot commented on DRILL-8239:
---------------------------------------

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.





> Convert JSON UDF to EVF
> -----------------------
>
>                 Key: DRILL-8239
>                 URL: https://issues.apache.org/jira/browse/DRILL-8239
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Execution - Data Types
>    Affects Versions: 1.20.1
>            Reporter: Charles Givre
>            Assignee: Charles Givre
>            Priority: Minor
>
> In an effort to fully deprecate the old JsonReader, this PR converts the 
> convert_from JSON UDF to EVF.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to