[ML] Fix isNoop() for datafeed update (#48046)
max_empty_searches = -1 in a datafeed update implies max_empty_searches will be unset on the datafeed when the update is applied. The isNoop() method needs to take this -1 to null equivalence into account.
This commit is contained in:
parent
6589617a51
commit
83321b0e5e
|
@ -419,7 +419,8 @@ public class DatafeedUpdate implements Writeable, ToXContentObject {
|
||||||
&& (scriptFields == null || Objects.equals(scriptFields, datafeed.getScriptFields()))
|
&& (scriptFields == null || Objects.equals(scriptFields, datafeed.getScriptFields()))
|
||||||
&& (delayedDataCheckConfig == null || Objects.equals(delayedDataCheckConfig, datafeed.getDelayedDataCheckConfig()))
|
&& (delayedDataCheckConfig == null || Objects.equals(delayedDataCheckConfig, datafeed.getDelayedDataCheckConfig()))
|
||||||
&& (chunkingConfig == null || Objects.equals(chunkingConfig, datafeed.getChunkingConfig()))
|
&& (chunkingConfig == null || Objects.equals(chunkingConfig, datafeed.getChunkingConfig()))
|
||||||
&& (maxEmptySearches == null || Objects.equals(maxEmptySearches, datafeed.getMaxEmptySearches()));
|
&& (maxEmptySearches == null || Objects.equals(maxEmptySearches, datafeed.getMaxEmptySearches())
|
||||||
|
|| (maxEmptySearches == -1 && datafeed.getMaxEmptySearches() == null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
|
@ -286,7 +286,7 @@ public class DatafeedUpdateTests extends AbstractSerializingTestCase<DatafeedUpd
|
||||||
|
|
||||||
DatafeedConfig updatedDatafeed = update.apply(datafeed, Collections.emptyMap());
|
DatafeedConfig updatedDatafeed = update.apply(datafeed, Collections.emptyMap());
|
||||||
|
|
||||||
assertThat(datafeed, not(equalTo(updatedDatafeed)));
|
assertThat("update was " + update, datafeed, not(equalTo(updatedDatafeed)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue