malinjawi commented on code in PR #13595:
URL: https://github.com/apache/gluten/pull/13595#discussion_r4647650434


##########
docs/backends/velox/get-started/VeloxLance.md:
##########
@@ -70,15 +94,78 @@ also applies to vectors nested in a struct or a list.
 The offload decision is made at plan time 
(`LanceScanTransformer.isExportable`), so a
 non-offloadable scan is detected before execution rather than failing inside 
Velox.
 
+## Writing
+
+Set `spark.gluten.sql.columnar.backend.velox.lance.enableNativeWrite=true` to 
offload writes to
+Lance tables:
+
+```scala
+df.write.format("lance").option("path", "/data/table.lance").save()
+df.write.format("lance").mode("append").option("path", 
"/data/table.lance").save()
+df.write.format("lance").mode("overwrite").option("path", 
"/data/table.lance").save()
+```
+
+Each task exports its Velox batches as an Arrow C stream and writes them into 
uncommitted Lance
+fragments with the write parameters lance-spark resolves for the table, such 
as its file format
+version and file size limits. lance-spark's `LanceBatchWrite` then commits the 
fragments on the
+driver, as it does for its own writer, so the commit, the table version and 
the metrics it reports
+are unchanged.
+
+A write is left on lance-spark's writer (fallback, not an error) when Velox 
cannot serve it:
+
+| Write                                                      | Behavior |
+|------------------------------------------------------------|----------|
+| Append, overwrite (`INSERT INTO`, `INSERT OVERWRITE`)      | Offload  |
+| Saving to a new path                                       | Offload  |
+| `CREATE TABLE AS SELECT`, `REPLACE TABLE AS SELECT`        | Offload on 
Spark 3.5 and later |

Review Comment:
   You're right, thanks. I ran it on 3.4: CTAS goes through 
`RewriteCreateTableAsSelect` and is offloaded, and RTAS stays on lance-spark's 
writer. The docs row is split into CTAS (offloaded) and RTAS (Spark 3.5 and 
later). The CTAS test now asserts the CTAS offload on every version, and on 3.4 
asserts that RTAS isn't offloaded. Its comment says why.



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