Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Hisoka-X committed Feb 23, 2024
1 parent f510aa8 commit 1dac370
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import java.util.Optional;

import static org.apache.seatunnel.api.common.SeaTunnelAPIErrorCode.SINK_TABLE_NOT_EXIST;
Expand All @@ -34,12 +37,12 @@
@Slf4j
public class DefaultSaveModeHandler implements SaveModeHandler {

public SchemaSaveMode schemaSaveMode;
public DataSaveMode dataSaveMode;
public Catalog catalog;
public TablePath tablePath;
public CatalogTable catalogTable;
public String customSql;
@Nonnull public SchemaSaveMode schemaSaveMode;
@Nonnull public DataSaveMode dataSaveMode;
@Nonnull public Catalog catalog;
@Nonnull public TablePath tablePath;
@Nullable public CatalogTable catalogTable;
@Nullable public String customSql;

public DefaultSaveModeHandler(
SchemaSaveMode schemaSaveMode,
Expand Down Expand Up @@ -169,7 +172,9 @@ protected void createTable() {
"Creating table {} with action {}",
tablePath,
catalog.previewAction(
Catalog.ActionType.CREATE_TABLE, tablePath, Optional.of(catalogTable)));
Catalog.ActionType.CREATE_TABLE,
tablePath,
Optional.ofNullable(catalogTable)));
} catch (UnsupportedOperationException ignore) {
log.info("Creating table {}", tablePath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import java.util.Map;
import java.util.Optional;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

/**
Expand Down Expand Up @@ -241,7 +240,6 @@ private Map<String, String> buildTableOptions(TablePath tablePath) {
public PreviewResult previewAction(
ActionType actionType, TablePath tablePath, Optional<CatalogTable> catalogTable) {
if (actionType == ActionType.CREATE_TABLE) {
checkArgument(catalogTable.isPresent(), "CatalogTable cannot be null");
return new InfoPreviewResult("create index " + tablePath.getTableName());
} else if (actionType == ActionType.DROP_TABLE) {
return new InfoPreviewResult("delete index " + tablePath.getTableName());
Expand Down

0 comments on commit 1dac370

Please sign in to comment.