Hey Folks, I am unable to perform some operation i...
# daft-dev
a
Hey Folks, I am unable to perform some operation in daft which is very crucial for my pipeline. • In Pyspark we can do something => F.col("date_trans") - F.expr("interval 1 day") but here i am unable to find alternative • In Pyspark we can subtract two dates => F.col("date_trans1") - F.col("date_trans2") but here i am unable to find alternative Kindly suggest
1
j
Ah I think you’re looking for the Duration datatype! Cc @Colin Ho for any thoughts
Ah looks like we support the Duration datatype, but don’t yet support arithmetic using it 😛 Shouldn’t be too hard to build though! I’ll chat with the team and see if we can get something out this week
c
Hey @Akshat Suwalka! We should be able to do arithmetic between
Timestamp
and
Duration
datatypes. E.g.
Copy code
import daft
import datetime

df = daft.from_pydict({"datetime": [datetime.datetime.now()], "timedelta": [datetime.timedelta(days=1)]})
df = df.with_column("diff", df["datetime"] - df["timedelta"])
df.show()
We're going to work on arithmetic between
Date
and
Duration
next, as well as between `Date`/`Timestamp`
j