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


##########
fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergScanRange.java:
##########
@@ -454,13 +455,17 @@ public void populateRangeParams(TTableFormatFileDesc 
formatDesc, TFileRangeDesc
             // field-ids/DV-offset exactly as legacy built them.
             List<TIcebergDeleteFileDesc> deleteDescs = new 
ArrayList<>(deleteFiles.size());
             for (DeleteFile delete : deleteFiles) {
+                nativeEncryption |= delete.encryption != null;
                 deleteDescs.add(delete.toThrift());
             }
             fileDesc.setDeleteFiles(deleteDescs);
         }
 
         // native reader format (JNI = system tables, P6.5). Leaves the 
parent's default (FORMAT_JNI) otherwise.
-        if ("orc".equals(fileFormat)) {
+        if (nativeEncryption) {
+            // Older readers may ignore optional key fields; a distinct 
physical wire value must stop them.
+            rangeDesc.setFormatType(TFileFormatType.FORMAT_PARQUET_PME);

Review Comment:
   Fixed in f209c9dc49. PME now participates in both FileQueryScanNode's 
columnar target selection and FileScanLocalState's physical-split gate. The 
existing load, serial and Iceberg-delete restrictions remain in place.
   
   The FE format/capability matrix now includes PME. A new BE test covers one 
256 MiB encrypted coarse range with a 64 MiB target, inherited and explicit PME 
formats, retention of 16 requested scanners, and the serial/load/delete 
refusals. The FE regression reproduces the missing target on baseline 
378e10f32d79.
   
   The official FE selection passes all 177 tests in 12 suites. Both changed 
C++ translation units pass syntax checks and the repository clang-tidy check; 
all eight PR C++ files pass clang-format 16. Native GTest execution is 
explicitly unverified: the official run-be-ut attempt is blocked before 
execution by missing libgoogle_cloud_cpp_oauth2.a. The PR description records 
that gap.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/scan/FileScanEncryptionGuard.java:
##########
@@ -35,80 +36,129 @@
 import org.apache.doris.thrift.TTableFormatFileDesc;
 
 import java.util.List;
+import java.util.Map;
+import java.util.function.BooleanSupplier;
 
 /** Last checks before serializing file keys, including lazy split responses 
and replanned retries. */
 public final class FileScanEncryptionGuard {
     private FileScanEncryptionGuard() {
     }
 
-    private static void rejectEncryptedRead(boolean internalRpc) {
-        // An external plaintext channel cannot carry file keys, even if local 
private TLS is enabled.
-        if (!internalRpc) {
-            throw new IllegalStateException("File encryption 
[KEY_TRANSPORT_UNAVAILABLE]");
-        }
-        // Native decryption and protected transport for file keys are not 
implemented yet.
-        throw new IllegalStateException("File encryption [READ_UNAVAILABLE]");
+    public static void checkFragments(TPipelineFragmentParamsList fragments) {
+        checkFragments(fragments, () -> false);
     }
 
-    public static void checkFragments(TPipelineFragmentParamsList fragments) {
-        checkFragments(fragments, true);
+    public static boolean checkFragments(TPipelineFragmentParamsList 
fragments, BooleanSupplier supportsEncryption) {
+        return checkFragments(fragments, supportsEncryption, true);
     }
 
     public static void checkFragments(TPipelineFragmentParamsList fragments, 
boolean internalRpc) {
-        if (!fragments.isSetParamsList()) {
-            return;
-        }
-        for (TPipelineFragmentParams fragment : fragments.getParamsList()) {
-            if (fragment.isSetFileScanParams()) {
-                for (TFileScanRangeParams params : 
fragment.getFileScanParams().values()) {
-                    checkParams(params, internalRpc);
+        checkFragments(fragments, () -> false, internalRpc);
+    }
+
+    public static boolean checkFragments(TPipelineFragmentParamsList 
fragments, BooleanSupplier supportsEncryption,
+            boolean internalRpc) {
+        Checker checker = new Checker(supportsEncryption, true, internalRpc);
+        if (fragments.isSetParamsList()) {
+            Map<Integer, TFileScanRangeParams> paramsByNode = Map.of();
+            for (TPipelineFragmentParams fragment : fragments.getParamsList()) 
{
+                // Later simplified fragments reuse the query-wide params sent 
in the first fragment.
+                if (fragment.isSetFileScanParams()) {
+                    paramsByNode = fragment.getFileScanParams();
+                    for (TFileScanRangeParams params : paramsByNode.values()) {
+                        checker.checkParams(params);

Review Comment:
   Fixed in f209c9dc49. Shared marker-only capability checks now use the 
recipient's fragment plan node IDs and actual scan-range assignments, so an 
OLAP-only recipient is not rejected for another worker's unused PME marker. 
Simplified fragments inherit the shared map, and real file nodes with no 
initial ranges (including empty lazy range lists) still require capability.
   
   Actual key descriptors anywhere in the serialized shared map are still 
validated and require capability/protected transport, even when their marker is 
unassigned. The per-range/shared-format and remote-transport fences remain 
intact.
   
   The new mixed OLAP/encrypted-recipient regression fails on baseline 
378e10f32d79 with READ_UNAVAILABLE and passes after the fix. Added negative 
coverage checks marker-only plans, simplified/empty lazy fragments, unassigned 
real keys and invalid descriptor versions. All 17 focused guard/coalescing 
tests and the full official 177-test selection pass. Local self-review also 
checked ThriftPlansBuilder's query-wide map construction and 
first-fragment/simplified-fragment serialization.



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