Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[functions] Functions Working with Date/DateTime #853

Closed
29 tasks done
sundy-li opened this issue Jun 19, 2021 · 28 comments · Fixed by #1848
Closed
29 tasks done

[functions] Functions Working with Date/DateTime #853

sundy-li opened this issue Jun 19, 2021 · 28 comments · Fixed by #1848
Labels
community-take good first issue Category: good first issue prio: high High priority

Comments

@sundy-li
Copy link
Member

sundy-li commented Jun 19, 2021

From https://clickhouse.tech/docs/en/sql-reference/functions/date-time-functions/

prio order from high to low

Low priority:

  • timeZone
  • toTimeZone
  • timeZoneOf
  • timeZoneOffset
  • toStartOfInterval
  • toYear
  • toQuarter
  • toUnixTimestamp
  • toTime
  • toRelativeYearNum
  • toRelativeQuarterNum
  • toRelativeMonthNum
  • toRelativeWeekNum
  • toRelativeDayNum
  • toRelativeHourNum
  • toRelativeMinuteNum
  • toRelativeSecondNum
  • toISOYear
  • toISOWeek
  • toWeek
  • toYearWeek
  • date_trunc
  • date_add
  • date_diff
  • date_sub
  • timestamp_add
  • timestamp_sub
  • addYears
  • subtractYears
  • timeSlots
  • formatDateTime
  • dateName
  • FROM_UNIXTIME
  • toModifiedJulianDay
  • toModifiedJulianDayOrNull
  • fromModifiedJulianDay
  • fromModifiedJulianDayOrNull
This was referenced Jun 19, 2021
@BohuTANG BohuTANG added this to the v0.5 milestone Jun 22, 2021
@zhang2014 zhang2014 added easy-task good first issue Category: good first issue labels Jul 27, 2021
@gauss1314
Copy link
Contributor

gauss1314 commented Aug 8, 2021

Let me implement function: toStartOfYear.

@BohuTANG BohuTANG added the prio: high High priority label Aug 24, 2021
@dust1
Copy link
Contributor

dust1 commented Aug 25, 2021

Hello i am interested.
Does this mean I need to implement the above functions in the SELECT statement like the clickhouse example : SELECT toDateTime('2016-06-15 23:00:00') AS time, toDate(time) AS date_local, toDate(time, 'Asia/Yekaterinburg') AS date_yekat, toString(time, 'US/Samoa') AS time_samoa ?

@sundy-li
Copy link
Member Author

Does this mean I need to implement the above functions in the SELECT statement like the clickhouse example

Yes, but we must introduce Date/DateTime datatypes in previous

@dust1
Copy link
Contributor

dust1 commented Aug 25, 2021

Yes, but we must introduce Date/DateTime datatypes in previous

A bit challenging. Maybe I can try it.
Can you give me some reference about how to introduce Date/DateTime datatypes ?
And it's a task lists, Can I submit a PR of a certain function separately ?

@sundy-li
Copy link
Member Author

Can you give me some reference about how to introduce Date/DateTime datatypes ?

Since Datafuse runtime compute system is base on arrow2, so we are considering help to add custom logic datatypes in arrow2. Refer: jorgecarleitao/arrow2#326

@dust1
Copy link
Contributor

dust1 commented Aug 25, 2021

/help

@databend-bot
Copy link
Member

/assignme -- assign the issue to you
/help -- show help

@dust1
Copy link
Contributor

dust1 commented Aug 25, 2021

/assignme

@sundy-li
Copy link
Member Author

sundy-li commented Aug 30, 2021

@gauss1314 @dust1

Now we have Date16(clickhouse's Date), Date32, DateTime32 types, and we have an example function now, today in https://github.com/datafuselabs/datafuse/tree/master/common/functions/src/scalars/dates

You can continue this task now. Let's implement it in order by priority.

@dust1
Copy link
Contributor

dust1 commented Aug 30, 2021

You can continue this task now. Let's implement it in order by priority.

ok

@ygf11
Copy link
Contributor

ygf11 commented Aug 30, 2021

@sundy-li I am also interested in these task.
To avoid conflict, which one should I take?

@sundy-li
Copy link
Member Author

sundy-li commented Aug 30, 2021

@sundy-li I am also interested in these task.
To avoid conflict, which one should I task?

Thanks, You can try these three first

 toYYYYMM
 toYYYYMMDD
 toYYYYMMDDhhmmss

Since they are all return numbers, so better to design it as a generic function or something like LogicFunction

@ygf11
Copy link
Contributor

ygf11 commented Aug 30, 2021

Since they are all return numbers, so better to design it as a generic function or something like LogicFunction

ok.

@TCeason
Copy link
Collaborator

TCeason commented Aug 31, 2021

/assign

Could I try to impl the func timezone?

@sundy-li
Copy link
Member Author

sundy-li commented Sep 1, 2021

Could I try to impl the func timezone?

Yes, but we better add timezone into DateTime Type in previous, you can try this task #1680

@taiyang-li
Copy link
Contributor

/assignme

Could I try toDate and toDateTime ? @sundy-li

@GrapeBaBa
Copy link
Contributor

@sundy-li cool, which one can i try?

@sundy-li
Copy link
Member Author

sundy-li commented Sep 6, 2021

@sundy-li cool, which one can i try?

You can try from toMonth --> toMonday

@GrapeBaBa
Copy link
Contributor

@sundy-li cool, which one can i try?

You can try from toMonth --> toMonday

@sundy-li I saw this items with WIP label, Is somebody doing these?

@sundy-li
Copy link
Member Author

sundy-li commented Sep 7, 2021

@sundy-li cool, which one can i try?

You can try from toMonth --> toMonday

@sundy-li I saw this items with WIP label, Is somebody doing these?

I set it to wip means you are assigned of this, I'll update the assigners

@dust1
Copy link
Contributor

dust1 commented Sep 8, 2021

Next, do I implement the oStartOfYear and toStartOfISOYear functions or other?

@dust1
Copy link
Contributor

dust1 commented Sep 15, 2021

toStartOfQuarter
toStartOfMonth
toStartOfWeek

@dust1
Copy link
Contributor

dust1 commented Sep 27, 2021

The toStartOfInterval function only needs to be implemented INTERVAL x year, INTERVAL x month, INTERVAL x day, INTERVAL x minute ,INTERVAL x house`,Will there be others?

@Xuanwo
Copy link
Member

Xuanwo commented Apr 7, 2022

Is this issue still going on?

@sundy-li
Copy link
Member Author

sundy-li commented Apr 7, 2022

Let's close it, thanks for all the contributors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-take good first issue Category: good first issue prio: high High priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.