Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,8 @@ public Map<TopicPartition, Long> insert(ConcurrentLinkedQueue<ClickHouseStruct>

Map<TopicPartition, Long> partitionToOffsetMap = new HashMap<TopicPartition, Long>();

// BlockMetaData bmd = new BlockMetaData();
// HashMap<Integer, MutablePair<Long, Long>> partitionToOffsetMap = new HashMap<Integer, MutablePair<Long, Long>>();

if (records.isEmpty()) {
log.debug("No Records to process");
// bmd.setPartitionToOffsetMap(partitionToOffsetMap);
return partitionToOffsetMap;
}

Expand Down Expand Up @@ -466,14 +462,6 @@ public BlockMetaData addToPreparedStatementBatch(String topicName, Map<MutablePa
return bmd;
}



public void insertTopicOffsetMetadata(Map<TopicPartition, Long> topicPartitionToOffsetMap) {

// try (PreparedStatement ps = this.conn.prepareStatement(insertQuery)) {
//
// }
}
/**
* Case-insensitive
*
Expand Down Expand Up @@ -688,8 +676,7 @@ else if (value instanceof Long) {
}
}

// Sign column.
//String signColumn = this.config.getString(ClickHouseSinkConnectorConfigVariables.CLICKHOUSE_TABLE_SIGN_COLUMN);
// CollapsingMergeTree
if(this.engine != null && this.engine.getEngine() == DBMetadata.TABLE_ENGINE.COLLAPSING_MERGE_TREE.getEngine() &&
this.signColumn != null)
if (this.columnNameToDataTypeMap.containsKey(signColumn) && columnNameToIndexMap.containsKey(signColumn)) {
Expand All @@ -708,26 +695,22 @@ else if (value instanceof Long) {

}

// Version column.
//String versionColumn = this.config.getString(ClickHouseSinkConnectorConfigVariables.CLICKHOUSE_TABLE_VERSION_COLUMN);
if(this.engine != null && this.engine.getEngine() == DBMetadata.TABLE_ENGINE.REPLACING_MERGE_TREE.getEngine() && this.versionColumn != null) {
// ReplacingMergeTree
if (this.engine != null && this.engine.getEngine() == DBMetadata.TABLE_ENGINE.REPLACING_MERGE_TREE.getEngine() && this.versionColumn != null) {
// Version column
if (this.columnNameToDataTypeMap.containsKey(versionColumn)) {
long currentTimeInMs = System.currentTimeMillis();
//if (record.getCdcOperation().getOperation().equalsIgnoreCase(ClickHouseConverter.CDC_OPERATION.UPDATE.getOperation()))
{
//ps.setLong(columnNameToIndexMap.get(versionColumn), record.getTs_ms());
if(columnNameToIndexMap.containsKey(versionColumn)) {
if (record.getGtid() != -1) {
if(this.config.getBoolean(ClickHouseSinkConnectorConfigVariables.SNOWFLAKE_ID)) {
ps.setLong(columnNameToIndexMap.get(versionColumn), SnowFlakeId.generate(record.getTs_ms(), record.getGtid()));
} else {
ps.setLong(columnNameToIndexMap.get(versionColumn), record.getGtid());
}
if (columnNameToIndexMap.containsKey(versionColumn)) {
if (record.getGtid() != -1) {
if (this.config.getBoolean(ClickHouseSinkConnectorConfigVariables.SNOWFLAKE_ID)) {
ps.setLong(columnNameToIndexMap.get(versionColumn), SnowFlakeId.generate(record.getTs_ms(), record.getGtid()));
} else {
ps.setLong(columnNameToIndexMap.get(versionColumn), record.getTs_ms());
ps.setLong(columnNameToIndexMap.get(versionColumn), record.getGtid());
}
} else {
ps.setLong(columnNameToIndexMap.get(versionColumn), record.getTs_ms());
}
}

}
// Sign column to mark deletes in ReplacingMergeTree
if(this.replacingMergeTreeDeleteColumn != null && this.columnNameToDataTypeMap.containsKey(replacingMergeTreeDeleteColumn)) {
Expand Down

This file was deleted.

Loading