Skip to content

feat(c): expose string and range predicates through the C binding#523

Merged
JingsongLi merged 6 commits into
apache:mainfrom
JunRuiLee:feat/c-binding-string-range-predicates
Jul 15, 2026
Merged

feat(c): expose string and range predicates through the C binding#523
JingsongLi merged 6 commits into
apache:mainfrom
JunRuiLee:feat/c-binding-string-range-predicates

Conversation

@JunRuiLee

Copy link
Copy Markdown
Contributor

Purpose

The C binding (bindings/c) exposed only comparison, null, and IN/NOT IN predicates. String-pattern and range operators — already implemented in the core PredicateBuilder — were unreachable from C, so C consumers (e.g. engine integrations) could not push those filters down.

Brief change log

  • Add C FFI functions for starts_with / ends_with / contains / like / between / not_between, each with a default (case-sensitive) and a _with_case_sensitive variant.
  • Reuse the existing build_leaf_predicate_datum / build_leaf_predicate_datums helpers; like maps its escape byte via a small escape_char_from_c helper (0 → core default \) and passes it through a closure, so no error-handling path is duplicated. Non-\ escapes are rejected by core.
  • Pin the six new base symbols with compile-time signature assertions, matching the existing convention that guards C-linked predicate symbols against accidental ABI changes.
  • Binding-only: no changes to the core crate.

Tests

  • cargo test -p paimon-c — added unit tests covering the happy path, a rejected non-\ escape, a non-string datum error, the low > high short-circuit, and a smoke test touching every _with_case_sensitive variant.

API and Format

  • Adds new C API symbols; no change to existing symbols or to any storage format.

Documentation

  • Doc comments on each new function; no separate docs needed.

…ase-sensitive variants

Add compile-time signature assertions for the six new base predicate symbols
(starts_with/ends_with/contains/like/between/not_between), matching the
existing convention that pins every C-linked predicate symbol so an
accidental signature change fails to compile rather than silently breaking
header consumers. Add a smoke test exercising the six _with_case_sensitive
variants so all new FFI entry points are touched. Also widen the datum-array
helper comment to cover BETWEEN/NOT BETWEEN.

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@JingsongLi JingsongLi merged commit 088cc60 into apache:main Jul 15, 2026
12 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