suxiaogang223 commented on code in PR #65262:
URL: https://github.com/apache/doris/pull/65262#discussion_r3584000860


##########
fe/be-java-extensions/iceberg-metadata-scanner/src/main/java/org/apache/doris/iceberg/IcebergSysTableJniScanner.java:
##########
@@ -106,9 +103,10 @@ protected int getNext() throws IOException {
                     break;
                 }
                 StructLike row = reader.next();
-                for (int i = 0; i < fields.size(); i++) {
-                    SelectedField field = fields.get(i);
-                    Object value = row.get(field.sourceIndex, 
field.field.type().typeId().javaClass());
+                for (int i = 0; i < requiredFieldCount; i++) {
+                    // FE keeps the fields requested by BE at the start of the 
Iceberg projection.
+                    // FileScanTask.schema() is not the row schema for every 
DataTask implementation.
+                    Object value = row.get(i, Object.class);
                     ColumnValue columnValue = new 
IcebergSysTableColumnValue(value, timezone);

Review Comment:
   Thanks for tracing the hypothetical zero-column JNI path. That path is not 
reachable for the current scan plan, though: 
`PhysicalPlanTranslator.updateScanSlotsMaterialization()` explicitly keeps the 
smallest physical scan slot when projection would otherwise remove every slot, 
and a storage-layer COUNT without a project retains the underlying relation 
output. As a result, `file_slot_descs`/`required_fields` remain non-empty 
before split planning, and `IcebergSysTableJniScanner` appends that retained 
field for each row. The existing FE behavior is therefore already the "keep a 
cheap required output field" option suggested here.
   
   I agree that the two COUNT regression statements currently verify execution 
only, not the returned value. That is useful test hardening, but it does not 
make the zero-column path reachable or require BE virtual-row propagation for 
this PR.



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