Skip to content

Commit 24de3bd

Browse files
authored
[ML-Dataframe] Move dataframe actions into core (#39463)
1 parent 349c8a3 commit 24de3bd

File tree

73 files changed

+151
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+151
-135
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/dataframe/DataFrameFeatureSetUsage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.elasticsearch.common.xcontent.XContentBuilder;
1313
import org.elasticsearch.xpack.core.XPackFeatureSet.Usage;
1414
import org.elasticsearch.xpack.core.XPackField;
15-
import org.elasticsearch.xpack.core.dataframe.transform.DataFrameIndexerTransformStats;
15+
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameIndexerTransformStats;
1616

1717
import java.io.IOException;
1818
import java.util.Map;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
package org.elasticsearch.xpack.dataframe.action;
6+
package org.elasticsearch.xpack.core.dataframe.action;
77

88
import org.elasticsearch.action.Action;
99
import org.elasticsearch.action.ActionRequestBuilder;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.action;
88

99
import org.apache.logging.log4j.LogManager;
1010
import org.elasticsearch.action.Action;
@@ -27,7 +27,7 @@
2727
import org.elasticsearch.common.xcontent.XContentBuilder;
2828
import org.elasticsearch.tasks.Task;
2929
import org.elasticsearch.xpack.core.dataframe.DataFrameField;
30-
import org.elasticsearch.xpack.dataframe.transforms.DataFrameTransformConfig;
30+
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformConfig;
3131

3232
import java.io.IOException;
3333
import java.util.ArrayList;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.action;
88

99
import org.elasticsearch.action.Action;
1010
import org.elasticsearch.action.ActionRequestBuilder;
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.common.xcontent.XContentBuilder;
2525
import org.elasticsearch.tasks.Task;
2626
import org.elasticsearch.xpack.core.dataframe.DataFrameField;
27+
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformStateAndStats;
2728

2829
import java.io.IOException;
2930
import java.util.Collections;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.action;
88

99
import org.elasticsearch.action.Action;
1010
import org.elasticsearch.action.ActionRequestValidationException;
@@ -23,7 +23,7 @@
2323
import org.elasticsearch.common.xcontent.XContentFactory;
2424
import org.elasticsearch.common.xcontent.XContentParser;
2525
import org.elasticsearch.common.xcontent.XContentType;
26-
import org.elasticsearch.xpack.dataframe.transforms.DataFrameTransformConfig;
26+
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformConfig;
2727

2828
import java.io.IOException;
2929
import java.util.ArrayList;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.action;
88

99
import org.elasticsearch.action.Action;
1010
import org.elasticsearch.action.ActionRequestValidationException;
@@ -17,7 +17,7 @@
1717
import org.elasticsearch.common.xcontent.ToXContentObject;
1818
import org.elasticsearch.common.xcontent.XContentBuilder;
1919
import org.elasticsearch.common.xcontent.XContentParser;
20-
import org.elasticsearch.xpack.dataframe.transforms.DataFrameTransformConfig;
20+
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformConfig;
2121

2222
import java.io.IOException;
2323
import java.util.Objects;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.action;
88

99
import org.elasticsearch.action.Action;
1010
import org.elasticsearch.action.ActionRequestBuilder;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
package org.elasticsearch.xpack.dataframe.action;
6+
package org.elasticsearch.xpack.core.dataframe.action;
77

88
import org.elasticsearch.action.Action;
99
import org.elasticsearch.action.ActionRequestBuilder;
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.core.dataframe.transform;
7+
package org.elasticsearch.xpack.core.dataframe.transforms;
88

99
import org.elasticsearch.common.ParseField;
1010
import org.elasticsearch.common.io.stream.StreamInput;
@@ -18,6 +18,7 @@
1818
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
1919

2020
public class DataFrameIndexerTransformStats extends IndexerJobStats {
21+
private static final String NAME = "data_frame_indexer_transform_stats";
2122
private static ParseField NUM_PAGES = new ParseField("pages_processed");
2223
private static ParseField NUM_INPUT_DOCUMENTS = new ParseField("documents_processed");
2324
private static ParseField NUM_OUTPUT_DOCUMENTS = new ParseField("documents_indexed");
@@ -30,8 +31,8 @@ public class DataFrameIndexerTransformStats extends IndexerJobStats {
3031
private static ParseField INDEX_FAILURES = new ParseField("index_failures");
3132

3233
public static final ConstructingObjectParser<DataFrameIndexerTransformStats, Void> PARSER = new ConstructingObjectParser<>(
33-
NAME.getPreferredName(), args -> new DataFrameIndexerTransformStats((long) args[0], (long) args[1], (long) args[2],
34-
(long) args[3], (long) args[4], (long) args[5], (long) args[6], (long) args[7], (long) args[8], (long) args[9]));
34+
NAME, args -> new DataFrameIndexerTransformStats((long) args[0], (long) args[1], (long) args[2],
35+
(long) args[3], (long) args[4], (long) args[5], (long) args[6], (long) args[7], (long) args[8], (long) args[9]));
3536

3637
static {
3738
PARSER.declareLong(constructorArg(), NUM_PAGES);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.transforms;
7+
package org.elasticsearch.xpack.core.dataframe.transforms;
88

99
import org.elasticsearch.cluster.AbstractDiffable;
1010
import org.elasticsearch.common.Nullable;
@@ -20,8 +20,8 @@
2020
import org.elasticsearch.index.query.MatchAllQueryBuilder;
2121
import org.elasticsearch.xpack.core.dataframe.DataFrameField;
2222
import org.elasticsearch.xpack.core.dataframe.DataFrameMessages;
23+
import org.elasticsearch.xpack.core.dataframe.transforms.pivot.PivotConfig;
2324
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
24-
import org.elasticsearch.xpack.dataframe.transforms.pivot.PivotConfig;
2525

2626
import java.io.IOException;
2727
import java.util.Collections;
@@ -36,7 +36,7 @@
3636
*/
3737
public class DataFrameTransformConfig extends AbstractDiffable<DataFrameTransformConfig> implements Writeable, ToXContentObject {
3838

39-
public static final String NAME = "data_frame_transforms";
39+
private static final String NAME = "data_frame_transform";
4040
public static final ParseField HEADERS = new ParseField("headers");
4141
public static final ParseField SOURCE = new ParseField("source");
4242
public static final ParseField DESTINATION = new ParseField("dest");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.core.dataframe.transform;
7+
package org.elasticsearch.xpack.core.dataframe.transforms;
88

99
import org.elasticsearch.common.Nullable;
1010
import org.elasticsearch.common.ParseField;
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.transforms;
88

99
import org.elasticsearch.common.ParseField;
1010
import org.elasticsearch.common.io.stream.StreamInput;
@@ -14,22 +14,21 @@
1414
import org.elasticsearch.common.xcontent.ToXContentObject;
1515
import org.elasticsearch.common.xcontent.XContentBuilder;
1616
import org.elasticsearch.xpack.core.dataframe.DataFrameField;
17-
import org.elasticsearch.xpack.core.dataframe.transform.DataFrameIndexerTransformStats;
18-
import org.elasticsearch.xpack.core.dataframe.transform.DataFrameTransformState;
1917

2018
import java.io.IOException;
2119
import java.util.Objects;
2220

2321
public class DataFrameTransformStateAndStats implements Writeable, ToXContentObject {
2422

23+
private static final String NAME = "data_frame_transform_state_and_stats";
2524
public static final ParseField STATE_FIELD = new ParseField("state");
2625

2726
private final String id;
2827
private final DataFrameTransformState transformState;
2928
private final DataFrameIndexerTransformStats transformStats;
3029

3130
public static final ConstructingObjectParser<DataFrameTransformStateAndStats, Void> PARSER = new ConstructingObjectParser<>(
32-
GetDataFrameTransformsAction.NAME,
31+
NAME,
3332
a -> new DataFrameTransformStateAndStats((String) a[0], (DataFrameTransformState) a[1], (DataFrameIndexerTransformStats) a[2]));
3433

3534
static {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.transforms;
7+
package org.elasticsearch.xpack.core.dataframe.transforms;
88

99
import org.apache.logging.log4j.LogManager;
1010
import org.apache.logging.log4j.Logger;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.transforms.pivot;
7+
package org.elasticsearch.xpack.core.dataframe.transforms.pivot;
88

99
import org.apache.logging.log4j.LogManager;
1010
import org.apache.logging.log4j.Logger;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
package org.elasticsearch.xpack.dataframe.transforms.pivot;
6+
package org.elasticsearch.xpack.core.dataframe.transforms.pivot;
77

88
import org.elasticsearch.common.ParseField;
99
import org.elasticsearch.common.io.stream.StreamInput;
@@ -51,7 +51,7 @@ private static ConstructingObjectParser<DateHistogramGroupSource, Void> createPa
5151
return new DateHistogramGroupSource(field);
5252
});
5353

54-
SingleGroupSource.declareValuesSourceFields(parser, null);
54+
declareValuesSourceFields(parser, null);
5555

5656
parser.declareField((histogram, interval) -> {
5757
if (interval instanceof Long) {
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.transforms.pivot;
7+
package org.elasticsearch.xpack.core.dataframe.transforms.pivot;
88

99
import org.apache.logging.log4j.LogManager;
1010
import org.apache.logging.log4j.Logger;
@@ -23,7 +23,6 @@
2323
import org.elasticsearch.xpack.core.dataframe.DataFrameField;
2424
import org.elasticsearch.xpack.core.dataframe.DataFrameMessages;
2525
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
26-
import org.elasticsearch.xpack.dataframe.transforms.pivot.SingleGroupSource.Type;
2726

2827
import java.io.IOException;
2928
import java.util.LinkedHashMap;
@@ -51,7 +50,7 @@ public GroupConfig(final Map<String, Object> source, final Map<String, SingleGro
5150
public GroupConfig(StreamInput in) throws IOException {
5251
source = in.readMap();
5352
groups = in.readMap(StreamInput::readString, (stream) -> {
54-
Type groupType = Type.fromId(stream.readByte());
53+
SingleGroupSource.Type groupType = SingleGroupSource.Type.fromId(stream.readByte());
5554
switch (groupType) {
5655
case TERMS:
5756
return new TermsGroupSource(stream);
@@ -157,7 +156,7 @@ private static Map<String, SingleGroupSource<?>> parseGroupConfig(final XContent
157156
ensureExpectedToken(XContentParser.Token.START_OBJECT, token, parser::getTokenLocation);
158157
token = parser.nextToken();
159158
ensureExpectedToken(XContentParser.Token.FIELD_NAME, token, parser::getTokenLocation);
160-
Type groupType = SingleGroupSource.Type.valueOf(parser.currentName().toUpperCase(Locale.ROOT));
159+
SingleGroupSource.Type groupType = SingleGroupSource.Type.valueOf(parser.currentName().toUpperCase(Locale.ROOT));
161160

162161
token = parser.nextToken();
163162
ensureExpectedToken(XContentParser.Token.START_OBJECT, token, parser::getTokenLocation);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
package org.elasticsearch.xpack.dataframe.transforms.pivot;
6+
package org.elasticsearch.xpack.core.dataframe.transforms.pivot;
77

88
import org.elasticsearch.common.ParseField;
99
import org.elasticsearch.common.io.stream.StreamInput;
@@ -44,7 +44,7 @@ private static ConstructingObjectParser<HistogramGroupSource, Void> createParser
4444
double interval = (double) args[1];
4545
return new HistogramGroupSource(field, interval);
4646
});
47-
SingleGroupSource.declareValuesSourceFields(parser, null);
47+
declareValuesSourceFields(parser, null);
4848
parser.declareDouble(optionalConstructorArg(), INTERVAL);
4949
return parser;
5050
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.transforms.pivot;
7+
package org.elasticsearch.xpack.core.dataframe.transforms.pivot;
88

99
import org.elasticsearch.common.io.stream.StreamInput;
1010
import org.elasticsearch.common.io.stream.StreamOutput;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.transforms.pivot;
7+
package org.elasticsearch.xpack.core.dataframe.transforms.pivot;
88

99
import org.elasticsearch.common.ParseField;
1010
import org.elasticsearch.common.io.stream.StreamInput;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.transforms.pivot;
7+
package org.elasticsearch.xpack.core.dataframe.transforms.pivot;
88

99
import org.elasticsearch.common.io.stream.StreamInput;
1010
import org.elasticsearch.common.xcontent.ConstructingObjectParser;

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/dataframe/DataFrameFeatureSetUsageTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import org.elasticsearch.common.io.stream.Writeable.Reader;
1010
import org.elasticsearch.test.AbstractWireSerializingTestCase;
11-
import org.elasticsearch.xpack.core.dataframe.transform.DataFrameIndexerTransformStatsTests;
11+
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameIndexerTransformStatsTests;
1212
import org.elasticsearch.xpack.core.indexing.IndexerState;
1313

1414
import java.util.HashMap;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.action;
88

99
import org.elasticsearch.common.io.stream.Writeable;
1010
import org.elasticsearch.test.AbstractWireSerializingTestCase;
11-
import org.elasticsearch.xpack.dataframe.action.DeleteDataFrameTransformAction.Request;
11+
import org.elasticsearch.xpack.core.dataframe.action.DeleteDataFrameTransformAction.Request;
1212

1313
public class DeleteDataFrameTransformActionRequestTests extends AbstractWireSerializingTestCase<Request> {
1414
@Override
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.action;
88

99
import org.elasticsearch.cluster.metadata.MetaData;
1010
import org.elasticsearch.common.io.stream.Writeable;
1111
import org.elasticsearch.test.AbstractWireSerializingTestCase;
12-
import org.elasticsearch.xpack.dataframe.action.GetDataFrameTransformsAction.Request;
12+
import org.elasticsearch.xpack.core.dataframe.action.GetDataFrameTransformsAction.Request;
1313

1414
public class GetDataFrameTransformsActionRequestTests extends AbstractWireSerializingTestCase<Request> {
1515

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.action;
88

99
import org.elasticsearch.common.logging.LoggerMessageFormat;
1010
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -13,9 +13,9 @@
1313
import org.elasticsearch.common.xcontent.support.XContentMapValues;
1414
import org.elasticsearch.test.ESTestCase;
1515
import org.elasticsearch.xpack.core.watcher.watch.Payload.XContent;
16-
import org.elasticsearch.xpack.dataframe.action.GetDataFrameTransformsAction.Response;
17-
import org.elasticsearch.xpack.dataframe.transforms.DataFrameTransformConfig;
18-
import org.elasticsearch.xpack.dataframe.transforms.DataFrameTransformConfigTests;
16+
import org.elasticsearch.xpack.core.dataframe.action.GetDataFrameTransformsAction.Response;
17+
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformConfig;
18+
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformConfigTests;
1919

2020
import java.io.IOException;
2121
import java.util.ArrayList;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
package org.elasticsearch.xpack.dataframe.action;
7+
package org.elasticsearch.xpack.core.dataframe.action;
88

99
import org.elasticsearch.cluster.metadata.MetaData;
1010
import org.elasticsearch.common.io.stream.Writeable;
1111
import org.elasticsearch.test.AbstractWireSerializingTestCase;
12-
import org.elasticsearch.xpack.dataframe.action.GetDataFrameTransformsStatsAction.Request;
12+
import org.elasticsearch.xpack.core.dataframe.action.GetDataFrameTransformsStatsAction.Request;
1313

1414
public class GetDataFrameTransformsStatsActionRequestTests extends AbstractWireSerializingTestCase<Request> {
1515
@Override

0 commit comments

Comments
 (0)