Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce warnings from FilePatternUtils #394

Merged
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 @@ -145,9 +145,9 @@ private Optional<Integer> getPartitionId(final Matcher matcher, final String sou

}

private Optional<Integer> getOffset(final Matcher matcher, final String sourceName) {
private Optional<Long> getOffset(final Matcher matcher, final String sourceName) {
try {
return Optional.of(Integer.parseInt(matcher.group(PATTERN_START_OFFSET_KEY)));
return Optional.of(Long.parseLong(matcher.group(PATTERN_START_OFFSET_KEY)));
} catch (IllegalArgumentException e) {
// It is possible that when checking for the group it does not match and returns an
// illegalStateException, Number format exception is also covered by this in this case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Context<K extends Comparable<K>> {

private String topic;
private Integer partition;
private Integer offset;
private Long offset;
private K storageKey;

public Context(final K storageKey) {
Expand Down Expand Up @@ -74,11 +74,11 @@ public final void setStorageKey(final K storageKey) {
this.storageKey = storageKey;
}

public final Optional<Integer> getOffset() {
public final Optional<Long> getOffset() {
return Optional.ofNullable(offset);
}

public final void setOffset(final Integer offset) {
public final void setOffset(final Long offset) {
this.offset = offset;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ void checkTopicDistribution(final String expectedSourceFormat, final String sour
"{{partition}}-{{start_offset}}-{{topic}}.txt, logs2-1-logs2.txt, logs2,2,0001",
"{{topic}}-{{start_offset}}-{{partition}}.txt, logs2-99999-0001.txt, logs2,1,99999",
"{{partition}}-{{start_offset}}-{{topic}}.txt, logs0002-01-logs2.txt, logs2,2,0001",
"{{partition}}-{{start_offset}}-{{topic}}.txt, logs002-1-logs2.txt, logs2,2,0001", })
"{{partition}}-{{start_offset}}-{{topic}}.txt, logs002-1-logs2.txt, logs2,2,0001",
"{{partition}}-{{start_offset}}-{{topic}}.txt, logs002-9223372036854775807-logs2.txt, logs2,2,9223372036854775807",
"{{partition}}-{{start_offset}}-{{topic}}.txt, logs002-8273685692-logs2.txt, logs2,2,8273685692" })
void checkTopicDistribution(final String expectedSourceFormat, final String sourceName, final String expectedTopic,
final int expectedPartition, final int expectedOffset) {
final int expectedPartition, final long expectedOffset) {

final FilePatternUtils utils = new FilePatternUtils(expectedSourceFormat);
final Optional<Context<String>> ctx = utils.process(sourceName);
Expand Down
Loading