jmgpeeters commented on a change in pull request #10285:
URL: https://github.com/apache/arrow/pull/10285#discussion_r630979427



##########
File path: 
java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowOptionalColumnsTest.java
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.adapter.jdbc.h2;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.arrow.adapter.jdbc.AbstractJdbcToArrowTest;
+import org.apache.arrow.adapter.jdbc.JdbcToArrow;
+import org.apache.arrow.adapter.jdbc.JdbcToArrowTestHelper;
+import org.apache.arrow.adapter.jdbc.Table;
+import org.apache.arrow.memory.RootAllocator;
+import org.apache.arrow.vector.VectorSchemaRoot;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/**
+ * JUnit Test Class which contains methods to test JDBC to Arrow data 
conversion functionality for
+ * (non-)optional columns, in particular with regard to the ensuing 
VectorSchemaRoot's schema.
+ */
+@RunWith(Parameterized.class)
+public class JdbcToArrowOptionalColumnsTest extends AbstractJdbcToArrowTest {
+  private static final String[] testFiles = {
+    "h2/test1_null_and_notnull.yml"
+  };
+
+  /**
+   * Constructor which populate table object for each test iteration.
+   *
+   * @param table Table object
+   */
+  public JdbcToArrowOptionalColumnsTest(Table table) {
+    this.table = table;
+  }
+
+  /**
+   * Get the test data as a collection of Table objects for each test 
iteration.
+   *
+   * @return Collection of Table objects
+   * @throws SQLException           on error
+   * @throws ClassNotFoundException on error
+   * @throws IOException            on error
+   */
+  @Parameterized.Parameters
+  public static Collection<Object[]> getTestData() throws SQLException, 
ClassNotFoundException, IOException {
+    return Arrays.asList(prepareTestData(testFiles, 
JdbcToArrowNullTest.class));
+  }
+
+  /**
+   * Test Method to test JdbcToArrow Functionality for dealing with nullable 
and non-nullable columns.
+   */
+  @Test
+  public void testJdbcToArrowValues() throws SQLException, IOException {
+    testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new 
RootAllocator(Integer.MAX_VALUE)));
+  }

Review comment:
       I suppose we do, yes, but I built this test based on existing tests, 
which don't seem to close the allocator either, see e.g. JdbcToArrowNullTest 
and JdbcToArrowDataTypesTest. 
   
   The memory is probably small enough, and the process short-lived enough, 
that it doesn't matter.




-- 
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:
[email protected]


Reply via email to