@@ -2254,6 +2254,25 @@ public void testGetNullFromVariableWidthVector() {
22542254    }
22552255  }
22562256
2257+   @ Test 
2258+   public  void  testIntVectorEqualsWithNull () {
2259+     try  (final  IntVector  vector1  = new  IntVector ("v1" , allocator );
2260+         final  IntVector  vector2  = new  IntVector ("v2" , allocator )) {
2261+ 
2262+       vector1 .allocateNew (2 );
2263+       vector1 .setValueCount (2 );
2264+       vector2 .allocateNew (2 );
2265+       vector2 .setValueCount (2 );
2266+ 
2267+       vector1 .setSafe (0 , 1 );
2268+       vector1 .setSafe (1 , 2 );
2269+ 
2270+       vector2 .setSafe (0 , 1 );
2271+ 
2272+       assertFalse (vector1 .equals (vector2 ));
2273+     }
2274+   }
2275+ 
22572276  @ Test 
22582277  public  void  testIntVectorEquals () {
22592278    try  (final  IntVector  vector1  = new  IntVector ("v1" , allocator );
@@ -2309,6 +2328,25 @@ public void testDecimalVectorEquals() {
23092328    }
23102329  }
23112330
2331+   @ Test 
2332+   public  void  testVarcharVectorEuqalsWithNull () {
2333+     try  (final  VarCharVector  vector1  = new  VarCharVector ("v1" , allocator );
2334+         final  VarCharVector  vector2  = new  VarCharVector ("v2" , allocator )) {
2335+ 
2336+       vector1 .allocateNew ();
2337+       vector2 .allocateNew ();
2338+ 
2339+       // set some values 
2340+       vector1 .setSafe (0 , STR1 , 0 , STR1 .length );
2341+       vector1 .setSafe (1 , STR2 , 0 , STR2 .length );
2342+       vector1 .setValueCount (2 );
2343+ 
2344+       vector2 .setSafe (0 , STR1 , 0 , STR1 .length );
2345+       vector2 .setValueCount (2 );
2346+       assertFalse (vector1 .equals (vector2 ));
2347+     }
2348+   }
2349+ 
23122350  @ Test 
23132351  public  void  testVarcharVectorEquals () {
23142352    try  (final  VarCharVector  vector1  = new  VarCharVector ("v1" , allocator );
@@ -2359,6 +2397,32 @@ public void testVarBinaryVectorEquals() {
23592397    }
23602398  }
23612399
2400+   @ Test 
2401+   public  void  testListVectorEqualsWithNull () {
2402+     try  (final  ListVector  vector1  = ListVector .empty ("v1" , allocator );
2403+         final  ListVector  vector2  = ListVector .empty ("v2" , allocator );) {
2404+ 
2405+       UnionListWriter  writer1  = vector1 .getWriter ();
2406+       writer1 .allocate ();
2407+ 
2408+       //set some values 
2409+       writeListVector (writer1 , new  int [] {1 , 2 });
2410+       writeListVector (writer1 , new  int [] {3 , 4 });
2411+       writeListVector (writer1 , new  int [] {});
2412+       writer1 .setValueCount (3 );
2413+ 
2414+       UnionListWriter  writer2  = vector2 .getWriter ();
2415+       writer2 .allocate ();
2416+ 
2417+       //set some values 
2418+       writeListVector (writer2 , new  int [] {1 , 2 });
2419+       writeListVector (writer2 , new  int [] {3 , 4 });
2420+       writer2 .setValueCount (3 );
2421+ 
2422+       assertFalse (vector1 .equals (vector2 ));
2423+     }
2424+   }
2425+ 
23622426  @ Test 
23632427  public  void  testListVectorEquals () {
23642428    try  (final  ListVector  vector1  = ListVector .empty ("v1" , allocator );
@@ -2389,6 +2453,35 @@ public void testListVectorEquals() {
23892453    }
23902454  }
23912455
2456+   @ Test 
2457+   public  void  testStructVectorEqualsWithNull () {
2458+ 
2459+     try  (final  StructVector  vector1  = StructVector .empty ("v1" , allocator );
2460+         final  StructVector  vector2  = StructVector .empty ("v2" , allocator );) {
2461+       vector1 .addOrGet ("f0" , FieldType .nullable (new  ArrowType .Int (32 , true )), IntVector .class );
2462+       vector1 .addOrGet ("f1" , FieldType .nullable (new  ArrowType .Int (64 , true )), BigIntVector .class );
2463+       vector2 .addOrGet ("f0" , FieldType .nullable (new  ArrowType .Int (32 , true )), IntVector .class );
2464+       vector2 .addOrGet ("f1" , FieldType .nullable (new  ArrowType .Int (64 , true )), BigIntVector .class );
2465+ 
2466+       NullableStructWriter  writer1  = vector1 .getWriter ();
2467+       writer1 .allocate ();
2468+ 
2469+       writeStructVector (writer1 , 1 , 10L );
2470+       writeStructVector (writer1 , 2 , 20L );
2471+       writeStructVector (writer1 , 3 , 30L );
2472+       writer1 .setValueCount (3 );
2473+ 
2474+       NullableStructWriter  writer2  = vector2 .getWriter ();
2475+       writer2 .allocate ();
2476+ 
2477+       writeStructVector (writer2 , 1 , 10L );
2478+       writeStructVector (writer2 , 3 , 30L );
2479+       writer2 .setValueCount (3 );
2480+ 
2481+       assertFalse (vector1 .equals (vector2 ));
2482+     }
2483+   }
2484+ 
23922485  @ Test 
23932486  public  void  testStructVectorEquals () {
23942487    try  (final  StructVector  vector1  = StructVector .empty ("v1" , allocator );
@@ -2421,6 +2514,32 @@ public void testStructVectorEquals() {
24212514    }
24222515  }
24232516
2517+   @ Test 
2518+   public  void  testStructVectorEqualsWithDiffChild () {
2519+     try  (final  StructVector  vector1  = StructVector .empty ("v1" , allocator );
2520+         final  StructVector  vector2  = StructVector .empty ("v2" , allocator );) {
2521+       vector1 .addOrGet ("f0" , FieldType .nullable (new  ArrowType .Int (32 , true )), IntVector .class );
2522+       vector1 .addOrGet ("f1" , FieldType .nullable (new  ArrowType .Int (64 , true )), BigIntVector .class );
2523+       vector2 .addOrGet ("f0" , FieldType .nullable (new  ArrowType .Int (32 , true )), IntVector .class );
2524+       vector2 .addOrGet ("f10" , FieldType .nullable (new  ArrowType .Int (64 , true )), BigIntVector .class );
2525+ 
2526+       NullableStructWriter  writer1  = vector1 .getWriter ();
2527+       writer1 .allocate ();
2528+ 
2529+       writeStructVector (writer1 , 1 , 10L );
2530+       writeStructVector (writer1 , 2 , 20L );
2531+       writer1 .setValueCount (2 );
2532+ 
2533+       NullableStructWriter  writer2  = vector2 .getWriter ();
2534+       writer2 .allocate ();
2535+ 
2536+       writeStructVector (writer2 , 1 , 10L );
2537+       writeStructVector (writer2 , 2 , 20L );
2538+       writer2 .setValueCount (2 );
2539+       assertFalse (vector1 .equals (vector2 ));
2540+     }
2541+   }
2542+ 
24242543  @ Test 
24252544  public  void  testUnionVectorEquals () {
24262545    try  (final  UnionVector  vector1  = new  UnionVector ("v1" , allocator , null );
0 commit comments