-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
What happens?
Several previously valid casts (or extract ops) now fail, despite looking quite reasonable (eg: casting from datetime to date, or extracting the epoch from a datetime).
(This is currently a blocker for us as we'd love to make the upgrade to take advantage of the recent list-op fixes/updates, but have a significant reliance on basic temporal casts).
To Reproduce
Setup:
from datetime import datetime
import pandas as pd
import duckdb as dd
values = [
datetime(2011,1,11,1,2,3),
datetime(2022,2,22,4,5,6),
]
df = pd.DataFrame({"dt": values})
dconn = dd.connect()
-
Failing
datetime → date
cast:dconn.execute("SELECT dt::date FROM df").fetchall() # Conversion Error: # Unimplemented type for cast (TIMESTAMP_NS -> DATE)
Previously returned
[(date(2011,1,11),), (date(2022,2,22),)]
-
Failing
datetime → time
cast:dconn.execute("SELECT dt::time FROM df").fetchall() # Conversion Error: # Unimplemented type for cast (TIMESTAMP_NS -> TIME)
Previously returned
[(time(1,2,3),), (time(4,5,6),)]
-
Failing extraction of
epoch
from datetimes:dconn.execute("SELECT EXTRACT(epoch FROM dt) FROM df").fetchall() # Binder Error: # epoch can only take temporal arguments
Previously returned
[(1294707723,), (1645502706,)]
This last one can be temporarily worked around by explicitly casting with
dt::timestamp
, but still represents a regression as this was not previously required and "dt" clearly is a temporal field ;)
OS:
macOS 14.1.2 (Apple Silicon)
DuckDB Version:
0.9.2
DuckDB Client:
Python
Full Name:
Alexander Beedie
Affiliation:
ADIA
Have you tried this on the latest main
branch?
I have tested with a release build (and could not test with a main build)
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
- Yes, I have