public static INDArray convertArrowVector ( FieldVector fieldVector , ColumnType type ) { DataBuffer buffer = null ; int cols = fieldVector . getValueCount ( ) ; ByteBuffer direct = ByteBuffer . allocateDirect ( fieldVector . getDataBuffer ( ) . capacity ( ) ) ; direct . order ( ByteOrder . nativeOrder ( ) ) ; fieldVector . getDataBuffer ( ) . getBytes ( 0 , direct ) ; direct . rewind ( ) ; switch ( type ) { case Integer : buffer = Nd4j . createBuffer ( direct , DataType . INT , cols , 0 ) ; break ; case Float : buffer = Nd4j . createBuffer ( direct , DataType . FLOAT , cols ) ; break ; case Double : buffer = Nd4j . createBuffer ( direct , DataType . DOUBLE , cols ) ; break ; case Long : buffer = Nd4j . createBuffer ( direct , DataType . LONG , cols ) ; break ; } return Nd4j . create ( buffer , new int [ ] { cols , 1 } ) ; }
Convert a field vector to a column vector