@@ -167,7 +167,7 @@ public void stop() {
167
167
168
168
@ Override
169
169
public boolean enableBatchRead () {
170
- return readUsingBatch == null ? false : readUsingBatch ;
170
+ return readUsingBatch != null && readUsingBatch ;
171
171
}
172
172
173
173
@ Override
@@ -215,6 +215,12 @@ protected List<CombinedScanTask> tasks() {
215
215
return combinedScanTasks ;
216
216
}
217
217
218
+ /**
219
+ * Used to calculate start offset. If the startSnapshotId has a value, start the construction
220
+ * from the specified snapshot, otherwise, start the construction from the beginning.
221
+ *
222
+ * @return The start offset to scan from.
223
+ */
218
224
private StreamingOffset calculateStartingOffset () {
219
225
StreamingOffset startingOffset ;
220
226
if (startSnapshotId != null ) {
@@ -232,6 +238,12 @@ private StreamingOffset calculateStartingOffset() {
232
238
return startingOffset ;
233
239
}
234
240
241
+ /**
242
+ * Used to calculate end offset.
243
+ *
244
+ * @param start The start offset to scan from
245
+ * @return The end offset to scan to
246
+ */
235
247
private StreamingOffset calculateEndOffset (StreamingOffset start ) {
236
248
if (start .equals (StreamingOffset .START_OFFSET )) {
237
249
return StreamingOffset .START_OFFSET ;
@@ -255,6 +267,13 @@ private StreamingOffset calculateEndOffset(StreamingOffset start) {
255
267
}
256
268
}
257
269
270
+ /**
271
+ * Streaming Read control is performed by changing the startOffset and maxSize.
272
+ *
273
+ * @param startOffset The start offset to scan from
274
+ * @param maxSize The maximum size of Bytes can calculate how many batches
275
+ * @return MicroBatch of list
276
+ */
258
277
@ VisibleForTesting
259
278
@ SuppressWarnings ("checkstyle:HiddenField" )
260
279
List <MicroBatch > getChangesWithRateLimit (StreamingOffset startOffset , long maxSize ) {
@@ -335,9 +354,11 @@ private boolean shouldGenerateFromStartOffset(StreamingOffset startOffset) {
335
354
}
336
355
337
356
private static void assertNoOverwrite (Snapshot snapshot ) {
338
- if (snapshot .operation ().equals (DataOperations .OVERWRITE )) {
357
+ if (snapshot .operation ().equals (DataOperations .OVERWRITE ) ||
358
+ snapshot .operation ().equals (DataOperations .REPLACE ) ||
359
+ snapshot .operation ().equals (DataOperations .DELETE )) {
339
360
throw new UnsupportedOperationException (String .format ("Found %s operation, cannot support incremental data for " +
340
- "snapshot %d" , DataOperations . OVERWRITE , snapshot .snapshotId ()));
361
+ "snapshot %d" , snapshot . operation () , snapshot .snapshotId ()));
341
362
}
342
363
}
343
364
0 commit comments