ptimizeroracle opened a new issue, #51499:
URL: https://github.com/apache/arrow/issues/51499

   ### Describe the bug
   
   `pyarrow.compute.strftime` passes unsupported format specifiers through 
literally instead of either formatting them or raising. `%s` (epoch seconds, a 
widely used strftime extension) returns the format string itself as the data:
   
   ```python
   >>> import pyarrow as pa, pyarrow.compute as pc
   >>> from datetime import datetime
   >>> d = pa.array([datetime(2021, 1, 1, 12, 30, 45)])
   >>> pc.strftime(d, format="%s").to_pylist()
   ['%s']
   >>> int(datetime(2021, 1, 1, 12, 30, 45).timestamp())  # expected
   1609500645
   ```
   
   polars and duckdb both return the epoch value for `%s`, and raising would 
also be acceptable, but silently returning `'%s'` as column data means 
downstream code consumes the format string as if it were real data with no 
error anywhere.
   
   (side observation on the same kernel: `%S` returns `'45.000000'` rather than 
the two-digit `'45'`, which also diverges from strftime conventions, but the 
`%s` case is the silent-data-corruption one)
   
   ### Component(s)
   
   Python
   


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