RussellSpitzer commented on code in PR #17822:
URL: https://github.com/apache/iceberg/pull/17822#discussion_r4353971136


##########
format/spec.md:
##########
@@ -693,6 +696,114 @@ Sorting floating-point numbers should produce the 
following behavior: `-NaN` < `
 
 A data or delete file is associated with a sort order by the sort order's id 
within [a manifest](#manifests). Therefore, the table must declare all the sort 
orders for lookup. A table could also be configured with a default sort order 
id, indicating how the new data should be sorted by default. Writers should use 
this default sort order to sort the data on write, but are not required to if 
the default order is prohibitively expensive, as it would be for streaming 
writes.
 
+### Constraints
+
+Constraints are added in v4 and are not supported in v3 or earlier.
+
+A **constraint** declares a condition that a table's live rows are expected to 
satisfy. Its definition is stored in table metadata. Each snapshot contains the 
writer-reported status of each constraint that existed when the snapshot was 
created; see [Constraint Validation](#constraint-validation).
+
+Three constraint types are defined:
+
+* `check` -- every row must satisfy a predicate
+* `unique` -- the values of a set of fields must be distinct across the rows 
in which every field in the set is non-null; a row in which any field in the 
set is null is not compared, so more than one such row may exist
+* `primary-key` -- the values of a set of fields must be distinct across all 
rows and must not be null
+
+Readers must ignore a constraint with an unknown type. Writers must not commit 
to a table that has a constraint with an unknown type.

Review Comment:
   I saw the discussion that lead to this line and I feel like we are just 
repeating ourselves. We already have a requirement that if "enforced" is true 
you must validate rows. If you happen not to understand the constraint 
type/expression/whatever then you obviously cannot validate and therefore 
cannot write. I would just drop this 🤷 



##########
format/spec.md:
##########
@@ -693,6 +696,114 @@ Sorting floating-point numbers should produce the 
following behavior: `-NaN` < `
 
 A data or delete file is associated with a sort order by the sort order's id 
within [a manifest](#manifests). Therefore, the table must declare all the sort 
orders for lookup. A table could also be configured with a default sort order 
id, indicating how the new data should be sorted by default. Writers should use 
this default sort order to sort the data on write, but are not required to if 
the default order is prohibitively expensive, as it would be for streaming 
writes.
 
+### Constraints
+
+Constraints are added in v4 and are not supported in v3 or earlier.
+
+A **constraint** declares a condition that a table's live rows are expected to 
satisfy. Its definition is stored in table metadata. Each snapshot contains the 
writer-reported status of each constraint that existed when the snapshot was 
created; see [Constraint Validation](#constraint-validation).
+
+Three constraint types are defined:
+
+* `check` -- every row must satisfy a predicate
+* `unique` -- the values of a set of fields must be distinct across the rows 
in which every field in the set is non-null; a row in which any field in the 
set is null is not compared, so more than one such row may exist
+* `primary-key` -- the values of a set of fields must be distinct across all 
rows and must not be null
+
+Readers must ignore a constraint with an unknown type. Writers must not commit 
to a table that has a constraint with an unknown type.

Review Comment:
   I saw the discussion that led to this line and I feel like we are just 
repeating ourselves. We already have a requirement that if "enforced" is true 
you must validate rows. If you happen not to understand the constraint 
type/expression/whatever then you obviously cannot validate and therefore 
cannot write. I would just drop this 🤷 



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