singhpk234 commented on code in PR #13879:
URL: https://github.com/apache/iceberg/pull/13879#discussion_r3478726290


##########
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:
   Good point, please let me think this more, ideally a catalog should not 
allow attaching such policy to the column in the first place if its gonna 
violate the spec, but i think having it gonna make things simple we have 
similar restrictions for other things like what can be fed to sha256 .... 



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