Java Code Examples for org.apache.arrow.vector.BitVector#setValueCount()

The following examples show how to use org.apache.arrow.vector.BitVector#setValueCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestArrowBooleanConnector.java    From yosegi with Apache License 2.0 5 votes vote down vote up
@Test
public void T_convert_1() throws IOException{
  BufferAllocator allocator = new RootAllocator( 1024 * 1024 * 10 );
  BitVector vector = new BitVector( "test" , allocator );
  vector.allocateNew();
  vector.setSafe( 0 , 0 );
  vector.setSafe( 1 , 1 );
  vector.setSafe( 2 , 0 );
  vector.setNull( 3 );
  vector.setSafe( 4 , 1 );
  vector.setSafe( 5 , 1 );
  vector.setSafe( 6 , 1 );
  vector.setNull( 7 );
  vector.setValueCount( 8 );

  IColumn column = ArrowColumnFactory.convert( "test" , vector );
  assertEquals( column.getColumnName() , "test" );
  assertEquals( column.size() , 8 );
  assertTrue( ( column.getColumnType() == ColumnType.BOOLEAN ) );
  assertEquals( ( (PrimitiveObject)( column.get(0).getRow() ) ).getBoolean() , false  );
  assertEquals( ( (PrimitiveObject)( column.get(1).getRow() ) ).getBoolean() , true  );
  assertEquals( ( (PrimitiveObject)( column.get(2).getRow() ) ).getBoolean() , false  );
  assertEquals( column.get(3).getRow() , null  );
  assertEquals( ( (PrimitiveObject)( column.get(4).getRow() ) ).getBoolean() , true  );
  assertEquals( ( (PrimitiveObject)( column.get(5).getRow() ) ).getBoolean() , true  );
  assertEquals( ( (PrimitiveObject)( column.get(6).getRow() ) ).getBoolean() , true  );
  assertEquals( column.get(7).getRow() , null  );
}
 
Example 2
Source File: TestArrowBooleanConnector.java    From multiple-dimension-spread with Apache License 2.0 5 votes vote down vote up
@Test
public void T_convert_1() throws IOException{
  BufferAllocator allocator = new RootAllocator( 1024 * 1024 * 10 );
  BitVector vector = new BitVector( "test" , allocator );
  vector.allocateNew();
  vector.setSafe( 0 , 0 );  
  vector.setSafe( 1 , 1 );  
  vector.setSafe( 2 , 0 );  
  vector.setNull( 3 );  
  vector.setSafe( 4 , 1 );  
  vector.setSafe( 5 , 1 );  
  vector.setSafe( 6 , 1 );  
  vector.setNull( 7 );  
  vector.setValueCount( 8 );

  IColumn column = ArrowColumnFactory.convert( "test" , vector );
  assertEquals( column.getColumnName() , "test" );
  assertEquals( column.size() , 8 );
  assertTrue( ( column.getColumnType() == ColumnType.BOOLEAN ) );
  assertEquals( ( (PrimitiveObject)( column.get(0).getRow() ) ).getBoolean() , false  );
  assertEquals( ( (PrimitiveObject)( column.get(1).getRow() ) ).getBoolean() , true  );
  assertEquals( ( (PrimitiveObject)( column.get(2).getRow() ) ).getBoolean() , false  );
  assertEquals( column.get(3).getRow() , null  );
  assertEquals( ( (PrimitiveObject)( column.get(4).getRow() ) ).getBoolean() , true  );
  assertEquals( ( (PrimitiveObject)( column.get(5).getRow() ) ).getBoolean() , true  );
  assertEquals( ( (PrimitiveObject)( column.get(6).getRow() ) ).getBoolean() , true  );
  assertEquals( column.get(7).getRow() , null  );
}
 
Example 3
Source File: TestQueryReAttempt.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private BitVector bitVector(String name) {
  BitVector vec = new BitVector(name, getAllocator());
  vec.allocateNew(COUNT);
  vec.set(0, 1);
  vec.set(1, 0);
  vec.setNull(2);
  vec.set(3, 1);
  vec.set(4, 1);

  vec.setValueCount(COUNT);
  return vec;
}