akshaytayal opened a new issue, #13749:
URL: https://github.com/apache/gluten/issues/13749

   ### Backend
   
   VL (Velox)
   
   ### Bug description
   
   A query that applies dynamic partition pruning (DPP) to an Iceberg 
format-version 3 table fails during Gluten validation, instead of running 
natively or falling back. Vanilla Spark returns the correct result.
   
   Repro, with the default AQE and broadcast settings:
   
   ```sql
   CREATE TABLE fact (k INT, v INT) USING iceberg PARTITIONED BY (k)
     TBLPROPERTIES ('format-version' = '3');
   INSERT INTO fact VALUES (1, 10), (2, 20), (2, 21), (3, 30);
   CREATE TABLE dim (k INT, tag STRING) USING iceberg;
   INSERT INTO dim VALUES (2, 'keep'), (3, 'drop');
   
   SELECT f.k, f.v FROM fact f JOIN dim d ON f.k = d.k WHERE d.tag = 'keep';
   ```
   
   Expected: `(2, 20), (2, 21)`. Actual (Spark 3.5):
   
   ```
   java.lang.IllegalStateException: Can't translate k#85 IN dynamicpruning#115 
to v2 Predicate, no subquery result
     at 
org.apache.spark.sql.execution.datasources.v2.DataSourceV2Strategy$.translateRuntimeFilterV2(DataSourceV2Strategy.scala:647)
     at 
org.apache.spark.sql.execution.datasources.v2.BatchScanExecShim.filteredPartitions(BatchScanExecShim.scala:82)
     at 
org.apache.gluten.execution.BatchScanExecTransformerBase.finalPartitions(BatchScanExecTransformer.scala:199)
     at 
org.apache.gluten.execution.IcebergScanTransformer.doValidateInternal(IcebergScanTransformer.scala:177)
   ```
   
   Spark 4.1 fails the same way with `SparkException: [INTERNAL_ERROR] Can't 
translate ... no subquery result`.
   
   For v3 tables, `IcebergScanTransformer.doValidateInternal` checks for delete 
files through `finalPartitions`, which applies the runtime filters. The DPP 
subquery has not run yet during validation, so the filter translation throws, 
and the exception is not turned into a fallback. #12833 avoided the same 
failure for root paths by reading the planned scan tasks instead 
(https://github.com/apache/gluten/pull/12833#discussion_r3986350918).
   
   ### Gluten version
   
   main branch
   
   ### Spark version
   
   Spark-3.5.x, Spark-4.1.x
   


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