diff --git a/java/vector/src/main/java/org/apache/arrow/vector/table/BaseTable.java b/java/vector/src/main/java/org/apache/arrow/vector/table/BaseTable.java index b405782c777..9f645b64bc5 100644 --- a/java/vector/src/main/java/org/apache/arrow/vector/table/BaseTable.java +++ b/java/vector/src/main/java/org/apache/arrow/vector/table/BaseTable.java @@ -90,6 +90,10 @@ public BaseTable(List fieldVectors, int rowCount, DictionaryProvide this.schema = new Schema(fields); } + BaseTable() { + this.fieldVectors = new ArrayList<>(); + } + /** * Returns a FieldReader for the vector with the given name. * @@ -254,7 +258,7 @@ FieldVector getVector(String columnName) { return entry.getValue(); } } - throw new IllegalStateException(String.format("No vector named '%s' is present in the table", columnName)); + throw new IllegalArgumentException(String.format("No vector named '%s' is present in the table", columnName)); } /** @@ -266,6 +270,48 @@ FieldVector getVector(int columnIndex) { return fieldVectors.get(columnIndex); } + + /** + * Returns a copy of the vector with the given name, or throws IllegalArgumentException if the name is not found. + * Names are case-sensitive. + * + * @param columnName The name of the vector to copy + * @return A copy of the Vector with the given name + * @throws IllegalArgumentException if the name is not the name of a vector in the table. + */ + public FieldVector getVectorCopy(String columnName) { + FieldVector source; + for (Map.Entry entry : fieldVectorsMap.entrySet()) { + if (entry.getKey().getName().equals(columnName)) { + source = entry.getValue(); + FieldVector copy = source.getField().createVector(source.getAllocator()); + copy.allocateNew(); + for (int i = 0; i < source.getValueCount(); i++) { + copy.copyFromSafe(i, i, source); + } + copy.setValueCount(source.getValueCount()); + return copy; + } + } + throw new IllegalStateException(String.format("No vector named '%s' is present in the table", columnName)); + } + + /** + * Returns a copy of the vector at the given position. + * + * @param columnIndex The 0-based position of the vector to be copied + */ + public FieldVector getVectorCopy(int columnIndex) { + FieldVector source = fieldVectors.get(columnIndex); + FieldVector copy = source.getField().createVector(source.getAllocator()); + copy.allocateNew(); + for (int i = 0; i < source.getValueCount(); i++) { + copy.copyFromSafe(i, i, source); + } + copy.setValueCount(source.getValueCount()); + return copy; + } + /** * Returns an immutable Row object holding a reference to this table. The default character * encoding used by the cursor to decode Strings will be StandardCharsets.UTF_8 as this is the only charset diff --git a/java/vector/src/main/java/org/apache/arrow/vector/table/Row.java b/java/vector/src/main/java/org/apache/arrow/vector/table/Row.java index b6cc566f2f7..053d6735572 100644 --- a/java/vector/src/main/java/org/apache/arrow/vector/table/Row.java +++ b/java/vector/src/main/java/org/apache/arrow/vector/table/Row.java @@ -179,7 +179,7 @@ public boolean isNull(int columnIndex) { /** * Returns an object representing the value in the ExtensionTypeVector at the currentRow and vectorIndex. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if the type is incorrect. */ public Object getExtensionType(int vectorIndex) { @@ -189,7 +189,7 @@ public Object getExtensionType(int vectorIndex) { /** * Returns an object representing the value in the named ExtensionTypeVector at the currentRow. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type. * * @param columnName The name of the vector providing the result @@ -201,7 +201,7 @@ public Object getExtensionType(String columnName) { } /** - * Returns a Map from the column of the given vectorIndex at the current row. An IllegalStateException is + * Returns a Map from the column of the given vectorIndex at the current row. An IllegalArgumentException is * thrown if the column is not present in the Row and a ClassCastException is thrown if * it has a different type. */ @@ -211,7 +211,7 @@ public List getMap(int vectorIndex) { } /** - * Returns a Map from the column of the given name at the current row. An IllegalStateException is + * Returns a Map from the column of the given name at the current row. An IllegalArgumentException is * thrown if the column is not present in the Row and a ClassCastException is thrown if * it has a different type */ @@ -222,7 +222,7 @@ public List getMap(String columnName) { /** * Returns an Object from the column at vectorIndex at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public Object getStruct(int vectorIndex) { @@ -232,7 +232,7 @@ public Object getStruct(int vectorIndex) { /** * Returns an Object from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public Object getStruct(String columnName) { @@ -242,7 +242,7 @@ public Object getStruct(String columnName) { /** * Returns an Object from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public Object getUnion(int vectorIndex) { @@ -252,7 +252,7 @@ public Object getUnion(int vectorIndex) { /** * Returns an Object from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public Object getUnion(String columnName) { @@ -262,7 +262,7 @@ public Object getUnion(String columnName) { /** * Returns an Object from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public Object getDenseUnion(String columnName) { @@ -272,7 +272,7 @@ public Object getDenseUnion(String columnName) { /** * Returns an Object from the column with the given vectorIndex at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public Object getDenseUnion(int vectorIndex) { @@ -281,7 +281,7 @@ public Object getDenseUnion(int vectorIndex) { } /** - * Returns a List from the column of the given name at the current row. An IllegalStateException + * Returns a List from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present in the Row and a ClassCastException is thrown * if it has a different type */ @@ -292,7 +292,7 @@ public List getList(String columnName) { /** * Returns a List from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present and a ClassCastException is + * IllegalArgumentException is thrown if the column is not present and a ClassCastException is * thrown if it has a different type */ public List getList(int columnIndex) { @@ -301,7 +301,7 @@ public List getList(int columnIndex) { } /** - * Returns an int from the column of the given name at the current row. An IllegalStateException + * Returns an int from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present in the Row and a ClassCastException is thrown * if it has a different type */ @@ -312,7 +312,7 @@ public int getInt(String columnName) { /** * Returns an int from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present and a ClassCastException is + * IllegalArgumentException is thrown if the column is not present and a ClassCastException is * thrown if it has a different type */ public int getInt(int columnIndex) { @@ -322,7 +322,7 @@ public int getInt(int columnIndex) { /** * Updates the holder with the value in the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public void getInt(String columnName, NullableIntHolder holder) { @@ -332,7 +332,7 @@ public void getInt(String columnName, NullableIntHolder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present and a ClassCastException is + * IllegalArgumentException is thrown if the column is not present and a ClassCastException is * thrown if it has a different type */ public void getInt(int columnIndex, NullableIntHolder holder) { @@ -341,7 +341,7 @@ public void getInt(int columnIndex, NullableIntHolder holder) { } /** - * Returns an int from the column of the given name at the current row. An IllegalStateException + * Returns an int from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present in the Row and a ClassCastException is thrown * if it has a different type */ @@ -352,7 +352,7 @@ public int getUInt4(String columnName) { /** * Returns an int from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present and a ClassCastException is + * IllegalArgumentException is thrown if the column is not present and a ClassCastException is * thrown if it has a different type */ public int getUInt4(int columnIndex) { @@ -362,7 +362,7 @@ public int getUInt4(int columnIndex) { /** * Updates the holder with the value at the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public void getUInt4(String columnName, NullableUInt4Holder holder) { @@ -372,7 +372,7 @@ public void getUInt4(String columnName, NullableUInt4Holder holder) { /** * Updates the holder with the value at the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present and a ClassCastException is + * IllegalArgumentException is thrown if the column is not present and a ClassCastException is * thrown if it has a different type */ public void getUInt4(int columnIndex, NullableUInt4Holder holder) { @@ -381,7 +381,7 @@ public void getUInt4(int columnIndex, NullableUInt4Holder holder) { } /** - * Returns a short from the column of the given name at the current row. An IllegalStateException + * Returns a short from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -392,7 +392,7 @@ public short getSmallInt(String columnName) { /** * Returns a short from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public short getSmallInt(int columnIndex) { @@ -402,7 +402,7 @@ public short getSmallInt(int columnIndex) { /** * Updates the holder with the value in the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getSmallInt(String columnName, NullableSmallIntHolder holder) { @@ -412,7 +412,7 @@ public void getSmallInt(String columnName, NullableSmallIntHolder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getSmallInt(int columnIndex, NullableSmallIntHolder holder) { @@ -421,7 +421,7 @@ public void getSmallInt(int columnIndex, NullableSmallIntHolder holder) { } /** - * Returns a char from the column of the given name at the current row. An IllegalStateException + * Returns a char from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -432,7 +432,7 @@ public char getUInt2(String columnName) { /** * Returns a char from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public char getUInt2(int columnIndex) { @@ -442,7 +442,7 @@ public char getUInt2(int columnIndex) { /** * Updates the holder with the value in the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getUInt2(String columnName, NullableUInt2Holder holder) { @@ -452,7 +452,7 @@ public void getUInt2(String columnName, NullableUInt2Holder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getUInt2(int columnIndex, NullableUInt2Holder holder) { @@ -461,7 +461,7 @@ public void getUInt2(int columnIndex, NullableUInt2Holder holder) { } /** - * Returns a byte from the column of the given name at the current row. An IllegalStateException + * Returns a byte from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -472,7 +472,7 @@ public byte getTinyInt(String columnName) { /** * Returns a byte from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public byte getTinyInt(int columnIndex) { @@ -482,7 +482,7 @@ public byte getTinyInt(int columnIndex) { /** * Updates the holder with the value in the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTinyInt(String columnName, NullableTinyIntHolder holder) { @@ -492,7 +492,7 @@ public void getTinyInt(String columnName, NullableTinyIntHolder holder) { /** * Updates the holder with the value in the column at the given index and current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTinyInt(int columnIndex, NullableTinyIntHolder holder) { @@ -501,7 +501,7 @@ public void getTinyInt(int columnIndex, NullableTinyIntHolder holder) { } /** - * Returns a byte from the column of the given name at the current row. An IllegalStateException + * Returns a byte from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -512,7 +512,7 @@ public byte getUInt1(String columnName) { /** * Returns a byte from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public byte getUInt1(int columnIndex) { @@ -522,7 +522,7 @@ public byte getUInt1(int columnIndex) { /** * Updates the holder with the value in the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getUInt1(String columnName, NullableUInt1Holder holder) { @@ -532,7 +532,7 @@ public void getUInt1(String columnName, NullableUInt1Holder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getUInt1(int columnIndex, NullableUInt1Holder holder) { @@ -541,7 +541,7 @@ public void getUInt1(int columnIndex, NullableUInt1Holder holder) { } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -552,7 +552,7 @@ public long getBigInt(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getBigInt(int columnIndex) { @@ -562,7 +562,7 @@ public long getBigInt(int columnIndex) { /** * Updates the holder with the value in the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getBigInt(String columnName, NullableBigIntHolder holder) { @@ -572,7 +572,7 @@ public void getBigInt(String columnName, NullableBigIntHolder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getBigInt(int columnIndex, NullableBigIntHolder holder) { @@ -581,7 +581,7 @@ public void getBigInt(int columnIndex, NullableBigIntHolder holder) { } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -592,7 +592,7 @@ public long getUInt8(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getUInt8(int columnIndex) { @@ -602,7 +602,7 @@ public long getUInt8(int columnIndex) { /** * Updates the holder with the value in the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getUInt8(String columnName, NullableUInt8Holder holder) { @@ -612,7 +612,7 @@ public void getUInt8(String columnName, NullableUInt8Holder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getUInt8(int columnIndex, NullableUInt8Holder holder) { @@ -621,7 +621,7 @@ public void getUInt8(int columnIndex, NullableUInt8Holder holder) { } /** - * Returns a float from the column of the given name at the current row. An IllegalStateException + * Returns a float from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -632,7 +632,7 @@ public float getFloat4(String columnName) { /** * Returns a float from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public float getFloat4(int columnIndex) { @@ -642,7 +642,7 @@ public float getFloat4(int columnIndex) { /** * Updates the holder with the value in the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getFloat4(String columnName, NullableFloat4Holder holder) { @@ -652,7 +652,7 @@ public void getFloat4(String columnName, NullableFloat4Holder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getFloat4(int columnIndex, NullableFloat4Holder holder) { @@ -661,7 +661,7 @@ public void getFloat4(int columnIndex, NullableFloat4Holder holder) { } /** - * Returns a double from the column of the given name at the current row. An IllegalStateException + * Returns a double from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -672,7 +672,7 @@ public double getFloat8(String columnName) { /** * Returns a double from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public double getFloat8(int columnIndex) { @@ -682,7 +682,7 @@ public double getFloat8(int columnIndex) { /** * Updates the holder with the value in the column with the given index at the current row. - * An IllegalStateException is thrown if the column is not present, and a ClassCastException is thrown + * An IllegalArgumentException is thrown if the column is not present, and a ClassCastException is thrown * if it is present but has a different type */ public void getFloat8(String columnName, NullableFloat8Holder holder) { @@ -692,7 +692,7 @@ public void getFloat8(String columnName, NullableFloat8Holder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getFloat8(int columnIndex, NullableFloat8Holder holder) { @@ -702,7 +702,7 @@ public void getFloat8(int columnIndex, NullableFloat8Holder holder) { /** * Returns an int from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public int getBit(String columnName) { @@ -712,7 +712,7 @@ public int getBit(String columnName) { /** * Returns an int from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public int getBit(int columnIndex) { @@ -722,7 +722,7 @@ public int getBit(int columnIndex) { /** * Updates the holder with the value in the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getBit(String columnName, NullableBitHolder holder) { @@ -732,7 +732,7 @@ public void getBit(String columnName, NullableBitHolder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getBit(int columnIndex, NullableBitHolder holder) { @@ -741,7 +741,7 @@ public void getBit(int columnIndex, NullableBitHolder holder) { } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -752,7 +752,7 @@ public long getTimeNano(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getTimeNano(int columnIndex) { @@ -762,7 +762,7 @@ public long getTimeNano(int columnIndex) { /** * Updates the holder with the value in the column with the given name at the current row. - * An IllegalStateException is thrown if the column is not present, and a ClassCastException is thrown + * An IllegalArgumentException is thrown if the column is not present, and a ClassCastException is thrown * if it is present but has a different type */ public void getTimeNano(String columnName, NullableTimeNanoHolder holder) { @@ -772,7 +772,7 @@ public void getTimeNano(String columnName, NullableTimeNanoHolder holder) { /** * Updates the holder with the value in the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type. */ public void getTimeNano(int columnIndex, NullableTimeNanoHolder holder) { @@ -781,7 +781,7 @@ public void getTimeNano(int columnIndex, NullableTimeNanoHolder holder) { } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type. */ @@ -792,7 +792,7 @@ public long getTimeMicro(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type. */ public long getTimeMicro(int columnIndex) { @@ -802,7 +802,7 @@ public long getTimeMicro(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. - * An IllegalStateException is thrown if the column is not present, and a ClassCastException is thrown if it is + * An IllegalArgumentException is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type. */ public void getTimeMicro(String columnName, NullableTimeMicroHolder holder) { @@ -812,7 +812,7 @@ public void getTimeMicro(String columnName, NullableTimeMicroHolder holder) { /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type. */ public void getTimeMicro(int columnIndex, NullableTimeMicroHolder holder) { @@ -821,7 +821,7 @@ public void getTimeMicro(int columnIndex, NullableTimeMicroHolder holder) { } /** - * Returns an int from the column of the given name at the current row. An IllegalStateException + * Returns an int from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type. */ @@ -832,7 +832,7 @@ public int getTimeMilli(String columnName) { /** * Returns an int from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type. */ public int getTimeMilli(int columnIndex) { @@ -842,7 +842,7 @@ public int getTimeMilli(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. - * An IllegalStateException is thrown if the column is not present, and a ClassCastException is thrown if it is + * An IllegalArgumentException is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type. */ public void getTimeMilli(String columnName, NullableTimeMilliHolder holder) { @@ -852,7 +852,7 @@ public void getTimeMilli(String columnName, NullableTimeMilliHolder holder) { /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type. */ public void getTimeMilli(int columnIndex, NullableTimeMilliHolder holder) { @@ -861,7 +861,7 @@ public void getTimeMilli(int columnIndex, NullableTimeMilliHolder holder) { } /** - * Returns a LocalDateTime from the column of the given name at the current row. An IllegalStateException + * Returns a LocalDateTime from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type. */ @@ -872,7 +872,7 @@ public LocalDateTime getTimeMilliObj(String columnName) { /** * Returns a LocalDateTime from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type. */ public LocalDateTime getTimeMilliObj(int columnIndex) { @@ -881,7 +881,7 @@ public LocalDateTime getTimeMilliObj(int columnIndex) { } /** - * Returns an int from the column of the given name at the current row. An IllegalStateException + * Returns an int from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type. */ @@ -892,7 +892,7 @@ public int getTimeSec(String columnName) { /** * Returns an int from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type. */ public int getTimeSec(int columnIndex) { @@ -902,7 +902,7 @@ public int getTimeSec(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. - * An IllegalStateException is thrown if the column is not present, and a ClassCastException is thrown if it is + * An IllegalArgumentException is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type. */ public void getTimeSec(String columnName, NullableTimeSecHolder holder) { @@ -912,7 +912,7 @@ public void getTimeSec(String columnName, NullableTimeSecHolder holder) { /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type. */ public void getTimeSec(int columnIndex, NullableTimeSecHolder holder) { @@ -921,7 +921,7 @@ public void getTimeSec(int columnIndex, NullableTimeSecHolder holder) { } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type. */ @@ -932,7 +932,7 @@ public long getTimeStampSec(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getTimeStampSec(int columnIndex) { @@ -942,7 +942,7 @@ public long getTimeStampSec(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. - * An IllegalStateException is thrown if the column is not present, and a ClassCastException is thrown if it is + * An IllegalArgumentException is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ public void getTimeStampSec(String columnName, NullableTimeStampSecHolder holder) { @@ -952,7 +952,7 @@ public void getTimeStampSec(String columnName, NullableTimeStampSecHolder holder /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTimeStampSec(int columnIndex, NullableTimeStampSecHolder holder) { @@ -961,7 +961,7 @@ public void getTimeStampSec(int columnIndex, NullableTimeStampSecHolder holder) } /** - * Returns a LocalDateTime from the column of the given name at the current row. An IllegalStateException + * Returns a LocalDateTime from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -972,7 +972,7 @@ public LocalDateTime getTimeStampSecObj(String columnName) { /** * Returns a LocalDateTime from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public LocalDateTime getTimeStampSecObj(int columnIndex) { @@ -982,7 +982,7 @@ public LocalDateTime getTimeStampSecObj(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. - * An IllegalStateException is thrown if the column is not present, and a ClassCastException is thrown if it is + * An IllegalArgumentException is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ public long getTimeStampSecTZ(String columnName) { @@ -992,7 +992,7 @@ public long getTimeStampSecTZ(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getTimeStampSecTZ(int columnIndex) { @@ -1002,7 +1002,7 @@ public long getTimeStampSecTZ(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. - * An IllegalStateException is thrown if the column is not present, and a ClassCastException is thrown if it is + * An IllegalArgumentException is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ public void getTimeStampSecTZ(String columnName, NullableTimeStampSecTZHolder holder) { @@ -1012,7 +1012,7 @@ public void getTimeStampSecTZ(String columnName, NullableTimeStampSecTZHolder ho /** * Updates the holder with the value from the column with the given index at the current row. - * An IllegalStateException is thrown if the column is not present, and a ClassCastException + * An IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTimeStampSecTZ(int columnIndex, NullableTimeStampSecTZHolder holder) { @@ -1021,7 +1021,7 @@ public void getTimeStampSecTZ(int columnIndex, NullableTimeStampSecTZHolder hold } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1032,7 +1032,7 @@ public long getTimeStampNano(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getTimeStampNano(int columnIndex) { @@ -1041,7 +1041,7 @@ public long getTimeStampNano(int columnIndex) { } /** - * Updates the holder with the value from the column of the given name at the current row. An IllegalStateException + * Updates the holder with the value from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1052,7 +1052,7 @@ public void getTimeStampNano(String columnName, NullableTimeStampNanoHolder hold /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTimeStampNano(int columnIndex, NullableTimeStampNanoHolder holder) { @@ -1062,7 +1062,7 @@ public void getTimeStampNano(int columnIndex, NullableTimeStampNanoHolder holder /** * Returns a LocalDateTime from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public LocalDateTime getTimeStampNanoObj(String columnName) { @@ -1072,7 +1072,7 @@ public LocalDateTime getTimeStampNanoObj(String columnName) { /** * Returns a LocalDateTime from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public LocalDateTime getTimeStampNanoObj(int columnIndex) { @@ -1081,7 +1081,7 @@ public LocalDateTime getTimeStampNanoObj(int columnIndex) { } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1092,7 +1092,7 @@ public long getTimeStampNanoTZ(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getTimeStampNanoTZ(int columnIndex) { @@ -1101,7 +1101,7 @@ public long getTimeStampNanoTZ(int columnIndex) { } /** - * Updates the holder with the value from the column of the given name at the current row. An IllegalStateException + * Updates the holder with the value from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1112,7 +1112,7 @@ public void getTimeStampNanoTZ(String columnName, NullableTimeStampNanoTZHolder /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTimeStampNanoTZ(int columnIndex, NullableTimeStampNanoTZHolder holder) { @@ -1121,7 +1121,7 @@ public void getTimeStampNanoTZ(int columnIndex, NullableTimeStampNanoTZHolder ho } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1132,7 +1132,7 @@ public long getTimeStampMilli(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getTimeStampMilli(int columnIndex) { @@ -1141,7 +1141,7 @@ public long getTimeStampMilli(int columnIndex) { } /** - * Updates the holder with the value from the column of the given name at the current row. An IllegalStateException + * Updates the holder with the value from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1152,7 +1152,7 @@ public void getTimeStampMilli(String columnName, NullableTimeStampMilliHolder ho /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTimeStampMilli(int columnIndex, NullableTimeStampMilliHolder holder) { @@ -1162,7 +1162,7 @@ public void getTimeStampMilli(int columnIndex, NullableTimeStampMilliHolder hold /** * Returns a LocalDateTime from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public LocalDateTime getTimeStampMilliObj(String columnName) { @@ -1172,7 +1172,7 @@ public LocalDateTime getTimeStampMilliObj(String columnName) { /** * Returns a LocalDateTime from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public LocalDateTime getTimeStampMilliObj(int columnIndex) { @@ -1181,7 +1181,7 @@ public LocalDateTime getTimeStampMilliObj(int columnIndex) { } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1192,7 +1192,7 @@ public long getTimeStampMilliTZ(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getTimeStampMilliTZ(int columnIndex) { @@ -1201,7 +1201,7 @@ public long getTimeStampMilliTZ(int columnIndex) { } /** - * Updates the holder with the value from the column of the given name at the current row. An IllegalStateException + * Updates the holder with the value from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different types */ @@ -1212,7 +1212,7 @@ public void getTimeStampMilliTZ(String columnName, NullableTimeStampMilliTZHolde /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTimeStampMilliTZ(int columnIndex, NullableTimeStampMilliTZHolder holder) { @@ -1221,7 +1221,7 @@ public void getTimeStampMilliTZ(int columnIndex, NullableTimeStampMilliTZHolder } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1232,7 +1232,7 @@ public long getTimeStampMicro(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getTimeStampMicro(int columnIndex) { @@ -1241,7 +1241,7 @@ public long getTimeStampMicro(int columnIndex) { } /** - * Updates the holder with the value from the column of the given name at the current row. An IllegalStateException + * Updates the holder with the value from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1252,7 +1252,7 @@ public void getTimeStampMicro(String columnName, NullableTimeStampMicroHolder ho /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTimeStampMicro(int columnIndex, NullableTimeStampMicroHolder holder) { @@ -1262,7 +1262,7 @@ public void getTimeStampMicro(int columnIndex, NullableTimeStampMicroHolder hold /** * Returns a LocalDateTime from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public LocalDateTime getTimeStampMicroObj(String columnName) { @@ -1272,7 +1272,7 @@ public LocalDateTime getTimeStampMicroObj(String columnName) { /** * Returns a LocalDateTime from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public LocalDateTime getTimeStampMicroObj(int columnIndex) { @@ -1281,7 +1281,7 @@ public LocalDateTime getTimeStampMicroObj(int columnIndex) { } /** - * Returns a long from the column of the given name at the current row. An IllegalStateException + * Returns a long from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1292,7 +1292,7 @@ public long getTimeStampMicroTZ(String columnName) { /** * Returns a long from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public long getTimeStampMicroTZ(int columnIndex) { @@ -1301,7 +1301,7 @@ public long getTimeStampMicroTZ(int columnIndex) { } /** - * Updates the holder with the value from the column of the given name at the current row. An IllegalStateException + * Updates the holder with the value from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1312,7 +1312,7 @@ public void getTimeStampMicroTZ(String columnName, NullableTimeStampMicroTZHolde /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getTimeStampMicroTZ(int columnIndex, NullableTimeStampMicroTZHolder holder) { @@ -1322,7 +1322,7 @@ public void getTimeStampMicroTZ(int columnIndex, NullableTimeStampMicroTZHolder /** * Returns a Duration from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public Duration getDurationObj(String columnName) { @@ -1332,7 +1332,7 @@ public Duration getDurationObj(String columnName) { /** * Returns a Duration from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public Duration getDurationObj(int columnIndex) { @@ -1342,7 +1342,7 @@ public Duration getDurationObj(int columnIndex) { /** * Returns an ArrowBuf from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public ArrowBuf getDuration(String columnName) { @@ -1352,7 +1352,7 @@ public ArrowBuf getDuration(String columnName) { /** * Returns an ArrowBuf from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public ArrowBuf getDuration(int columnIndex) { @@ -1362,7 +1362,7 @@ public ArrowBuf getDuration(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getDuration(String columnName, NullableDurationHolder holder) { @@ -1372,7 +1372,7 @@ public void getDuration(String columnName, NullableDurationHolder holder) { /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getDuration(int columnIndex, NullableDurationHolder holder) { @@ -1382,7 +1382,7 @@ public void getDuration(int columnIndex, NullableDurationHolder holder) { /** * Returns a PeriodDuration from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public PeriodDuration getIntervalMonthDayNanoObj(String columnName) { @@ -1392,7 +1392,7 @@ public PeriodDuration getIntervalMonthDayNanoObj(String columnName) { /** * Returns a PeriodDuration from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public PeriodDuration getIntervalMonthDayNanoObj(int columnIndex) { @@ -1402,7 +1402,7 @@ public PeriodDuration getIntervalMonthDayNanoObj(int columnIndex) { /** * Returns an ArrowBuf from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public ArrowBuf getIntervalMonthDayNano(String columnName) { @@ -1412,7 +1412,7 @@ public ArrowBuf getIntervalMonthDayNano(String columnName) { /** * Returns an ArrowBuf from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public ArrowBuf getIntervalMonthDayNano(int columnIndex) { @@ -1422,7 +1422,7 @@ public ArrowBuf getIntervalMonthDayNano(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getIntervalMonthDayNano( @@ -1433,7 +1433,7 @@ public void getIntervalMonthDayNano( /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getIntervalMonthDayNano(int columnIndex, NullableIntervalMonthDayNanoHolder holder) { @@ -1443,7 +1443,7 @@ public void getIntervalMonthDayNano(int columnIndex, NullableIntervalMonthDayNan /** * Returns an ArrowBuf from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public ArrowBuf getIntervalDay(String columnName) { @@ -1453,7 +1453,7 @@ public ArrowBuf getIntervalDay(String columnName) { /** * Returns an ArrowBuf from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public ArrowBuf getIntervalDay(int columnIndex) { @@ -1463,7 +1463,7 @@ public ArrowBuf getIntervalDay(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getIntervalDay(String columnName, NullableIntervalDayHolder holder) { @@ -1473,7 +1473,7 @@ public void getIntervalDay(String columnName, NullableIntervalDayHolder holder) /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getIntervalDay(int columnIndex, NullableIntervalDayHolder holder) { @@ -1483,7 +1483,7 @@ public void getIntervalDay(int columnIndex, NullableIntervalDayHolder holder) { /** * Returns a Duration from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public Duration getIntervalDayObj(int columnIndex) { @@ -1493,7 +1493,7 @@ public Duration getIntervalDayObj(int columnIndex) { /** * Returns a Duration from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public Duration getIntervalDayObj(String columnName) { @@ -1502,7 +1502,7 @@ public Duration getIntervalDayObj(String columnName) { } /** - * Returns a Period from the column of the given name at the current row. An IllegalStateException + * Returns a Period from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1513,7 +1513,7 @@ public Period getIntervalYearObj(String columnName) { /** * Returns a Period from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public Period getIntervalYearObj(int columnIndex) { @@ -1522,7 +1522,7 @@ public Period getIntervalYearObj(int columnIndex) { } /** - * Returns an int from the column of the given name at the current row. An IllegalStateException + * Returns an int from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1533,7 +1533,7 @@ public int getIntervalYear(String columnName) { /** * Returns an int from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public int getIntervalYear(int columnIndex) { @@ -1543,7 +1543,7 @@ public int getIntervalYear(int columnIndex) { /** * Updates the holder with the value from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getIntervalYear(String columnName, NullableIntervalYearHolder holder) { @@ -1553,7 +1553,7 @@ public void getIntervalYear(String columnName, NullableIntervalYearHolder holder /** * Updates the holder with the value from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getIntervalYear(int columnIndex, NullableIntervalYearHolder holder) { @@ -1563,7 +1563,7 @@ public void getIntervalYear(int columnIndex, NullableIntervalYearHolder holder) /** * Updates the value of the holder with data from vector at the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getDecimal(int columnIndex, NullableDecimalHolder holder) { @@ -1573,7 +1573,7 @@ public void getDecimal(int columnIndex, NullableDecimalHolder holder) { /** * Updates the value of the holder with data from the vector with given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public void getDecimal(String columnName, NullableDecimalHolder holder) { @@ -1583,7 +1583,7 @@ public void getDecimal(String columnName, NullableDecimalHolder holder) { /** * Returns a BigDecimal from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public BigDecimal getDecimalObj(String columnName) { @@ -1593,7 +1593,7 @@ public BigDecimal getDecimalObj(String columnName) { /** * Returns a BigDecimal from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public BigDecimal getDecimalObj(int columnIndex) { @@ -1603,7 +1603,7 @@ public BigDecimal getDecimalObj(int columnIndex) { /** * Returns an ArrowBuf from the column of the given name at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public ArrowBuf getDecimal(String columnName) { @@ -1613,7 +1613,7 @@ public ArrowBuf getDecimal(String columnName) { /** * Returns an ArrowBuf from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public ArrowBuf getDecimal(int columnIndex) { @@ -1622,7 +1622,7 @@ public ArrowBuf getDecimal(int columnIndex) { } /** - * Returns a byte[] from the column of the given name at the current row. An IllegalStateException + * Returns a byte[] from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1633,7 +1633,7 @@ public byte[] getVarBinary(String columnName) { /** * Returns a byte[] from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public byte[] getVarBinary(int columnIndex) { @@ -1642,7 +1642,7 @@ public byte[] getVarBinary(int columnIndex) { } /** - * Returns a byte[] from the column of the given name at the current row. An IllegalStateException + * Returns a byte[] from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1653,7 +1653,7 @@ public byte[] getFixedSizeBinary(String columnName) { /** * Returns a byte[] from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public byte[] getFixedSizeBinary(int columnIndex) { @@ -1662,7 +1662,7 @@ public byte[] getFixedSizeBinary(int columnIndex) { } /** - * Returns a byte[] from the column of the given name at the current row. An IllegalStateException + * Returns a byte[] from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present, and a ClassCastException is thrown if it is * present but has a different type */ @@ -1673,7 +1673,7 @@ public byte[] getLargeVarBinary(String columnName) { /** * Returns a byte[] from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present, and a ClassCastException + * IllegalArgumentException is thrown if the column is not present, and a ClassCastException * is thrown if it is present but has a different type */ public byte[] getLargeVarBinary(int columnIndex) { @@ -1682,7 +1682,7 @@ public byte[] getLargeVarBinary(int columnIndex) { } /** - * Returns a String from the column of the given name at the current row. An IllegalStateException + * Returns a String from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present in the Row and a ClassCastException is thrown * if it has a different type * @@ -1695,7 +1695,7 @@ public String getVarCharObj(String columnName) { /** * Returns a String from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type * * @param columnIndex the index of the FieldVector holding the value @@ -1706,7 +1706,7 @@ public String getVarCharObj(int columnIndex) { } /** - * Returns a byte[] from the column of the given name at the current row. An IllegalStateException + * Returns a byte[] from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present in the Row and a ClassCastException is thrown * if it has a different type * @@ -1719,7 +1719,7 @@ public byte[] getVarChar(String columnName) { /** * Returns a byte[] from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type * * @param columnIndex the index of the FieldVector holding the value @@ -1730,7 +1730,7 @@ public byte[] getVarChar(int columnIndex) { } /** - * Returns a String from the column of the given name at the current row. An IllegalStateException + * Returns a String from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present in the Row and a ClassCastException is thrown * if it has a different type * @@ -1744,7 +1744,7 @@ public String getLargeVarCharObj(String columnName) { /** * Returns a String from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public String getLargeVarCharObj(int columnIndex) { @@ -1753,7 +1753,7 @@ public String getLargeVarCharObj(int columnIndex) { } /** - * Returns a byte[] from the column of the given name at the current row. An IllegalStateException + * Returns a byte[] from the column of the given name at the current row. An IllegalArgumentException * is thrown if the column is not present in the Row and a ClassCastException is thrown * if it has a different type * @@ -1767,7 +1767,7 @@ public byte[] getLargeVarChar(String columnName) { /** * Returns a byte[] from the column with the given index at the current row. An - * IllegalStateException is thrown if the column is not present in the Row and an + * IllegalArgumentException is thrown if the column is not present in the Row and a * ClassCastException is thrown if it has a different type */ public byte[] getLargeVarChar(int columnIndex) { diff --git a/java/vector/src/main/java/org/apache/arrow/vector/table/Table.java b/java/vector/src/main/java/org/apache/arrow/vector/table/Table.java index 37cdf9eb1e2..a981a775fa5 100644 --- a/java/vector/src/main/java/org/apache/arrow/vector/table/Table.java +++ b/java/vector/src/main/java/org/apache/arrow/vector/table/Table.java @@ -17,16 +17,20 @@ package org.apache.arrow.vector.table; +import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.StreamSupport; import org.apache.arrow.util.Preconditions; import org.apache.arrow.vector.FieldVector; import org.apache.arrow.vector.VectorSchemaRoot; +import org.apache.arrow.vector.dictionary.Dictionary; import org.apache.arrow.vector.dictionary.DictionaryProvider; +import org.apache.arrow.vector.types.pojo.DictionaryEncoding; import org.apache.arrow.vector.util.TransferPair; /** @@ -95,6 +99,36 @@ public Table(VectorSchemaRoot vsr) { vsr.clear(); } + /** + * Returns a deep copy of this table. + */ + public Table copy() { + List vectorCopies = new ArrayList<>(); + for (int i = 0; i < getVectorCount(); i++) { + vectorCopies.add(getVectorCopy(i)); + } + DictionaryProvider providerCopy = null; + if (dictionaryProvider != null) { + Set ids = dictionaryProvider.getDictionaryIds(); + Dictionary[] dictionaryCopies = new Dictionary[ids.size()]; + int i = 0; + for (Long id : ids) { + Dictionary src = dictionaryProvider.lookup(id); + FieldVector srcVector = src.getVector(); + FieldVector destVector = srcVector.getField().createVector(srcVector.getAllocator()); + destVector.copyFromSafe(0, srcVector.getValueCount(), srcVector); // TODO: Remove safe copy for perf + DictionaryEncoding srcEncoding = src.getEncoding(); + Dictionary dest = new Dictionary(destVector, + new DictionaryEncoding(srcEncoding.getId(), srcEncoding.isOrdered(), srcEncoding.getIndexType())); + dictionaryCopies[i] = dest; + i++; + } + providerCopy = new DictionaryProvider.MapDictionaryProvider(dictionaryCopies); + } + return new Table(vectorCopies, (int) getRowCount(), providerCopy); + } + + /** * Returns a new Table created by adding the given vector to the vectors in this Table. * diff --git a/java/vector/src/test/java/org/apache/arrow/vector/table/BaseTableTest.java b/java/vector/src/test/java/org/apache/arrow/vector/table/BaseTableTest.java index 6812785e72b..3bdaef712ce 100644 --- a/java/vector/src/test/java/org/apache/arrow/vector/table/BaseTableTest.java +++ b/java/vector/src/test/java/org/apache/arrow/vector/table/BaseTableTest.java @@ -175,7 +175,48 @@ void testGetVector() { List vectorList = twoIntColumns(allocator); try (Table t = new Table(vectorList)) { assertNotNull(t.getVector(INT_VECTOR_NAME_1)); - assertThrows(IllegalStateException.class, + assertThrows(IllegalArgumentException.class, + () -> t.getVector("wrong name")); + } + } + + @Test + void getVectorCopyByIndex() { + List vectorList = twoIntColumns(allocator); + List vectorList2 = twoIntColumns(allocator); + try (Table t = new Table(vectorList)) { + // compare value by value + for (int vIdx = 0; vIdx < vectorList.size(); vIdx++) { + IntVector original = (IntVector) vectorList2.get(vIdx); + IntVector copy = (IntVector) t.getVectorCopy(vIdx); + assertNotNull(copy); + assertEquals(2, copy.getValueCount()); + assertEquals(0, copy.getNullCount()); + for (int i = 0; i < t.getRowCount(); i++) { + assertEquals(original.getObject(i), copy.getObject(i)); + } + } + assertThrows(IllegalArgumentException.class, + () -> t.getVector("wrong name")); + } + } + + @Test + void getVectorCopyByName() { + List vectorList = twoIntColumns(allocator); + List vectorList2 = twoIntColumns(allocator); + try (Table t = new Table(vectorList)) { + assertNotNull(t.getVectorCopy(INT_VECTOR_NAME_1)); + for (int vIdx = 0; vIdx < vectorList.size(); vIdx++) { + IntVector original = (IntVector) vectorList2.get(vIdx); + IntVector copy = (IntVector) t.getVectorCopy(original.getName()); + assertEquals(2, copy.getValueCount()); + assertEquals(0, copy.getNullCount()); + for (int i = 0; i < t.getRowCount(); i++) { + assertEquals(original.getObject(i), copy.getObject(i)); + } + } + assertThrows(IllegalArgumentException.class, () -> t.getVector("wrong name")); } } diff --git a/java/vector/src/test/java/org/apache/arrow/vector/table/RowTest.java b/java/vector/src/test/java/org/apache/arrow/vector/table/RowTest.java index 8feaddbeb35..eb50e866b19 100644 --- a/java/vector/src/test/java/org/apache/arrow/vector/table/RowTest.java +++ b/java/vector/src/test/java/org/apache/arrow/vector/table/RowTest.java @@ -169,7 +169,7 @@ void testNameNotFound() { try (Table t = new Table(vectorList)) { Row c = t.immutableRow(); c.setPosition(1); - assertThrows(IllegalStateException.class, + assertThrows(IllegalArgumentException.class, () -> c.getVarCharObj("wrong name")); } } diff --git a/java/vector/src/test/java/org/apache/arrow/vector/table/TableTest.java b/java/vector/src/test/java/org/apache/arrow/vector/table/TableTest.java index ebbab4f57f8..539482e510a 100644 --- a/java/vector/src/test/java/org/apache/arrow/vector/table/TableTest.java +++ b/java/vector/src/test/java/org/apache/arrow/vector/table/TableTest.java @@ -127,6 +127,26 @@ void constructor2() { } } + @Test + void copy() { + List vectorList = twoIntColumns(allocator); + try (Table t = new Table(vectorList)) { + assertEquals(2, t.getVectorCount()); + try (Table copy = t.copy()) { + for (FieldVector v: t.fieldVectors) { + FieldVector vCopy = copy.getVector(v.getName()); + assertNotNull(vCopy); + assertEquals(v.getValueCount(), vCopy.getValueCount()); + for (int i = 0; i < v.getValueCount(); i++) { + Integer vValue = ((IntVector) v).getObject(i); + Integer vCopyValue = ((IntVector) vCopy).getObject(i); + assertEquals(vValue, vCopyValue); + } + } + } + } + } + @Test void addVector() { List vectorList = twoIntColumns(allocator);