malinjawi commented on PR #13790:
URL: https://github.com/apache/gluten/pull/13790#issuecomment-7191135581

   Thanks @felipepessoto. Fair point on the default, and honestly I opened this 
PR too quickly. I was chasing the planning gap on a couple of short queries and 
went for the smallest change that closed it, instead of fixing what's 
underneath. I'll move it to draft, and start with the lazy `UnsafeProjection` 
and the spill directory as separate PRs.
   
   > Could you share the executed plan for the **internal metadata job** behind 
that scan, with rows per task and, if available, time spent in setup versus 
conversion?
   
   This is Delta's "Filtering files for query" job on a small test table (640 
files, local run, numbers from the Spark UI):
   
   ```
   Scan ExistingRDD Delta Table State with Stats   output rows: 640
   Filter (Spark)                                  output rows: 128
   RowToVeloxColumnar                              input rows: 128, time to 
convert: 7 ms
   WholeStageCodegenTransformer (project)          duration: 335 ms total over 
50 tasks (min 2, med 7, max 14)
   VeloxColumnarToRow                              output rows: 128
   ```
   
   <img width="3000" height="3400" alt="image" 
src="https://github.com/user-attachments/assets/40328f39-eede-4783-b9cb-39838bd2b446";
 />
   
   That's about 13 rows per task. The filter stays on Spark: Delta wraps each 
skipping predicate in a Scala UDF for its scan-size metrics, and we don't 
support that natively, so the only thing offloaded is the project above it (it 
nulls `stats` on the rows that passed).
   
   For setup versus conversion I used a 20,480-file table (about 410 rows per 
task). Task time for one planning is ~100 ms on vanilla and ~930 ms on Gluten: 
roughly 40% the `UnsafeProjection`, 40% native setup and teardown, 7% 
conversion, and under 1 ms in the native operators.
   
   > What I don't think we know yet is whether it still wins when there's 
substantially more work per partition.
   
   I lowered `spark.databricks.delta.snapshotPartitions` on that table to put 
more rows in each task:
   
   | Rows per task | Vanilla task time (ms) | Gluten task time (ms) |
   |---|---|---|
   | 410 | 102 | 927 |
   | 2,560 | 61 | 225 |
   | 20,480 | 36 | 85 |
   
   Setup stops mattering as tasks get bigger, but vanilla stays about 2x ahead 
at 20k rows per task, and by then it's conversion. So the setup fixes are worth 
doing on their own, but for Delta's metadata jobs the thing to investigate is 
getting that filter to run natively. Until it does there's no native work in 
the job to speed up, only the cost of going in and out.
   
   This is local on my Mac with a warm snapshot. Cold replay isn't measured 
yet, I'll add it when I get some cluster time.


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