From cbd92326246eaac74258b6045368946113f54f54 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:30:51 +0800 Subject: [PATCH 1/2] Update Tablet.java --- .../org/apache/tsfile/write/record/Tablet.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java b/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java index c16bfa2eb..422b52743 100644 --- a/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java +++ b/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java @@ -756,8 +756,21 @@ private boolean isBitMapsEqual(BitMap[] thisBitMaps, BitMap[] thatBitMaps, int c if (thisBitMaps == thatBitMaps) { return true; } - if (thisBitMaps == null || thatBitMaps == null) { - return false; + if (thisBitMaps == null) { + for (int i = 0; i < columns; i++) { + if (thatBitMaps[i] != null) { + return false; + } + } + return true; + } + if (thatBitMaps == null) { + for (int i = 0; i < columns; i++) { + if (thisBitMaps[i] != null) { + return false; + } + } + return true; } for (int i = 0; i < columns; i++) { From 676677ae7e5c49ce901647246a5fb4531501d5a4 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:38:53 +0800 Subject: [PATCH 2/2] Update Tablet.java --- .../main/java/org/apache/tsfile/write/record/Tablet.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java b/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java index 422b52743..943b5a3cd 100644 --- a/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java +++ b/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java @@ -606,6 +606,15 @@ public static Object[] readTabletValuesFromBuffer( return values; } + /** + * Note that the function will judge 2 tablets to be equal when their contents are logically the + * same. Namely, a tablet with bitmap "null" may be equal to another tablet with 3 columns and + * bitmap "[null, null, null]", and a tablet with rowSize 2 is judged identical to other tablets + * regardless of any timeStamps with indexes larger than or equal to 2. + * + * @param o the tablet to compare + * @return true if the tablets are logically equal + */ @Override public boolean equals(Object o) { if (this == o) {