qzyu999 commented on code in PR #3596:
URL: https://github.com/apache/iceberg-python/pull/3596#discussion_r3832872267


##########
pyiceberg/catalog/__init__.py:
##########
@@ -46,12 +46,12 @@
 from pyiceberg.schema import Schema
 from pyiceberg.serializers import ToOutputFile
 from pyiceberg.table import (
-    DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE,
     CommitTableResponse,
     CreateTableTransaction,
     StagedTable,
     Table,
     TableProperties,
+    _get_downcast_ns_timestamp_to_us,

Review Comment:
   Fixed



##########
pyiceberg/table/__init__.py:
##########
@@ -116,9 +116,39 @@
     from pyiceberg.catalog.rest.scan_planning import RESTContentFile, 
RESTDeleteFile, RESTFileScanTask
 
 ALWAYS_TRUE = AlwaysTrue()
+DOWNCAST_NS_TIMESTAMP_TO_US = "downcast-ns-timestamp-to-us"
+# Deprecated: use DOWNCAST_NS_TIMESTAMP_TO_US. The old key said "on-write" but 
the
+# config also controls read-path downcasting, so the name was misleading.
 DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE = "downcast-ns-timestamp-to-us-on-write"
 
 
+def _get_downcast_ns_timestamp_to_us() -> bool:
+    """Return the effective value of the downcast-ns-timestamp-to-us config.
+
+    Checks the new ``downcast-ns-timestamp-to-us`` key first. If not set, falls
+    back to the deprecated ``downcast-ns-timestamp-to-us-on-write`` key and
+    emits a :class:`DeprecationWarning` so callers can migrate their config.
+    """
+    config = Config()
+
+    value = config.get_bool(DOWNCAST_NS_TIMESTAMP_TO_US)
+    if value is not None:
+        return value
+
+    legacy = config.get_bool(DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE)
+    if legacy is not None:
+        warnings.warn(

Review Comment:
   Fixed



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