westonpace commented on issue #12618:
URL: https://github.com/apache/arrow/issues/12618#issuecomment-1071331036
In the spirit of brainstorming, JDBC has some similar interfaces (not that
anyone I've ever met particularly loves them). For creating data there is
`java.sql.PreparedStatement` (although bulk inserts are less common in the OLTP
world):
```
PreparedStatement ps = c.prepareStatement("INSERT INTO table VALUES (?,
?, ?)");
ps.setString("name", "Alice");
ps.setInt("age", 21);
ps.setDouble("weight", 50.0);
ps.addBatch();
ps.clearParameters();
ps.setString("name", "Bob");
ps.setInt("age", 30);
ps.setDouble("weight", 60.0);
ps.addBatch();
// Could presumably go from ps to VectorSchemaRoot somehow
```
For reading data there is `java.sql.ResultSet`:
```
ResultSet rs = ...; // From VectorSchemaRoot
var name1 = rs.getString("name");
var age1 = rs.getInt("age");
var weight1 = rs.getDouble("weight");
rs.next();
var name2 = rs.getString("name");
var age2 = rs.getInt("age");
var weight2 = rs.getDouble("weight");
```
Even if you don't use these directly it might be valuable to have
compatibility with them, especially `java.sql.ResultSet`. It's also an
abstract class so I wonder if you could have a `java.sql.ResultSet` that is a
zero-copy view of Arrow data.
Although I believe JPA / Hibernate style APIs are probably more popular
these days:
```
List<People> people = GetPeople();
VectorSchemaRoot root = VectorSchemaRootFromObjects(people);
```
--
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]