Skip to content

Commit

Permalink
[ML][Data Frame] have DataFrameTransformConfigUpdate#apply set Version (
Browse files Browse the repository at this point in the history
  • Loading branch information
benwtrent authored Aug 9, 2019
1 parent 13a8835 commit 8d4ffc6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ public Builder setPivotConfig(PivotConfig pivotConfig) {
return this;
}

Builder setVersion(Version version) {
this.transformVersion = version;
return this;
}

public DataFrameTransformConfig build() {
return new DataFrameTransformConfig(id,
source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package org.elasticsearch.xpack.core.dataframe.transforms;

import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.Version;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -248,6 +249,7 @@ public DataFrameTransformConfig apply(DataFrameTransformConfig config) {
if (headers != null) {
builder.setHeaders(headers);
}
builder.setVersion(Version.CURRENT);
return builder.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void testApply() {
PivotConfigTests.randomPivotConfig(),
randomBoolean() ? null : randomAlphaOfLengthBetween(1, 1000),
randomBoolean() ? null : Instant.now(),
randomBoolean() ? null : Version.CURRENT.toString());
randomBoolean() ? null : Version.V_7_2_0.toString());
DataFrameTransformConfigUpdate update = new DataFrameTransformConfigUpdate(null, null, null, null, null);

assertThat(config, equalTo(update.apply(config)));
Expand All @@ -108,6 +108,7 @@ public void testApply() {
assertThat(updatedConfig.getSyncConfig(), equalTo(syncConfig));
assertThat(updatedConfig.getDescription(), equalTo(newDescription));
assertThat(updatedConfig.getHeaders(), equalTo(headers));
assertThat(updatedConfig.getVersion(), equalTo(Version.CURRENT));
}

public void testApplyWithSyncChange() {
Expand Down

0 comments on commit 8d4ffc6

Please sign in to comment.