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..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) { @@ -756,8 +765,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++) {