Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,15 @@ public void close() {

@Override
public boolean next() throws SQLException {
checkClosed();
try (BigQueryJdbcMdc.MdcCloseable mdc =
BigQueryJdbcMdc.registerInstance(this.statement.connection, this.statement.connectionId)) {
LOG.finest("++enter++");
checkClosed();
return nextImpl();
}
}

private boolean nextImpl() throws SQLException {
if (this.isNested) {
if (this.currentNestedBatch == null || this.currentNestedBatch.getNestedRecords() == null) {
IllegalStateException ex =
Expand Down Expand Up @@ -319,10 +327,16 @@ private Object getObjectInternal(int columnIndex) throws SQLException {

@Override
public Object getObject(int columnIndex) throws SQLException {
try (BigQueryJdbcMdc.MdcCloseable mdc =
BigQueryJdbcMdc.registerInstance(this.statement.connection, this.statement.connectionId)) {
// columnIndex is SQL index starting at 1
LOG.finest("++enter++");
checkClosed();
return getObjectImpl(columnIndex);
}
}

// columnIndex is SQL index starting at 1
LOG.finest("++enter++");
checkClosed();
private Object getObjectImpl(int columnIndex) throws SQLException {
Object value = getObjectInternal(columnIndex);
if (value == null) {
return null;
Expand Down Expand Up @@ -451,14 +465,22 @@ private String formatRangeElement(Object element, StandardSQLTypeName elementTyp
}

@Override
public void close() {
LOG.fine("Closing BigqueryArrowResultSet %s.", this);
this.isClosed = true;
if (ownedThread != null && !ownedThread.isInterrupted()) {
// interrupt the producer thread when result set is closed
ownedThread.interrupt();
public void close() throws SQLException {
if (isClosed()) {
return;
}

try (BigQueryJdbcMdc.MdcCloseable mdc =
BigQueryJdbcMdc.registerInstance(this.statement.connection, this.statement.connectionId)) {
LOG.finest("++enter++");
LOG.fine("Closing BigqueryArrowResultSet %s.", this);
this.isClosed = true;
if (ownedThread != null && !ownedThread.isInterrupted()) {
// interrupt the producer thread when result set is closed
ownedThread.interrupt();
}
super.close();
}
super.close();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public String getQueryId() {
}

@Override
public void close() {
public void close() throws SQLException {
try {
if (statement != null && statement.isCloseOnCompletion() && !statement.hasMoreResults()) {
statement.close();
Expand Down
Loading
Loading