Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Hisoka-X committed Sep 18, 2023
1 parent 12e6a42 commit 07d31ff
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,17 @@
import org.apache.seatunnel.api.table.type.BasicType;
import org.apache.seatunnel.api.table.type.LocalTimeType;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Slf4j
public class InMemoryCatalog implements Catalog {
private static final Logger LOGGER = LoggerFactory.getLogger(InMemoryCatalog.class);
private final ReadonlyConfig options;
private final String name;
// database -> tables
Expand Down Expand Up @@ -116,15 +114,15 @@ public void open() throws CatalogException {
String password = options.get(InMemoryCatalogOptionRule.password);
String host = options.get(InMemoryCatalogOptionRule.host);
int port = options.get(InMemoryCatalogOptionRule.port);
LOGGER.trace(
log.trace(
String.format(
"InMemoryCatalog %s opening with %s/%s in %s:%s",
name, username, password, host, port));
}

@Override
public void close() throws CatalogException {
LOGGER.trace(String.format("InMemoryCatalog %s closing", name));
log.trace(String.format("InMemoryCatalog %s closing", name));
}

@Override
Expand Down Expand Up @@ -184,7 +182,7 @@ public void createTable(TablePath tablePath, CatalogTable table, boolean ignoreI
List<CatalogTable> tables = catalogTables.get(tablePath.getDatabaseName());
if (tables.stream().anyMatch(t -> t.getTableId().toTablePath().equals(tablePath))) {
if (ignoreIfExists) {
LOGGER.debug("Table {} already exists, ignore", tablePath.getFullName());
log.debug("Table {} already exists, ignore", tablePath.getFullName());
} else {
throw new TableAlreadyExistException(name, tablePath);
}
Expand All @@ -205,7 +203,7 @@ public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)
tables.removeIf(t -> t.getTableId().toTablePath().equals(tablePath));
} else {
if (ignoreIfNotExists) {
LOGGER.debug("Table {} not exists, ignore", tablePath.getFullName());
log.debug("Table {} not exists, ignore", tablePath.getFullName());
} else {
throw new TableNotExistException(name, tablePath);
}
Expand All @@ -220,7 +218,7 @@ public void createDatabase(TablePath tablePath, boolean ignoreIfExists)
throws DatabaseAlreadyExistException, CatalogException {
if (catalogTables.containsKey(tablePath.getDatabaseName())) {
if (ignoreIfExists) {
LOGGER.debug("Database {} already exists, ignore", tablePath.getDatabaseName());
log.debug("Database {} already exists, ignore", tablePath.getDatabaseName());
} else {
throw new DatabaseAlreadyExistException(name, tablePath.getDatabaseName());
}
Expand All @@ -236,7 +234,7 @@ public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)
catalogTables.remove(tablePath.getDatabaseName());
} else {
if (ignoreIfNotExists) {
LOGGER.debug("Database {} not exists, ignore", tablePath.getDatabaseName());
log.debug("Database {} not exists, ignore", tablePath.getDatabaseName());
} else {
throw new DatabaseNotExistException(name, tablePath.getDatabaseName());
}
Expand Down

0 comments on commit 07d31ff

Please sign in to comment.