Copilot commented on code in PR #13413:
URL: https://github.com/apache/gluten/pull/13413#discussion_r4672759253
##########
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
+
+
+
+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
+the Kafka CI build configuration. The Gluten checkout must include the Velox
+Kafka scan offload rule and native Kafka plan conversion, as well as the native
+reader. Building the reader alone does not enable scan offloading.
+
+Follow the prerequisites in the
+[Velox build guide](../backends/velox/get-started/Velox.md), then build native
+libraries before the JVM bundle:
+
+```bash
+export JAVA_HOME=/path/to/jdk-17
+export PATH="$JAVA_HOME/bin:$PATH"
+export PROMPT_ALWAYS_RESPOND=y
+
+./dev/builddeps-veloxbe.sh --enable_vcpkg=ON --enable_kafka=ON \
+ --enable_s3=OFF --enable_gcs=OFF --enable_hdfs=OFF --enable_abfs=OFF
+
+./build/mvn clean install -Pbackends-velox -Pspark-3.5 -Pscala-2.12 \
+ -Pjava-17 -Pkafka -Pfast-build -DskipTests
Review Comment:
This command does not actually put the Kafka integration into the bundle it
produces. The `kafka` profile adds the `gluten-kafka` reactor module, but
`package/pom.xml` has no corresponding `kafka` dependency profile, so the
shaded `package/target` jar omits `OffloadKafkaScan` and the Kafka scan
transformer. A user following these steps will get a bundle without the JVM
offload rule even though the next section tells them to run it. Add
`gluten-kafka` to the package profile (or otherwise package it explicitly) and
keep this build command aligned with that packaging path.
--
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]