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/util/visibility.h" |
25 | |
26 | namespace arrow { |
27 | |
28 | class Array; |
29 | class Column; |
30 | class ChunkedArray; |
31 | class RecordBatch; |
32 | class Schema; |
33 | class Status; |
34 | class Table; |
35 | |
36 | struct PrettyPrintOptions { |
37 | PrettyPrintOptions(int indent_arg, int window_arg = 10, int indent_size_arg = 2, |
38 | std::string null_rep_arg = "null" , bool skip_new_lines_arg = false) |
39 | : indent(indent_arg), |
40 | indent_size(indent_size_arg), |
41 | window(window_arg), |
42 | null_rep(null_rep_arg), |
43 | skip_new_lines(skip_new_lines_arg) {} |
44 | |
45 | /// Number of spaces to shift entire formatted object to the right |
46 | int indent; |
47 | |
48 | /// Size of internal indents |
49 | int indent_size; |
50 | |
51 | /// Maximum number of elements to show at the beginning and at the end. |
52 | int window; |
53 | |
54 | /// String to use for representing a null value, defaults to "null" |
55 | std::string null_rep; |
56 | |
57 | /// Skip new lines between elements, defaults to false |
58 | bool skip_new_lines; |
59 | }; |
60 | |
61 | /// \brief Print human-readable representation of RecordBatch |
62 | ARROW_EXPORT |
63 | Status PrettyPrint(const RecordBatch& batch, int indent, std::ostream* sink); |
64 | |
65 | /// \brief Print human-readable representation of Table |
66 | ARROW_EXPORT |
67 | Status PrettyPrint(const Table& table, const PrettyPrintOptions& options, |
68 | std::ostream* sink); |
69 | |
70 | /// \brief Print human-readable representation of Array |
71 | ARROW_EXPORT |
72 | Status PrettyPrint(const Array& arr, int indent, std::ostream* sink); |
73 | |
74 | /// \brief Print human-readable representation of Array |
75 | ARROW_EXPORT |
76 | Status PrettyPrint(const Array& arr, const PrettyPrintOptions& options, |
77 | std::ostream* sink); |
78 | |
79 | /// \brief Print human-readable representation of Array |
80 | ARROW_EXPORT |
81 | Status PrettyPrint(const Array& arr, const PrettyPrintOptions& options, |
82 | std::string* result); |
83 | |
84 | /// \brief Print human-readable representation of ChunkedArray |
85 | ARROW_EXPORT |
86 | Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& options, |
87 | std::ostream* sink); |
88 | |
89 | /// \brief Print human-readable representation of ChunkedArray |
90 | ARROW_EXPORT |
91 | Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& options, |
92 | std::string* result); |
93 | |
94 | /// \brief Print human-readable representation of Column |
95 | ARROW_EXPORT |
96 | Status PrettyPrint(const Column& column, const PrettyPrintOptions& options, |
97 | std::ostream* sink); |
98 | |
99 | ARROW_EXPORT |
100 | Status PrettyPrint(const Schema& schema, const PrettyPrintOptions& options, |
101 | std::ostream* sink); |
102 | |
103 | ARROW_EXPORT |
104 | Status PrettyPrint(const Schema& schema, const PrettyPrintOptions& options, |
105 | std::string* result); |
106 | |
107 | ARROW_EXPORT |
108 | Status DebugPrint(const Array& arr, int indent); |
109 | |
110 | } // namespace arrow |
111 | |
112 | #endif // ARROW_PRETTY_PRINT_H |
113 | |