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

refactor: convert dates to timestamps #290

Merged
merged 1 commit into from
Jan 30, 2025
Merged

refactor: convert dates to timestamps #290

merged 1 commit into from
Jan 30, 2025

Conversation

simPod
Copy link
Owner

@simPod simPod commented Jan 29, 2025

@filecage I think this is the proper way to convert php datetime instances. Convert to timestamp and let clickhouse do whatever it wants with it.

@simPod simPod force-pushed the timestmap branch 3 times, most recently from 49b247e to f1fab3f Compare January 29, 2025 14:47
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.97%. Comparing base (5c080b3) to head (55426ba).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #290      +/-   ##
==========================================
- Coverage   95.00%   94.97%   -0.03%     
==========================================
  Files          40       40              
  Lines         741      737       -4     
==========================================
- Hits          704      700       -4     
  Misses         37       37              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@simPod simPod force-pushed the timestmap branch 2 times, most recently from eb9c425 to 9b39439 Compare January 29, 2025 15:18
@filecage
Copy link
Contributor

@simPod Yes, I agree and I was thinking the same yesterday after my last comment.

Copy link
Contributor

@filecage filecage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also replace the converter for Datetime64 with

'datetime64' => static fn (DateTimeInterface|string|int|float $value) => $value instanceof DateTimeInterface
    ? $value->format('U.u')
    : $value,

Working example:

set param_b='1738231983.447853';
select {b: DateTime64} SETTINGS date_time_output_format='iso' FORMAT Pretty;

@simPod
Copy link
Owner Author

simPod commented Jan 30, 2025

Good point

@filecage
Copy link
Contributor

LGTM. Thank you for involving me in this!

@simPod simPod merged commit d8072cd into master Jan 30, 2025
14 checks passed
@simPod simPod deleted the timestmap branch January 30, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants