malinjawi opened a new pull request, #13837: URL: https://github.com/apache/gluten/pull/13837
## What changes are proposed in this pull request? First part of #13806, split out of #13595. Today a write to a Lance table converts Velox's batches back to rows, and lance-spark turns them into Arrow again. With `spark.gluten.sql.columnar.lance.enableNativeWrite=true` (experimental, off by default), appends skip that: each task exports its Velox batches over the Arrow C Data Interface, Lance writes them into fragments, and lance-spark still commits on the driver. That covers `INSERT INTO`, CTAS, saving to a new path and RTAS on Spark 3.5. `INSERT OVERWRITE`, nested and vector columns, blobs, sharded tables and a few types still go to lance-spark's writer; they're the next parts of #13806. Velox has no Lance writer, so the batches go to Lance's Java `Fragment.write`. Lance pulls batches while Spark pushes them, so it runs on a background thread fed by a small queue (`LanceFragmentWriter`), like lance-spark's own writer. As with Iceberg, the parts that don't depend on Velox are in `gluten-lance`, and the Velox node, rule and batch export are in `backends-velox/src-lance`. Bumps lance-spark to 0.9.0-beta.2 for the fragment write spec (lance-format/lance-spark#892). On an 8-node cluster, appending TPC-DS `store_sales` (1.44B rows) took 39 s natively, against 72 s with lance-spark's writer and 89 s on vanilla Spark, with 44% less CPU than lance-spark's writer. That was measured on #13595, which has the same append path. The output was 3.6% bigger than lance-spark's, because Velox doesn't zero the values under nulls and Lance encodes them anyway. The next PR fixes that. ## How was this patch tested? Added `VeloxLanceWriteSuite` and `LanceColumnarBatchDataWriterSuite`. Ran them with the Lance scan tests on Spark 3.5, 4.0, 4.1 and 4.2. ## Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-5-5) -- 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]
