@Override public Object getObject(int index) { if (isSet(index) == 0) { return null; } final List<Object> vals = new JsonStringArrayList<>(listSize); for (int i = 0; i < listSize; i++) { vals.add(vector.getObject(index * listSize + i)); } return vals; }
public String contentToTSVString() { StringBuilder sb = new StringBuilder(); List<Object> row = new ArrayList<>(schema.getFields().size()); for (Field field : schema.getFields()) { row.add(field.getName()); } printRow(sb, row); for (int i = 0; i < rowCount; i++) { row.clear(); for (FieldVector v : fieldVectors) { row.add(v.getObject(i)); } printRow(sb, row); } return sb.toString(); } }
/** * Validate two arrow FieldVectors are equal. * * @param vector1 the 1st VectorField to compare * @param vector2 the 2nd VectorField to compare * @throws IllegalArgumentException if they are different */ public static void compareFieldVectors(FieldVector vector1, FieldVector vector2) { Field field1 = vector1.getField(); if (!field1.equals(vector2.getField())) { throw new IllegalArgumentException("Different Fields:\n" + field1 + "\n!=\n" + vector2.getField()); } int valueCount = vector1.getValueCount(); if (valueCount != vector2.getValueCount()) { throw new IllegalArgumentException("Different value count for field " + field1 + " : " + valueCount + " != " + vector2.getValueCount()); } for (int j = 0; j < valueCount; j++) { Object obj1 = vector1.getObject(j); Object obj2 = vector2.getObject(j); if (!equals(field1.getType(), obj1, obj2)) { throw new IllegalArgumentException( "Different values in column:\n" + field1 + " at index " + j + ": " + obj1 + " != " + obj2); } } }
for (int i = 0; i < dictionary.getVector().getValueCount(); i++) { lookUps.put(dictionary.getVector().getObject(i), i);