arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-1493: [C++] Flush stream in PrettyPrint functions
Date Fri, 08 Sep 2017 22:33:23 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 5aca7b669 -> 8911a3463


ARROW-1493: [C++] Flush stream in PrettyPrint functions

I'm not sure how to test this.

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #1066 from wesm/ARROW-1493 and squashes the following commits:

ffbb9af8 [Wes McKinney] Flush stream in PrettyPrint functions


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/8911a346
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/8911a346
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/8911a346

Branch: refs/heads/master
Commit: 8911a34633d6d6957d07d8b2f579c22ecab43d95
Parents: 5aca7b6
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Fri Sep 8 18:33:18 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Fri Sep 8 18:33:18 2017 -0400

----------------------------------------------------------------------
 cpp/src/arrow/pretty_print.cc | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/8911a346/cpp/src/arrow/pretty_print.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc
index 1202faa..3f64d75 100644
--- a/cpp/src/arrow/pretty_print.cc
+++ b/cpp/src/arrow/pretty_print.cc
@@ -45,6 +45,10 @@ class PrettyPrinter {
   void OpenArray();
   void CloseArray();
 
+  void Flush() {
+    (*sink_) << std::flush;
+  }
+
  protected:
   int indent_;
   std::ostream* sink_;
@@ -298,7 +302,11 @@ class ArrayPrinter : public PrettyPrinter {
     return PrettyPrint(*array.indices(), indent_ + 2, sink_);
   }
 
-  Status Print() { return VisitArrayInline(array_, this); }
+  Status Print() {
+    RETURN_NOT_OK(VisitArrayInline(array_, this));
+    Flush();
+    return Status::OK();
+  }
 
  private:
   const Array& array_;
@@ -330,6 +338,7 @@ Status PrettyPrint(const RecordBatch& batch, int indent, std::ostream*
sink) {
     RETURN_NOT_OK(PrettyPrint(*batch.column(i), indent + 2, sink));
     (*sink) << "\n";
   }
+  (*sink) << std::flush;
   return Status::OK();
 }
 
@@ -352,6 +361,7 @@ class SchemaPrinter : public PrettyPrinter {
       }
       RETURN_NOT_OK(PrintField(*schema_.field(i)));
     }
+    Flush();
     return Status::OK();
   }
 


Mime
View raw message