You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2020/08/12 22:45:07 UTC

[GitHub] [accumulo] keith-turner commented on a change in pull request #1676: WIP - convert translators to lambdas

keith-turner commented on a change in pull request #1676:
URL: https://github.com/apache/accumulo/pull/1676#discussion_r469588043



##########
File path: core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
##########
@@ -670,8 +676,11 @@ static void doLookup(ClientContext context, String server, Map<KeyExtent,List<Ra
         TabletType ttype = TabletType.type(requested.keySet());
         boolean waitForWrites = !ThriftScanner.serversWaitedForWrites.get(ttype).contains(server);
 
-        Map<TKeyExtent,List<TRange>> thriftTabletRanges = Translator.translate(requested,
-            Translators.KET, new Translator.ListTranslator<>(Translators.RT));
+       Map<TKeyExtent, List<TRange>> thriftTabletRanges = requested.entrySet().stream()

Review comment:
       With these changes, is it possible to remove any of the constants like `Translators.KET`?

##########
File path: core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
##########
@@ -533,15 +535,19 @@ static void trackScanning(Map<KeyExtent,List<Range>> failures,
       Map<KeyExtent,List<Range>> unscanned, MultiScanResult scanResult) {
 
     // translate returned failures, remove them from unscanned, and add them to failures
-    Map<KeyExtent,List<Range>> retFailures = Translator.translate(scanResult.failures,
-        Translators.TKET, new Translator.ListTranslator<>(Translators.TRT));
+         Map<KeyExtent, List<Range>> retFailures = scanResult.failures.entrySet().stream()
+            .collect(Collectors.toMap(
+                    entry -> new KeyExtent(entry.getKey()),
+                    entry -> entry.getValue().stream().map(Range::new).collect(Collectors.toList())
+          ));
+
     unscanned.keySet().removeAll(retFailures.keySet());
     failures.putAll(retFailures);
 
-    // translate full scans and remove them from unscanned
-    HashSet<KeyExtent> fullScans =
-        new HashSet<>(Translator.translate(scanResult.fullScans, Translators.TKET));
-    unscanned.keySet().removeAll(fullScans);
+        // translate full scans and remove them from unscanned
+
+    Set<KeyExtent> fullScans = scanResult.fullScans.stream().map(KeyExtent::new).collect(Collectors.toSet());
+        unscanned.keySet().removeAll(fullScans);

Review comment:
       running `mvn compile` locally will format all of the source code I think and that may fix this up




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org