jtuglu1 commented on code in PR #18953:
URL: https://github.com/apache/druid/pull/18953#discussion_r2740155504


##########
extensions-contrib/druid-iceberg-extensions/src/main/java/org/apache/druid/iceberg/input/IcebergCatalog.java:
##########
@@ -100,12 +107,44 @@ public List<String> extractSnapshotDataFiles(
 
       tableScan = tableScan.caseSensitive(isCaseSensitive());
       CloseableIterable<FileScanTask> tasks = tableScan.planFiles();
-      CloseableIterable.transform(tasks, FileScanTask::file)
-                       .forEach(dataFile -> 
dataFilePaths.add(dataFile.path().toString()));
+
+      Expression detectedResidual = null;
+      for (FileScanTask task : tasks) {
+        dataFilePaths.add(task.file().path().toString());
+
+        // Check for residual filters
+        if (detectedResidual == null) {
+          Expression residual = task.residual();
+          if (residual != null && !residual.equals(Expressions.alwaysTrue())) {
+            detectedResidual = residual;
+          }
+        }
+      }
+
+      // Handle residual filter based on mode
+      if (detectedResidual != null) {
+        String message = StringUtils.format(
+            "Iceberg filter produced residual expression that requires 
row-level filtering. "
+            + "This typically means the filter is on a non-partition column. "
+            + "Residual rows may be ingested unless filtered by transformSpec. 
"
+            + "Residual filter: [%s]",
+            detectedResidual
+        );
+
+        if (residualFilterMode == ResidualFilterMode.FAIL) {
+          throw DruidException.forPersona(DruidException.Persona.DEVELOPER)

Review Comment:
   Considering a developer is the person running the ingests (same as with 
queries), I figured we'd surface it there. IMO Admin should not be concerned 
with the state of data, but rather how/whether the data can be ingested at all.



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