lidavidm commented on code in PR #12692:
URL: https://github.com/apache/arrow/pull/12692#discussion_r885780647


##########
java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowVectorIteratorTest.java:
##########
@@ -119,7 +134,10 @@ public void testVectorSchemaRootReuse() throws 
SQLException, IOException {
       assertNotNull(cur);
 
       // verify the first column, with may contain nulls.
-      assertEquals(expectedColValues[batchCount], cur.getVector(0).toString());
+      assertEquals(expectedIntColValues[batchCount], 
cur.getVector(0).toString());

Review Comment:
   Is there a better way to assert equality than the string representation 
(perhaps with getObject as done elsewhere)? This is a little brittle



##########
java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/JdbcToArrowTestHelper.java:
##########
@@ -378,4 +393,25 @@ public static String[] getValues(String[] values, String 
dataType) {
     }
     return value.split(",");
   }
+
+  public static Integer[][] getListValues(String[] values, String dataType) {
+    String[] dataArr = getValues(values, dataType);
+    Integer[][] valueArr = new Integer[dataArr.length][];
+    int i = 0;
+    for (String data : dataArr) {
+      if ("null".equals(data.trim())) {
+        valueArr[i++] = null;
+      } else if ("()".equals(data.trim())) {
+        valueArr[i++] = new Integer[0];
+      } else {
+        String[] row = data.replace("(", "").replace(")", "").split(";");
+        Integer[] arr = new Integer[row.length];
+        for (int j = 0; j < arr.length; j++) {
+          arr[j] = "null".equals(row[j]) ? null : Integer.parseInt(row[j]);
+        }
+        valueArr[i++] = arr;
+      }
+    }
+    return valueArr;
+  }

Review Comment:
   It feels like this could be reused from Table.getListValues? Especially as 
this seems to also handle nulls



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to