DomGarguilo commented on code in PR #6027:
URL: https://github.com/apache/accumulo/pull/6027#discussion_r2633285620


##########
test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java:
##########
@@ -1037,6 +1038,59 @@ public void testGetTabletInformation() throws Exception {
         });
       }
 
+      var unboundedStartRange = new Range(null, new Text("4"));
+      try (var tablets = 
accumuloClient.tableOperations().getTabletInformation(tableName,
+          unboundedStartRange, TabletInformation.Field.LOCATION)) {
+        var endRows = 
tablets.map(TabletInformation::getTabletId).map(TabletId::getEndRow)
+            .map(er -> er == null ? "null" : er.toString()).toList();
+        assertEquals(List.of("1", "2", "3", "4"), endRows);
+      }
+
+      var unboundedEndRange = new Range(new Text("6"), true, null, true);
+      try (var tablets = 
accumuloClient.tableOperations().getTabletInformation(tableName,
+          unboundedEndRange, TabletInformation.Field.LOCATION)) {
+        var endRows = 
tablets.map(TabletInformation::getTabletId).map(TabletId::getEndRow)
+            .map(er -> er == null ? "null" : er.toString()).toList();
+        assertEquals(List.of("6", "7", "8", "null"), endRows);
+      }
+
+      var exclusiveStartRange = new Range(new Text("4"), false, new Text("6"), 
true);
+      try (var tablets = 
accumuloClient.tableOperations().getTabletInformation(tableName,
+          exclusiveStartRange, TabletInformation.Field.LOCATION)) {
+        var endRows = 
tablets.map(TabletInformation::getTabletId).map(TabletId::getEndRow)
+            .map(Text::toString).toList();
+        assertEquals(List.of("5", "6"), endRows);
+      }
+
+      var inclusiveStartRange = new Range(new Text("4"), true, new Text("6"), 
true);
+      try (var tablets = 
accumuloClient.tableOperations().getTabletInformation(tableName,
+          inclusiveStartRange, TabletInformation.Field.LOCATION)) {
+        var endRows = 
tablets.map(TabletInformation::getTabletId).map(TabletId::getEndRow)
+            .map(Text::toString).toList();
+        assertEquals(List.of("4", "5", "6"), endRows);
+      }
+
+      var fileFieldMissingRange = List.of(new Range(new Text("2"), new 
Text("4")));
+      try (var tablets = 
accumuloClient.tableOperations().getTabletInformation(tableName,
+          fileFieldMissingRange, TabletInformation.Field.LOCATION)) {
+        tablets.forEach(ti -> assertThrows(IllegalStateException.class, 
ti::getNumFiles));
+      }
+
+      var overlappingRange = new Range(new Text("2"), new Text("4"));
+      var overlappingRange2 = new Range(new Text("3"), new Text("5"));
+      var disjointRange = new Range(new Text("7"), new Text("8"));
+      try (var tablets = 
accumuloClient.tableOperations().getTabletInformation(tableName,
+          List.of(overlappingRange, overlappingRange2, disjointRange),
+          TabletInformation.Field.LOCATION)) {
+        var tabletIds = tablets.map(TabletInformation::getTabletId).toList();
+        var endRows = 
tabletIds.stream().map(TabletId::getEndRow).map(Text::toString).toList();
+        assertEquals(6, tabletIds.size());
+        assertEquals(tabletIds.size(), new HashSet<>(tabletIds).size());
+        assertEquals(endRows, new ArrayList<>(new LinkedHashSet<>(endRows)));
+        assertEquals(Set.of("2", "3", "4", "5", "7", "8"), new 
HashSet<>(endRows));
+        assertEquals(List.of("2", "3", "4", "5", "7", "8"), endRows);

Review Comment:
   Yea you're right. fixed in 636b10b



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to