[ML-DataFrame] add support for fixed_interval, calendar_interval, remove interval#42427
[ML-DataFrame] add support for fixed_interval, calendar_interval, remove interval#42427hendrikmuhs merged 14 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/ml-core |
.../main/java/org/elasticsearch/client/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
.../main/java/org/elasticsearch/client/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
.../main/java/org/elasticsearch/client/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
.../main/java/org/elasticsearch/client/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
.../main/java/org/elasticsearch/client/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
...n/java/org/elasticsearch/xpack/core/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
...n/java/org/elasticsearch/xpack/core/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
...n/java/org/elasticsearch/xpack/core/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Is it worth to add a test for "calendar_interval" as well?
There was a problem hiding this comment.
we should add better test coverage for sure, however I think it is ok to do them as follow ups.
.../main/java/org/elasticsearch/client/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
|
run elasticsearch-ci/1 |
There was a problem hiding this comment.
One more nit: I've just realized it can be compressed to one line using:
return builder.field(NAME, interval);
This call uses the following method, seems this is exactly what is needed here:
public XContentBuilder field(String name, ToXContent value) throws IOException;
There was a problem hiding this comment.
The way it's done at the moment the params are preserved. It doesn't matter now but in the future it could make a difference.
.../main/java/org/elasticsearch/client/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
.../main/java/org/elasticsearch/client/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
...n/java/org/elasticsearch/xpack/core/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
...n/java/org/elasticsearch/xpack/core/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
...n/java/org/elasticsearch/xpack/core/dataframe/transforms/pivot/DateHistogramGroupSource.java
Outdated
Show resolved
Hide resolved
| private Interval readInterval(StreamInput in) throws IOException { | ||
| byte id = in.readByte(); | ||
| switch (id) { | ||
| case 0: |
There was a problem hiding this comment.
[optional]
To avoid magic numbers leaking from the Interval implementations I would:
- Introduce "static final byte INTERVAL_TYPE_ID" fields in both FixedInterval and CalendarInterval classes.
- Return them from "getIntervalTypeId()" method
- Use them here in "switch" clause instead of byte literals
…ove interval (#42427) * add support for fixed_interval, calendar_interval, remove interval * adapt HLRC * checkstyle * add a hlrc to server test * adapt yml test * improve naming and doc * improve interface and add test code for hlrc to server * address review comments * repair merge conflict * fix date patterns * address review comments * remove assert for warning * improve exception message * use constants
…ove interval (elastic#42427) * add support for fixed_interval, calendar_interval, remove interval * adapt HLRC * checkstyle * add a hlrc to server test * adapt yml test * improve naming and doc * improve interface and add test code for hlrc to server * address review comments * repair merge conflict * fix date patterns * address review comments * remove assert for warning * improve exception message * use constants
date_histogram interval got deprecated in #33727
data frames should use the new syntax. There is no need to support the old syntax as this feature will be released with 7.2.
fixes #42297