danielcweeks commented on code in PR #14447:
URL: https://github.com/apache/iceberg/pull/14447#discussion_r2632286996
##########
bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreCatalog.java:
##########
@@ -135,7 +138,8 @@ void initialize(
properties,
conf);
- this.listAllTables =
Boolean.parseBoolean(properties.getOrDefault(LIST_ALL_TABLES, "true"));
+ this.listAllTables =
+
Boolean.parseBoolean(properties.getOrDefault(BigQueryProperties.LIST_ALL_TABLES,
"true"));
Review Comment:
nit: you could push this parsing into `BigQueryProperties` as well.
##########
bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreCatalog.java:
##########
@@ -58,14 +57,25 @@
public class BigQueryMetastoreCatalog extends BaseMetastoreCatalog
implements SupportsNamespaces, Configurable<Object> {
- // User provided properties.
- public static final String PROJECT_ID = "gcp.bigquery.project-id";
- public static final String GCP_LOCATION = "gcp.bigquery.location";
- public static final String LIST_ALL_TABLES = "gcp.bigquery.list-all-tables";
+ /**
+ * @deprecated since 1.11.0, will be removed in 1.12.0; use {@link
BigQueryProperties#PROJECT_ID}
+ * instead.
+ */
+ @Deprecated public static final String PROJECT_ID =
"gcp.bigquery.project-id";
Review Comment:
nit: @Deprecation annotation should go above (not in front) of the line
##########
bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryProperties.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.gcp.bigquery;
+
+import com.google.auth.oauth2.GoogleCredentials;
+import com.google.auth.oauth2.ImpersonatedCredentials;
+import com.google.cloud.ServiceOptions;
+import com.google.cloud.bigquery.BigQueryOptions;
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.UncheckedIOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import
org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BigQueryProperties implements Serializable {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(BigQueryProperties.class);
+
+ // User provided properties.
+ public static final String PROJECT_ID = "gcp.bigquery.project-id";
+ public static final String GCP_LOCATION = "gcp.bigquery.location";
+ public static final String LIST_ALL_TABLES = "gcp.bigquery.list-all-tables";
+
+ // Service account impersonation properties.
+ public static final String IMPERSONATE_SERVICE_ACCOUNT =
"gcp.impersonate.service-account";
+ public static final String IMPERSONATE_LIFETIME_SECONDS =
"gcp.impersonate.lifetime-seconds";
+ public static final String IMPERSONATE_SCOPES = "gcp.impersonate.scopes";
+ public static final String IMPERSONATE_DELEGATES =
"gcp.impersonate.delegates";
Review Comment:
I wouldn't assume the AWS/S3 implementation is a good model to follow. It
grew up somewhat organically and there were multiple attempts to disambiguate
across the different services (glue/s3/dynamo/lakeformation/etc) and is a bit
messy.
What I'd like to avoid is confusion for users like if the set
`gcp.impersonate.service-account` that it only applies to `gcs` and not to
`bigquery`, which is a little confusing. (I believe that's what it would be
currently). So, scoping to `gcs` would be consistent with the other properties
like (project id). We could have a better model where you can set a general
one at the `gcp` level and then overrides for `gcs/bigquery` but it we could
always add that later if necessary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]