hongzhi-gao opened a new pull request, #19248:
URL: https://github.com/apache/iotdb/pull/19248

   ## Description
   
   Python client CI with pandas 3.1.1 fails when reading extreme TIMESTAMP 
values. For example, `9223372036854775807` milliseconds raises 
`OutOfBoundsDatetime` in `convert_to_timestamp()`, and its fallback repeats the 
same failing numeric constructor. This affects both Field formatting and query 
results converted to a DataFrame.
   
   [pandas 3.1 changed the default resolution of numeric datetime input to 
microseconds](https://pandas.pydata.org/docs/whatsnew/v3.1.0.html#datetime-timedelta-resolution-for-numeric-input).
 Construct fallback timestamps from a NumPy datetime64 scalar at the original 
precision, preserving the integer epoch value without rescaling. Apply timezone 
conversion from UTC; keep the existing naive-timestamp fallback when the date 
exceeds timezone conversion limits. The normal conversion path is unchanged.
   
   Before: the maximum millisecond value raises `OutOfBoundsDatetime`. After: 
it remains exactly `9223372036854775807` milliseconds and can be formatted as 
`292278994-08-17T07:12:55.807` when the naive fallback is required.
   
   Add regression coverage for both integer types, ms/us/ns precision, signed 
boundaries, NaT, UTC and nonzero timezones, and Field formatting. No dependency 
pinning or server changes.
   
   ## Validation
   
   - Confirmed the original helper fails 9 cases in the initial regression set 
on pandas 3.1.1.
   - `python -m pytest tests/unit -q`: 106 passed on each of pandas 2.2.3 
(Python 3.12.3), 3.0.5 (Python 3.12.3), and 3.1.1 (Python 3.11.14).
   - `python -m pytest 
tests/integration/test_tablemodel_insert.py::test_insert_use_tablet -q`: passed 
on pandas 3.1.1 against the existing local Apache IoTDB `iotdb:dev` Docker 
image.
   - `python -m pytest . -q`: 152 passed in 497.26 seconds on pandas 3.1.1 
(Python 3.11.14), using the same local Docker image. Two warnings remain: 
SQLAlchemy statement caching and pandas' unit argument with a null input.
   - `python -m black iotdb-client/client-py/ --check --diff`: passed, 77 files 
unchanged.
   - Focused flake8 checks for undefined names, unused imports and 
redefinitions, and `git diff --check`: passed.
   
   The local Python interpreter differs from CI's Python 3.15.2; remote CI 
remains necessary for that runtime. The local integration image was reused 
rather than rebuilt from this branch.
   
   This PR has:
   - [x] been self-reviewed.
   - [x] added regression unit tests.
   - [x] been tested against a local IoTDB Docker instance.
   


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