-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AMORO-1906]Refactor code of "Table" and "Catalog" to support Paimon …
…format integration (#1960) * Integration paimon * Integration paimon * Integration paimon * Integration paimon * tmp * Support registering for the Paimon Catalog * Support registering for the Paimon Catalog * Support registering for the Paimon Catalog * Support registering for the Paimon Catalog * Fix ut * Polish code * Fix compile error * Merge master * polish code * Merge master * Fix UT * Polish code * Polish code * polish code * polish code * Update ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java Co-authored-by: ZhouJinsong <zhoujinsong0505@163.com> * Update ams/server/src/main/java/com/netease/arctic/server/dashboard/PaimonTableDescriptor.java Co-authored-by: ZhouJinsong <zhoujinsong0505@163.com> * tmp * polish code * polish code --------- Co-authored-by: ZhouJinsong <zhoujinsong0505@163.com>
- Loading branch information
1 parent
5b4208c
commit 4ae100a
Showing
81 changed files
with
3,454 additions
and
1,324 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
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
99 changes: 99 additions & 0 deletions
99
ams/server/src/main/java/com/netease/arctic/server/catalog/PaimonServerCatalog.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,99 @@ | ||
/* | ||
* 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 com.netease.arctic.server.catalog; | ||
|
||
import com.netease.arctic.AmoroTable; | ||
import com.netease.arctic.CommonUnifiedCatalog; | ||
import com.netease.arctic.UnifiedCatalog; | ||
import com.netease.arctic.ams.api.CatalogMeta; | ||
import com.netease.arctic.ams.api.TableIdentifier; | ||
import com.netease.arctic.table.TableMetaStore; | ||
import com.netease.arctic.utils.CatalogUtil; | ||
import java.util.List; | ||
import java.util.concurrent.Callable; | ||
import java.util.stream.Collectors; | ||
|
||
public class PaimonServerCatalog extends ExternalCatalog { | ||
|
||
private volatile UnifiedCatalog paimonCatalog; | ||
|
||
private volatile TableMetaStore tableMetaStore; | ||
|
||
protected PaimonServerCatalog(CatalogMeta metadata) { | ||
super(metadata); | ||
this.tableMetaStore = CatalogUtil.buildMetaStore(metadata); | ||
this.paimonCatalog = doAs(() -> new CommonUnifiedCatalog( | ||
null, | ||
metadata, | ||
metadata.catalogProperties | ||
)); | ||
} | ||
|
||
@Override | ||
public void updateMetadata(CatalogMeta metadata) { | ||
super.updateMetadata(metadata); | ||
this.tableMetaStore = CatalogUtil.buildMetaStore(metadata); | ||
this.paimonCatalog = doAs(() -> new CommonUnifiedCatalog( | ||
null, | ||
metadata, | ||
metadata.catalogProperties | ||
)); | ||
} | ||
|
||
@Override | ||
public boolean exist(String database) { | ||
return doAs(() -> paimonCatalog.exist(database)); | ||
} | ||
|
||
@Override | ||
public boolean exist(String database, String tableName) { | ||
return doAs(() -> paimonCatalog.exist(database, tableName)); | ||
} | ||
|
||
@Override | ||
public List<String> listDatabases() { | ||
return doAs(() -> paimonCatalog.listDatabases()); | ||
} | ||
|
||
@Override | ||
public List<TableIdentifier> listTables() { | ||
return doAs(() -> paimonCatalog.listDatabases() | ||
.stream() | ||
.map(this::listTables) | ||
.flatMap(List::stream) | ||
.collect(Collectors.toList())); | ||
} | ||
|
||
@Override | ||
public List<TableIdentifier> listTables(String database) { | ||
return doAs(() -> paimonCatalog.listTableMetas(database) | ||
.stream() | ||
.map(t -> t.getIdentifier().buildTableIdentifier()) | ||
.collect(Collectors.toList())); | ||
} | ||
|
||
@Override | ||
public AmoroTable<?> loadTable(String database, String tableName) { | ||
return doAs(() -> paimonCatalog.loadTable(database, tableName)); | ||
} | ||
|
||
private <T> T doAs(Callable<T> callable) { | ||
return tableMetaStore.doAs(callable); | ||
} | ||
} |
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
Oops, something went wrong.