Skip to content

Commit

Permalink
Handle case mismatch in region input
Browse files Browse the repository at this point in the history
  • Loading branch information
jayehwhyehentee committed Jan 27, 2025
1 parent ce6e5b0 commit 5abd91d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ private String getRegion(String userProvidedRegion) {
// Max sink parallelism is deduced using destination dataset's region.
// Ensure instance variable 'region' is assigned before invoking this method.
private int getMaxParallelism() {
if (BQ_MULTI_REGIONS.contains(region)) {
return MULTI_REGION_MAX_SINK_PARALLELISM;
for (String multiRegion : BQ_MULTI_REGIONS) {
if (multiRegion.equalsIgnoreCase(region)) {
return MULTI_REGION_MAX_SINK_PARALLELISM;
}
}
return DEFAULT_MAX_SINK_PARALLELISM;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ public void testRegionAndParallelism_useProvidedMultiRegion() {
.serializer(new AvroToProtoSerializer())
.enableTableCreation(true)
.streamExecutionEnvironment(env)
.region("us")
.region("US")
.build();
BigQueryDefaultSink sink = new BigQueryDefaultSink(sinkConfig);
assertEquals("us", sink.region);
assertEquals("US", sink.region);
assertEquals(512, sink.maxParallelism);
}

Expand Down

0 comments on commit 5abd91d

Please sign in to comment.