LiJie20190102 commented on code in PR #10295:
URL: https://github.com/apache/seatunnel/pull/10295#discussion_r2671927967
##########
seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/client/HbaseClient.java:
##########
@@ -392,4 +396,10 @@ public ResultScanner scan(
public RegionLocator getRegionLocator(String tableName) throws IOException
{
return this.connection.getRegionLocator(TableName.valueOf(tableName));
}
+
+ public RegionLocator getRegionLocator(String namespace, String tableName)
throws IOException {
+ String actualNamespace =
+ StringUtils.isBlank(namespace) ?
HbaseParameters.DEFAULT_NAMESPACE : namespace;
Review Comment:
ditto
##########
seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/source/HbaseSourceSplitEnumerator.java:
##########
@@ -176,59 +187,88 @@ private void assignSplit(int taskId) {
public Set<HbaseSourceSplit> getTableSplits() {
try {
- RegionLocator regionLocator =
hbaseClient.getRegionLocator(hbaseParameters.getTable());
- byte[][] startKeys = regionLocator.getStartKeys();
- byte[][] endKeys = regionLocator.getEndKeys();
- List<HbaseSourceSplit> splits = new ArrayList<>();
- boolean isBinaryRowkey = hbaseParameters.isBinaryRowkey();
- byte[] userStartRowkey =
- HBaseUtil.convertRowKey(hbaseParameters.getStartRowkey(),
isBinaryRowkey);
- byte[] userEndRowkey =
- HBaseUtil.convertRowKey(hbaseParameters.getEndRowkey(),
isBinaryRowkey);
- HBaseUtil.validateRowKeyRange(userStartRowkey, userEndRowkey);
-
- int i = 0;
- while (i < startKeys.length) {
- byte[] regionStartKey = startKeys[i];
- byte[] regionEndKey = endKeys[i];
- if (userEndRowkey.length > 0
- && Bytes.compareTo(userEndRowkey, regionStartKey) <= 0
- && Bytes.compareTo(regionStartKey,
HConstants.EMPTY_BYTE_ARRAY) != 0) {
- i++;
- continue;
- }
+ String namespace = hbaseParameters.getNamespace();
+ if (namespace == null || namespace.isEmpty()) {
Review Comment:
ditto
##########
seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/client/HbaseClient.java:
##########
@@ -377,8 +377,12 @@ public ResultScanner scan(
String[] columnNameSplit = columnName.split(":");
scan.addColumn(Bytes.toBytes(columnNameSplit[0]),
Bytes.toBytes(columnNameSplit[1]));
}
+ String namespace =
+ StringUtils.isBlank(hbaseParameters.getNamespace())
Review Comment:
After obtaining the namespace using `hbaseParameters.getNamespace()`, is it
unnecessary to check for nullity, since it has already been set to non-null
when constructing `hbaseParameters`
--
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]