keith-turner commented on a change in pull request #1537: Add PrintInfo options 
to dump full keys, apply formatter
URL: https://github.com/apache/accumulo/pull/1537#discussion_r385922287
 
 

 ##########
 File path: 
core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
 ##########
 @@ -192,23 +268,43 @@ public void execute(final String[] args) throws 
Exception {
           }
         }
 
+        Formatter formatter = null;
+        if (opts.formatterClazz != null) {
+          final Class<? extends Formatter> formatterClass = 
getFormater(opts.formatterClazz);
+          FormatterConfig config = new FormatterConfig();
+          config.setPrintTimestamps(true);
+          formatter =
+              FormatterFactory.getFormatter(formatterClass, new 
FormatterAdapter(dataIter), config);
+        }
+
         for (String lgName : localityGroupCF.keySet()) {
           LocalityGroupUtil.seek(dataIter, new Range(), lgName, 
localityGroupCF);
-          while (dataIter.hasTop()) {
-            Key key = dataIter.getTopKey();
-            Value value = dataIter.getTopValue();
-            if (opts.dump) {
-              System.out.println(key + " -> " + value);
-              if (System.out.checkError())
+
+          if (formatter != null) {
+            while (formatter.hasNext()) {
+              System.out.print(formatter.next());
+              if (System.out.checkError()) {
                 return;
+              }
             }
-            if (opts.histogram) {
-              kvHistogram.add(key.getSize() + value.getSize());
-            }
-            if (opts.keyStats) {
-              dataKeyStats.add(key);
+          } else {
+            while (dataIter.hasTop()) {
+              Key key = dataIter.getTopKey();
+              Value value = dataIter.getTopValue();
+              if (opts.dump || opts.fullKeys) {
+                System.out
+                    .println((opts.fullKeys ? key.toStringNoTruncate() : key) 
+ " -> " + value);
 
 Review comment:
   ```suggestion
                 if (formatter != null) {
                   System.out
                       .println(formatter.apply(key,value));
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to