Skip to main content

Types and Predicates

The Java table API exchanges InternalRow values. Use Paimon's internal value representations when constructing rows or predicate literals; SQL type names do not imply that arbitrary Java objects can be placed in a row.

Data Types

Paimon logical typeInternal Java value
BOOLEANboolean / Boolean
TINYINTbyte / Byte
SMALLINTshort / Short
INTint / Integer
BIGINTlong / Long
FLOATfloat / Float
DOUBLEdouble / Double
CHAR, VARCHAR, STRINGorg.apache.paimon.data.BinaryString
DECIMALorg.apache.paimon.data.Decimal
DATEint, days since the Unix epoch
TIMEint, milliseconds since midnight
TIMESTAMP, TIMESTAMP_LTZorg.apache.paimon.data.Timestamp
BINARY, VARBINARY, BYTESbyte[]
ARRAYorg.apache.paimon.data.InternalArray
MAPorg.apache.paimon.data.InternalMap
ROWorg.apache.paimon.data.InternalRow

For example, the sample schema (f0 STRING, f1 INT) accepts:

import org.apache.paimon.data.BinaryString;
import org.apache.paimon.data.GenericRow;

GenericRow row = GenericRow.of(BinaryString.fromString("Alice"), 12);

GenericRow uses insert row kind by default. For changelog writes, use Paimon's org.apache.paimon.types.RowKind and the table's supported change semantics. Flink's external Row and RowKind are separate types; the Flink API converts them. See Data Types for logical type definitions and additional types.

Predicate Types

Construct a PredicateBuilder from table.rowType(). Field indexes refer to the original table schema, even when the read uses projection.

SQL predicatePredicateBuilder method
AND, ORand, or
IS NULL, IS NOT NULLisNull, isNotNull
IN, NOT INin, notIn
=, <>equal, notEqual
<, <=lessThan, lessOrEqual
>, >=greaterThan, greaterOrEqual
BETWEENbetween
LIKElike
Array membershiparrayContains
import org.apache.paimon.data.BinaryString;
import org.apache.paimon.predicate.Predicate;
import org.apache.paimon.predicate.PredicateBuilder;

PredicateBuilder builder = new PredicateBuilder(table.rowType());
Predicate filter = PredicateBuilder.and(
builder.equal(0, BinaryString.fromString("Alice")),
builder.greaterOrEqual(1, 12));

Pass predicates to ReadBuilder.withFilter. Enable TableRead.executeFilter() when the reader must also evaluate them per row; pruning alone can return candidate rows that do not match. See Java Reads for a complete example.