Skip to content

Commit

Permalink
encapsulate
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Jan 27, 2025
1 parent 8495a91 commit f403b13
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public QueryResult executeQuery() throws AdbcException {
NativeQueryResult result = JniLoader.INSTANCE.statementExecuteQuery(handle);
// TODO: need to handle result in such a way that we free it even if we error here
ArrowReader reader;
try (final ArrowArrayStream cStream = ArrowArrayStream.wrap(result.cDataStream)) {
try (final ArrowArrayStream cStream = ArrowArrayStream.wrap(result.cDataStream())) {
reader = org.apache.arrow.c.Data.importArrayStream(allocator, cStream);
}
return new QueryResult(result.rowsAffected, reader);
return new QueryResult(result.rowsAffected(), reader);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@
package org.apache.arrow.adbc.driver.jni.impl;

public class NativeQueryResult {
public final long rowsAffected;
public final long cDataStream;
private final long rowsAffected;
private final long cDataStream;

public NativeQueryResult(long rowsAffected, long cDataStream) {
this.rowsAffected = rowsAffected;
this.cDataStream = cDataStream;
}

public long rowsAffected() {
return rowsAffected;
}

public long cDataStream() {
return cDataStream;
}
}

0 comments on commit f403b13

Please sign in to comment.