Skip to content

Commit b1f669d

Browse files
test(fix): update the test proxy to preseve the ordering of column qu… (#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>
1 parent 06f9615 commit b1f669d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/CbtTestProxy.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import java.nio.file.Path;
6161
import java.nio.file.Paths;
6262
import java.util.Iterator;
63+
import java.util.LinkedHashMap;
6364
import java.util.List;
6465
import java.util.Map;
6566
import java.util.concurrent.ConcurrentHashMap;
@@ -488,7 +489,8 @@ public void readRows(ReadRowsRequest request, StreamObserver<RowsResult> respons
488489
/**
489490
* Helper method to convert row from type com.google.cloud.bigtable.data.v2.models.Row to type
490491
* com.google.bigtable.v2.Row. After conversion, row cells within the same column and family are
491-
* grouped and ordered; but the ordering of family and qualifier is not preserved.
492+
* grouped and ordered; the ordering of qualifiers within the same family is preserved; but the
493+
* ordering of families is not (the original order is not specified after all).
492494
*
493495
* @param row Logical row of type com.google.cloud.bigtable.data.v2.models.Row
494496
* @return the converted row in RowResult Builder
@@ -502,7 +504,9 @@ private static RowResult.Builder convertRowResult(
502504
row.getCells().stream()
503505
.collect(
504506
Collectors.groupingBy(
505-
RowCell::getFamily, Collectors.groupingBy(RowCell::getQualifier)));
507+
RowCell::getFamily,
508+
Collectors.groupingBy(
509+
RowCell::getQualifier, LinkedHashMap::new, Collectors.toList())));
506510
for (Map.Entry<String, Map<ByteString, List<RowCell>>> e : grouped.entrySet()) {
507511
Family.Builder family = rowBuilder.addFamiliesBuilder().setName(e.getKey());
508512

0 commit comments

Comments
 (0)