Constraints, Checks, and Default Values
The Airport extension supports tables with constraints, check expressions, and default values. Arrow Flight servers declare these properties in the table’s Apache Arrow schema metadata.
Not Null Constraints
When an Apache Arrow field is marked as non-nullable, Airport interprets this as a NOT NULL constraint. This constraint is enforced during INSERT and UPDATE operations.
Check Constraints
Since Apache Arrow lacks a standard mechanism for expressing check constraints, Airport uses msgpack serialization within schema metadata.
Check constraints are defined as string-based SQL expressions. For example, "color IN ('blue', 'green')" restricts the color field to only those two values.
Checks are serialized using the following structure and stored in a metadata key named check_constraints:
struct AirportTableCheckConstraints {
std::vector<std::string> constraints;
MSGPACK_DEFINE_MAP(constraints)
};Default Values
Arrow Flight tables can specify default values for columns during insertions. Since Apache Arrow lacks native support for defaults, Airport uses field-level metadata.
If a field contains a metadata key named default, its string value is parsed as a SQL expression to generate the default value. If the expression cannot be parsed, table creation fails.