zy-kkk commented on code in PR #57004: URL: https://github.com/apache/doris/pull/57004#discussion_r2446868982
########## fe/fe-core/src/main/java/org/apache/doris/datasource/connectivity/IcebergRestConnectivityTester.java: ########## @@ -0,0 +1,68 @@ +// 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.doris.datasource.connectivity; + +import org.apache.doris.datasource.property.metastore.AbstractIcebergProperties; +import org.apache.doris.datasource.property.metastore.IcebergRestProperties; + +import org.apache.iceberg.CatalogProperties; +import org.apache.iceberg.rest.RESTSessionCatalog; + +import java.util.Map; + +public class IcebergRestConnectivityTester extends AbstractIcebergConnectivityTester { + private static final String DEFAULT_BASE_LOCATION = "default-base-location"; + private String warehouseLocation; + + public IcebergRestConnectivityTester(AbstractIcebergProperties properties) { + super(properties); + } + + @Override + public String getTestType() { + return "Iceberg REST"; + } + + @Override + public void testConnection() throws Exception { + Map<String, String> restProps = ((IcebergRestProperties) properties).getIcebergRestCatalogProperties(); + + try (RESTSessionCatalog catalog = new RESTSessionCatalog()) { + catalog.initialize("connectivity-test", restProps); + + Map<String, String> mergedProps = catalog.properties(); + String location = mergedProps.get(CatalogProperties.WAREHOUSE_LOCATION); + this.warehouseLocation = validateAndGetLocation(location); + if (this.warehouseLocation == null) { + location = mergedProps.get(DEFAULT_BASE_LOCATION); Review Comment: This is for the backup attribute of Polaris, because warehouse in Polaris is just a logical attribute, and the real location is the default-base-location customized by Polaris -- 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]
