Skip to content

Commit 5f1f1fd

Browse files
committed
test
1 parent 4b1d2ab commit 5f1f1fd

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

google/cloud/odbc/bq_driver/internal/odbc_sql_execute_utils.cc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,28 @@ StatusRecord FetchBQDataRead(StatementHandle& stmt_handle,
767767
return StatusRecord{SQLStates::k_HY000(), error_message};
768768
}
769769

770-
return FetchBQDataReadArrow(
770+
StatusRecord read_status = FetchBQDataReadArrow(
771771
stmt_handle, insert_response->configuration.query.destination_table);
772+
773+
if (!read_status.ok() && read_status.message.find("errors resolving bigquerystorage.googleapis.com") != std::string::npos) {
774+
LOG(INFO) << "FetchBQDataRead:: DNS error detected. Setting GRPC_DNS_RESOLVER to native.";
775+
#ifdef _WIN32
776+
_putenv_s("GRPC_DNS_RESOLVER", "native");
777+
#else
778+
setenv("GRPC_DNS_RESOLVER", "native", 1);
779+
#endif
780+
LOG(INFO) << "FetchBQDataRead:: Environment variable set. Retrying FetchBQDataReadArrow...";
781+
782+
read_status = FetchBQDataReadArrow(
783+
stmt_handle, insert_response->configuration.query.destination_table);
784+
785+
if (read_status.ok()) {
786+
LOG(INFO) << "FetchBQDataRead:: Retry successful after setting GRPC_DNS_RESOLVER.";
787+
} else {
788+
LOG(ERROR) << "FetchBQDataRead:: Retry failed with error: " << read_status.message;
789+
}
790+
}
791+
return read_status;
772792
}
773793

774794
#endif // (!defined(_WIN32) || defined(_WIN64)) && !defined(NO_ARROW)

0 commit comments

Comments
 (0)