MgjLLL commented on code in PR #8136:
URL: https://github.com/apache/paimon/pull/8136#discussion_r3394104278


##########
paimon-python/pypaimon/catalog/table_query_auth.py:
##########
@@ -0,0 +1,87 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
+from typing import Callable, Dict, List, Optional
+
+import pyarrow as pa
+import pyarrow.compute as pc
+
+from pypaimon.common.predicate_json_parser import (
+    extract_referenced_fields,
+    parse_predicate_to_batch_filter,
+)
+from pypaimon.schema.data_types import DataField
+
+
+class TableNoPermissionException(Exception):
+    MSG = "Table %s has no permission. Cause by %s."
+
+    def __init__(self, identifier, cause=None):
+        cause_msg = str(cause) if cause else ""
+        super().__init__(self.MSG % (identifier, cause_msg))
+        self.identifier = identifier
+        self.__cause__ = cause
+
+
+class TableQueryAuthResult:
+
+    def __init__(self, filter: Optional[List[str]], column_masking: 
Optional[Dict[str, str]]):
+        self.filter = filter
+        self.column_masking = column_masking
+
+    def convert_plan(self, plan):
+        from pypaimon.read.query_auth_split import QueryAuthSplit
+        from pypaimon.read.plan import Plan
+
+        if not self.filter and not self.column_masking:
+            return plan
+        auth_splits = [QueryAuthSplit(split, self) for split in plan.splits()]
+        return Plan(auth_splits)

Review Comment:
   convert_plan now returns Plan(auth_splits, snapshot_id=plan.snapshot_id). 
Without this, query-auth tables planned from a non-empty snapshot lost row-id 
conflict / global-index update checks (check_from_snapshot=-1). New test 
TestConvertPlanPreservesSnapshotId covers both non-null and None cases.



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

Reply via email to