Expressions class provides factory methods for creating filter expressions and predicates in Apache Iceberg.
Overview
Expressions are used to:- Filter data during scans
- Define partition predicates
- Specify row-level conditions
- Create aggregations
Logical Operators
and()
Combines two expressions with AND logic.or()
Combines two expressions with OR logic.not()
Negates an expression.Comparison Predicates
equal()
Tests for equality.notEqual()
Tests for inequality.lessThan()
Tests if value is less than the given value.lessThanOrEqual()
Tests if value is less than or equal to the given value.greaterThan()
Tests if value is greater than the given value.greaterThanOrEqual()
Tests if value is greater than or equal to the given value.String Predicates
startsWith()
Tests if string starts with a prefix.notStartsWith()
Tests if string does not start with a prefix.Null Predicates
isNull()
Tests if value is null.notNull()
Tests if value is not null.isNaN()
Tests if value is NaN (for floating point types).notNaN()
Tests if value is not NaN.Set Predicates
in()
Tests if value is in a set of values.notIn()
Tests if value is not in a set of values.Transform Functions
bucket()
Bucket transform.year()
Year transform for dates and timestamps.month()
Month transform for dates and timestamps.day()
Day transform for dates and timestamps.hour()
Hour transform for timestamps.truncate()
Truncate transform.Literals
lit()
Creates a literal from a value.Timestamp Literals
Aggregates
count()
Count non-null values.countNull()
Count null values.countStar()
Count all rows.max()
Maximum value.min()
Minimum value.Always True/False
alwaysTrue()
Expression that always evaluates to true.alwaysFalse()
Expression that always evaluates to false.Examples
Basic Filtering
Complex Filters
Date and Time Filtering
String Filtering
Partition Filtering
Null Handling
Dynamic Filter Building
Combining Transforms
See Also
- Types - Type system
- Transforms - Partition transforms
- TableScan - Using filters in scans