Skip to content

Commit e0e616a

Browse files
add nullable annotation
1 parent 889788a commit e0e616a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/main/java/io/cdap/plugin/gcp/bigquery/sqlengine/BigQuerySQLEngine.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void prepareRun(SQLEngineContext context) throws Exception {
160160
storage = GCPUtils.getStorage(project, credentials);
161161
Dataset dataset = bigQuery.getDataset(DatasetId.of(datasetProject, datasetName));
162162
bucket = BigQueryUtil.getStagingBucketName(context.getRuntimeArguments(), sqlEngineConfig.getLocation(),
163-
dataset, null);
163+
dataset, sqlEngineConfig.getBucket());
164164

165165
String cmekKey = !Strings.isNullOrEmpty(sqlEngineConfig.cmekKey) ? sqlEngineConfig.cmekKey :
166166
ctx.getRuntimeArguments().get(CmekUtils.CMEK_KEY);
@@ -175,7 +175,8 @@ public void prepareRun(SQLEngineContext context) throws Exception {
175175
sqlEngineConfig.getLocation(), cmekKeyName);
176176
// Configure GCS bucket that is used to stage temporary files.
177177
// If the bucket is created for this run, mark it for deletion after executon is completed
178-
BigQuerySinkUtils.configureBucket(configuration, bucket, "bqpushdown-" + runId);
178+
String fallbackBucketName = "bqpushdown-" + runId;
179+
BigQuerySinkUtils.configureBucket(configuration, bucket, fallbackBucketName);
179180

180181
// Configure credentials for the source
181182
BigQuerySourceUtils.configureServiceAccount(configuration, sqlEngineConfig.connection);

src/main/java/io/cdap/plugin/gcp/bigquery/util/BigQueryUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ public static Map<String, String> getJobTags(String jobType) {
868868
* @param bucket bucket from plugin configuration
869869
* @return Bucket name to use for this sink.
870870
*/
871+
@Nullable
871872
public static String getStagingBucketName(Map<String, String> arguments, @Nullable String configLocation,
872873
@Nullable Dataset dataset, @Nullable String bucket) {
873874
// Get Bucket Prefix from configuration

src/main/java/io/cdap/plugin/gcp/dataplex/sink/DataplexBatchSink.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ private void prepareRunBigQueryDataset(BatchSinkContext context) throws Exceptio
293293
Dataset dataset = bigQuery.getDataset(datasetId);
294294
String bucket = BigQueryUtil.getStagingBucketName(context.getArguments().asMap(), config.getLocation(),
295295
dataset, null);
296-
bucket = BigQuerySinkUtils.configureBucket(baseConfiguration, bucket, "dataplex-" + runUUID);
296+
String fallbackBucketName = "dataplex-" + runUUID;
297+
bucket = BigQuerySinkUtils.configureBucket(baseConfiguration, bucket, fallbackBucketName);
297298
if (!context.isPreviewEnabled()) {
298299
BigQuerySinkUtils.createResources(bigQuery, GCPUtils.getStorage(project, credentials),
299300
DatasetId.of(datasetProject, datasetName),

0 commit comments

Comments
 (0)