forked from snowflakedb/snowflake-kafka-connector
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NO-SNOW Improve offset logging for Snowpipe (snowflakedb#1027)
Co-authored-by: Wojciech Trefon <[email protected]>
- Loading branch information
1 parent
6c2ce0e
commit 95471f2
Showing
5 changed files
with
154 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/com/snowflake/kafka/connector/internal/OffsetContinuityRanges.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.snowflake.kafka.connector.internal; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import org.apache.commons.lang3.tuple.Pair; | ||
|
||
public class OffsetContinuityRanges { | ||
private final List<Pair<Long, Long>> continuousOffsets; | ||
private final List<Pair<Long, Long>> missingOffsets; | ||
|
||
public OffsetContinuityRanges( | ||
List<Pair<Long, Long>> continuousOffsets, List<Pair<Long, Long>> missingOffsets) { | ||
this.continuousOffsets = continuousOffsets; | ||
this.missingOffsets = missingOffsets; | ||
} | ||
|
||
public String getContinuousOffsets() { | ||
return serializeList(continuousOffsets); | ||
} | ||
|
||
public String getMissingOffsets() { | ||
return serializeList(missingOffsets); | ||
} | ||
|
||
private static String serializeList(List<Pair<Long, Long>> list) { | ||
return list.stream() | ||
.map(range -> "[" + range.getLeft() + "," + range.getRight() + "]") | ||
.collect(Collectors.joining("", "[", "]")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters