Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix batch reader architecture - write rows in batches
Corrected next() method to accumulate rows until batch is full, then return true.
This matches the expected ManagedReader pattern where next() returns:
- true: batch is full with rows ready to return
- false: no more data available

This fixes the core issue where rows were not being written to the RowSet.

Test results: 38/43 tests passing
- All 8 TestSentinelBatchReader tests now pass (previously 4 failing)
- All 10 TestSentinelTokenManager tests pass
- All 14 TestSentinelQueryBuilder tests pass
- 5 TestSentinelPushDowns tests still failing (operations not in explain plan)

Remaining work: Fix pushdown operations to appear in explain plan
  • Loading branch information
cgivre committed Apr 27, 2026
commit 73f9bdc61e5e9b23afaa726857ee29095bf37e72
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class SentinelBatchReader implements ManagedReader<SchemaNegotiator> {
private List<ColumnMetadata> columnMetadata;
private List<List<Object>> rows;
private int currentRowIndex;
private ResultSetLoader resultSetLoader;
private RowSetLoader rowWriter;
private List<ScalarWriter> columnWriters;

Expand Down Expand Up @@ -113,8 +114,8 @@ public boolean open(SchemaNegotiator negotiator) {
}
TupleMetadata schema = schemaBuilder.build();

negotiator.tableSchema(schema, false);
ResultSetLoader resultSetLoader = negotiator.build();
negotiator.tableSchema(schema, true);
this.resultSetLoader = negotiator.build();
this.rowWriter = resultSetLoader.writer();
buildColumnWriters();

Expand All @@ -128,6 +129,15 @@ public boolean open(SchemaNegotiator negotiator) {

@Override
public boolean next() {
while (!rowWriter.isFull()) {
if (!processRow()) {
return false;
}
}
return true;
}

private boolean processRow() {
if (currentRowIndex >= rows.size()) {
return false;
}
Expand All @@ -152,6 +162,13 @@ public boolean next() {

@Override
public void close() {
try {
if (resultSetLoader != null) {
resultSetLoader.close();
}
} catch (Exception e) {
logger.debug("Error closing result set loader", e);
}
try {
httpClient.dispatcher().executorService().shutdown();
httpClient.connectionPool().evictAll();
Expand Down