liyafan82 commented on a change in pull request #6912: URL: https://github.com/apache/arrow/pull/6912#discussion_r416553407
########## File path: java/vector/src/main/java/org/apache/arrow/vector/util/ValueVectorUtility.java ########## @@ -82,4 +89,43 @@ public static String getToString(ValueVector vector, int start, int end) { return sb.toString(); } + + /** + * Validate field vector. + */ + public static void validate(FieldVector vector) { + Preconditions.checkNotNull(vector); + + ArrowType arrowType = vector.getField().getType(); + int typeBufferCount = TypeLayout.getTypeBufferCount(arrowType); + TypeLayout typeLayout = TypeLayout.getTypeLayout(arrowType); + + if (vector.getValueCount() < 0) { + throw new RuntimeException("vector valueCount is negative"); Review comment: I think IllegalArgumentException is better? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org