mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-22 12:56:53 +00:00
[ML] Use LinkedHashMap to preserve order in job and datafeed fields (#36389)
This commit is contained in:
parent
9626e700ce
commit
891a37adaa
@ -31,7 +31,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@ -94,7 +94,7 @@ public class Job implements ToXContentObject {
|
||||
TimeValue.parseTimeValue(val, BACKGROUND_PERSIST_INTERVAL.getPreferredName())), BACKGROUND_PERSIST_INTERVAL);
|
||||
PARSER.declareLong(Builder::setResultsRetentionDays, RESULTS_RETENTION_DAYS);
|
||||
PARSER.declareLong(Builder::setModelSnapshotRetentionDays, MODEL_SNAPSHOT_RETENTION_DAYS);
|
||||
PARSER.declareField(Builder::setCustomSettings, (p, c) -> p.map(), CUSTOM_SETTINGS, ValueType.OBJECT);
|
||||
PARSER.declareField(Builder::setCustomSettings, (p, c) -> p.mapOrdered(), CUSTOM_SETTINGS, ValueType.OBJECT);
|
||||
PARSER.declareStringOrNull(Builder::setModelSnapshotId, MODEL_SNAPSHOT_ID);
|
||||
PARSER.declareString(Builder::setResultsIndexName, RESULTS_INDEX_NAME);
|
||||
PARSER.declareBoolean(Builder::setDeleting, DELETING);
|
||||
@ -441,7 +441,7 @@ public class Job implements ToXContentObject {
|
||||
this.backgroundPersistInterval = job.getBackgroundPersistInterval();
|
||||
this.modelSnapshotRetentionDays = job.getModelSnapshotRetentionDays();
|
||||
this.resultsRetentionDays = job.getResultsRetentionDays();
|
||||
this.customSettings = job.getCustomSettings() == null ? null : new HashMap<>(job.getCustomSettings());
|
||||
this.customSettings = job.getCustomSettings() == null ? null : new LinkedHashMap<>(job.getCustomSettings());
|
||||
this.modelSnapshotId = job.getModelSnapshotId();
|
||||
this.resultsIndexName = job.getResultsIndexNameNoPrefix();
|
||||
this.deleting = job.getDeleting();
|
||||
|
@ -165,9 +165,9 @@ public class DatafeedConfig extends AbstractDiffable<DatafeedConfig> implements
|
||||
parser.declareString((builder, val) ->
|
||||
builder.setFrequency(TimeValue.parseTimeValue(val, FREQUENCY.getPreferredName())), FREQUENCY);
|
||||
if (ignoreUnknownFields) {
|
||||
parser.declareObject(Builder::setQuery, (p, c) -> p.map(), QUERY);
|
||||
parser.declareObject(Builder::setAggregations, (p, c) -> p.map(), AGGREGATIONS);
|
||||
parser.declareObject(Builder::setAggregations, (p, c) -> p.map(), AGGS);
|
||||
parser.declareObject(Builder::setQuery, (p, c) -> p.mapOrdered(), QUERY);
|
||||
parser.declareObject(Builder::setAggregations, (p, c) -> p.mapOrdered(), AGGREGATIONS);
|
||||
parser.declareObject(Builder::setAggregations, (p, c) -> p.mapOrdered(), AGGS);
|
||||
} else {
|
||||
parser.declareObject(Builder::setParsedQuery, (p, c) -> AbstractQueryBuilder.parseInnerQueryBuilder(p), QUERY);
|
||||
parser.declareObject(Builder::setParsedAggregations, (p, c) -> AggregatorFactories.parseAggregators(p), AGGREGATIONS);
|
||||
|
@ -32,8 +32,8 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@ -116,7 +116,7 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContentO
|
||||
TimeValue.parseTimeValue(val, BACKGROUND_PERSIST_INTERVAL.getPreferredName())), BACKGROUND_PERSIST_INTERVAL);
|
||||
parser.declareLong(Builder::setResultsRetentionDays, RESULTS_RETENTION_DAYS);
|
||||
parser.declareLong(Builder::setModelSnapshotRetentionDays, MODEL_SNAPSHOT_RETENTION_DAYS);
|
||||
parser.declareField(Builder::setCustomSettings, (p, c) -> p.map(), CUSTOM_SETTINGS, ValueType.OBJECT);
|
||||
parser.declareField(Builder::setCustomSettings, (p, c) -> p.mapOrdered(), CUSTOM_SETTINGS, ValueType.OBJECT);
|
||||
parser.declareStringOrNull(Builder::setModelSnapshotId, MODEL_SNAPSHOT_ID);
|
||||
parser.declareStringOrNull(Builder::setModelSnapshotMinVersion, MODEL_SNAPSHOT_MIN_VERSION);
|
||||
parser.declareString(Builder::setResultsIndexName, RESULTS_INDEX_NAME);
|
||||
@ -674,7 +674,7 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContentO
|
||||
this.backgroundPersistInterval = job.getBackgroundPersistInterval();
|
||||
this.modelSnapshotRetentionDays = job.getModelSnapshotRetentionDays();
|
||||
this.resultsRetentionDays = job.getResultsRetentionDays();
|
||||
this.customSettings = job.getCustomSettings() == null ? null : new HashMap<>(job.getCustomSettings());
|
||||
this.customSettings = job.getCustomSettings() == null ? null : new LinkedHashMap<>(job.getCustomSettings());
|
||||
this.modelSnapshotId = job.getModelSnapshotId();
|
||||
this.modelSnapshotMinVersion = job.getModelSnapshotMinVersion();
|
||||
this.resultsIndexName = job.getResultsIndexNameNoPrefix();
|
||||
|
Loading…
x
Reference in New Issue
Block a user