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 offset to date_histogram, replacing pre_offsest and post_offset #9597

Closed
wants to merge 3 commits into from

Conversation

cbuescher
Copy link
Member

Add offset option to 'date_histogram' replacing and simplifying the previous 'pre_offset' and 'post_offset' options.
This change is part of a larger clean up task for date_histogram from issue #9062.

…ffset' and 'post_offset'

Add offset option to 'date_histogram' replacing and simplifying the previous 'pre_offset' and 'post_offset' options.
This change is part of a larger clean up task for `date_histogram` from issue elastic#9062.
@@ -203,41 +201,29 @@ public byte id() {

@Override
public long roundKey(long value) {
return rounding.roundKey(value + preOffset);
return rounding.roundKey(value - offset);
Copy link
Contributor

Choose a reason for hiding this comment

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

This change alone makes offsets much easier to understand!

@cbuescher
Copy link
Member Author

@jpountz added some minor changes. Should this be marked as 'breaking'? I will put the offset option alongside the old options on the 1.x branch now, will issue separate PR for that.

}

@Override
public void readFrom(StreamInput in) throws IOException {
rounding = Rounding.Streams.read(in);
if (in.getVersion().before(Version.V_1_4_0_Beta1)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

cool you are removing these BWC conditionals!! thanks!! I missed them

@jpountz
Copy link
Contributor

jpountz commented Feb 9, 2015

LGTM

Should this be marked as 'breaking'?

Yes. I see you already did. :)

I will put the offset option alongside the old options on the 1.x branch now, will issue separate PR for that.

Sounds good, thanks!

@cbuescher
Copy link
Member Author

Merged with master with d2f852a.

@cbuescher cbuescher closed this Feb 9, 2015
@clintongormley clintongormley changed the title Aggregations: Add 'offset' to date_histogram, replacing 'pre_offsest' and 'post_offset' Add offset to date_histogram, replacing pre_offsest and post_offset Jun 6, 2015
@cbuescher cbuescher deleted the fix/9062-offset branch March 31, 2016 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants