-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/geoshape-doc-values' into tl-d…
…v-geoshape
- Loading branch information
Showing
114 changed files
with
3,846 additions
and
1,201 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
...java/org/elasticsearch/client/dataframe/transforms/DataFrameTransformCheckpointStats.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.client.dataframe.transforms; | ||
|
||
import org.elasticsearch.common.ParseField; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.xcontent.ConstructingObjectParser; | ||
import org.elasticsearch.common.xcontent.XContentParser; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
public class DataFrameTransformCheckpointStats { | ||
public static final ParseField TIMESTAMP_MILLIS = new ParseField("timestamp_millis"); | ||
public static final ParseField TIME_UPPER_BOUND_MILLIS = new ParseField("time_upper_bound_millis"); | ||
|
||
public static DataFrameTransformCheckpointStats EMPTY = new DataFrameTransformCheckpointStats(0L, 0L); | ||
|
||
private final long timestampMillis; | ||
private final long timeUpperBoundMillis; | ||
|
||
public static final ConstructingObjectParser<DataFrameTransformCheckpointStats, Void> LENIENT_PARSER = new ConstructingObjectParser<>( | ||
"data_frame_transform_checkpoint_stats", true, args -> { | ||
long timestamp = args[0] == null ? 0L : (Long) args[0]; | ||
long timeUpperBound = args[1] == null ? 0L : (Long) args[1]; | ||
|
||
return new DataFrameTransformCheckpointStats(timestamp, timeUpperBound); | ||
}); | ||
|
||
static { | ||
LENIENT_PARSER.declareLong(ConstructingObjectParser.optionalConstructorArg(), TIMESTAMP_MILLIS); | ||
LENIENT_PARSER.declareLong(ConstructingObjectParser.optionalConstructorArg(), TIME_UPPER_BOUND_MILLIS); | ||
} | ||
|
||
public static DataFrameTransformCheckpointStats fromXContent(XContentParser parser) throws IOException { | ||
return LENIENT_PARSER.parse(parser, null); | ||
} | ||
|
||
public DataFrameTransformCheckpointStats(final long timestampMillis, final long timeUpperBoundMillis) { | ||
this.timestampMillis = timestampMillis; | ||
this.timeUpperBoundMillis = timeUpperBoundMillis; | ||
} | ||
|
||
public DataFrameTransformCheckpointStats(StreamInput in) throws IOException { | ||
this.timestampMillis = in.readLong(); | ||
this.timeUpperBoundMillis = in.readLong(); | ||
} | ||
|
||
public long getTimestampMillis() { | ||
return timestampMillis; | ||
} | ||
|
||
public long getTimeUpperBoundMillis() { | ||
return timeUpperBoundMillis; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(timestampMillis, timeUpperBoundMillis); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (this == other) { | ||
return true; | ||
} | ||
|
||
if (other == null || getClass() != other.getClass()) { | ||
return false; | ||
} | ||
|
||
DataFrameTransformCheckpointStats that = (DataFrameTransformCheckpointStats) other; | ||
|
||
return this.timestampMillis == that.timestampMillis && this.timeUpperBoundMillis == that.timeUpperBoundMillis; | ||
} | ||
} |
102 changes: 102 additions & 0 deletions
102
...va/org/elasticsearch/client/dataframe/transforms/DataFrameTransformCheckpointingInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.client.dataframe.transforms; | ||
|
||
import org.elasticsearch.common.ParseField; | ||
import org.elasticsearch.common.xcontent.ConstructingObjectParser; | ||
import org.elasticsearch.common.xcontent.XContentParser; | ||
|
||
import java.util.Objects; | ||
|
||
public class DataFrameTransformCheckpointingInfo { | ||
|
||
public static final ParseField CURRENT_CHECKPOINT = new ParseField("current"); | ||
public static final ParseField IN_PROGRESS_CHECKPOINT = new ParseField("in_progress"); | ||
public static final ParseField OPERATIONS_BEHIND = new ParseField("operations_behind"); | ||
|
||
private final DataFrameTransformCheckpointStats current; | ||
private final DataFrameTransformCheckpointStats inProgress; | ||
private final long operationsBehind; | ||
|
||
|
||
private static final ConstructingObjectParser<DataFrameTransformCheckpointingInfo, Void> LENIENT_PARSER = | ||
new ConstructingObjectParser<>( | ||
"data_frame_transform_checkpointing_info", true, a -> { | ||
long behind = a[2] == null ? 0L : (Long) a[2]; | ||
|
||
return new DataFrameTransformCheckpointingInfo( | ||
a[0] == null ? DataFrameTransformCheckpointStats.EMPTY : (DataFrameTransformCheckpointStats) a[0], | ||
a[1] == null ? DataFrameTransformCheckpointStats.EMPTY : (DataFrameTransformCheckpointStats) a[1], behind); | ||
}); | ||
|
||
static { | ||
LENIENT_PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), | ||
(p, c) -> DataFrameTransformCheckpointStats.fromXContent(p), CURRENT_CHECKPOINT); | ||
LENIENT_PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), | ||
(p, c) -> DataFrameTransformCheckpointStats.fromXContent(p), IN_PROGRESS_CHECKPOINT); | ||
LENIENT_PARSER.declareLong(ConstructingObjectParser.optionalConstructorArg(), OPERATIONS_BEHIND); | ||
} | ||
|
||
public DataFrameTransformCheckpointingInfo(DataFrameTransformCheckpointStats current, DataFrameTransformCheckpointStats inProgress, | ||
long operationsBehind) { | ||
this.current = Objects.requireNonNull(current); | ||
this.inProgress = Objects.requireNonNull(inProgress); | ||
this.operationsBehind = operationsBehind; | ||
} | ||
|
||
public DataFrameTransformCheckpointStats getCurrent() { | ||
return current; | ||
} | ||
|
||
public DataFrameTransformCheckpointStats getInProgress() { | ||
return inProgress; | ||
} | ||
|
||
public long getOperationsBehind() { | ||
return operationsBehind; | ||
} | ||
|
||
public static DataFrameTransformCheckpointingInfo fromXContent(XContentParser p) { | ||
return LENIENT_PARSER.apply(p, null); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(current, inProgress, operationsBehind); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (this == other) { | ||
return true; | ||
} | ||
|
||
if (other == null || getClass() != other.getClass()) { | ||
return false; | ||
} | ||
|
||
DataFrameTransformCheckpointingInfo that = (DataFrameTransformCheckpointingInfo) other; | ||
|
||
return Objects.equals(this.current, that.current) && | ||
Objects.equals(this.inProgress, that.inProgress) && | ||
this.operationsBehind == that.operationsBehind; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.