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

Feature/issue 688 support function parse_datetime #693

Merged
merged 11 commits into from
May 15, 2024

Conversation

lizhou1111
Copy link
Collaborator

@lizhou1111 lizhou1111 commented May 9, 2024

  1. format_datetime_in_joda_syntax
timeplus-OptiPlex-7000 :) with '2018-01-12 22:33:44' as s, to_datetime(s) as datetime, to_datetime64(s, 6) as datetime64, to_date16(s) as date, to_date(s) as date32 SELECT format_datetime_in_joda_syntax(datetime, 'ee'), format_datetime_in_joda_syntax(datetime64, 'ee'), format_datetime_in_joda_syntax(date, 'ee'), format_datetime_in_joda_syntax(date32, 'ee');
                          

WITH '2018-01-12 22:33:44' AS s, to_datetime(s) AS datetime, to_datetime64(s, 6) AS datetime64, to_date16(s) AS date, to_date(s) AS date32
SELECT
  format_datetime_in_joda_syntax(datetime, 'ee'), format_datetime_in_joda_syntax(datetime64, 'ee'), format_datetime_in_joda_syntax(date, 'ee'), format_datetime_in_joda_syntax(date32, 'ee')

Query id: e270f107-d73a-420f-af6f-d357ea5f284e

┌─format_datetime_in_joda_syntax(datetime, 'ee')─┬─format_datetime_in_joda_syntax(datetime64, 'ee')─┬─format_datetime_in_joda_syntax(date, 'ee')─┬─format_datetime_in_joda_syntax(date32, 'ee')─┐
│ 05050505                                           │
└────────────────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────────────────┴──────────────────────────────────────────────┘

1 row in set. Elapsed: 0.022 sec.
  1. parse_datetime
timeplus-OptiPlex-7000 :) select parse_datetime('10:04:11 03-07-2019', '%s:%i:%H %d-%m-%Y', 'UTC')

SELECT
  parse_datetime('10:04:11 03-07-2019', '%s:%i:%H %d-%m-%Y', 'UTC')

Query id: 2a7cf9e3-e929-473b-9ec4-daaedd7b10a9

┌─parse_datetime('10:04:11 03-07-2019', '%s:%i:%H %d-%m-%Y', 'UTC')─┐
│                                               2019-07-03 11:04:10 │
└───────────────────────────────────────────────────────────────────┘

1 row in set. Elapsed: 0.005 sec. 
  1. parse_datetime_in_joda_syntax
timeplus-OptiPlex-7000 :) select parse_datetime_in_joda_syntax('2 31 20 4', 'M d d M', 'UTC')

SELECT
  parse_datetime_in_joda_syntax('2 31 20 4', 'M d d M', 'UTC')

Query id: 4911ed0a-3033-47f8-97e2-b83361c93a32

┌─parse_datetime_in_joda_syntax('2 31 20 4', 'M d d M', 'UTC')─┐
│                                          2000-04-20 00:00:00 │
└──────────────────────────────────────────────────────────────┘

1 row in set. Elapsed: 0.006 sec.

More details please see the original clickhouse pr above.
Related to #688

@lizhou1111 lizhou1111 marked this pull request as ready for review May 9, 2024 08:15
@lizhou1111 lizhou1111 requested a review from yl-lisen May 9, 2024 08:15
@lizhou1111 lizhou1111 self-assigned this May 9, 2024
@lizhou1111 lizhou1111 added feature community Feedback from community labels May 9, 2024
@lizhou1111 lizhou1111 force-pushed the feature/issue-688-support-function-parseDatetime branch from 16b7849 to 9e329a7 Compare May 14, 2024 03:15
@lizhou1111 lizhou1111 force-pushed the feature/issue-688-support-function-parseDatetime branch from 13d8ee4 to 78cb03a Compare May 15, 2024 02:30
@lizhou1111
Copy link
Collaborator Author

this close #688

@lizhou1111 lizhou1111 merged commit 19fcccd into develop May 15, 2024
21 checks passed
@lizhou1111 lizhou1111 deleted the feature/issue-688-support-function-parseDatetime branch May 15, 2024 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Feedback from community feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants