public static List < Writable > rowToWritables ( Schema schema , Row row ) { List < Writable > ret = new ArrayList <> ( ) ; for ( int i = 0 ; i < row . size ( ) ; i ++ ) { switch ( schema . getType ( i ) ) { case Double : ret . add ( new DoubleWritable ( row . getDouble ( i ) ) ) ; break ; case Float : ret . add ( new FloatWritable ( row . getFloat ( i ) ) ) ; break ; case Integer : ret . add ( new IntWritable ( row . getInt ( i ) ) ) ; break ; case Long : ret . add ( new LongWritable ( row . getLong ( i ) ) ) ; break ; case String : ret . add ( new Text ( row . getString ( i ) ) ) ; break ; default : throw new IllegalStateException ( "Illegal type" ) ; } } return ret ; }
Convert a given Row to a list of writables given the specified Schema