huaxingao commented on code in PR #16131:
URL: https://github.com/apache/iceberg/pull/16131#discussion_r4593158649
##########
core/src/main/java/org/apache/iceberg/rest/responses/LoadTableResponseParser.java:
##########
@@ -124,6 +131,11 @@ public static LoadTableResponse fromJson(JsonNode json) {
builder.withLabels(LabelsParser.fromJson(JsonUtil.get(LABELS, json)));
}
+ if (json.hasNonNull(READ_RESTRICTIONS)) {
+ builder.withReadRestrictions(
+ ReadRestrictionsParser.fromJson(json.get(READ_RESTRICTIONS),
metadata.schema()));
Review Comment:
This turns the filter's field IDs into names using the current schema. I see
two problems:
1. If the filter uses a field ID that is only in an older schema, loadTable
fails. But column projections are checked against all schemas (RESTTable line
58), so the two parts follow different rules.
2. For time travel, DataTableScan binds against the snapshot's schema
(useSnapshotSchema() is true), so the name-based filter binds by name there. If
the column was renamed, the read fails. If names were swapped (a -> b, b -> a),
the filter binds to the wrong column and returns rows it should hide.
The spec asks for field-ID references so the filter survives renames. Could
we keep the filter bound by ID instead of converting to names here?
##########
core/src/main/java/org/apache/iceberg/TableUtil.java:
##########
@@ -69,4 +71,19 @@ public static boolean supportsRowLineage(Table table) {
return formatVersion(table) >=
TableMetadata.MIN_FORMAT_VERSION_ROW_LINEAGE;
}
+
+ /**
+ * Returns the server-provided read restrictions carried by the given table,
if any. Returns
+ * {@link Optional#empty()} for tables that don't participate in the {@link
+ * SupportsReadRestrictions} contract (most non-REST catalogs) and for
wrapper tables
+ * (SerializableTable, metadata tables) — restrictions are a driver-side
planning concept and
Review Comment:
This says metadata tables don't get the restrictions. That can leak data.
Should reading a metadata table fail when the table has restrictions?
--
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]