2222import org .apache .iotdb .commons .exception .IllegalPathException ;
2323import org .apache .iotdb .commons .path .PartialPath ;
2424import org .apache .iotdb .commons .queryengine .plan .planner .plan .node .PlanNodeId ;
25+ import org .apache .iotdb .db .conf .IoTDBDescriptor ;
2526import org .apache .iotdb .db .exception .WriteProcessException ;
2627import org .apache .iotdb .db .queryengine .plan .planner .plan .node .write .InsertRowNode ;
2728import org .apache .iotdb .db .queryengine .plan .planner .plan .node .write .InsertTabletNode ;
2829
2930import org .apache .tsfile .enums .TSDataType ;
3031import org .apache .tsfile .utils .BitMap ;
3132import org .apache .tsfile .write .schema .MeasurementSchema ;
33+ import org .junit .After ;
3234import org .junit .Before ;
3335import org .junit .Test ;
3436
5254public class AbstractMemTablePartialInsertTest {
5355
5456 private PrimitiveMemTable memTable ;
57+ private static boolean prevEnableNullValueInWriteThroughputMetric ;
5558
5659 @ Before
5760 public void setUp () {
5861 memTable = new PrimitiveMemTable ("root.sg" , "0" );
62+ prevEnableNullValueInWriteThroughputMetric =
63+ IoTDBDescriptor .getInstance ().getConfig ().isIncludeNullValueInWriteThroughputMetric ();
64+ IoTDBDescriptor .getInstance ().getConfig ().setIncludeNullValueInWriteThroughputMetric (false );
65+ }
66+
67+ @ After
68+ public void tearDown () {
69+ IoTDBDescriptor .getInstance ()
70+ .getConfig ()
71+ .setIncludeNullValueInWriteThroughputMetric (prevEnableNullValueInWriteThroughputMetric );
5972 }
6073
6174 // =========================================================================
@@ -70,7 +83,7 @@ public void testInsertAlignedRow_noFailure_noNullValue_pointsInsertedEqualsTotal
7083 // formula: getMeasurementColumnCnt(3) - failedNum(0) - nullPoints(0) = 3
7184 InsertRowNode node =
7285 buildAlignedInsertRowNode (
73- new String [] {"s0" , "s1" , "s2" }, new Object [] {1 , 2L , 3.0f }, -1 /* no failure */ );
86+ new String [] {"s0" , "s1" , "s2" }, new Object [] {1 , 2 , 3 }, -1 /* no failure */ );
7487
7588 int points = memTable .insertAlignedRow (node );
7689
@@ -91,7 +104,7 @@ public void testInsertAlignedRow_oneFailedMeasurement_pointsInsertedNotNegative(
91104 // 2 measurements, first one fails
92105 InsertRowNode node =
93106 buildAlignedInsertRowNode (
94- new String [] {"s0" , "s1" }, new Object [] {1 , 2L }, 0 /* mark index 0 as failed */ );
107+ new String [] {"s0" , "s1" }, new Object [] {1 , 2 }, 0 /* mark index 0 as failed */ );
95108
96109 int points = memTable .insertAlignedRow (node );
97110
@@ -111,6 +124,7 @@ public void testInsertAlignedRow_allMeasurementsFailed_pointsInsertedIsZero()
111124 // mark both as failed
112125 node .markFailedMeasurement (0 );
113126 node .markFailedMeasurement (1 );
127+ node .setFailedMeasurementNumber (2 );
114128
115129 int points = memTable .insertAlignedRow (node );
116130
@@ -173,6 +187,7 @@ public void testInsertTablet_allMeasurementsFailed_pointsInsertedIsZero()
173187 InsertTabletNode node = buildInsertTabletNode (new String [] {"s0" , "s1" }, rowCount , null , -1 );
174188 node .markFailedMeasurement (0 );
175189 node .markFailedMeasurement (1 );
190+ node .setFailedMeasurementNumber (2 );
176191
177192 int points = memTable .insertTablet (node , 0 , rowCount );
178193
@@ -236,6 +251,7 @@ private static InsertRowNode buildAlignedInsertRowNode(
236251 false );
237252 if (failedIndex >= 0 ) {
238253 node .markFailedMeasurement (failedIndex );
254+ node .setFailedMeasurementNumber (1 );
239255 }
240256 return node ;
241257 }
@@ -274,6 +290,7 @@ private static InsertTabletNode buildInsertTabletNode(
274290 rowCount );
275291 if (failedIndex >= 0 ) {
276292 node .markFailedMeasurement (failedIndex );
293+ node .setFailedMeasurementNumber (1 );
277294 }
278295 return node ;
279296 }
0 commit comments