Skip to content

feat(spec): define Predicate data structure and PredicateBuilder#156

Merged
JingsongLi merged 2 commits into
apache:mainfrom
QuakeWang:feat/predicate-data-structure
Mar 30, 2026
Merged

feat(spec): define Predicate data structure and PredicateBuilder#156
JingsongLi merged 2 commits into
apache:mainfrom
QuakeWang:feat/predicate-data-structure

Conversation

@QuakeWang

Copy link
Copy Markdown
Member

Purpose

Linked issue: close #154

Add foundational predicate types and field-mapping utilities for filter pushdown. This is infrastructure-only — no behavior change in the read path.

Brief change log

Tests

API and Format

New public API added:

  • Datum, PredicateOperator, Predicate, PredicateBuilder, field_idx_to_partition_idx

Documentation

@QuakeWang

Copy link
Copy Markdown
Member Author

@JingsongLi PTAL

@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.

One noteworthy aspect is the equivalence comparison of Decimal. In Java, Decimal uses compareTo to achieve equivalence, which can maintain equality even at different scales.

@QuakeWang

Copy link
Copy Markdown
Member Author

One noteworthy aspect is the equivalence comparison of Decimal. In Java, Decimal uses compareTo to achieve equivalence, which can maintain equality even at different scales.

Good catch! I have fixed this.

Datum now has a manual PartialEq impl instead of derive(PartialEq). The Decimal variant normalizes both sides to a common scale before comparing unscaled values, matching Java Decimal.equals() which delegates to compareTo() == 0

For example, Decimal(unscaled=10, scale=1) and Decimal(unscaled=100, scale=2) are now considered equal since both represent 1.0.

@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 0b08970 into apache:main Mar 30, 2026
8 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.

feat: Define Predicate data structure and PredicateBuilder

2 participants