
com.huaweicloud.dws.client.TableConfig Maven / Gradle / Ivy
package com.huaweicloud.dws.client;
import com.huaweicloud.dws.client.model.ConflictStrategy;
import com.huaweicloud.dws.client.model.WriteMode;
import lombok.Getter;
import java.io.Serializable;
import java.util.List;
/**
* @ProjectName: dws-connector
* @ClassName: TableConfig
* @Description:
* @Date: 2023/2/15 19:09
* @Version: 1.0
*/
@Getter
public class TableConfig implements Serializable {
/**
* 运行参数
*/
protected ConflictStrategy conflictStrategy = ConflictStrategy.INSERT_OR_UPDATE;
/**
* 写入模式
*/
protected WriteMode writeMode = WriteMode.AUTO;
/**
* 在 WriteMode.AUTO 为自动模式下,数据量最低多少使用copy方式入库
*/
protected int copyWriteBatchSize = 6000;
protected long autoFlushMaxIntervalMs = 3000L;
protected int autoFlushBatchSize = 5000;
/**
* 缓存溢出系数
*/
protected int batchOutWeighRatio = 1;
/**
* 内核优化参数
*/
protected boolean enableHstoreUpsertAutocommit;
protected List uniqueKeys;
public TableConfig withUniqueKeys(List uniqueKeys) {
this.uniqueKeys = uniqueKeys;
return this;
}
public TableConfig withConflictStrategy(ConflictStrategy conflictStrategy) {
this.conflictStrategy = conflictStrategy;
return this;
}
public TableConfig withWriteMode(WriteMode writeMode) {
this.writeMode = writeMode;
return this;
}
public TableConfig withCopyWriteBatchSize(int copyWriteBatchSize) {
this.copyWriteBatchSize = copyWriteBatchSize;
return this;
}
public TableConfig withAutoFlushMaxIntervalMs(long autoFlushMaxIntervalMs) {
this.autoFlushMaxIntervalMs = autoFlushMaxIntervalMs;
return this;
}
public TableConfig withAutoFlushBatchSize(int autoFlushBatchSize) {
this.autoFlushBatchSize = autoFlushBatchSize;
return this;
}
public TableConfig withBatchOutWeighRatio(int batchOutWeighRatio) {
this.batchOutWeighRatio = batchOutWeighRatio;
return this;
}
public TableConfig withEnableHstoreUpsertAutocommit(boolean enableHstoreUpsertAutocommit) {
this.enableHstoreUpsertAutocommit = enableHstoreUpsertAutocommit;
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy