File tree Expand file tree Collapse file tree
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/event/common/tablet Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020package org .apache .iotdb .db .pipe .event .common .tablet ;
2121
2222import org .apache .tsfile .enums .TSDataType ;
23+ import org .apache .tsfile .utils .BitMap ;
2324import org .apache .tsfile .write .record .Tablet ;
2425import org .apache .tsfile .write .schema .IMeasurementSchema ;
2526import org .apache .tsfile .write .schema .MeasurementSchema ;
@@ -49,4 +50,26 @@ public void testPutValueUnmarksReusedNullRow() {
4950 Assert .assertFalse (tablet .isNull (0 , 0 ));
5051 Assert .assertTrue (tablet .isNull (0 , 1 ));
5152 }
53+
54+ @ Test
55+ public void testCompactBitMapsIgnoresUnusedTailBits () {
56+ final List <IMeasurementSchema > schemas =
57+ Arrays .asList (
58+ new MeasurementSchema ("s1" , TSDataType .FLOAT ),
59+ new MeasurementSchema ("s2" , TSDataType .FLOAT ));
60+ final Tablet tablet = new Tablet ("root.sg.d1" , schemas , 2 );
61+ final BitMap [] bitMaps = new BitMap [] {new BitMap (2 ), new BitMap (2 )};
62+ bitMaps [0 ].markAll ();
63+ bitMaps [0 ].unmark (0 );
64+ bitMaps [0 ].unmark (1 );
65+ bitMaps [1 ].mark (1 );
66+ tablet .setBitMaps (bitMaps );
67+ tablet .setRowSize (2 );
68+
69+ PipeTabletUtils .compactBitMaps (tablet );
70+
71+ Assert .assertNotNull (tablet .getBitMaps ());
72+ Assert .assertNull (tablet .getBitMaps ()[0 ]);
73+ Assert .assertNotNull (tablet .getBitMaps ()[1 ]);
74+ }
5275}
You can’t perform that action at this time.
0 commit comments