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

add date_histogram #1900

Merged
merged 2 commits into from
Mar 2, 2023
Merged

add date_histogram #1900

merged 2 commits into from
Mar 2, 2023

Conversation

PSeitz
Copy link
Contributor

@PSeitz PSeitz commented Feb 23, 2023

add date_histogram (DateHistogramReq) to aggregations

Limitations:

  • only fixed_interval is supported, calendar-aware features like calendar_interval are not supported
  • format is unsupported. Fixed to Rfc3339 currently.
  • bounds are not yet supported to be provided via String, e.g. "2015-01-01T00:00:00Z"

@PSeitz PSeitz requested a review from fulmicoton February 23, 2023 06:28
@PSeitz PSeitz force-pushed the dyn_histogram branch 2 times, most recently from 1efc451 to cf38158 Compare February 23, 2023 06:37
@codecov-commenter
Copy link

codecov-commenter commented Feb 23, 2023

Codecov Report

Merging #1900 (0ba14d7) into main (8a71e00) will increase coverage by 0.01%.
The diff coverage is 94.29%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #1900      +/-   ##
==========================================
+ Coverage   94.47%   94.49%   +0.01%     
==========================================
  Files         307      309       +2     
  Lines       55658    55984     +326     
==========================================
+ Hits        52582    52900     +318     
- Misses       3076     3084       +8     
Impacted Files Coverage Δ
src/aggregation/mod.rs 93.60% <ø> (ø)
src/error.rs 12.28% <ø> (ø)
src/aggregation/agg_req.rs 94.69% <87.50%> (-0.29%) ⬇️
src/aggregation/segment_agg_result.rs 94.41% <87.50%> (-0.30%) ⬇️
src/aggregation/bucket/histogram/date_histogram.rs 95.06% <94.40%> (ø)
src/aggregation/agg_req_with_accessor.rs 98.11% <100.00%> (+0.05%) ⬆️
src/aggregation/bucket/histogram/histogram.rs 99.47% <100.00%> (+<0.01%) ⬆️
src/aggregation/error.rs 100.00% <100.00%> (ø)
src/aggregation/intermediate_agg_result.rs 97.94% <100.00%> (+0.19%) ⬆️
src/query/boolean_query/block_wand.rs 96.85% <0.00%> (-0.21%) ⬇️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

}

fn parse_into_milliseconds(input: &str) -> Result<u64, DateHistogramParseError> {
fn parse_offset_into_microseconds(input: &str) -> Result<i64, AggregationError> {
let is_sign = |byte| &[byte] == b"-" || &[byte] == b"+";
Copy link
Collaborator

@fulmicoton fulmicoton Feb 27, 2023

Choose a reason for hiding this comment

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

Why do we need to parse numbers?
str::parse does not work here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah ok, so you wanted to reuse parse_into_microseconds, but offset can be negative or something like that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

no really I don't get it... O_o

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah ok, so you wanted to reuse parse_into_microseconds, but offset can be negative or something like that?

Yes, that's it. The sign is optional

e.g. offset: 5d or -5d

let (sign, input) = input.split_at(1);
let mut val = parse_into_microseconds(input)?;
if sign == "-" {
val *= -1;
Copy link
Collaborator

@fulmicoton fulmicoton Feb 27, 2023

Choose a reason for hiding this comment

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

This can overflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a this point, that's an i64

Copy link
Collaborator

@fulmicoton fulmicoton left a comment

Choose a reason for hiding this comment

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

see comments inline

Can you help me understand the point of parse_offset_into_microseconds ?

@PSeitz PSeitz force-pushed the dyn_histogram branch 3 times, most recently from 9bee6a5 to 0ba14d7 Compare February 27, 2023 10:58
@PSeitz PSeitz requested a review from fulmicoton March 1, 2023 03:52
@PSeitz PSeitz merged commit ca20bfa into main Mar 2, 2023
@PSeitz PSeitz deleted the dyn_histogram branch March 2, 2023 04:17
This was referenced Mar 21, 2023
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.

3 participants