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:
>>> 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
Describe the bug
pyarrow.compute.strftimepasses 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: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:
%Sreturns'45.000000'rather than the two-digit'45', which also diverges from strftime conventions, but the%scase is the silent-data-corruption one)Component(s)
Python