This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.12 by this push:
new 94b4fdd [To rel/0.12][IOTDB-1298] Insertion performance loss due to
meaningless autoboxing and unboxing (#3004)
94b4fdd is described below
commit 94b4fdd17810a2f34a8fea31bcacb08378ba24e9
Author: Steve Yurong Su <[email protected]>
AuthorDate: Wed Apr 14 11:58:23 2021 +0800
[To rel/0.12][IOTDB-1298] Insertion performance loss due to meaningless
autoboxing and unboxing (#3004)
* remove the method updateTimesCache() in InsertTabletPlan
---
.../db/qp/physical/crud/InsertTabletPlan.java | 24 +++-------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
index 8ca7a40..fa75882 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
@@ -58,9 +58,6 @@ public class InsertTabletPlan extends InsertPlan {
// indicate whether this plan has been set 'start' or 'end' in order to
support plan transmission
// without data loss in cluster version
boolean isExecuting = false;
- // cached values
- private Long maxTime = Long.MIN_VALUE;
- private Long minTime = Long.MAX_VALUE;
private List<PartialPath> paths;
private int start;
private int end;
@@ -423,7 +420,6 @@ public class InsertTabletPlan extends InsertPlan {
rowCount = rows;
this.times = new long[rows];
times = QueryDataSetUtils.readTimesFromBuffer(buffer, rows);
- updateTimesCache();
columns = QueryDataSetUtils.readValuesFromBuffer(buffer, dataTypes,
measurementSize, rows);
this.index = buffer.getLong();
@@ -450,11 +446,11 @@ public class InsertTabletPlan extends InsertPlan {
@Override
public long getMinTime() {
- return minTime;
+ return times.length != 0 ? times[0] : Long.MIN_VALUE;
}
public long getMaxTime() {
- return maxTime;
+ return times.length != 0 ? times[times.length - 1] : Long.MAX_VALUE;
}
public TimeValuePair composeLastTimeValuePair(int measurementIndex) {
@@ -500,18 +496,6 @@ public class InsertTabletPlan extends InsertPlan {
public void setTimes(long[] times) {
this.times = times;
- updateTimesCache();
- }
-
- private void updateTimesCache() {
- for (Long time : times) {
- if (time > maxTime) {
- maxTime = time;
- }
- if (time < minTime) {
- minTime = time;
- }
- }
}
public int getRowCount() {
@@ -573,15 +557,13 @@ public class InsertTabletPlan extends InsertPlan {
&& Arrays.equals(times, that.times)
&& Objects.equals(timeBuffer, that.timeBuffer)
&& Objects.equals(valueBuffer, that.valueBuffer)
- && Objects.equals(maxTime, that.maxTime)
- && Objects.equals(minTime, that.minTime)
&& Objects.equals(paths, that.paths)
&& Objects.equals(range, that.range);
}
@Override
public int hashCode() {
- int result = Objects.hash(timeBuffer, valueBuffer, rowCount, maxTime,
minTime, paths, range);
+ int result = Objects.hash(timeBuffer, valueBuffer, rowCount, paths, range);
result = 31 * result + Arrays.hashCode(times);
return result;
}