yzeng1618 commented on code in PR #10318:
URL: https://github.com/apache/seatunnel/pull/10318#discussion_r2685189058
##########
seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/client/HbaseClient.java:
##########
@@ -377,9 +389,22 @@ public ResultScanner scan(
String[] columnNameSplit = columnName.split(":");
scan.addColumn(Bytes.toBytes(columnNameSplit[0]),
Bytes.toBytes(columnNameSplit[1]));
}
- return this.connection
- .getTable(TableName.valueOf(hbaseParameters.getTable()))
- .getScanner(scan);
+ return scan;
+ }
+
+ private static void applyTimeRange(Scan scan, HbaseParameters
hbaseParameters)
+ throws IOException {
+ Long minTimestamp = hbaseParameters.getMinTimestamp();
+ Long maxTimestamp = hbaseParameters.getMaxTimestamp();
+ if (minTimestamp != null || maxTimestamp != null) {
+ long min = minTimestamp == null ? 0L : minTimestamp;
+ long max = maxTimestamp == null ? Long.MAX_VALUE : maxTimestamp;
+ if (min > max) {
+ throw new IllegalArgumentException(
+ "min_timestamp can't be larger than max_timestamp");
+ }
+ scan.setTimeRange(min, max);
Review Comment:
Added validations for time range: start_timestamp/end_timestamp must be >=
0, and when both are set we require start_timestamp < end_timestamp. Although
HBase Scan#setTimeRange allows min == max at API level, the semantics is [min,
max), so min == max results in an empty scan and is usually not meaningful.
Therefore we fail fast with an IllegalArgumentException
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]