ReemaAlzaid opened a new pull request, #12471:
URL: https://github.com/apache/gluten/pull/12471

   ## What changes are proposed in this pull request?
   
   Broadcast hash joins on the cuDF (GPU) backend were silently returning empty
   results, and GPU batches were crashing whenever CPU code tried to read them.
   This PR fixes both:
   
   **1. Broadcast joins built from an empty stream** 
(`VeloxBroadcastBuildSideRDD.scala`)
   For broadcast joins, Gluten puts the build-side data into a prebuilt CPU hash
   table and feeds the plan an empty iterator. The CPU join uses that prebuilt
   table — but the GPU join (`CudfHashJoin`) doesn't know it exists, so it built
   its hash table from the empty iterator and every broadcast join returned 0 
rows.
   Fix: when cuDF is enabled, stream the broadcast batches into the plan, same 
as
   shuffle joins already do.
   
   **2. GPU vectors crashing on host reads** (new `CudfVectorUtils.h` + call 
sites)
   A `CudfVector` lives on the GPU and has no host-side children, so host code
   reading or serializing it saw garbage (the `childAt` crashes). Added a small
   helper that copies the vector to host first, and applied it at every
   host-read site — including the ColumnarToRow converter, which was causing a
   JVM segfault in q15.
   
   Needs a Velox build with the multi-column `hash_with_seed` fix
   https://github.com/facebookincubator/velox/pull/18047
   
   ## How was this patch tested?
   
   `gluten-it queries-compare` vs vanilla Spark (2× NVIDIA L40S, Spark 3.5,
   pure GPU: `allowCpuFallback=false`, broadcast joins enabled):
   
   - TPC-H: **3/22 → 18/22** passing
   - TPC-DS: **2/103 → 43/103** passing, 828 crashes → 0
   - TPC-H SF10 with GPU scans: **~5.5× faster** than vanilla Spark overall
     (e.g. q21: 82s → 11s)
   
   Remaining failures are pre-existing cuDF expression gaps
   (`row_constructor_with_null`, `substring`), not related to this change.
   


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