From b1f669d448d9f48d3fa79f2cb4066e1c8db30453 Mon Sep 17 00:00:00 2001 From: "J. Liu" Date: Tue, 21 Mar 2023 10:58:33 -0400 Subject: [PATCH] =?UTF-8?q?test(fix):=20update=20the=20test=20proxy=20to?= =?UTF-8?q?=20preseve=20the=20ordering=20of=20column=20qu=E2=80=A6=20(#166?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .../com/google/cloud/bigtable/testproxy/CbtTestProxy.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/CbtTestProxy.java b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/CbtTestProxy.java index c668ca5e30..c14d4b4186 100644 --- a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/CbtTestProxy.java +++ b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/CbtTestProxy.java @@ -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; @@ -488,7 +489,8 @@ public void readRows(ReadRowsRequest request, StreamObserver 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 @@ -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>> e : grouped.entrySet()) { Family.Builder family = rowBuilder.addFamiliesBuilder().setName(e.getKey());