-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(java/driver/flight-sql): implement getObjects #605
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I left some general comments.
...validation/src/main/java/org/apache/arrow/adbc/driver/testsuite/AbstractTransactionTest.java
Show resolved
Hide resolved
private void writeVarChar(VarCharWriter writer, String value) { | ||
byte[] bytes = value.getBytes(StandardCharsets.UTF_8); | ||
try (ArrowBuf tempBuf = allocator.buffer(bytes.length)) { | ||
tempBuf.setBytes(0, bytes, 0, bytes.length); | ||
writer.writeVarChar(0, bytes.length, tempBuf); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why we don't just upstream this (at some point). This bit of code gets written so much for no gain...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a stab at it later. writeVarChar(Text text)
method is actually part of VarCharWriterImpl
already, but it's not exposed through VarCharWriter
interface for some reason. Most of the codebase around writers is code generated, so this might actually be an oversight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...r/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/ObjectMetadataBuilder.java
Outdated
Show resolved
Hide resolved
...r/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/ObjectMetadataBuilder.java
Outdated
Show resolved
Hide resolved
byte[] lastDbSchemaAdded = null; | ||
int catalogIndex = 0; | ||
|
||
for (FlightEndpoint endpoint : info.getEndpoints()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What other drivers have done is factor out the reader logic from the statement so that it doesn't need to be replicated here. Though maybe it's simple enough that it isn't a big deal.
FlightStream stream = client.getStream(endpoint.getTicket()); | ||
while (stream.next()) { | ||
try (VectorSchemaRoot res = stream.getRoot()) { | ||
VarCharVector catalogVector = (VarCharVector) res.getVector(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate the schema somewhere before casting?
...r/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/ObjectMetadataBuilder.java
Outdated
Show resolved
Hide resolved
@tokoko , this issue hasn't been updated since May. May I help finish getting this one merged? |
@jduo sure, go for it. just resolved conflicts with main and some small comments. thanks |
Superseded by #1517 |
implements
getObjects
in flight-sql driver.There are some limitations that I hope is okay to postpone, namely catalogs and schemas are being left out if they don't contain any tables and don't show up in FlightSql's getTables output. This shouldn't be too hard to rectify, but is currently tricky to test with just
sqlite
validation, because you can't have more than one database in sqlite. I'll add necessary tests and a fix later on as part ofDremio
validation suite.