]> git.proxmox.com Git - ceph.git/blame - ceph/src/arrow/cpp/src/arrow/pretty_print.h
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / cpp / src / arrow / pretty_print.h
CommitLineData
1d09f67e
TL
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#pragma once
19
20#include <iosfwd>
21#include <string>
22#include <utility>
23
24#include "arrow/util/visibility.h"
25
26namespace arrow {
27
28class Array;
29class ChunkedArray;
30class RecordBatch;
31class Schema;
32class Status;
33class Table;
34
35struct PrettyPrintOptions {
36 PrettyPrintOptions() = default;
37
38 PrettyPrintOptions(int indent_arg, // NOLINT runtime/explicit
39 int window_arg = 10, int indent_size_arg = 2,
40 std::string null_rep_arg = "null", bool skip_new_lines_arg = false,
41 bool truncate_metadata_arg = true)
42 : indent(indent_arg),
43 indent_size(indent_size_arg),
44 window(window_arg),
45 null_rep(std::move(null_rep_arg)),
46 skip_new_lines(skip_new_lines_arg),
47 truncate_metadata(truncate_metadata_arg) {}
48
49 static PrettyPrintOptions Defaults() { return PrettyPrintOptions(); }
50
51 /// Number of spaces to shift entire formatted object to the right
52 int indent = 0;
53
54 /// Size of internal indents
55 int indent_size = 2;
56
57 /// Maximum number of elements to show at the beginning and at the end.
58 int window = 10;
59
60 /// String to use for representing a null value, defaults to "null"
61 std::string null_rep = "null";
62
63 /// Skip new lines between elements, defaults to false
64 bool skip_new_lines = false;
65
66 /// Limit display of each KeyValueMetadata key/value pair to a single line at
67 /// 80 character width
68 bool truncate_metadata = true;
69
70 /// If true, display field metadata when pretty-printing a Schema
71 bool show_field_metadata = true;
72
73 /// If true, display schema metadata when pretty-printing a Schema
74 bool show_schema_metadata = true;
75};
76
77/// \brief Print human-readable representation of RecordBatch
78ARROW_EXPORT
79Status PrettyPrint(const RecordBatch& batch, int indent, std::ostream* sink);
80
81ARROW_EXPORT
82Status PrettyPrint(const RecordBatch& batch, const PrettyPrintOptions& options,
83 std::ostream* sink);
84
85/// \brief Print human-readable representation of Table
86ARROW_EXPORT
87Status PrettyPrint(const Table& table, const PrettyPrintOptions& options,
88 std::ostream* sink);
89
90/// \brief Print human-readable representation of Array
91ARROW_EXPORT
92Status PrettyPrint(const Array& arr, int indent, std::ostream* sink);
93
94/// \brief Print human-readable representation of Array
95ARROW_EXPORT
96Status PrettyPrint(const Array& arr, const PrettyPrintOptions& options,
97 std::ostream* sink);
98
99/// \brief Print human-readable representation of Array
100ARROW_EXPORT
101Status PrettyPrint(const Array& arr, const PrettyPrintOptions& options,
102 std::string* result);
103
104/// \brief Print human-readable representation of ChunkedArray
105ARROW_EXPORT
106Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& options,
107 std::ostream* sink);
108
109/// \brief Print human-readable representation of ChunkedArray
110ARROW_EXPORT
111Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& options,
112 std::string* result);
113
114ARROW_EXPORT
115Status PrettyPrint(const Schema& schema, const PrettyPrintOptions& options,
116 std::ostream* sink);
117
118ARROW_EXPORT
119Status PrettyPrint(const Schema& schema, const PrettyPrintOptions& options,
120 std::string* result);
121
122ARROW_EXPORT
123Status DebugPrint(const Array& arr, int indent);
124
125} // namespace arrow