public interface ResultSet extends StructReader, AutoCloseable
This allows access to the data of one row at a time using the methods from the StructReader interface. The rows are read in the order of the query results. To advance to the
next row call next(). This returns false once all the rows have been iterated
over. The result set is initially positioned before the first row, so next() must be
called before reading any data.
getMetadata() may be called before calling next. It will block until the metadata has
been received.
ResultSet implementations may buffer data ahead and/or maintain a persistent streaming
connection to the remote service until all data has been returned or the resultSet closed. As
such, it is important that all uses of ResultSet either fully consume it (that is, call
next() until false is returned or it throws an exception) or explicitly call
close(): failure to do so may result in wasted work or leaked resources.
ResultSet implementations are not required to be thread-safe: the thread that asked
for a ResultSet must be the one that interacts with it.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the result set and cancels the underlying request if it is still open.
|
ResultSetMetadata |
getMetadata()
Returns the
ResultSetMetadata for the ResultSet. |
boolean |
next()
Advances the result set to the next row, returning
false if no such row exists. |
getBoolean, getBoolean, getBytes, getBytes, getDate, getDate, getDouble, getDouble, getFloat, getFloat, getList, getList, getLong, getLong, getMap, getMap, getProtoEnum, getProtoEnum, getProtoMessage, getProtoMessage, getString, getString, getStruct, getStruct, getTimestamp, getTimestamp, isNull, isNullboolean next()
false if no such row exists. Calls
to data access methods will throw an exception after next has returned False.ResultSetMetadata getMetadata()
ResultSetMetadata for the ResultSet. Blocks until the underlying request
receives the metadata.void close()
ResultSet before next() has returned false or raised an exception. Calling close() is also allowed if the result set has
been fully consumed, so a recommended practice is to unconditionally close the result set once
it is done with, typically using a try-with-resources construct.close in interface AutoCloseableCopyright © 2026 Google LLC. All rights reserved.