westonpace commented on issue #12618:
URL: https://github.com/apache/arrow/issues/12618#issuecomment-1072905534
I still think this is a variation on `PreparedStatement` though I agree it
is more friendly. For example, I don't see a lot of difference between:
```
public VectorSchemaRoot toArrowVectorSchemaRoot() {
DataFrame.Builder builder = DataFrame.builder();
builder.addColumn("catalog_name", MinorType.VARCHAR, false);
builder.addColumn("db_schema_name", MinorType.VARCHAR, false);
builder.addColumn("table_name", MinorType.VARCHAR, false);
builder.addColumn("table_type", MinorType.VARCHAR, false);
builder.addColumn("table_schema", MinorType.VARBINARY, false);
Map<String, Object> row = new HashMap<>();
row.put("catalog_name", catalogName);
row.put("db_schema_name", schemaName);
row.put("table_name", tableName);
row.put("table_type", tableType);
row.put("table_schema", new
Schema(dataFrame.columns()).toByteArray());
builder.addRow(row);
DataFrame df = builder.build();
return df.toArrowVectorSchemaRoot();
}
```
...and...
```
public VectorSchemaRoot toArrowVectorSchemaRoot() {
// DataFrame.Builder builder = DataFrame.builder();
PreparedStatement ps = GetArrowPreparedStatement();
// row.put("catalog_name", catalogName);
ps.setString("catalog_name", catalogName);
// row.put("db_schema_name", schemaName);
ps.setString("db_schema_name", schemaName);
// row.put("table_name", tableName);
ps.setString("table_name", tableName);
// row.put("table_type", tableType);
ps.setString("table_type", tableType);
// row.put("table_schema", new
Schema(dataFrame.columns()).toByteArray());
ps.setBytes("table_schema", new
Schema(dataFrame.columns()).toByteArray());
// builder.addRow(row);
ps.addBatch();
// return df.toArrowVectorSchemaRoot();
return PreparedStatementToVectorSchemaRoot(ps);
}
```
I will definitely agree that the API you've proposed uses more domain
appropriate terminology, and I think that alone is worth the effort, but I
still think you're solving pretty much the same problem.
--
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]