Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
pretty_print.h
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 
18 #ifndef ARROW_PRETTY_PRINT_H
19 #define ARROW_PRETTY_PRINT_H
20 
21 #include <ostream>
22 #include <string>
23 
24 #include "arrow/type_fwd.h"
25 #include "arrow/util/visibility.h"
26 
27 namespace arrow {
28 
29 class Array;
30 class ChunkedArray;
31 class Status;
32 
34  PrettyPrintOptions(int indent_arg, int window_arg = 10, int indent_size_arg = 2,
35  std::string null_rep_arg = "null")
36  : indent(indent_arg),
37  indent_size(indent_size_arg),
38  window(window_arg),
39  null_rep(null_rep_arg) {}
40 
42  int indent;
43 
46 
48  int window;
49 
51  std::string null_rep;
52 };
53 
55 ARROW_EXPORT
56 Status PrettyPrint(const RecordBatch& batch, int indent, std::ostream* sink);
57 
59 ARROW_EXPORT
60 Status PrettyPrint(const Array& arr, int indent, std::ostream* sink);
62 
63 ARROW_EXPORT
64 Status PrettyPrint(const Array& arr, const PrettyPrintOptions& options,
65  std::ostream* sink);
67 ARROW_EXPORT
68 Status PrettyPrint(const Array& arr, const PrettyPrintOptions& options,
69  std::string* result);
70 
72 ARROW_EXPORT
73 Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& options,
74  std::ostream* sink);
76 ARROW_EXPORT
77 Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& options,
78  std::string* result);
79 
80 ARROW_EXPORT
81 Status PrettyPrint(const Schema& schema, const PrettyPrintOptions& options,
82  std::ostream* sink);
83 
84 ARROW_EXPORT
85 Status PrettyPrint(const Schema& schema, const PrettyPrintOptions& options,
86  std::string* result);
87 
88 ARROW_EXPORT
89 Status DebugPrint(const Array& arr, int indent);
90 
91 } // namespace arrow
92 
93 #endif // ARROW_PRETTY_PRINT_H
Collection of equal-length arrays matching a particular Schema.
Definition: record_batch.h:41
Definition: status.h:95
Definition: pretty_print.h:33
PrettyPrintOptions(int indent_arg, int window_arg=10, int indent_size_arg=2, std::string null_rep_arg="null")
Definition: pretty_print.h:34
int indent
Number of spaces to shift entire formatted object to the right.
Definition: pretty_print.h:42
Status DebugPrint(const Array &arr, int indent)
int indent_size
Size of internal indents.
Definition: pretty_print.h:45
Sequence of arrow::Field objects describing the columns of a record batch or table data structure...
Definition: type.h:773
Top-level namespace for Apache Arrow C++ API.
Definition: adapter.h:32
Array base type Immutable data array with some logical type and some length.
Definition: array.h:200
std::string null_rep
String to use for representing a null value, defaults to "null".
Definition: pretty_print.h:51
int window
Maximum number of elements to show at the beginning and at the end.
Definition: pretty_print.h:48
Status PrettyPrint(const RecordBatch &batch, int indent, std::ostream *sink)
Print human-readable representation of RecordBatch.
std::shared_ptr< Schema > schema(const std::vector< std::shared_ptr< Field >> &fields, const std::shared_ptr< const KeyValueMetadata > &metadata=NULLPTR)
Create a Schema instance.
A data structure managing a list of primitive Arrow arrays logically as one large array...
Definition: table.h:40