zhouyuan commented on code in PR #13413:
URL: https://github.com/apache/gluten/pull/13413#discussion_r4672958129


##########
docs/get-started/VeloxKafka.md:
##########
@@ -0,0 +1,224 @@
+---

Review Comment:
   should move this file to 
   
https://github.com/ReemaAlzaid/gluten/tree/bad4ba70ed08b3462700af631ef4d493c0747232/docs/backends/velox/get-started



##########
docs/get-started/VeloxKafka.md:
##########
@@ -0,0 +1,224 @@
+---
+layout: page
+title: Kafka with Gluten and Velox
+nav_order: 13
+parent: Getting-Started
+---
+
+# Kafka with Gluten and Velox
+
+Gluten's experimental Kafka integration offloads eligible Spark Structured
+Streaming micro-batch reads to the Velox backend. Queries use Spark's existing
+`readStream.format("kafka")` API. Gluten changes how the Kafka scan executes:
+the native reader uses librdkafka to produce columnar batches inside each
+Spark executor.
+
+Spark continues to plan micro-batches, schedule tasks, and manage checkpoints
+and streaming sinks. Kafka writes use Spark's Kafka writer.
+
+## How Gluten reads Kafka
+
+![Spark's driver plans offset ranges and tracks checkpoints; executor tasks 
use JNI and the Velox Kafka connector to read topic partitions into columnar 
batches.](../image/velox-kafka-read.svg)
+
+1. **Spark** resolves topic partitions and plans offset ranges for each 
micro-batch.
+2. **Gluten** replaces an eligible Kafka scan with
+   `MicroBatchScanExecTransformer`. Executor tasks pass the Substrait plan and
+   partition splits through JNI to Velox.
+3. **Velox** reads each topic partition over `[startOffset, endOffset)` using
+   librdkafka and returns columnar batches. Supported downstream operators can
+   also run natively.
+
+The native reader disables automatic consumer-group offset commits and offset
+storage; Spark owns checkpoint progress. The diagram shows one executor, but
+Spark can distribute tasks across multiple executors.
+
+## Supported reads
+
+- Kafka DataSource V2 **micro-batch reads** are eligible for offloading. Batch
+  reads, continuous processing, and Kafka writes are outside this native path.
+- Supported columns are `key` and `value` (`binary`), `topic` (`string`),
+  `partition` and `timestampType` (`int`), `offset` (`long`), and `timestamp`
+  (`timestamp`). Decode keys and values in the query as needed.
+- The native reader does not support `headers`. Queries that request `headers`
+  with `includeHeaders=true` fall back to Spark for the Kafka scan. Filters run
+  above the scan; Kafka predicate pushdown is not supported.
+- Spark's driver uses the Java Kafka client; native readers use librdkafka.
+  Unknown native properties are skipped, and Java JAAS, callback, and 
credential
+  settings are not translated. Validate both client paths before using TLS or
+  SASL. The example uses a local PLAINTEXT broker.
+
+## Build Gluten with Kafka support
+
+The commands below use **Spark 3.5.5, Scala 2.12, and JDK 17 on Linux**, 
matching

Review Comment:
   Is Kafka support ready for other spark-versions? for this example Spark-3.5 
is fine



##########
docs/get-started/VeloxKafka.md:
##########
@@ -0,0 +1,224 @@
+---
+layout: page
+title: Kafka with Gluten and Velox
+nav_order: 13
+parent: Getting-Started
+---
+
+# Kafka with Gluten and Velox
+
+Gluten's experimental Kafka integration offloads eligible Spark Structured
+Streaming micro-batch reads to the Velox backend. Queries use Spark's existing
+`readStream.format("kafka")` API. Gluten changes how the Kafka scan executes:
+the native reader uses librdkafka to produce columnar batches inside each
+Spark executor.
+
+Spark continues to plan micro-batches, schedule tasks, and manage checkpoints
+and streaming sinks. Kafka writes use Spark's Kafka writer.
+
+## How Gluten reads Kafka
+
+![Spark's driver plans offset ranges and tracks checkpoints; executor tasks 
use JNI and the Velox Kafka connector to read topic partitions into columnar 
batches.](../image/velox-kafka-read.svg)
+
+1. **Spark** resolves topic partitions and plans offset ranges for each 
micro-batch.
+2. **Gluten** replaces an eligible Kafka scan with
+   `MicroBatchScanExecTransformer`. Executor tasks pass the Substrait plan and
+   partition splits through JNI to Velox.
+3. **Velox** reads each topic partition over `[startOffset, endOffset)` using
+   librdkafka and returns columnar batches. Supported downstream operators can
+   also run natively.
+
+The native reader disables automatic consumer-group offset commits and offset
+storage; Spark owns checkpoint progress. The diagram shows one executor, but
+Spark can distribute tasks across multiple executors.
+
+## Supported reads
+
+- Kafka DataSource V2 **micro-batch reads** are eligible for offloading. Batch
+  reads, continuous processing, and Kafka writes are outside this native path.
+- Supported columns are `key` and `value` (`binary`), `topic` (`string`),
+  `partition` and `timestampType` (`int`), `offset` (`long`), and `timestamp`
+  (`timestamp`). Decode keys and values in the query as needed.
+- The native reader does not support `headers`. Queries that request `headers`
+  with `includeHeaders=true` fall back to Spark for the Kafka scan. Filters run
+  above the scan; Kafka predicate pushdown is not supported.
+- Spark's driver uses the Java Kafka client; native readers use librdkafka.
+  Unknown native properties are skipped, and Java JAAS, callback, and 
credential
+  settings are not translated. Validate both client paths before using TLS or
+  SASL. The example uses a local PLAINTEXT broker.

Review Comment:
   Better to call out the unsupported ones still can work but use original Java 
kafka reader



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