huaxingao opened a new pull request, #18776:
URL: https://github.com/apache/iceberg/pull/18776

   ## Summary
   
   This is the first part of implementing table constraints from the v4 spec 
(#17822). It adds the constraint model and its JSON parser. Storing constraints 
in table metadata and constraint statuses in snapshots will come in follow-up 
PRs. The full change is in #18633 for context.
   
   ## Changes
   
   **API**
   - `Constraint` with `id()`, `name()`, `type()`, `enforced()`, and 
`timestampMillis()`.
   - Subtypes `CheckConstraint`, `KeyConstraint` (with `fieldIds()`), 
`UniqueConstraint`, and `PrimaryKeyConstraint`.
   - `ConstraintType`: `check`, `unique`, and `primary-key`.
   
   **Core**
   - `BaseConstraint` with one implementation per type.
   - `ConstraintParser` reads and writes constraints in the JSON format from 
the spec.
   - Validation:
     - A `check` constraint must have an `expression` and must not have 
`field-ids`.
     - `unique` and `primary-key` constraints must have non-empty `field-ids` 
with no duplicates, and must not have an `expression`.
     - Unknown constraint types are rejected.
   
   ## Not in this PR
   
   - `CheckConstraint.expression()`. The expression must use ID references, 
which `ExpressionParser` doesn't support yet (#17343, #18629). Until then, the 
expression JSON is kept as-is so it is not lost on read and write.
   - Constraints in table metadata, constraint statuses in snapshots, and APIs 
to change constraints. These will come in follow-up PRs.
   
   ## Testing
   
   - New `TestConstraintParser`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to