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


##########
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:
   Please use our built-in deprecation message instead. It helps release 
managers know when to remove things:
   
   From docs:
   ```
   from pyiceberg.utils.deprecated import deprecation_message
   
   deprecation_message(
       deprecated_in="0.1.0",
       removed_in="0.2.0",
       help_message="The old_property is deprecated. Please use the 
something_else property instead.",
   )
   ```



##########
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:
   Can we make this a public method?
   
   I personally don't like importing private methods.



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