Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
fix byte[] can not be the hashkey
Browse files Browse the repository at this point in the history
  • Loading branch information
olivertang committed Feb 12, 2022
1 parent cac18b7 commit d3f0d43
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/main/java/com/xiaomi/infra/pegasus/client/PegasusTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ public void onCompletion(client_operator clientOP) {
result.valueMap = new HashMap<>();
for (full_data oneData : gop.get_response().data) {
result.valueMap.put(
Pair.of(oneData.hash_key.data, oneData.sort_key.data), oneData.value.data);
Pair.of(new String(oneData.hash_key.data), new String(oneData.sort_key.data)),
oneData.value.data);
}

promise.setSuccess(result);
Expand Down Expand Up @@ -1086,10 +1087,10 @@ public int batchGet3(
futures.add(asyncBatchGet(request, timeout));
}

List<Map<Pair<byte[], byte[]>, byte[]>> resultMapList = new ArrayList<>();
List<Map<Pair<String, String>, byte[]>> resultMapList = new ArrayList<>();
for (int i = 0; i < this.table.getPartitionCount(); i++) {
if (emptyResults.get(i)) {
Map<Pair<byte[], byte[]>, byte[]> emptyMap = new HashMap<>();
Map<Pair<String, String>, byte[]> emptyMap = new HashMap<>();
resultMapList.add(emptyMap);
continue;
}
Expand All @@ -1112,7 +1113,10 @@ public int batchGet3(
continue;
}

byte[] value = resultMapList.get(index).get(keys.get(i));
byte[] value =
resultMapList
.get(index)
.get(Pair.of(new String(keys.get(i).getLeft()), new String(keys.get(i).getRight())));
results.add(Pair.of(null, value));

count++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public static class BatchGetResult {
*/
public boolean allFetched;

public Map<Pair<byte[], byte[]>, byte[]> valueMap;
public Map<Pair<String, String>, byte[]> valueMap;
}

public static interface MultiGetListener extends GenericFutureListener<Future<MultiGetResult>> {
Expand Down

0 comments on commit d3f0d43

Please sign in to comment.