Skip to content

Commit ead8446

Browse files
committed
add ColumnFamilyTimeRange in getscanners, adjust definition position
1 parent b10890e commit ead8446

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/main/java/com/alipay/oceanbase/hbase/OHTable.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,7 @@ public List<ResultScanner> getScanners(final Scan scan) throws IOException {
11011101
operationTimeout) {
11021102
public List<ResultScanner> call() throws IOException {
11031103
byte[] family = new byte[] {};
1104+
List<ResultScanner> resultScanners = new ArrayList<ResultScanner>();
11041105
ObTableClientQueryAsyncStreamResult clientQueryAsyncStreamResult;
11051106
ObTableQueryAsyncRequest request;
11061107
ObTableQuery obTableQuery;
@@ -1112,12 +1113,14 @@ public List<ResultScanner> call() throws IOException {
11121113
// In a Scan operation where the family map is greater than 1 or equal to 0,
11131114
// we handle this by appending the column family to the qualifier on the client side.
11141115
// The server can then use this information to filter the appropriate column families and qualifiers.
1116+
if (!scan.getColumnFamilyTimeRange().isEmpty()) {
1117+
throw new FeatureNotSupportedException("setColumnFamilyTimeRange is only supported in single column family for now");
1118+
}
11151119
NavigableSet<byte[]> columnFilters = new TreeSet<>(Bytes.BYTES_COMPARATOR);
11161120
processColumnFilters(columnFilters, scan.getFamilyMap());
11171121
filter = buildObHTableFilter(scan.getFilter(), scan.getTimeRange(),
11181122
scan.getMaxVersions(), columnFilters);
11191123
obTableQuery = buildObTableQuery(filter, scan);
1120-
List<ResultScanner> resultScanners = new ArrayList<ResultScanner>();
11211124

11221125
request = buildObTableQueryAsyncRequest(obTableQuery,
11231126
getTargetTableName(tableNameString));
@@ -1138,11 +1141,21 @@ public List<ResultScanner> call() throws IOException {
11381141
for (Map.Entry<byte[], NavigableSet<byte[]>> entry : scan.getFamilyMap()
11391142
.entrySet()) {
11401143
family = entry.getKey();
1144+
if (!scan.getColumnFamilyTimeRange().isEmpty()) {
1145+
Map<byte[], TimeRange> colFamTimeRangeMap = scan.getColumnFamilyTimeRange();
1146+
if (colFamTimeRangeMap.size() > 1) {
1147+
throw new FeatureNotSupportedException("setColumnFamilyTimeRange is only supported in single column family for now");
1148+
} else if (colFamTimeRangeMap.get(family) == null) {
1149+
throw new IllegalArgumentException("Scan family is not matched in ColumnFamilyTimeRange");
1150+
} else {
1151+
TimeRange tr = colFamTimeRangeMap.get(family);
1152+
scan.setTimeRange(tr.getMin(), tr.getMax());
1153+
}
1154+
}
11411155
filter = buildObHTableFilter(scan.getFilter(), scan.getTimeRange(),
11421156
scan.getMaxVersions(), entry.getValue());
11431157
obTableQuery = buildObTableQuery(filter, scan);
11441158

1145-
List<ResultScanner> resultScanners = new ArrayList<ResultScanner>();
11461159
String targetTableName = getTargetTableName(tableNameString, Bytes.toString(family),
11471160
configuration);
11481161
request = buildObTableQueryAsyncRequest(obTableQuery, targetTableName);

0 commit comments

Comments
 (0)