forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f850e5
commit 1c1f31b
Showing
6 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...ore/src/main/java/org/apache/doris/datasource/iceberg/IcebergS3TablesExternalCatalog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// 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.iceberg; | ||
|
||
import org.apache.doris.datasource.CatalogProperty; | ||
import org.apache.doris.datasource.property.PropertyConverter; | ||
import org.apache.doris.datasource.property.constants.S3Properties; | ||
|
||
import org.apache.iceberg.CatalogProperties; | ||
import org.apache.iceberg.aws.AwsClientProperties; | ||
import org.apache.iceberg.aws.s3.S3FileIOProperties; | ||
import software.amazon.s3tables.iceberg.S3TablesCatalog; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class IcebergS3TablesExternalCatalog extends IcebergExternalCatalog { | ||
|
||
public IcebergS3TablesExternalCatalog(long catalogId, String name, String resource, Map<String, String> props, | ||
String comment) { | ||
super(catalogId, name, comment); | ||
props = PropertyConverter.convertToMetaProperties(props); | ||
catalogProperty = new CatalogProperty(resource, props); | ||
} | ||
|
||
@Override | ||
protected void initCatalog() { | ||
icebergCatalogType = ICEBERG_S3_TABLES; | ||
S3TablesCatalog s3TablesCatalog = new S3TablesCatalog(); | ||
Map<String, String> s3TablesCatalogProperties = convertToS3TablesCatalogProperties(); | ||
String warehouse = catalogProperty.getHadoopProperties().get(CatalogProperties.WAREHOUSE_LOCATION); | ||
s3TablesCatalogProperties.put(CatalogProperties.WAREHOUSE_LOCATION, warehouse); | ||
s3TablesCatalog.initialize(getName(), s3TablesCatalogProperties); | ||
catalog = s3TablesCatalog; | ||
} | ||
|
||
private Map<String, String> convertToS3TablesCatalogProperties() { | ||
Map<String, String> props = catalogProperty.getProperties(); | ||
Map<String, String> s3Properties = new HashMap<>(props); | ||
if (props.containsKey(S3Properties.ENDPOINT)) { | ||
s3Properties.put(S3FileIOProperties.ENDPOINT, props.get(S3Properties.ENDPOINT)); | ||
} | ||
if (props.containsKey(S3Properties.ACCESS_KEY)) { | ||
s3Properties.put(S3FileIOProperties.ACCESS_KEY_ID, props.get(S3Properties.ACCESS_KEY)); | ||
} | ||
if (props.containsKey(S3Properties.SECRET_KEY)) { | ||
s3Properties.put(S3FileIOProperties.SECRET_ACCESS_KEY, props.get(S3Properties.SECRET_KEY)); | ||
} | ||
if (props.containsKey(S3Properties.REGION)) { | ||
s3Properties.put(AwsClientProperties.CLIENT_REGION, props.get(S3Properties.REGION)); | ||
} | ||
if (props.containsKey(PropertyConverter.USE_PATH_STYLE)) { | ||
s3Properties.put(S3FileIOProperties.PATH_STYLE_ACCESS, props.get(PropertyConverter.USE_PATH_STYLE)); | ||
} | ||
return s3Properties; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters