5252import java .io .File ;
5353import java .io .IOException ;
5454import java .nio .ByteBuffer ;
55+ import java .time .LocalDate ;
5556import java .util .ArrayList ;
5657import java .util .Collections ;
5758import java .util .List ;
@@ -354,8 +355,9 @@ public void writeNonAlignedWithTabletWithNullValue() {
354355 setEnv (100 , 30 );
355356 try (TsFileWriter tsFileWriter = new TsFileWriter (f )) {
356357 measurementSchemas .add (new MeasurementSchema ("s1" , TSDataType .TEXT , TSEncoding .PLAIN ));
357- measurementSchemas .add (new MeasurementSchema ("s2" , TSDataType .TEXT , TSEncoding .PLAIN ));
358- measurementSchemas .add (new MeasurementSchema ("s3" , TSDataType .TEXT , TSEncoding .PLAIN ));
358+ measurementSchemas .add (new MeasurementSchema ("s2" , TSDataType .STRING , TSEncoding .PLAIN ));
359+ measurementSchemas .add (new MeasurementSchema ("s3" , TSDataType .BLOB , TSEncoding .PLAIN ));
360+ measurementSchemas .add (new MeasurementSchema ("s4" , TSDataType .DATE , TSEncoding .PLAIN ));
359361
360362 // register nonAligned timeseries
361363 tsFileWriter .registerTimeseries (new Path (deviceId ), measurementSchemas );
@@ -364,19 +366,25 @@ public void writeNonAlignedWithTabletWithNullValue() {
364366 long [] timestamps = tablet .timestamps ;
365367 Object [] values = tablet .values ;
366368 tablet .initBitMaps ();
367- long sensorNum = measurementSchemas .size ();
369+ int sensorNum = measurementSchemas .size ();
368370 long startTime = 0 ;
369371 for (long r = 0 ; r < 10000 ; r ++) {
370372 int row = tablet .rowSize ++;
371373 timestamps [row ] = startTime ++;
372- for (int i = 0 ; i < sensorNum ; i ++) {
374+ for (int i = 0 ; i < sensorNum - 1 ; i ++) {
373375 if (i == 1 && r > 1000 ) {
374376 tablet .bitMaps [i ].mark ((int ) r % tablet .getMaxRowNumber ());
375377 continue ;
376378 }
377379 Binary [] textSensor = (Binary []) values [i ];
378380 textSensor [row ] = new Binary ("testString........." , TSFileConfig .STRING_CHARSET );
379381 }
382+ if (r > 1000 ) {
383+ tablet .bitMaps [sensorNum - 1 ].mark ((int ) r % tablet .getMaxRowNumber ());
384+ } else {
385+ LocalDate [] dateSensor = (LocalDate []) values [sensorNum - 1 ];
386+ dateSensor [row ] = LocalDate .of (2024 , 4 , 1 );
387+ }
380388 // write
381389 if (tablet .rowSize == tablet .getMaxRowNumber ()) {
382390 tsFileWriter .write (tablet );
@@ -400,8 +408,9 @@ public void writeAlignedWithTabletWithNullValue() {
400408 setEnv (100 , 30 );
401409 try (TsFileWriter tsFileWriter = new TsFileWriter (f )) {
402410 measurementSchemas .add (new MeasurementSchema ("s1" , TSDataType .TEXT , TSEncoding .PLAIN ));
403- measurementSchemas .add (new MeasurementSchema ("s2" , TSDataType .TEXT , TSEncoding .PLAIN ));
404- measurementSchemas .add (new MeasurementSchema ("s3" , TSDataType .TEXT , TSEncoding .PLAIN ));
411+ measurementSchemas .add (new MeasurementSchema ("s2" , TSDataType .STRING , TSEncoding .PLAIN ));
412+ measurementSchemas .add (new MeasurementSchema ("s3" , TSDataType .BLOB , TSEncoding .PLAIN ));
413+ measurementSchemas .add (new MeasurementSchema ("s4" , TSDataType .DATE , TSEncoding .PLAIN ));
405414
406415 // register aligned timeseries
407416 tsFileWriter .registerAlignedTimeseries (new Path (deviceId ), measurementSchemas );
@@ -410,19 +419,25 @@ public void writeAlignedWithTabletWithNullValue() {
410419 long [] timestamps = tablet .timestamps ;
411420 Object [] values = tablet .values ;
412421 tablet .initBitMaps ();
413- long sensorNum = measurementSchemas .size ();
422+ int sensorNum = measurementSchemas .size ();
414423 long startTime = 0 ;
415424 for (long r = 0 ; r < 10000 ; r ++) {
416425 int row = tablet .rowSize ++;
417426 timestamps [row ] = startTime ++;
418- for (int i = 0 ; i < sensorNum ; i ++) {
427+ for (int i = 0 ; i < sensorNum - 1 ; i ++) {
419428 if (i == 1 && r > 1000 ) {
420429 tablet .bitMaps [i ].mark ((int ) r % tablet .getMaxRowNumber ());
421430 continue ;
422431 }
423432 Binary [] textSensor = (Binary []) values [i ];
424433 textSensor [row ] = new Binary ("testString........." , TSFileConfig .STRING_CHARSET );
425434 }
435+ if (r > 1000 ) {
436+ tablet .bitMaps [sensorNum - 1 ].mark ((int ) r % tablet .getMaxRowNumber ());
437+ } else {
438+ LocalDate [] dateSensor = (LocalDate []) values [sensorNum - 1 ];
439+ dateSensor [row ] = LocalDate .of (2024 , 4 , 1 );
440+ }
426441 // write
427442 if (tablet .rowSize == tablet .getMaxRowNumber ()) {
428443 tsFileWriter .writeAligned (tablet );
0 commit comments