Skip to content

Conversation

@nicosuave
Copy link
Member

Summary

  • Replace sqlparser-rs with DuckDB's native Parser class via C++ FFI
  • Add support for all DuckDB aggregate functions (STDDEV, MEDIAN, STRING_AGG, etc.)
  • Detect and reject non-decomposable aggregates (COUNT DISTINCT, MEDIAN, PERCENTILE) with clear error messages at query time
  • Remove "experimental" label from README

Changes

  • C++ FFI layer: New yardstick_parser_ffi.cpp uses DuckDB's Parser directly
  • Rust bindings: parser_ffi.rs provides safe Rust wrappers
  • Removed sqlparser-rs: No longer a dependency
  • Non-decomposable detection: Functions like COUNT(DISTINCT) fail with helpful error when used with AGGREGATE()
  • Extended tests: DuckDB-specific functions (DATE_TRUNC, COALESCE, array functions, cast syntax)

Non-decomposable Aggregates

These aggregates work in views but cannot be used with AGGREGATE():

-- Works: direct query
SELECT region, unique_customers FROM v;

-- Fails with clear error: cannot re-aggregate
SEMANTIC SELECT region, AGGREGATE(unique_customers) FROM v;

@nicosuave nicosuave force-pushed the duckdb-native-parser branch from 5ea943d to 518c27d Compare December 21, 2025 06:32
- Add C++ FFI layer using DuckDB's Parser class directly
- Remove sqlparser-rs dependency from Cargo.toml
- Add detection and rejection of non-decomposable aggregates (COUNT DISTINCT, MEDIAN, PERCENTILE) with clear error messages
- Expand aggregate function support to all DuckDB aggregates (STDDEV, MEDIAN, STRING_AGG, etc.)
- Add tests for DuckDB-specific functions (date functions, COALESCE, array functions, cast syntax)
- Update README to remove "experimental" label
- Document non-decomposable aggregate limitation
@nicosuave nicosuave force-pushed the duckdb-native-parser branch from 518c27d to 717c626 Compare December 21, 2025 06:37
Replace direct extern "C" declarations with function pointers that
are set at extension load time via yardstick_init_parser_ffi(). This
avoids circular link-time dependencies where Rust library builds
first but references C++ functions that don't exist yet.

The C++ extension now calls yardstick_init_parser_ffi() in LoadInternal
to provide all parser FFI function pointers to the Rust code.
@nicosuave nicosuave merged commit 7fbe8ab into main Dec 21, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants