-
Notifications
You must be signed in to change notification settings - Fork 1k
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
c9e62d7
commit 12931a2
Showing
2 changed files
with
168 additions
and
74 deletions.
There are no files selected for viewing
165 changes: 165 additions & 0 deletions
165
paimon-core/src/main/java/org/apache/paimon/catalog/DelegateCatalog.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,165 @@ | ||
/* | ||
* 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.paimon.catalog; | ||
|
||
import org.apache.paimon.fs.FileIO; | ||
import org.apache.paimon.metastore.MetastoreClient; | ||
import org.apache.paimon.schema.Schema; | ||
import org.apache.paimon.schema.SchemaChange; | ||
import org.apache.paimon.table.Table; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
/** A {@link Catalog} to delegate all operations to another {@link Catalog}. */ | ||
public class DelegateCatalog implements Catalog { | ||
|
||
protected final Catalog wrapped; | ||
|
||
public DelegateCatalog(Catalog wrapped) { | ||
this.wrapped = wrapped; | ||
} | ||
|
||
@Override | ||
public boolean caseSensitive() { | ||
return wrapped.caseSensitive(); | ||
} | ||
|
||
@Override | ||
public String warehouse() { | ||
return wrapped.warehouse(); | ||
} | ||
|
||
@Override | ||
public Map<String, String> options() { | ||
return wrapped.options(); | ||
} | ||
|
||
@Override | ||
public FileIO fileIO() { | ||
return wrapped.fileIO(); | ||
} | ||
|
||
@Override | ||
public Optional<CatalogLockFactory> lockFactory() { | ||
return wrapped.lockFactory(); | ||
} | ||
|
||
@Override | ||
public Optional<CatalogLockContext> lockContext() { | ||
return wrapped.lockContext(); | ||
} | ||
|
||
@Override | ||
public Optional<MetastoreClient.Factory> metastoreClientFactory(Identifier identifier) { | ||
return wrapped.metastoreClientFactory(identifier); | ||
} | ||
|
||
@Override | ||
public List<String> listDatabases() { | ||
return wrapped.listDatabases(); | ||
} | ||
|
||
@Override | ||
public boolean databaseExists(String databaseName) { | ||
return wrapped.databaseExists(databaseName); | ||
} | ||
|
||
@Override | ||
public void createDatabase(String name, boolean ignoreIfExists) | ||
throws DatabaseAlreadyExistException { | ||
wrapped.createDatabase(name, ignoreIfExists); | ||
} | ||
|
||
@Override | ||
public void createDatabase(String name, boolean ignoreIfExists, Map<String, String> properties) | ||
throws DatabaseAlreadyExistException { | ||
wrapped.createDatabase(name, ignoreIfExists, properties); | ||
} | ||
|
||
@Override | ||
public Map<String, String> loadDatabaseProperties(String name) | ||
throws DatabaseNotExistException { | ||
return wrapped.loadDatabaseProperties(name); | ||
} | ||
|
||
@Override | ||
public void dropDatabase(String name, boolean ignoreIfNotExists, boolean cascade) | ||
throws DatabaseNotExistException, DatabaseNotEmptyException { | ||
wrapped.dropDatabase(name, ignoreIfNotExists, cascade); | ||
} | ||
|
||
@Override | ||
public List<String> listTables(String databaseName) throws DatabaseNotExistException { | ||
return wrapped.listTables(databaseName); | ||
} | ||
|
||
@Override | ||
public boolean tableExists(Identifier identifier) { | ||
return wrapped.tableExists(identifier); | ||
} | ||
|
||
@Override | ||
public void dropTable(Identifier identifier, boolean ignoreIfNotExists) | ||
throws TableNotExistException { | ||
wrapped.dropTable(identifier, ignoreIfNotExists); | ||
} | ||
|
||
@Override | ||
public void createTable(Identifier identifier, Schema schema, boolean ignoreIfExists) | ||
throws TableAlreadyExistException, DatabaseNotExistException { | ||
wrapped.createTable(identifier, schema, ignoreIfExists); | ||
} | ||
|
||
@Override | ||
public void renameTable(Identifier fromTable, Identifier toTable, boolean ignoreIfNotExists) | ||
throws TableNotExistException, TableAlreadyExistException { | ||
wrapped.renameTable(fromTable, toTable, ignoreIfNotExists); | ||
} | ||
|
||
@Override | ||
public void alterTable(Identifier identifier, SchemaChange change, boolean ignoreIfNotExists) | ||
throws TableNotExistException, ColumnAlreadyExistException, ColumnNotExistException { | ||
wrapped.alterTable(identifier, change, ignoreIfNotExists); | ||
} | ||
|
||
@Override | ||
public void alterTable( | ||
Identifier identifier, List<SchemaChange> changes, boolean ignoreIfNotExists) | ||
throws TableNotExistException, ColumnAlreadyExistException, ColumnNotExistException { | ||
wrapped.alterTable(identifier, changes, ignoreIfNotExists); | ||
} | ||
|
||
@Override | ||
public Table getTable(Identifier identifier) throws TableNotExistException { | ||
return wrapped.getTable(identifier); | ||
} | ||
|
||
@Override | ||
public void dropPartition(Identifier identifier, Map<String, String> partitions) | ||
throws TableNotExistException, PartitionNotExistException { | ||
wrapped.dropPartition(identifier, partitions); | ||
} | ||
|
||
@Override | ||
public void close() throws Exception { | ||
wrapped.close(); | ||
} | ||
} |
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