sungwy commented on code in PR #13879:
URL: https://github.com/apache/iceberg/pull/13879#discussion_r3506516485
##########
open-api/rest-catalog-open-api.py:
##########
@@ -1525,6 +1673,40 @@ class AddSchemaUpdate(BaseUpdate):
)
+class ReadRestrictions(BaseModel):
+ """
+ Read restrictions for a table.
+ A reader evaluates the row filter against original, untransformed column
values, then applies required-column-projections to the surviving rows. Each
action must produce a value of the same type as the input column. If a reader
cannot apply any returned restriction (a filter expression or an action), it
must fail the query and must not silently return raw, partial, or empty results.
+ If a projection targets a field, that action governs every value reachable
through it; other projections in the same object that target a descendant of
that field have no effect.
+ An empty ReadRestrictions object (no required-column-projections and no
required-row-filter) imposes no restrictions and is equivalent to the field
being absent from the response.
+
+ """
+
+ required_column_projections: (
+ list[
+ MaskAlphanum
+ | MaskToFixedValue
+ | ReplaceWithNull
+ | ShowFirst4
+ | ShowLast4
+ | TruncateToYear
+ | TruncateToMonth
+ | Sha256Global
+ | Sha256QueryLocal
+ ]
+ | None
+ ) = Field(
+ None,
+ alias='required-column-projections',
+ description='A list of columns that require specific actions to be
applied when reading. A server must not return an action for a column whose
type is not listed in that action\'s "Applicable to" set. If absent or empty,
no required actions apply; columns not listed are not subject to any required
action.\n1. For each column listed, the reader must apply the specified action
before\n returning values for that column.\n\n2. The reader must replace all
output references to the column with the result\n of the action, presenting
the result under the original column name. For\n example, if the action for
column \'cc\' is mask-alphanum, the reader must\n return the masked value as
\'cc\' in the query output.\n\n3. A column must appear at most once in
required-column-projections.\n',
Review Comment:
I think that makes sense... I also think it would be helpful to gauge the
thought of the wider community on this rule.
I'd be curious to learn if there's a reason why we don't mention anything
about map's uniqueness property in the Iceberg Spec, and in that sense if a
similar stance would apply to `ReadRestriction` spec.
Hypothetically - if the position of Iceberg is that `uniqueness` on map is
not enforced by the spec, but simply honored and applied by the libraries and
humans, then I can see this language conflicting with that position. I think
socializing this question will be helpful
--
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]