tokoko commented on code in PR #474:
URL: https://github.com/apache/arrow-adbc/pull/474#discussion_r1117741129


##########
java/driver/validation/src/main/java/org/apache/arrow/adbc/driver/testsuite/SqlTestUtil.java:
##########
@@ -69,4 +69,140 @@ public Schema ingestTableIntsStrs(
     }
     return schema;
   }
+
+  /** Load a table with composite primary key */
+  public Schema ingestTableWithConstraints(
+      BufferAllocator allocator, AdbcConnection connection, String tableName) 
throws Exception {
+    tableName = quirks.caseFoldTableName(tableName);
+    final Schema schema =
+        new Schema(
+            Arrays.asList(
+                Field.notNullable(
+                    quirks.caseFoldColumnName("INTS"), new ArrowType.Int(32, 
/*signed=*/ true)),
+                Field.nullable(quirks.caseFoldColumnName("INTS2"), new 
ArrowType.Int(32, true))));
+    try (final VectorSchemaRoot root = VectorSchemaRoot.create(schema, 
allocator)) {
+      final IntVector ints = (IntVector) root.getVector(0);
+      final IntVector strs = (IntVector) root.getVector(1);
+
+      ints.allocateNew(4);
+      ints.setSafe(0, 0);
+      ints.setSafe(1, 1);
+      ints.setSafe(2, 2);
+      ints.setSafe(3, 3);
+      strs.allocateNew(4);
+      strs.setSafe(0, 10);
+      strs.setSafe(1, 11);
+      strs.setSafe(2, 12);
+      strs.setSafe(3, 13);
+      root.setRowCount(4);
+      try (final AdbcStatement stmt = connection.bulkIngest(tableName, 
BulkIngestMode.CREATE)) {
+        stmt.bind(root);
+        stmt.executeUpdate();
+      }
+
+      try (final AdbcStatement stmt = connection.createStatement()) {
+        stmt.setSqlQuery("ALTER TABLE " + tableName + " ALTER COLUMN INTS SET 
NOT NULL");

Review Comment:
   Resolved. query generation is now in SqlValidationQuirks



##########
java/driver/validation/src/main/java/org/apache/arrow/adbc/driver/testsuite/SqlTestUtil.java:
##########
@@ -69,4 +69,140 @@ public Schema ingestTableIntsStrs(
     }
     return schema;
   }
+
+  /** Load a table with composite primary key */
+  public Schema ingestTableWithConstraints(
+      BufferAllocator allocator, AdbcConnection connection, String tableName) 
throws Exception {
+    tableName = quirks.caseFoldTableName(tableName);
+    final Schema schema =
+        new Schema(
+            Arrays.asList(
+                Field.notNullable(
+                    quirks.caseFoldColumnName("INTS"), new ArrowType.Int(32, 
/*signed=*/ true)),
+                Field.nullable(quirks.caseFoldColumnName("INTS2"), new 
ArrowType.Int(32, true))));
+    try (final VectorSchemaRoot root = VectorSchemaRoot.create(schema, 
allocator)) {
+      final IntVector ints = (IntVector) root.getVector(0);
+      final IntVector strs = (IntVector) root.getVector(1);
+
+      ints.allocateNew(4);
+      ints.setSafe(0, 0);
+      ints.setSafe(1, 1);
+      ints.setSafe(2, 2);
+      ints.setSafe(3, 3);
+      strs.allocateNew(4);
+      strs.setSafe(0, 10);
+      strs.setSafe(1, 11);
+      strs.setSafe(2, 12);
+      strs.setSafe(3, 13);
+      root.setRowCount(4);
+      try (final AdbcStatement stmt = connection.bulkIngest(tableName, 
BulkIngestMode.CREATE)) {
+        stmt.bind(root);
+        stmt.executeUpdate();
+      }
+
+      try (final AdbcStatement stmt = connection.createStatement()) {
+        stmt.setSqlQuery("ALTER TABLE " + tableName + " ALTER COLUMN INTS SET 
NOT NULL");
+        stmt.executeUpdate();
+      }
+
+      try (final AdbcStatement stmt = connection.createStatement()) {
+        stmt.setSqlQuery("ALTER TABLE " + tableName + " ALTER COLUMN INTS2 SET 
NOT NULL");
+        stmt.executeUpdate();
+      }
+
+      try (final AdbcStatement stmt = connection.createStatement()) {
+        stmt.setSqlQuery(

Review Comment:
   same here



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