@@ -1105,6 +1105,7 @@ public ResultSet getProcedureColumns(
11051105 queue .put (BigQueryFieldValueListWrapper .ofError (e ));
11061106 } catch (InterruptedException ie ) {
11071107 LOG .warning ("Failed to put exception to queue due to interruption." );
1108+ Thread .currentThread ().interrupt ();
11081109 }
11091110 } catch (Throwable t ) {
11101111 LOG .severe (
@@ -3517,7 +3518,7 @@ public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLExce
35173518 () -> {
35183519 final FieldList localResultSchemaFields = resultSchemaFields ;
35193520 final List <Future <List <Dataset >>> apiFutures = new ArrayList <>();
3520- final List <Dataset > collectedDatasets = Collections . synchronizedList ( new ArrayList <>() );
3521+ final List <Dataset > collectedDatasets = new ArrayList <>();
35213522 final List <FieldValueList > collectedResults = new ArrayList <>();
35223523
35233524 try {
@@ -3591,6 +3592,7 @@ public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLExce
35913592 Thread .currentThread ().interrupt ();
35923593 }
35933594 } finally {
3595+ apiFutures .forEach (f -> f .cancel (true ));
35943596 signalEndOfData (queue , localResultSchemaFields );
35953597 LOG .info ("Multi-schema fetcher thread finished." );
35963598 }
@@ -4063,6 +4065,7 @@ public ResultSet getFunctionColumns(
40634065 queue .put (BigQueryFieldValueListWrapper .ofError (e ));
40644066 } catch (InterruptedException ie ) {
40654067 LOG .warning ("Failed to put exception to queue due to interruption." );
4068+ Thread .currentThread ().interrupt ();
40664069 }
40674070 } catch (Throwable t ) {
40684071 LOG .severe (
@@ -4976,17 +4979,22 @@ private List<Dataset> fetchMatchingDatasets(
49764979 if (Thread .currentThread ().isInterrupted ()) {
49774980 break ;
49784981 }
4979- List <Dataset > datasets =
4980- findMatchingBigQueryObjects (
4981- "Dataset" ,
4982- () -> bigquery .listDatasets (project , DatasetListOption .pageSize (DEFAULT_PAGE_SIZE )),
4983- (name ) -> bigquery .getDataset (DatasetId .of (project , name )),
4984- (ds ) -> ds .getDatasetId ().getDataset (),
4985- schemaPattern ,
4986- schemaRegex ,
4987- LOG );
4988- if (datasets != null ) {
4989- allDatasets .addAll (datasets );
4982+ try {
4983+ List <Dataset > datasets =
4984+ findMatchingBigQueryObjects (
4985+ "Dataset" ,
4986+ () -> bigquery .listDatasets (project , DatasetListOption .pageSize (DEFAULT_PAGE_SIZE )),
4987+ (name ) -> bigquery .getDataset (DatasetId .of (project , name )),
4988+ (ds ) -> ds .getDatasetId ().getDataset (),
4989+ schemaPattern ,
4990+ schemaRegex ,
4991+ LOG );
4992+ if (datasets != null ) {
4993+ allDatasets .addAll (datasets );
4994+ }
4995+ } catch (Throwable t ) {
4996+ LOG .warning (
4997+ "Failed to fetch matching datasets for project " + project + ": " + t .getMessage ());
49904998 }
49914999 }
49925000 return allDatasets ;
0 commit comments