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
26namespace arrow {
27
28class Array;
29class Column;
30class ChunkedArray;
31class RecordBatch;
32class Schema;
33class Status;
34class Table;
35
36struct 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
62ARROW_EXPORT
63Status PrettyPrint(const RecordBatch& batch, int indent, std::ostream* sink);
64
65/// \brief Print human-readable representation of Table
66ARROW_EXPORT
67Status PrettyPrint(const Table& table, const PrettyPrintOptions& options,
68 std::ostream* sink);
69
70/// \brief Print human-readable representation of Array
71ARROW_EXPORT
72Status PrettyPrint(const Array& arr, int indent, std::ostream* sink);
73
74/// \brief Print human-readable representation of Array
75ARROW_EXPORT
76Status PrettyPrint(const Array& arr, const PrettyPrintOptions& options,
77 std::ostream* sink);
78
79/// \brief Print human-readable representation of Array
80ARROW_EXPORT
81Status PrettyPrint(const Array& arr, const PrettyPrintOptions& options,
82 std::string* result);
83
84/// \brief Print human-readable representation of ChunkedArray
85ARROW_EXPORT
86Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& options,
87 std::ostream* sink);
88
89/// \brief Print human-readable representation of ChunkedArray
90ARROW_EXPORT
91Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& options,
92 std::string* result);
93
94/// \brief Print human-readable representation of Column
95ARROW_EXPORT
96Status PrettyPrint(const Column& column, const PrettyPrintOptions& options,
97 std::ostream* sink);
98
99ARROW_EXPORT
100Status PrettyPrint(const Schema& schema, const PrettyPrintOptions& options,
101 std::ostream* sink);
102
103ARROW_EXPORT
104Status PrettyPrint(const Schema& schema, const PrettyPrintOptions& options,
105 std::string* result);
106
107ARROW_EXPORT
108Status DebugPrint(const Array& arr, int indent);
109
110} // namespace arrow
111
112#endif // ARROW_PRETTY_PRINT_H
113