Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,6 @@ public static void populate(WritableColumnVector col, InternalRow row, int field
}
}

/**
* Returns the array data as the java primitive array.
* For example, an array of IntegerType will return an int[].
* Throws exceptions for unhandled schemas.
*/
public static Object toPrimitiveJavaArray(ColumnarArray array) {
Copy link
Member

@viirya viirya Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious that why we have this method? Looks it is just used in test.

Copy link
Member Author

@kiszk kiszk Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. This method was used only for test. I removed this by replacing this with another method.

DataType dt = array.data.dataType();
if (dt instanceof IntegerType) {
int[] result = new int[array.length];
ColumnVector data = array.data;
for (int i = 0; i < result.length; i++) {
if (data.isNullAt(array.offset + i)) {
throw new RuntimeException("Cannot handle NULL values.");
}
result[i] = data.getInt(array.offset + i);
}
return result;
} else {
throw new UnsupportedOperationException();
}
}

private static void appendValue(WritableColumnVector dst, DataType t, Object o) {
if (o == null) {
if (t instanceof CalendarIntervalType) {
Expand Down
Loading