Nano Banana Pro
Agent skill for nano-banana-pro
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
clickhouse-datafusion is a Rust library that integrates ClickHouse with Apache DataFusion, enabling ClickHouse tables to be queried through DataFusion's SQL engine. It builds on clickhouse-arrow for high-performance data access and provides advanced features like federation and ClickHouse UDF pushdown.
This project uses
just as a task runner. Common commands:
just test - Run all tests with different feature combinations (unit + integration)just test-unit - Run only unit tests with all feature combinationsjust test-one <test_name> - Run a specific test across all feature combinationsjust test-e2e [test_name] - Run end-to-end tests without federationjust test-federation [test_name] - Run federation-specific testsjust test-integration [test_name] - Run both e2e and federation testsjust coverage - Generate HTML test coverage report and open in browserjust coverage-lcov - Generate lcov.info coverage report for CIjust checks - Run same checks as CI (format, clippy, tests)Environment variables for debugging:
RUST_LOG=debug - Enable debug loggingDISABLE_CLEANUP=true - Keep test containers running after testsDISABLE_CLEANUP_ON_ERROR=true - Keep containers only on test failureclickhouse-datafusion bridges ClickHouse and DataFusion, allowing complex SQL queries that span ClickHouse tables and other DataFusion sources.
ClickHouseBuilder (src/builders.rs) - Main entry point for configuration
build_catalog() to create ClickHouseCatalogBuilderClickHouseSessionContext (src/context.rs) - Enhanced DataFusion context
Table Providers (src/providers/) - DataFusion integration layer
ClickHouseTableProvider - Implements DataFusion's TableProvider traitClickHouseTableProviderFactory - Creates table providers from SQL DDLClickHouseCatalogProvider - Manages ClickHouse schemas in DataFusionFederation (src/federation.rs) - Cross-database query support
UDF System (src/udfs/) - ClickHouse function integration
clickhouse() UDF for direct ClickHouse function callsclickhouse_apply() for lambda functions with parameter bindingclickhouse_eval() for string-based function evaluation (federation only)Function Pushdown Analyzer (src/analyzer/) - Advanced optimization
Tests use testcontainers to spin up isolated ClickHouse instances:
Test helpers in
tests/common/mod.rs provide:
use clickhouse_datafusion::{ClickHouseBuilder, ClickHouseSessionContext}; use datafusion::prelude::SessionContext; // Create basic DataFusion context let ctx = SessionContext::new(); // Enable federation if needed #[cfg(feature = "federation")] let ctx = ctx.federate(); // Enable ClickHouse UDF support let ctx = ClickHouseSessionContext::from(ctx); // Build ClickHouse integration let builder = ClickHouseBuilder::new("http://localhost:9000") .configure_arrow_options(|opts| opts.with_strings_as_strings(true)) .build_catalog(&ctx, Some("clickhouse")) .await?;
// Direct function calls "SELECT clickhouse(exp(id), 'Float64') FROM clickhouse.db.table" // Lambda functions "SELECT clickhouse(arrayMap($x, upper($x), names), 'List(Utf8)') FROM table" // String evaluation (federation only) "SELECT clickhouse_eval('exp(id)', 'Float64') FROM clickhouse.db.table"
federation, cloud, test-utils, mocks