Skip to content

Commit 50cdd24

Browse files
committed
fix(flink): unit is ignored when str cast to timestamp
1 parent bb9a84f commit 50cdd24

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ibis/backends/sql/compilers/flink.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,10 @@ def visit_Cast(self, op, *, arg, to):
423423
self.f.convert_tz(self.cast(arg, dt.string), "UTC+0", tz)
424424
)
425425
else:
426+
from ibis.common.temporal import TimestampUnit
427+
428+
if to.unit == TimestampUnit.SECOND:
429+
return self.f.to_timestamp(arg)
426430
return self.f.to_timestamp(arg, "yyyy-MM-dd HH:mm:ss.SSS")
427431
elif to.is_json():
428432
return arg

0 commit comments

Comments
 (0)