dimas-b commented on code in PR #4050:
URL: https://github.com/apache/polaris/pull/4050#discussion_r2982783639
##########
runtime/server/build.gradle.kts:
##########
@@ -43,6 +43,10 @@ dependencies {
runtimeOnly(project(":polaris-extensions-federation-hive"))
}
+ if ((project.findProperty("NonRESTCatalogs") as
String?)?.contains("BIGQUERY") == true) {
+ runtimeOnly(project(":polaris-extensions-federation-bigquery"))
Review Comment:
This means `BIGQUERY` will NOT be included into the standard Apache Polaris
distributions... Is that intended?
##########
extensions/federation/bigquery/src/main/java/org/apache/polaris/extensions/federation/bigquery/BigQueryMetastoreFederatedCatalogFactory.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * 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.polaris.extensions.federation.bigquery;
+
+import io.smallrye.common.annotation.Identifier;
+import jakarta.enterprise.context.ApplicationScoped;
+import java.util.Map;
+import org.apache.iceberg.catalog.Catalog;
+import org.apache.iceberg.gcp.bigquery.BigQueryMetastoreCatalog;
+import org.apache.iceberg.rest.RESTUtil;
+import org.apache.polaris.core.catalog.ExternalCatalogFactory;
+import org.apache.polaris.core.catalog.GenericTableCatalog;
+import org.apache.polaris.core.connection.AuthenticationParametersDpo;
+import org.apache.polaris.core.connection.AuthenticationType;
+import org.apache.polaris.core.connection.ConnectionConfigInfoDpo;
+import org.apache.polaris.core.connection.ConnectionType;
+import
org.apache.polaris.core.connection.bigquery.BigQueryMetastoreConnectionConfigInfoDpo;
+import org.apache.polaris.core.credentials.PolarisCredentialManager;
+
+/** Factory class for creating a BigQuery Metastore catalog handle based on
connection configuration. */
+@ApplicationScoped
+@Identifier(ConnectionType.BIGQUERY_FACTORY_IDENTIFIER)
+public class BigQueryMetastoreFederatedCatalogFactory implements
ExternalCatalogFactory {
+
+ @Override
+ public Catalog createCatalog(
+ ConnectionConfigInfoDpo connectionConfigInfoDpo,
+ PolarisCredentialManager polarisCredentialManager,
+ Map<String, String> catalogProperties) {
+
+ // Currently, Polaris supports BigQuery Metastore federation only via
IMPLICIT authentication.
+ // Hence, prior to initializing the configuration, ensure that the catalog
uses
+ // IMPLICIT authentication.
+ AuthenticationParametersDpo authenticationParametersDpo =
+ connectionConfigInfoDpo.getAuthenticationParameters();
+ if (authenticationParametersDpo.getAuthenticationTypeCode()
+ != AuthenticationType.IMPLICIT.getCode()) {
+ throw new IllegalStateException(
+ "BigQuery Metastore federation only supports IMPLICIT
authentication.");
+ }
+
+ String warehouse =
+ ((BigQueryMetastoreConnectionConfigInfoDpo)
connectionConfigInfoDpo).getWarehouse();
+ Map<String, String> mergedProperties =
+ RESTUtil.merge(
+ catalogProperties != null ? catalogProperties : Map.of(),
+
connectionConfigInfoDpo.asIcebergCatalogProperties(polarisCredentialManager));
+
+ BigQueryMetastoreCatalog bigQueryMetastoreCatalog = new
BigQueryMetastoreCatalog();
+ bigQueryMetastoreCatalog.initialize(warehouse, mergedProperties);
Review Comment:
How / where do it get BigQuery connection credentials?
##########
spec/polaris-management-service.yml:
##########
@@ -933,6 +934,7 @@ components:
ICEBERG_REST: "#/components/schemas/IcebergRestConnectionConfigInfo"
HADOOP: "#/components/schemas/HadoopConnectionConfigInfo"
HIVE: "#/components/schemas/HiveConnectionConfigInfo"
+ BIGQUERY:
"#/components/schemas/BigQueryMetastoreConnectionConfigInfo"
Review Comment:
Please open a `dev` ML discussion for this (it's customary for all REST API
changes).
--
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]