Java Code Examples for org.apache.arrow.vector.SmallIntVector#allocateNew()
The following examples show how to use
org.apache.arrow.vector.SmallIntVector#allocateNew() .
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: TestData.java From dremio-oss with Apache License 2.0 | 6 votes |
private Pair<SmallIntVector, ResultVerifier> testSmallIntVector() { final String colName = "colSmallInt"; final List<Integer> values = asList(20, null, -2000, 32700, 0); SmallIntVector valuesVector = new SmallIntVector(colName, allocator); valuesVector.allocateNew(values.size()); for (int i = 0; i < values.size(); i++) { if (values.get(i) == null) { valuesVector.setNull(i); } else { valuesVector.set(i, values.get(i)); } } ResultVerifier verifier = new ResultVerifier() { @Override public void verify(DataPOJO output) { verifyIntValues(values, output, colName); } }; return Pair.of(valuesVector, verifier); }
Example 2
Source File: TestArrowShortConnector.java From yosegi with Apache License 2.0 | 5 votes |
@Test public void T_convert_1() throws IOException{ BufferAllocator allocator = new RootAllocator( 1024 * 1024 * 10 ); SmallIntVector vector = new SmallIntVector( "test" , allocator ); vector.allocateNew(); vector.setSafe( 0 , (short)0 ); vector.setSafe( 1 , (short)1 ); vector.setSafe( 2 , (short)0 ); vector.setNull( 3 ); vector.setSafe( 4 , (short)1 ); vector.setSafe( 5 , (short)1 ); vector.setSafe( 6 , (short)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.SHORT ) ); assertEquals( ( (PrimitiveObject)( column.get(0).getRow() ) ).getShort() , (short)0 ); assertEquals( ( (PrimitiveObject)( column.get(1).getRow() ) ).getShort() , (short)1 ); assertEquals( ( (PrimitiveObject)( column.get(2).getRow() ) ).getShort() , (short)0 ); assertEquals( column.get(3).getRow() , null ); assertEquals( ( (PrimitiveObject)( column.get(4).getRow() ) ).getShort() , (short)1 ); assertEquals( ( (PrimitiveObject)( column.get(5).getRow() ) ).getShort() , (short)1 ); assertEquals( ( (PrimitiveObject)( column.get(6).getRow() ) ).getShort() , (short)1 ); assertEquals( column.get(7).getRow() , null ); }
Example 3
Source File: TestArrowShortConnector.java From multiple-dimension-spread with Apache License 2.0 | 5 votes |
@Test public void T_convert_1() throws IOException{ BufferAllocator allocator = new RootAllocator( 1024 * 1024 * 10 ); SmallIntVector vector = new SmallIntVector( "test" , allocator ); vector.allocateNew(); vector.setSafe( 0 , (short)0 ); vector.setSafe( 1 , (short)1 ); vector.setSafe( 2 , (short)0 ); vector.setNull( 3 ); vector.setSafe( 4 , (short)1 ); vector.setSafe( 5 , (short)1 ); vector.setSafe( 6 , (short)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.SHORT ) ); assertEquals( ( (PrimitiveObject)( column.get(0).getRow() ) ).getShort() , (short)0 ); assertEquals( ( (PrimitiveObject)( column.get(1).getRow() ) ).getShort() , (short)1 ); assertEquals( ( (PrimitiveObject)( column.get(2).getRow() ) ).getShort() , (short)0 ); assertEquals( column.get(3).getRow() , null ); assertEquals( ( (PrimitiveObject)( column.get(4).getRow() ) ).getShort() , (short)1 ); assertEquals( ( (PrimitiveObject)( column.get(5).getRow() ) ).getShort() , (short)1 ); assertEquals( ( (PrimitiveObject)( column.get(6).getRow() ) ).getShort() , (short)1 ); assertEquals( column.get(7).getRow() , null ); }
Example 4
Source File: ArrowShortMemoryAllocator.java From yosegi with Apache License 2.0 | 4 votes |
public ArrowShortMemoryAllocator( final SmallIntVector vector , final int rowCount ) { vector.allocateNew( rowCount ); this.vector = vector; }
Example 5
Source File: ArrowShortMemoryAllocator.java From multiple-dimension-spread with Apache License 2.0 | 4 votes |
public ArrowShortMemoryAllocator( final SmallIntVector vector , final int rowCount ){ vector.allocateNew( rowCount ); this.vector = vector; }