Skip to content

Commit

Permalink
test(fix): update the test proxy to preseve the ordering of column qu… (
Browse files Browse the repository at this point in the history
#1669)

* test(fix): update the test proxy to preseve the ordering of column qualifiers from ReadRows operation

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
liujiongxin and gcf-owl-bot[bot] committed Mar 21, 2023
1 parent 06f9615 commit b1f669d
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -60,6 +60,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -488,7 +489,8 @@ public void readRows(ReadRowsRequest request, StreamObserver<RowsResult> respons
/**
* Helper method to convert row from type com.google.cloud.bigtable.data.v2.models.Row to type
* com.google.bigtable.v2.Row. After conversion, row cells within the same column and family are
* grouped and ordered; but the ordering of family and qualifier is not preserved.
* grouped and ordered; the ordering of qualifiers within the same family is preserved; but the
* ordering of families is not (the original order is not specified after all).
*
* @param row Logical row of type com.google.cloud.bigtable.data.v2.models.Row
* @return the converted row in RowResult Builder
Expand All @@ -502,7 +504,9 @@ private static RowResult.Builder convertRowResult(
row.getCells().stream()
.collect(
Collectors.groupingBy(
RowCell::getFamily, Collectors.groupingBy(RowCell::getQualifier)));
RowCell::getFamily,
Collectors.groupingBy(
RowCell::getQualifier, LinkedHashMap::new, Collectors.toList())));
for (Map.Entry<String, Map<ByteString, List<RowCell>>> e : grouped.entrySet()) {
Family.Builder family = rowBuilder.addFamiliesBuilder().setName(e.getKey());

Expand Down

0 comments on commit b1f669d

Please sign in to comment.