File indexing completed on 2025-08-28 08:27:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #pragma once
0019
0020 #include <cstdint>
0021 #include <functional>
0022 #include <memory>
0023 #include <vector>
0024
0025 #include "arrow/testing/visibility.h"
0026 #include "arrow/type.h"
0027 #include "arrow/type_fwd.h"
0028
0029 namespace arrow::util::internal {
0030
0031 class ARROW_TESTING_EXPORT NestedListGenerator {
0032 public:
0033
0034
0035
0036 static std::shared_ptr<DataType> NestedFSLType(
0037 const std::shared_ptr<DataType>& inner_type, const std::vector<int>& sizes);
0038
0039
0040
0041
0042 static std::shared_ptr<DataType> NestedListType(
0043 const std::shared_ptr<DataType>& inner_type, size_t depth);
0044
0045 static Result<std::shared_ptr<Array>> NestedFSLArray(
0046 const std::shared_ptr<DataType>& inner_type, const std::vector<int>& list_sizes,
0047 int64_t length);
0048
0049 static Result<std::shared_ptr<Array>> NestedListArray(
0050 const std::shared_ptr<DataType>& inner_type, const std::vector<int>& list_sizes,
0051 int64_t length);
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 static void VisitAllNestedListConfigurations(
0062 const std::vector<std::shared_ptr<DataType>>& inner_value_types,
0063 const std::function<void(const std::shared_ptr<DataType>&,
0064 const std::vector<int>&)>& visit,
0065 int max_depth = 3, int max_power_of_2_size = 32);
0066
0067 private:
0068
0069 static Status AppendNestedList(ArrayBuilder* nested_builder, const int* list_sizes,
0070 int64_t* next_inner_value);
0071
0072 static Result<std::shared_ptr<Array>> NestedListArray(
0073 ArrayBuilder* nested_builder, const std::vector<int>& list_sizes, int64_t length);
0074 };
0075
0076 }