This guide explains how to set up and query DazzleDuck tables using Apache Spark SQL with Arrow Flight SQL.
DazzleDuck leverages Apache Arrow Flight, a high-performance RPC framework designed specifically for transferring large amounts of columnar data over a network. Unlike traditional JDBC/ODBC protocols, Arrow Flight eliminates the need for row-based serialization, significantly reducing transfer latency and increasing throughput.
- Apache Spark 3.5.x or 4.x
- JDK 17
- Docker
This library supports both Apache Spark 3.5.x and 4.x. Use Maven profiles to build for your target version:
| Profile | Spark Version | Jackson | Hadoop |
|---|---|---|---|
| Default | 4.1.1 | 2.20.1 | 3.4.2 |
spark-3_5 |
3.5.8 | 2.15.2 | 3.3.4 |
Build for Spark 4.x (default):
mvn clean packageBuild for Spark 3.5.x:
mvn clean package -Pspark-3_5Run tests with specific profile:
mvn test -Pspark-3_5Launch the DazzleDuck server with the example/data directory mounted at /data:
docker run -ti -v "$PWD/example/data":/local-data -p 59307:59307 -p 8080:8080 dazzleduck/dazzleduck --conf warehouse=/warehouseFor DazzleDuck server Check this repo(https://github.com/dazzleduck-web/dazzleduck-sql-server)
Start Spark SQL with the DazzleDuck package:
bin/spark-sql --packages io.dazzleduck.sql:dazzleduck-sql-spark:0.0.16At the Spark SQL prompt, create a temporary view to access your data:
CREATE TEMP VIEW t (key STRING, value STRING, p INT)
USING io.dazzleduck.sql.spark.ArrowRPCTableProvider
OPTIONS (
url 'jdbc:arrow-flight-sql://localhost:59307?disableCertificateVerification=true&user=admin&password=admin',
partition_columns 'p',
path '/local-data/parquet/kv',
connection_timeout 'PT60M'
);SELECT * FROM t;Launch the DazzleDuck server :
docker run -ti \
-p 59307:59307 \
-p 8080:8080 \
dazzleduck/dazzleduck \
--conf warehouse=/warehouse \
--conf dazzleduck_server.startup_script_provider.script_location=/startup/ducklake.sqlbin/spark-sql --packages io.dazzleduck.sql:dazzleduck-sql-spark:0.0.16At the Spark SQL prompt:
CREATE TEMP VIEW t (key STRING, value STRING, partition INT)
USING io.dazzleduck.sql.spark.ArrowRPCTableProvider
OPTIONS (
url 'jdbc:arrow-flight-sql://localhost:59307?useEncryption=true&disableCertificateVerification=true&user=admin&password=admin',
database 'my_data',
schema 'main',
table 'demo',
connection_timeout 'PT10M'
);SELECT * FROM t;- Default credentials are
admin/adminfor both username and password - Connection timeouts can be adjusted based on your data size and network conditions
- Connection refused: Verify that the DazzleDuck server is running and the ports are correctly exposed
- Certificate verification errors: Ensure
disableCertificateVerification=trueis included in the connection URL for development environments - Timeout issues: Increase the
connection_timeoutvalue if working with large datasets