Gabriel39 commented on code in PR #71239:
URL: https://github.com/apache/doris/pull/71239#discussion_r4767597081


##########
fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergScanPlanProvider.java:
##########
@@ -500,21 +499,28 @@ public long streamingSplitEstimate(ConnectorSession 
session, ConnectorTableHandl
         if (iceHandle.isResolvedEmptySnapshot() && !iceHandle.isSystemTable()) 
{
             resolveTable(session, iceHandle);
         }
-        if (iceHandle.isResolvedEmptySnapshot() || iceHandle.isSystemTable()
+        if (iceHandle.isResolvedEmptySnapshot()
                 || !sessionBool(session, ENABLE_EXTERNAL_TABLE_BATCH_MODE, 
true)) {
             return -1;
         }
+        if (iceHandle.isSystemTable()) {
+            Table base = resolveSysBaseTable(session, iceHandle);
+            return !isPositionDeletesSysTable(iceHandle) && 
!IcebergLabelsSysTable.isLabels(iceHandle)
+                    && IcebergEncryptionRead.isEncrypted(base) ? 1 : -1;
+        }
         Table table = resolveTable(session, iceHandle);
         TableScan scan = buildScan(table, iceHandle, filter, session);
         Snapshot snapshot = scan.snapshot();
         if (snapshot == null) {
             return -1;
         }
-        // V3 always plans synchronously; probing encrypted deletes here would 
reject a valid physical COUNT.
-        if (getFormatVersion(table) >= 3) {
+        boolean encrypted = IcebergEncryptionRead.isEncrypted(table);
+        // Plain V3/V4 DML consumes the delete-rewrite stash at plan time. 
Admitted encrypted tables
+        // reject every native write, so their read-only scans can safely 
retain lazy backpressure.
+        if (getFormatVersion(table) >= 3 && !encrypted) {

Review Comment:
   Fixed in `a727af22bc4` by marking declared-encrypted native scans with the 
shared PME format before the first lazy batch is dispatched, and mapping that 
property to the existing protected Thrift enum. Per-range physical Parquet/ORC 
dispatch is retained.
   
   The new `test_iceberg_encryption_mixed_lazy_count` suite has eight verified 
plaintext leading files and a keyed data/delete tail, one-split 
batches/queues/initial fetches, one file scanner, serial manifest loading, and 
disabled result caches. It covers HMS/REST, v3/v4, metadata caching, eager/lazy 
planning, and COUNT pushdown. The frozen pre-fix package reproduced 
`AGGREGATE_UNAVAILABLE` specifically when lazy COUNT pushdown was enabled.
   
   Candidate validation passes all nine related PME suites in official normal 
comparison, with zero failures/fatal errors/skips and all three native 
completion markers. All 64 new scalar counts independently match SDK reads and 
fixture arithmetic (72 data rows, or 70 after two position deletes). The 492 
connector/Thrift and 21 FE mapping/guard tests also pass.
   



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