Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .kokoro/presubmit/bigquery-graalvm-native-presubmit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ env_vars: {
value: "gcloud-devel"
}

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-Dbigquery.endpoint=https://us-east7-bigquery.googleapis.com -Dbigquery.storage.endpoint=us-east7-bigquerystorage.googleapis.com:443"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
Expand All @@ -40,5 +45,3 @@ env_vars: {
key: "BUILD_SUBDIR"
value: "java-bigquery"
}


5 changes: 5 additions & 0 deletions .kokoro/presubmit/bigquery-integration.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ env_vars: {
value: "gcloud-devel"
}

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-Dbigquery.endpoint=https://us-east7-bigquery.googleapis.com -Dbigquery.storage.endpoint=us-east7-bigquerystorage.googleapis.com:443"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ env_vars: {

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-Dit.test=!ITBigQueryWrite*RetryTest -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false"
value: "-Dit.test=!ITBigQueryWrite*RetryTest -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false -Dbigquery.storage.endpoint=us-east7-bigquerystorage.googleapis.com:443 -Dbigquery.endpoint=https://us-east7-bigquery.googleapis.com"
}
2 changes: 1 addition & 1 deletion .kokoro/presubmit/bigquerystorage-integration.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ env_vars: {

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-Dit.test=!ITBigQueryWrite*RetryTest -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false"
value: "-Dit.test=!ITBigQueryWrite*RetryTest -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false -Dbigquery.storage.endpoint=us-east7-bigquerystorage.googleapis.com:443 -Dbigquery.endpoint=https://us-east7-bigquery.googleapis.com"
}
19 changes: 19 additions & 0 deletions java-bigquery/google-cloud-bigquery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
</parent>
<properties>
<site.installationModule>google-cloud-bigquery</site.installationModule>
<bigquery.endpoint></bigquery.endpoint>
<bigquery.storage.endpoint></bigquery.storage.endpoint>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -326,5 +328,22 @@
</build>

</profile>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<environmentVariables>
<BIGQUERY_ENDPOINT>${bigquery.endpoint}</BIGQUERY_ENDPOINT>
<BIGQUERY_STORAGE_ENDPOINT>${bigquery.storage.endpoint}</BIGQUERY_STORAGE_ENDPOINT>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static RemoteBigQueryHelper create(String projectId, InputStream keyStrea
.setProjectId(projectId)
.setRetrySettings(retrySettings())
.setTransportOptions(transportOptions);
String endpoint = System.getenv("BIGQUERY_ENDPOINT");
String endpoint = System.getProperty("bigquery.endpoint", System.getenv("BIGQUERY_ENDPOINT"));
if (endpoint != null) {
builder.setHost(endpoint);
}
Expand Down Expand Up @@ -143,7 +143,7 @@ public static RemoteBigQueryHelper create(BigQueryOptions.Builder bigqueryOption
bigqueryOptionsBuilder
.setRetrySettings(retrySettings())
.setTransportOptions(transportOptions);
String endpoint = System.getenv("BIGQUERY_ENDPOINT");
String endpoint = System.getProperty("bigquery.endpoint", System.getenv("BIGQUERY_ENDPOINT"));
if (endpoint != null) {
builder.setHost(endpoint);
}
Expand Down Expand Up @@ -184,4 +184,16 @@ public static BigQueryHelperException translate(Exception ex) {
return new BigQueryHelperException(ex.getMessage(), ex);
}
}

/**
* Helper to check if the provided BigQuery client is configured to target a regional endpoint.
*/
public static boolean isRegionalEndpoint(BigQuery bigquery) {
if (bigquery == null || bigquery.getOptions() == null) {
return false;
}
String host = bigquery.getOptions().getHost();
return host != null
&& (host.contains("-bigquery.googleapis.com") || host.contains(".rep.googleapis.com"));
}
}
Loading
Loading