Apache Spark
The GreptimeDB connector for Apache Spark is a DataSource V2 connector that writes batch DataFrames and Structured Streaming micro-batches to GreptimeDB.
The connector requires Java 17 or later and the Scala 2.13 distribution of Apache Spark 4.2.0. It is write-only and requires an existing GreptimeDB table.
Install the connector
Download from Maven Central
For a Maven-based Spark application, add the connector as a dependency:
<dependency>
<groupId>io.greptime</groupId>
<artifactId>spark-connector-greptimedb</artifactId>
<version>0.1.0</version>
</dependency>
To load the connector directly into a Spark runtime, download the shaded JAR from Maven Central:
mvn dependency:copy \
-Dartifact=io.greptime:spark-connector-greptimedb:0.1.0:jar:shaded \
-DoutputDirectory=/path/to/spark/jars
Build from source
Build the connector from source:
git clone https://github.com/GreptimeTeam/spark-connector-greptimedb.git
cd spark-connector-greptimedb
mvn package
The build creates a shaded JAR under target/. Add it when submitting your
Spark application:
./bin/spark-submit \
--jars /path/to/spark-connector-greptimedb-*-shaded.jar \
/path/to/application.jar