]> git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/cpp/src/arrow/ipc/test_common.h
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / cpp / src / arrow / ipc / test_common.h
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 <cstdint>
21 #include <memory>
22 #include <vector>
23
24 #include "arrow/array.h"
25 #include "arrow/record_batch.h"
26 #include "arrow/status.h"
27 #include "arrow/testing/visibility.h"
28 #include "arrow/type.h"
29
30 namespace arrow {
31 namespace ipc {
32 namespace test {
33
34 // A typedef used for test parameterization
35 typedef Status MakeRecordBatch(std::shared_ptr<RecordBatch>* out);
36
37 ARROW_TESTING_EXPORT
38 void CompareArraysDetailed(int index, const Array& result, const Array& expected);
39
40 ARROW_TESTING_EXPORT
41 void CompareBatchColumnsDetailed(const RecordBatch& result, const RecordBatch& expected);
42
43 ARROW_TESTING_EXPORT
44 Status MakeRandomInt32Array(int64_t length, bool include_nulls, MemoryPool* pool,
45 std::shared_ptr<Array>* out, uint32_t seed = 0);
46
47 ARROW_TESTING_EXPORT
48 Status MakeRandomListArray(const std::shared_ptr<Array>& child_array, int num_lists,
49 bool include_nulls, MemoryPool* pool,
50 std::shared_ptr<Array>* out);
51
52 ARROW_TESTING_EXPORT
53 Status MakeRandomLargeListArray(const std::shared_ptr<Array>& child_array, int num_lists,
54 bool include_nulls, MemoryPool* pool,
55 std::shared_ptr<Array>* out);
56
57 ARROW_TESTING_EXPORT
58 Status MakeRandomBooleanArray(const int length, bool include_nulls,
59 std::shared_ptr<Array>* out);
60
61 ARROW_TESTING_EXPORT
62 Status MakeBooleanBatchSized(const int length, std::shared_ptr<RecordBatch>* out);
63
64 ARROW_TESTING_EXPORT
65 Status MakeBooleanBatch(std::shared_ptr<RecordBatch>* out);
66
67 ARROW_TESTING_EXPORT
68 Status MakeIntBatchSized(int length, std::shared_ptr<RecordBatch>* out,
69 uint32_t seed = 0);
70
71 ARROW_TESTING_EXPORT
72 Status MakeIntRecordBatch(std::shared_ptr<RecordBatch>* out);
73
74 ARROW_TESTING_EXPORT
75 Status MakeFloat3264BatchSized(int length, std::shared_ptr<RecordBatch>* out,
76 uint32_t seed = 0);
77
78 ARROW_TESTING_EXPORT
79 Status MakeFloat3264Batch(std::shared_ptr<RecordBatch>* out);
80
81 ARROW_TESTING_EXPORT
82 Status MakeFloatBatchSized(int length, std::shared_ptr<RecordBatch>* out,
83 uint32_t seed = 0);
84
85 ARROW_TESTING_EXPORT
86 Status MakeFloatBatch(std::shared_ptr<RecordBatch>* out);
87
88 ARROW_TESTING_EXPORT
89 Status MakeRandomStringArray(int64_t length, bool include_nulls, MemoryPool* pool,
90 std::shared_ptr<Array>* out);
91
92 ARROW_TESTING_EXPORT
93 Status MakeStringTypesRecordBatch(std::shared_ptr<RecordBatch>* out,
94 bool with_nulls = true);
95
96 ARROW_TESTING_EXPORT
97 Status MakeStringTypesRecordBatchWithNulls(std::shared_ptr<RecordBatch>* out);
98
99 ARROW_TESTING_EXPORT
100 Status MakeNullRecordBatch(std::shared_ptr<RecordBatch>* out);
101
102 ARROW_TESTING_EXPORT
103 Status MakeListRecordBatch(std::shared_ptr<RecordBatch>* out);
104
105 ARROW_TESTING_EXPORT
106 Status MakeFixedSizeListRecordBatch(std::shared_ptr<RecordBatch>* out);
107
108 ARROW_TESTING_EXPORT
109 Status MakeZeroLengthRecordBatch(std::shared_ptr<RecordBatch>* out);
110
111 ARROW_TESTING_EXPORT
112 Status MakeNonNullRecordBatch(std::shared_ptr<RecordBatch>* out);
113
114 ARROW_TESTING_EXPORT
115 Status MakeDeeplyNestedList(std::shared_ptr<RecordBatch>* out);
116
117 ARROW_TESTING_EXPORT
118 Status MakeStruct(std::shared_ptr<RecordBatch>* out);
119
120 ARROW_TESTING_EXPORT
121 Status MakeUnion(std::shared_ptr<RecordBatch>* out);
122
123 ARROW_TESTING_EXPORT
124 Status MakeDictionary(std::shared_ptr<RecordBatch>* out);
125
126 ARROW_TESTING_EXPORT
127 Status MakeDictionaryFlat(std::shared_ptr<RecordBatch>* out);
128
129 ARROW_TESTING_EXPORT
130 Status MakeNestedDictionary(std::shared_ptr<RecordBatch>* out);
131
132 ARROW_TESTING_EXPORT
133 Status MakeMap(std::shared_ptr<RecordBatch>* out);
134
135 ARROW_TESTING_EXPORT
136 Status MakeMapOfDictionary(std::shared_ptr<RecordBatch>* out);
137
138 ARROW_TESTING_EXPORT
139 Status MakeDates(std::shared_ptr<RecordBatch>* out);
140
141 ARROW_TESTING_EXPORT
142 Status MakeTimestamps(std::shared_ptr<RecordBatch>* out);
143
144 ARROW_TESTING_EXPORT
145 Status MakeIntervals(std::shared_ptr<RecordBatch>* out);
146
147 ARROW_TESTING_EXPORT
148 Status MakeTimes(std::shared_ptr<RecordBatch>* out);
149
150 ARROW_TESTING_EXPORT
151 Status MakeFWBinary(std::shared_ptr<RecordBatch>* out);
152
153 ARROW_TESTING_EXPORT
154 Status MakeDecimal(std::shared_ptr<RecordBatch>* out);
155
156 ARROW_TESTING_EXPORT
157 Status MakeNull(std::shared_ptr<RecordBatch>* out);
158
159 ARROW_TESTING_EXPORT
160 Status MakeUuid(std::shared_ptr<RecordBatch>* out);
161
162 ARROW_TESTING_EXPORT
163 Status MakeComplex128(std::shared_ptr<RecordBatch>* out);
164
165 ARROW_TESTING_EXPORT
166 Status MakeDictExtension(std::shared_ptr<RecordBatch>* out);
167
168 ARROW_TESTING_EXPORT
169 Status MakeRandomTensor(const std::shared_ptr<DataType>& type,
170 const std::vector<int64_t>& shape, bool row_major_p,
171 std::shared_ptr<Tensor>* out, uint32_t seed = 0);
172
173 } // namespace test
174 } // namespace ipc
175 } // namespace arrow