Caideyipi commented on code in PR #12018:
URL: https://github.com/apache/iotdb/pull/12018#discussion_r1477189706
##########
iotdb-api/pipe-api/src/main/java/org/apache/iotdb/pipe/api/customizer/parameter/PipeParameters.java:
##########
@@ -281,30 +283,15 @@ public String toString() {
}
/**
- * This method uses {@link KeyReducer} to reduce keys and then sorts them to
determine if two
- * PipeParameters are equivalent.
+ * This method adds (non-existed) or replaces (existed) attributes in this
PipeParameters with
+ * those from another PipeParameters.
+ *
+ * @param that provide the key that needs to be updated along with the value
+ * @return this pipe parameters
*/
- public boolean isEquivalent(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- PipeParameters that = (PipeParameters) obj;
- return Objects.equals(
- this.attributes.entrySet().stream()
- .collect(
- Collectors.toMap(
- entry -> KeyReducer.reduce(entry.getKey()),
Entry::getValue,
- (oldValue, newValue) -> oldValue, TreeMap::new))
- .toString(),
- that.attributes.entrySet().stream()
- .collect(
- Collectors.toMap(
- entry -> KeyReducer.reduce(entry.getKey()),
Entry::getValue,
- (oldValue, newValue) -> oldValue, TreeMap::new))
- .toString());
+ public PipeParameters addOrReplaceAttributes(PipeParameters that) {
+ that.attributes.forEach((k, v) ->
this.attributes.put(KeyReducer.reduce(k), v));
Review Comment:
A reasonable process may be like this:
1. See if reduced old attribute equals to reduced new attribute.
2. If so, remove the old one and add the new one into parameters.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]