This repository was archived by the owner on Mar 23, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2680,14 +2680,24 @@ void testListTablesWithRangePartitioning() {
26802680 try {
26812681 Page <Table > tables = bigquery .listTables (DATASET );
26822682 boolean found = false ;
2683- Iterator <Table > tableIterator = tables .getValues ().iterator ();
2684- while (tableIterator .hasNext () && !found ) {
2685- StandardTableDefinition standardTableDefinition = tableIterator .next ().getDefinition ();
2686- if (standardTableDefinition .getRangePartitioning () != null ) {
2687- assertEquals (RANGE_PARTITIONING , standardTableDefinition .getRangePartitioning ());
2688- assertEquals (RANGE , standardTableDefinition .getRangePartitioning ().getRange ());
2689- assertEquals ("IntegerField" , standardTableDefinition .getRangePartitioning ().getField ());
2683+ for (Table table : tables .getValues ()) {
2684+ // Look for the table that matches the newly partitioned table. Other tables in the
2685+ // dataset may not be partitioned and cannot match to them.
2686+ if (!table
2687+ .getTableId ()
2688+ .getTable ()
2689+ .equals (createdRangePartitioningTable .getTableId ().getTable ())) {
2690+ continue ;
2691+ }
2692+
2693+ StandardTableDefinition standardTableDefinition = table .getDefinition ();
2694+ RangePartitioning rangePartitioning = standardTableDefinition .getRangePartitioning ();
2695+ assertNotNull (rangePartitioning );
2696+ if (RANGE_PARTITIONING .equals (rangePartitioning )) {
2697+ assertEquals (RANGE , rangePartitioning .getRange ());
2698+ assertEquals ("IntegerField" , rangePartitioning .getField ());
26902699 found = true ;
2700+ break ;
26912701 }
26922702 }
26932703 assertTrue (found );
You can’t perform that action at this time.
0 commit comments