Skip to content

Commit

Permalink
Updage
Browse files Browse the repository at this point in the history
Signed-off-by: Zaorang Yang <[email protected]>
  • Loading branch information
zaorangyang committed Oct 26, 2023
1 parent 3ff3c3a commit 9203816
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.starrocks.data.load.stream.StarRocksVersion;
import com.starrocks.data.load.stream.StreamLoadUtils;

import java.io.Serializable;
import java.util.Arrays;
Expand Down Expand Up @@ -166,16 +165,8 @@ public StreamLoadTableProperties getDefaultTableProperties() {
return defaultTableProperties;
}

public StreamLoadTableProperties getTableProperties(String database, String table) {
return getTableProperties(StreamLoadUtils.getTableUniqueKey(database, table));
}

public StreamLoadTableProperties getTableProperties(String uniqueKey) {
return tablePropertiesMap.getOrDefault(uniqueKey, defaultTableProperties);
}

public StreamLoadTableProperties getTableProperties(String uniqueKey, String database, String table) {
StreamLoadTableProperties tableProperties = getTableProperties(uniqueKey);
StreamLoadTableProperties tableProperties = tablePropertiesMap.getOrDefault(uniqueKey, defaultTableProperties);
if (!tableProperties.getDatabase().equals(database) || !tableProperties.getDatabase().equals(table)) {
StreamLoadTableProperties.Builder tablePropertiesBuilder = StreamLoadTableProperties.builder();
tablePropertiesBuilder = tablePropertiesBuilder.copyFrom(tableProperties).database(database).table(table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public class StreamLoadTableProperties implements Serializable {
private final String table;
private final StreamLoadDataFormat dataFormat;
private final Map<String, String> properties;

private final boolean enableUpsertDelete;
private final long chunkLimit;
private final int maxBufferRows;
private final String columns;
Expand All @@ -48,7 +46,6 @@ private StreamLoadTableProperties(Builder builder) {
? StreamLoadUtils.getTableUniqueKey(database, table)
: builder.uniqueKey;

this.enableUpsertDelete = builder.enableUpsertDelete;
this.dataFormat = builder.dataFormat == null
? StreamLoadDataFormat.JSON
: builder.dataFormat;
Expand Down Expand Up @@ -77,10 +74,6 @@ public String getTable() {
return table;
}

public boolean isEnableUpsertDelete() {
return enableUpsertDelete;
}

public StreamLoadDataFormat getDataFormat() {
return dataFormat;
}
Expand All @@ -106,8 +99,6 @@ public static class Builder {
private String database;
private String table;
private String columns;

private boolean enableUpsertDelete;
private StreamLoadDataFormat dataFormat;
private long chunkLimit;
private int maxBufferRows = Integer.MAX_VALUE;
Expand All @@ -119,13 +110,16 @@ private Builder() {
}

// This function does not copy the uniqueKey and properties attributes because the uniqueKey
// is generated in the StreamLoadTableProperties constructor, and the properties are automatically
// is generated in the StreamLoadTableProperties constructor.
// The properties only contains three elements(database,table,columns), which are automatically
// populated during the build process.
// TODO: StreamLoadProperties.headers hold properties common to multiple tables, while
// StreamLoadTableProperties.properties hold the specific properties of an individual table.
// This should be taken into consideration during the refactoring.
public Builder copyFrom(StreamLoadTableProperties streamLoadTableProperties) {
database(streamLoadTableProperties.getDatabase());
table(streamLoadTableProperties.getTable());
columns(streamLoadTableProperties.getColumns());
enableUpsertDelete(streamLoadTableProperties.isEnableUpsertDelete());
streamLoadDataFormat(streamLoadTableProperties.getDataFormat());
chunkLimit(streamLoadTableProperties.getChunkLimit());
maxBufferRows(streamLoadTableProperties.getMaxBufferRows());
Expand All @@ -152,11 +146,6 @@ public Builder columns(String columns) {
return this;
}

public Builder enableUpsertDelete(boolean enableUpsertDelete) {
this.enableUpsertDelete = enableUpsertDelete;
return this;
}

public Builder streamLoadDataFormat(StreamLoadDataFormat dataFormat) {
this.dataFormat = dataFormat;
return this;
Expand Down

0 comments on commit 9203816

Please sign in to comment.