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.
[feature](paimon)support paimon with dlf for 2.1 (apache#41247) (apac…
…he#41694) bp: apache#41247
- Loading branch information
Showing
9 changed files
with
151 additions
and
7 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonDLFExternalCatalog.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,54 @@ | ||
// 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.paimon; | ||
|
||
import org.apache.doris.datasource.property.constants.PaimonProperties; | ||
|
||
import com.aliyun.datalake.metastore.hive2.ProxyMetaStoreClient; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.util.Map; | ||
|
||
public class PaimonDLFExternalCatalog extends PaimonExternalCatalog { | ||
private static final Logger LOG = LogManager.getLogger(PaimonDLFExternalCatalog.class); | ||
|
||
public PaimonDLFExternalCatalog(long catalogId, String name, String resource, | ||
Map<String, String> props, String comment) { | ||
super(catalogId, name, resource, props, comment); | ||
} | ||
|
||
@Override | ||
protected void initLocalObjectsImpl() { | ||
super.initLocalObjectsImpl(); | ||
catalogType = PAIMON_DLF; | ||
catalog = createCatalog(); | ||
} | ||
|
||
@Override | ||
protected void setPaimonCatalogOptions(Map<String, String> properties, Map<String, String> options) { | ||
options.put(PaimonProperties.PAIMON_CATALOG_TYPE, PaimonProperties.PAIMON_HMS_CATALOG); | ||
options.put(PaimonProperties.PAIMON_METASTORE_CLIENT, ProxyMetaStoreClient.class.getName()); | ||
options.put(PaimonProperties.PAIMON_OSS_ENDPOINT, | ||
properties.get(PaimonProperties.PAIMON_OSS_ENDPOINT)); | ||
options.put(PaimonProperties.PAIMON_OSS_ACCESS_KEY, | ||
properties.get(PaimonProperties.PAIMON_OSS_ACCESS_KEY)); | ||
options.put(PaimonProperties.PAIMON_OSS_SECRET_KEY, | ||
properties.get(PaimonProperties.PAIMON_OSS_SECRET_KEY)); | ||
} | ||
} |
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
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
9 changes: 9 additions & 0 deletions
9
regression-test/data/external_table_p2/paimon/test_paimon_dlf_catalog.out
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,9 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !c1 -- | ||
1 a | ||
2 b | ||
|
||
-- !c2 -- | ||
1 a | ||
2 b | ||
|
59 changes: 59 additions & 0 deletions
59
regression-test/suites/external_table_p2/paimon/test_paimon_dlf_catalog.groovy
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,59 @@ | ||
// 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. | ||
|
||
suite("test_paimon_dlf_catalog", "p2,external,paimon,external_remote,external_remote_paimon") { | ||
String enabled = context.config.otherConfigs.get("enablePaimonTest") | ||
if (enabled == null || !enabled.equalsIgnoreCase("true")) { | ||
return | ||
} | ||
|
||
try { | ||
String catalog = "test_paimon_dlf_catalog" | ||
String uid = context.config.otherConfigs.get("dlf_uid") | ||
String region = context.config.otherConfigs.get("dlf_region") | ||
String catalog_id = context.config.otherConfigs.get("dlf_catalog_id") | ||
String access_key = context.config.otherConfigs.get("dlf_access_key") | ||
String secret_key = context.config.otherConfigs.get("dlf_secret_key") | ||
|
||
|
||
sql """drop catalog if exists ${catalog};""" | ||
sql """ | ||
create catalog if not exists ${catalog} properties ( | ||
"type" = "paimon", | ||
"paimon.catalog.type" = "dlf", | ||
"warehouse" = "oss://selectdb-qa-datalake-test/p2_regression_case", | ||
"dlf.proxy.mode" = "DLF_ONLY", | ||
"dlf.uid" = "${uid}", | ||
"dlf.region" = "${region}", | ||
"dlf.catalog.id" = "${catalog_id}", | ||
"dlf.access_key" = "${access_key}", | ||
"dlf.secret_key" = "${secret_key}" | ||
); | ||
""" | ||
|
||
sql """ use ${catalog}.regression_paimon """ | ||
|
||
sql """set force_jni_scanner=false""" | ||
qt_c1 """ select * from tb_simple order by id """ | ||
sql """set force_jni_scanner=true""" | ||
qt_c2 """ select * from tb_simple order by id """ | ||
|
||
} finally { | ||
sql """set force_jni_scanner=false""" | ||
} | ||
} | ||
|