rdblue commented on a change in pull request #2660:
URL: https://github.com/apache/iceberg/pull/2660#discussion_r651339665
##########
File path:
spark3/src/main/java/org/apache/iceberg/spark/source/StreamingOffset.java
##########
@@ -62,22 +63,19 @@ static StreamingOffset fromJson(String json) {
try {
JsonNode node = JsonUtil.mapper().readValue(json, JsonNode.class);
- // The version of StreamingOffset. The offset was created with a version
number
- // used to validate when deserializing from json string.
- int version = JsonUtil.getInt(VERSION, node);
- Preconditions.checkArgument(version == CURR_VERSION,
- "Cannot parse offset JSON: offset version %s is not supported",
version);
-
- long snapshotId = JsonUtil.getLong(SNAPSHOT_ID, node);
- int position = JsonUtil.getInt(POSITION, node);
- boolean shouldScanAllFiles = JsonUtil.getBool(SCAN_ALL_FILES, node);
-
- return new StreamingOffset(snapshotId, position, shouldScanAllFiles);
+ return fromJsonNode(node);
} catch (IOException e) {
throw new IllegalArgumentException(String.format("Failed to parse
StreamingOffset from JSON string %s", json), e);
}
}
+ static StreamingOffset fromJson(InputStream inputStream) throws IOException {
Review comment:
Minor: methods do not typically throw `IOException` because it is often
not useful to calling code. I'd probably throw `RuntimeIOException` instead
from here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]