]>
git.proxmox.com Git - ceph.git/blob - 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
9 // http://www.apache.org/licenses/LICENSE-2.0
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
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"
34 // A typedef used for test parameterization
35 typedef Status
MakeRecordBatch(std::shared_ptr
<RecordBatch
>* out
);
38 void CompareArraysDetailed(int index
, const Array
& result
, const Array
& expected
);
41 void CompareBatchColumnsDetailed(const RecordBatch
& result
, const RecordBatch
& expected
);
44 Status
MakeRandomInt32Array(int64_t length
, bool include_nulls
, MemoryPool
* pool
,
45 std::shared_ptr
<Array
>* out
, uint32_t seed
= 0);
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
);
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
);
58 Status
MakeRandomBooleanArray(const int length
, bool include_nulls
,
59 std::shared_ptr
<Array
>* out
);
62 Status
MakeBooleanBatchSized(const int length
, std::shared_ptr
<RecordBatch
>* out
);
65 Status
MakeBooleanBatch(std::shared_ptr
<RecordBatch
>* out
);
68 Status
MakeIntBatchSized(int length
, std::shared_ptr
<RecordBatch
>* out
,
72 Status
MakeIntRecordBatch(std::shared_ptr
<RecordBatch
>* out
);
75 Status
MakeFloat3264BatchSized(int length
, std::shared_ptr
<RecordBatch
>* out
,
79 Status
MakeFloat3264Batch(std::shared_ptr
<RecordBatch
>* out
);
82 Status
MakeFloatBatchSized(int length
, std::shared_ptr
<RecordBatch
>* out
,
86 Status
MakeFloatBatch(std::shared_ptr
<RecordBatch
>* out
);
89 Status
MakeRandomStringArray(int64_t length
, bool include_nulls
, MemoryPool
* pool
,
90 std::shared_ptr
<Array
>* out
);
93 Status
MakeStringTypesRecordBatch(std::shared_ptr
<RecordBatch
>* out
,
94 bool with_nulls
= true);
97 Status
MakeStringTypesRecordBatchWithNulls(std::shared_ptr
<RecordBatch
>* out
);
100 Status
MakeNullRecordBatch(std::shared_ptr
<RecordBatch
>* out
);
103 Status
MakeListRecordBatch(std::shared_ptr
<RecordBatch
>* out
);
106 Status
MakeFixedSizeListRecordBatch(std::shared_ptr
<RecordBatch
>* out
);
109 Status
MakeZeroLengthRecordBatch(std::shared_ptr
<RecordBatch
>* out
);
112 Status
MakeNonNullRecordBatch(std::shared_ptr
<RecordBatch
>* out
);
115 Status
MakeDeeplyNestedList(std::shared_ptr
<RecordBatch
>* out
);
118 Status
MakeStruct(std::shared_ptr
<RecordBatch
>* out
);
121 Status
MakeUnion(std::shared_ptr
<RecordBatch
>* out
);
124 Status
MakeDictionary(std::shared_ptr
<RecordBatch
>* out
);
127 Status
MakeDictionaryFlat(std::shared_ptr
<RecordBatch
>* out
);
130 Status
MakeNestedDictionary(std::shared_ptr
<RecordBatch
>* out
);
133 Status
MakeMap(std::shared_ptr
<RecordBatch
>* out
);
136 Status
MakeMapOfDictionary(std::shared_ptr
<RecordBatch
>* out
);
139 Status
MakeDates(std::shared_ptr
<RecordBatch
>* out
);
142 Status
MakeTimestamps(std::shared_ptr
<RecordBatch
>* out
);
145 Status
MakeIntervals(std::shared_ptr
<RecordBatch
>* out
);
148 Status
MakeTimes(std::shared_ptr
<RecordBatch
>* out
);
151 Status
MakeFWBinary(std::shared_ptr
<RecordBatch
>* out
);
154 Status
MakeDecimal(std::shared_ptr
<RecordBatch
>* out
);
157 Status
MakeNull(std::shared_ptr
<RecordBatch
>* out
);
160 Status
MakeUuid(std::shared_ptr
<RecordBatch
>* out
);
163 Status
MakeComplex128(std::shared_ptr
<RecordBatch
>* out
);
166 Status
MakeDictExtension(std::shared_ptr
<RecordBatch
>* out
);
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);