fix formatting in QuerySubmitter

Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/86e5fb5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/86e5fb5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/86e5fb5c

Branch: refs/heads/master
Commit: 86e5fb5ccaf1e3db222c9b6a32e85652741f7232
Parents: 5f4f3bd
Author: Steven Phillips <[email protected]>
Authored: Tue Sep 3 17:31:52 2013 -0700
Committer: Steven Phillips <[email protected]>
Committed: Tue Sep 3 17:34:34 2013 -0700

----------------------------------------------------------------------
 .../org/apache/drill/exec/client/QuerySubmitter.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/86e5fb5c/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java
----------------------------------------------------------------------
diff --git 
a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java
 
b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java
index 4e4d32e..4ef0e9f 100644
--- 
a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java
+++ 
b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java
@@ -68,6 +68,8 @@ public class QuerySubmitter {
     AtomicInteger count = new AtomicInteger();
     private CountDownLatch latch = new CountDownLatch(1);
     RecordBatchLoader loader = new RecordBatchLoader(new 
BootStrapContext(DrillConfig.create()).getAllocator());
+    int width;
+
     @Override
     public void submissionFailed(RpcException ex) {
       System.out.println(String.format("Query failed: %s", ex));
@@ -87,14 +89,15 @@ public class QuerySubmitter {
         for (VectorWrapper vw : loader) {
           columns.add(vw.getValueVector().getField().getName());
         }
+        width = columns.size();
         for (int row = 0; row < rows; row++) {
           if (row%50 == 0) {
-            System.out.println(StringUtils.repeat("-", columns.size()*17 + 1));
+            System.out.println(StringUtils.repeat("-", width*17 + 1));
             for (String column : columns) {
-              System.out.printf("| %-15s", column.length() <= 15 ? column : 
column.substring(0, 14));
+              System.out.printf("| %-15s", width <= 15 ? column : 
column.substring(0, 14));
             }
             System.out.printf("|\n");
-            System.out.println(StringUtils.repeat("-", columns.size()*17 + 1));
+            System.out.println(StringUtils.repeat("-", width*17 + 1));
           }
           for (VectorWrapper vw : loader) {
             Object o = vw.getValueVector().getAccessor().getObject(row);
@@ -112,7 +115,7 @@ public class QuerySubmitter {
         }
       }
       if (result.getHeader().getIsLastChunk()) {
-//        System.out.println(StringUtils.repeat("-", columns.size()*17 + 1));
+        System.out.println(StringUtils.repeat("-", width*17 + 1));
         latch.countDown();
       }
       result.release();

Reply via email to