Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-27 08:47:23

0001 // Licensed to the Apache Software Foundation (ASF) under one
0002 // or more contributor license agreements.  See the NOTICE file
0003 // distributed with this work for additional information
0004 // regarding copyright ownership.  The ASF licenses this file
0005 // to you under the Apache License, Version 2.0 (the
0006 // "License"); you may not use this file except in compliance
0007 // with the License.  You may obtain a copy of the License at
0008 //
0009 //   http://www.apache.org/licenses/LICENSE-2.0
0010 //
0011 // Unless required by applicable law or agreed to in writing,
0012 // software distributed under the License is distributed on an
0013 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0014 // KIND, either express or implied.  See the License for the
0015 // specific language governing permissions and limitations
0016 // under the License.
0017 
0018 #pragma once
0019 
0020 #include <limits>
0021 #include <memory>
0022 #include <string>
0023 #include <vector>
0024 
0025 #include "arrow/util/macros.h"
0026 #include "arrow/util/visibility.h"
0027 
0028 namespace arrow {
0029 
0030 template <typename T>
0031 class Iterator;
0032 template <typename T>
0033 struct IterationTraits;
0034 
0035 template <typename T>
0036 class Result;
0037 
0038 class Status;
0039 
0040 namespace internal {
0041 struct Empty;
0042 }  // namespace internal
0043 template <typename T = internal::Empty>
0044 class Future;
0045 
0046 namespace util {
0047 class Codec;
0048 class CodecOptions;
0049 }  // namespace util
0050 
0051 class Buffer;
0052 class Device;
0053 class MemoryManager;
0054 class MemoryPool;
0055 class MutableBuffer;
0056 class ResizableBuffer;
0057 
0058 using BufferVector = std::vector<std::shared_ptr<Buffer>>;
0059 
0060 class DataType;
0061 class Field;
0062 class FieldRef;
0063 class KeyValueMetadata;
0064 enum class Endianness;
0065 class Schema;
0066 
0067 using DataTypeVector = std::vector<std::shared_ptr<DataType>>;
0068 using FieldVector = std::vector<std::shared_ptr<Field>>;
0069 
0070 class Array;
0071 struct ArrayData;
0072 struct ArraySpan;
0073 class ArrayBuilder;
0074 struct Scalar;
0075 
0076 using ArrayDataVector = std::vector<std::shared_ptr<ArrayData>>;
0077 using ArrayVector = std::vector<std::shared_ptr<Array>>;
0078 using ScalarVector = std::vector<std::shared_ptr<Scalar>>;
0079 
0080 class ChunkedArray;
0081 class RecordBatch;
0082 struct RecordBatchWithMetadata;
0083 class RecordBatchReader;
0084 class AsyncRecordBatchReader;
0085 class Table;
0086 
0087 struct Datum;
0088 struct TypeHolder;
0089 
0090 using ChunkedArrayVector = std::vector<std::shared_ptr<ChunkedArray>>;
0091 using RecordBatchVector = std::vector<std::shared_ptr<RecordBatch>>;
0092 using RecordBatchIterator = Iterator<std::shared_ptr<RecordBatch>>;
0093 
0094 class DictionaryType;
0095 class DictionaryArray;
0096 struct DictionaryScalar;
0097 
0098 class NullType;
0099 class NullArray;
0100 class NullBuilder;
0101 struct NullScalar;
0102 
0103 class FixedWidthType;
0104 
0105 class BooleanType;
0106 class BooleanArray;
0107 class BooleanBuilder;
0108 struct BooleanScalar;
0109 
0110 class BinaryType;
0111 class BinaryArray;
0112 class BinaryBuilder;
0113 struct BinaryScalar;
0114 
0115 class BinaryViewType;
0116 class BinaryViewArray;
0117 class BinaryViewBuilder;
0118 struct BinaryViewScalar;
0119 
0120 class LargeBinaryType;
0121 class LargeBinaryArray;
0122 class LargeBinaryBuilder;
0123 struct LargeBinaryScalar;
0124 
0125 class FixedSizeBinaryType;
0126 class FixedSizeBinaryArray;
0127 class FixedSizeBinaryBuilder;
0128 struct FixedSizeBinaryScalar;
0129 
0130 class StringType;
0131 class StringArray;
0132 class StringBuilder;
0133 struct StringScalar;
0134 
0135 class StringViewType;
0136 class StringViewArray;
0137 class StringViewBuilder;
0138 struct StringViewScalar;
0139 
0140 class LargeStringType;
0141 class LargeStringArray;
0142 class LargeStringBuilder;
0143 struct LargeStringScalar;
0144 
0145 class ListType;
0146 class ListArray;
0147 class ListBuilder;
0148 struct ListScalar;
0149 
0150 class LargeListType;
0151 class LargeListArray;
0152 class LargeListBuilder;
0153 struct LargeListScalar;
0154 
0155 class ListViewType;
0156 class ListViewArray;
0157 class ListViewBuilder;
0158 struct ListViewScalar;
0159 
0160 class LargeListViewType;
0161 class LargeListViewArray;
0162 class LargeListViewBuilder;
0163 struct LargeListViewScalar;
0164 
0165 class MapType;
0166 class MapArray;
0167 class MapBuilder;
0168 struct MapScalar;
0169 
0170 class FixedSizeListType;
0171 class FixedSizeListArray;
0172 class FixedSizeListBuilder;
0173 struct FixedSizeListScalar;
0174 
0175 class StructType;
0176 class StructArray;
0177 class StructBuilder;
0178 struct StructScalar;
0179 
0180 class Decimal32;
0181 class Decimal64;
0182 class Decimal128;
0183 class Decimal256;
0184 class DecimalType;
0185 class Decimal32Type;
0186 class Decimal64Type;
0187 class Decimal128Type;
0188 class Decimal256Type;
0189 class Decimal32Array;
0190 class Decimal64Array;
0191 class Decimal128Array;
0192 class Decimal256Array;
0193 class Decimal32Builder;
0194 class Decimal64Builder;
0195 class Decimal128Builder;
0196 class Decimal256Builder;
0197 struct Decimal32Scalar;
0198 struct Decimal64Scalar;
0199 struct Decimal128Scalar;
0200 struct Decimal256Scalar;
0201 
0202 struct UnionMode {
0203   enum type { SPARSE, DENSE };
0204 };
0205 
0206 class SparseUnionType;
0207 class SparseUnionArray;
0208 class SparseUnionBuilder;
0209 struct SparseUnionScalar;
0210 
0211 class DenseUnionType;
0212 class DenseUnionArray;
0213 class DenseUnionBuilder;
0214 struct DenseUnionScalar;
0215 
0216 class RunEndEncodedType;
0217 class RunEndEncodedArray;
0218 class RunEndEncodedBuilder;
0219 struct RunEndEncodedScalar;
0220 
0221 template <typename TypeClass>
0222 class NumericArray;
0223 
0224 template <typename TypeClass>
0225 class NumericBuilder;
0226 
0227 template <typename TypeClass>
0228 class NumericTensor;
0229 
0230 #define _NUMERIC_TYPE_DECL(KLASS)                     \
0231   class KLASS##Type;                                  \
0232   using KLASS##Array = NumericArray<KLASS##Type>;     \
0233   using KLASS##Builder = NumericBuilder<KLASS##Type>; \
0234   struct KLASS##Scalar;                               \
0235   using KLASS##Tensor = NumericTensor<KLASS##Type>;
0236 
0237 _NUMERIC_TYPE_DECL(Int8)
0238 _NUMERIC_TYPE_DECL(Int16)
0239 _NUMERIC_TYPE_DECL(Int32)
0240 _NUMERIC_TYPE_DECL(Int64)
0241 _NUMERIC_TYPE_DECL(UInt8)
0242 _NUMERIC_TYPE_DECL(UInt16)
0243 _NUMERIC_TYPE_DECL(UInt32)
0244 _NUMERIC_TYPE_DECL(UInt64)
0245 _NUMERIC_TYPE_DECL(HalfFloat)
0246 _NUMERIC_TYPE_DECL(Float)
0247 _NUMERIC_TYPE_DECL(Double)
0248 
0249 #undef _NUMERIC_TYPE_DECL
0250 
0251 enum class DateUnit : char { DAY = 0, MILLI = 1 };
0252 
0253 class DateType;
0254 class Date32Type;
0255 using Date32Array = NumericArray<Date32Type>;
0256 using Date32Builder = NumericBuilder<Date32Type>;
0257 struct Date32Scalar;
0258 
0259 class Date64Type;
0260 using Date64Array = NumericArray<Date64Type>;
0261 using Date64Builder = NumericBuilder<Date64Type>;
0262 struct Date64Scalar;
0263 
0264 struct ARROW_EXPORT TimeUnit {
0265   /// The unit for a time or timestamp DataType
0266   enum type { SECOND = 0, MILLI = 1, MICRO = 2, NANO = 3 };
0267 
0268   /// Iterate over all valid time units
0269   static const std::vector<TimeUnit::type>& values();
0270 };
0271 
0272 class TimeType;
0273 class Time32Type;
0274 using Time32Array = NumericArray<Time32Type>;
0275 using Time32Builder = NumericBuilder<Time32Type>;
0276 struct Time32Scalar;
0277 
0278 class Time64Type;
0279 using Time64Array = NumericArray<Time64Type>;
0280 using Time64Builder = NumericBuilder<Time64Type>;
0281 struct Time64Scalar;
0282 
0283 class TimestampType;
0284 using TimestampArray = NumericArray<TimestampType>;
0285 using TimestampBuilder = NumericBuilder<TimestampType>;
0286 struct TimestampScalar;
0287 
0288 class MonthIntervalType;
0289 using MonthIntervalArray = NumericArray<MonthIntervalType>;
0290 using MonthIntervalBuilder = NumericBuilder<MonthIntervalType>;
0291 struct MonthIntervalScalar;
0292 
0293 class DayTimeIntervalType;
0294 class DayTimeIntervalArray;
0295 class DayTimeIntervalBuilder;
0296 struct DayTimeIntervalScalar;
0297 
0298 class MonthDayNanoIntervalType;
0299 class MonthDayNanoIntervalArray;
0300 class MonthDayNanoIntervalBuilder;
0301 struct MonthDayNanoIntervalScalar;
0302 
0303 class DurationType;
0304 using DurationArray = NumericArray<DurationType>;
0305 using DurationBuilder = NumericBuilder<DurationType>;
0306 struct DurationScalar;
0307 
0308 class ExtensionType;
0309 class ExtensionArray;
0310 struct ExtensionScalar;
0311 
0312 class Tensor;
0313 class SparseTensor;
0314 
0315 // ----------------------------------------------------------------------
0316 
0317 struct Type {
0318   /// \brief Main data type enumeration
0319   ///
0320   /// This enumeration provides a quick way to interrogate the category
0321   /// of a DataType instance.
0322   enum type {
0323     /// A NULL type having no physical storage
0324     NA = 0,
0325 
0326     /// Boolean as 1 bit, LSB bit-packed ordering
0327     BOOL = 1,
0328 
0329     /// Unsigned 8-bit little-endian integer
0330     UINT8 = 2,
0331 
0332     /// Signed 8-bit little-endian integer
0333     INT8 = 3,
0334 
0335     /// Unsigned 16-bit little-endian integer
0336     UINT16 = 4,
0337 
0338     /// Signed 16-bit little-endian integer
0339     INT16 = 5,
0340 
0341     /// Unsigned 32-bit little-endian integer
0342     UINT32 = 6,
0343 
0344     /// Signed 32-bit little-endian integer
0345     INT32 = 7,
0346 
0347     /// Unsigned 64-bit little-endian integer
0348     UINT64 = 8,
0349 
0350     /// Signed 64-bit little-endian integer
0351     INT64 = 9,
0352 
0353     /// 2-byte floating point value
0354     HALF_FLOAT = 10,
0355 
0356     /// 4-byte floating point value
0357     FLOAT = 11,
0358 
0359     /// 8-byte floating point value
0360     DOUBLE = 12,
0361 
0362     /// UTF8 variable-length string as List<Char>
0363     STRING = 13,
0364 
0365     /// Variable-length bytes (no guarantee of UTF8-ness)
0366     BINARY = 14,
0367 
0368     /// Fixed-size binary. Each value occupies the same number of bytes
0369     FIXED_SIZE_BINARY = 15,
0370 
0371     /// int32_t days since the UNIX epoch
0372     DATE32 = 16,
0373 
0374     /// int64_t milliseconds since the UNIX epoch
0375     DATE64 = 17,
0376 
0377     /// Exact timestamp encoded with int64 since UNIX epoch
0378     /// Default unit millisecond
0379     TIMESTAMP = 18,
0380 
0381     /// Time as signed 32-bit integer, representing either seconds or
0382     /// milliseconds since midnight
0383     TIME32 = 19,
0384 
0385     /// Time as signed 64-bit integer, representing either microseconds or
0386     /// nanoseconds since midnight
0387     TIME64 = 20,
0388 
0389     /// YEAR_MONTH interval in SQL style
0390     INTERVAL_MONTHS = 21,
0391 
0392     /// DAY_TIME interval in SQL style
0393     INTERVAL_DAY_TIME = 22,
0394 
0395     /// Precision- and scale-based decimal type with 128 bits.
0396     DECIMAL128 = 23,
0397 
0398     /// Defined for backward-compatibility.
0399     DECIMAL = DECIMAL128,
0400 
0401     /// Precision- and scale-based decimal type with 256 bits.
0402     DECIMAL256 = 24,
0403 
0404     /// A list of some logical data type
0405     LIST = 25,
0406 
0407     /// Struct of logical types
0408     STRUCT = 26,
0409 
0410     /// Sparse unions of logical types
0411     SPARSE_UNION = 27,
0412 
0413     /// Dense unions of logical types
0414     DENSE_UNION = 28,
0415 
0416     /// Dictionary-encoded type, also called "categorical" or "factor"
0417     /// in other programming languages. Holds the dictionary value
0418     /// type but not the dictionary itself, which is part of the
0419     /// ArrayData struct
0420     DICTIONARY = 29,
0421 
0422     /// Map, a repeated struct logical type
0423     MAP = 30,
0424 
0425     /// Custom data type, implemented by user
0426     EXTENSION = 31,
0427 
0428     /// Fixed size list of some logical type
0429     FIXED_SIZE_LIST = 32,
0430 
0431     /// Measure of elapsed time in either seconds, milliseconds, microseconds
0432     /// or nanoseconds.
0433     DURATION = 33,
0434 
0435     /// Like STRING, but with 64-bit offsets
0436     LARGE_STRING = 34,
0437 
0438     /// Like BINARY, but with 64-bit offsets
0439     LARGE_BINARY = 35,
0440 
0441     /// Like LIST, but with 64-bit offsets
0442     LARGE_LIST = 36,
0443 
0444     /// Calendar interval type with three fields.
0445     INTERVAL_MONTH_DAY_NANO = 37,
0446 
0447     /// Run-end encoded data.
0448     RUN_END_ENCODED = 38,
0449 
0450     /// String (UTF8) view type with 4-byte prefix and inline small string
0451     /// optimization
0452     STRING_VIEW = 39,
0453 
0454     /// Bytes view type with 4-byte prefix and inline small string optimization
0455     BINARY_VIEW = 40,
0456 
0457     /// A list of some logical data type represented by offset and size.
0458     LIST_VIEW = 41,
0459 
0460     /// Like LIST_VIEW, but with 64-bit offsets and sizes
0461     LARGE_LIST_VIEW = 42,
0462 
0463     /// Precision- and scale-based decimal type with 32 bits.
0464     DECIMAL32 = 43,
0465 
0466     /// Precision- and scale-based decimal type with 64 bits.
0467     DECIMAL64 = 44,
0468 
0469     // Leave this at the end
0470     MAX_ID
0471   };
0472 };
0473 
0474 /// \brief Get a vector of all type ids
0475 ARROW_EXPORT std::vector<Type::type> AllTypeIds();
0476 
0477 /// \defgroup type-factories Factory functions for creating data types
0478 ///
0479 /// Factory functions for creating data types
0480 /// @{
0481 
0482 /// \brief Return a NullType instance
0483 ARROW_EXPORT const std::shared_ptr<DataType>& null();
0484 /// \brief Return a BooleanType instance
0485 ARROW_EXPORT const std::shared_ptr<DataType>& boolean();
0486 /// \brief Return a Int8Type instance
0487 ARROW_EXPORT const std::shared_ptr<DataType>& int8();
0488 /// \brief Return a Int16Type instance
0489 ARROW_EXPORT const std::shared_ptr<DataType>& int16();
0490 /// \brief Return a Int32Type instance
0491 ARROW_EXPORT const std::shared_ptr<DataType>& int32();
0492 /// \brief Return a Int64Type instance
0493 ARROW_EXPORT const std::shared_ptr<DataType>& int64();
0494 /// \brief Return a UInt8Type instance
0495 ARROW_EXPORT const std::shared_ptr<DataType>& uint8();
0496 /// \brief Return a UInt16Type instance
0497 ARROW_EXPORT const std::shared_ptr<DataType>& uint16();
0498 /// \brief Return a UInt32Type instance
0499 ARROW_EXPORT const std::shared_ptr<DataType>& uint32();
0500 /// \brief Return a UInt64Type instance
0501 ARROW_EXPORT const std::shared_ptr<DataType>& uint64();
0502 /// \brief Return a HalfFloatType instance
0503 ARROW_EXPORT const std::shared_ptr<DataType>& float16();
0504 /// \brief Return a FloatType instance
0505 ARROW_EXPORT const std::shared_ptr<DataType>& float32();
0506 /// \brief Return a DoubleType instance
0507 ARROW_EXPORT const std::shared_ptr<DataType>& float64();
0508 /// \brief Return a StringType instance
0509 ARROW_EXPORT const std::shared_ptr<DataType>& utf8();
0510 /// \brief Return a StringViewType instance
0511 ARROW_EXPORT const std::shared_ptr<DataType>& utf8_view();
0512 /// \brief Return a LargeStringType instance
0513 ARROW_EXPORT const std::shared_ptr<DataType>& large_utf8();
0514 /// \brief Return a BinaryType instance
0515 ARROW_EXPORT const std::shared_ptr<DataType>& binary();
0516 /// \brief Return a BinaryViewType instance
0517 ARROW_EXPORT const std::shared_ptr<DataType>& binary_view();
0518 /// \brief Return a LargeBinaryType instance
0519 ARROW_EXPORT const std::shared_ptr<DataType>& large_binary();
0520 /// \brief Return a Date32Type instance
0521 ARROW_EXPORT const std::shared_ptr<DataType>& date32();
0522 /// \brief Return a Date64Type instance
0523 ARROW_EXPORT const std::shared_ptr<DataType>& date64();
0524 
0525 /// \brief Create a FixedSizeBinaryType instance.
0526 ARROW_EXPORT
0527 std::shared_ptr<DataType> fixed_size_binary(int32_t byte_width);
0528 
0529 /// \brief Create a DecimalType instance depending on the precision
0530 ///
0531 /// If the precision is greater than 38, a Decimal256Type is returned,
0532 /// otherwise a Decimal128Type.
0533 ///
0534 /// Deprecated: prefer `smallest_decimal` instead.
0535 ARROW_DEPRECATED("Deprecated in 18.0. Use `smallest_decimal` instead")
0536 ARROW_EXPORT
0537 std::shared_ptr<DataType> decimal(int32_t precision, int32_t scale);
0538 
0539 /// \brief Create a the smallest DecimalType instance depending on precision
0540 ///
0541 /// Given the requested precision and scale, the smallest DecimalType which
0542 /// is able to represent that precision will be returned. As different
0543 /// bit-widths for decimal types are added, the concrete data type returned
0544 /// here can potentially change accordingly.
0545 ARROW_EXPORT
0546 std::shared_ptr<DataType> smallest_decimal(int32_t precision, int32_t scale);
0547 
0548 /// \brief Create a Decimal32Type instance
0549 ARROW_EXPORT
0550 std::shared_ptr<DataType> decimal32(int32_t precision, int32_t scale);
0551 
0552 /// \brief Create a Decimal64Type instance
0553 ARROW_EXPORT
0554 std::shared_ptr<DataType> decimal64(int32_t precision, int32_t scale);
0555 
0556 /// \brief Create a Decimal128Type instance
0557 ARROW_EXPORT
0558 std::shared_ptr<DataType> decimal128(int32_t precision, int32_t scale);
0559 
0560 /// \brief Create a Decimal256Type instance
0561 ARROW_EXPORT
0562 std::shared_ptr<DataType> decimal256(int32_t precision, int32_t scale);
0563 
0564 /// \brief Create a ListType instance from its child Field type
0565 ARROW_EXPORT
0566 std::shared_ptr<DataType> list(std::shared_ptr<Field> value_type);
0567 
0568 /// \brief Create a ListType instance from its child DataType
0569 ARROW_EXPORT
0570 std::shared_ptr<DataType> list(std::shared_ptr<DataType> value_type);
0571 
0572 /// \brief Create a LargeListType instance from its child Field type
0573 ARROW_EXPORT
0574 std::shared_ptr<DataType> large_list(std::shared_ptr<Field> value_type);
0575 
0576 /// \brief Create a LargeListType instance from its child DataType
0577 ARROW_EXPORT
0578 std::shared_ptr<DataType> large_list(std::shared_ptr<DataType> value_type);
0579 
0580 /// \brief Create a ListViewType instance
0581 ARROW_EXPORT std::shared_ptr<DataType> list_view(std::shared_ptr<DataType> value_type);
0582 
0583 /// \brief Create a ListViewType instance from its child Field type
0584 ARROW_EXPORT std::shared_ptr<DataType> list_view(std::shared_ptr<Field> value_type);
0585 
0586 /// \brief Create a LargetListViewType instance
0587 ARROW_EXPORT std::shared_ptr<DataType> large_list_view(
0588     std::shared_ptr<DataType> value_type);
0589 
0590 /// \brief Create a LargetListViewType instance from its child Field type
0591 ARROW_EXPORT std::shared_ptr<DataType> large_list_view(std::shared_ptr<Field> value_type);
0592 
0593 /// \brief Create a MapType instance from its key and value DataTypes
0594 ARROW_EXPORT
0595 std::shared_ptr<DataType> map(std::shared_ptr<DataType> key_type,
0596                               std::shared_ptr<DataType> item_type,
0597                               bool keys_sorted = false);
0598 
0599 /// \brief Create a MapType instance from its key DataType and value field.
0600 ///
0601 /// The field override is provided to communicate nullability of the value.
0602 ARROW_EXPORT
0603 std::shared_ptr<DataType> map(std::shared_ptr<DataType> key_type,
0604                               std::shared_ptr<Field> item_field,
0605                               bool keys_sorted = false);
0606 
0607 /// \brief Create a FixedSizeListType instance from its child Field type
0608 ARROW_EXPORT
0609 std::shared_ptr<DataType> fixed_size_list(std::shared_ptr<Field> value_type,
0610                                           int32_t list_size);
0611 
0612 /// \brief Create a FixedSizeListType instance from its child DataType
0613 ARROW_EXPORT
0614 std::shared_ptr<DataType> fixed_size_list(std::shared_ptr<DataType> value_type,
0615                                           int32_t list_size);
0616 /// \brief Return a Duration instance (naming use _type to avoid namespace conflict with
0617 /// built in time classes).
0618 ARROW_EXPORT std::shared_ptr<DataType> duration(TimeUnit::type unit);
0619 
0620 /// \brief Return a DayTimeIntervalType instance
0621 ARROW_EXPORT std::shared_ptr<DataType> day_time_interval();
0622 
0623 /// \brief Return a MonthIntervalType instance
0624 ARROW_EXPORT std::shared_ptr<DataType> month_interval();
0625 
0626 /// \brief Return a MonthDayNanoIntervalType instance
0627 ARROW_EXPORT std::shared_ptr<DataType> month_day_nano_interval();
0628 
0629 /// \brief Create a TimestampType instance from its unit
0630 ARROW_EXPORT
0631 std::shared_ptr<DataType> timestamp(TimeUnit::type unit);
0632 
0633 /// \brief Create a TimestampType instance from its unit and timezone
0634 ARROW_EXPORT
0635 std::shared_ptr<DataType> timestamp(TimeUnit::type unit, const std::string& timezone);
0636 
0637 /// \brief Create a 32-bit time type instance
0638 ///
0639 /// Unit can be either SECOND or MILLI
0640 ARROW_EXPORT std::shared_ptr<DataType> time32(TimeUnit::type unit);
0641 
0642 /// \brief Create a 64-bit time type instance
0643 ///
0644 /// Unit can be either MICRO or NANO
0645 ARROW_EXPORT std::shared_ptr<DataType> time64(TimeUnit::type unit);
0646 
0647 /// \brief Create a StructType instance
0648 ARROW_EXPORT std::shared_ptr<DataType> struct_(const FieldVector& fields);
0649 
0650 /// \brief Create a StructType instance from (name, type) pairs
0651 ARROW_EXPORT std::shared_ptr<DataType> struct_(
0652     std::initializer_list<std::pair<std::string, std::shared_ptr<DataType>>> fields);
0653 
0654 /// \brief Create a RunEndEncodedType instance
0655 ARROW_EXPORT std::shared_ptr<DataType> run_end_encoded(
0656     std::shared_ptr<DataType> run_end_type, std::shared_ptr<DataType> value_type);
0657 
0658 /// \brief Create a SparseUnionType instance
0659 ARROW_EXPORT std::shared_ptr<DataType> sparse_union(FieldVector child_fields,
0660                                                     std::vector<int8_t> type_codes = {});
0661 /// \brief Create a SparseUnionType instance
0662 ARROW_EXPORT std::shared_ptr<DataType> sparse_union(
0663     const ArrayVector& children, std::vector<std::string> field_names = {},
0664     std::vector<int8_t> type_codes = {});
0665 
0666 /// \brief Create a DenseUnionType instance
0667 ARROW_EXPORT std::shared_ptr<DataType> dense_union(FieldVector child_fields,
0668                                                    std::vector<int8_t> type_codes = {});
0669 /// \brief Create a DenseUnionType instance
0670 ARROW_EXPORT std::shared_ptr<DataType> dense_union(
0671     const ArrayVector& children, std::vector<std::string> field_names = {},
0672     std::vector<int8_t> type_codes = {});
0673 
0674 /// \brief Create a DictionaryType instance
0675 /// \param[in] index_type the type of the dictionary indices (must be
0676 /// a signed integer)
0677 /// \param[in] dict_type the type of the values in the variable dictionary
0678 /// \param[in] ordered true if the order of the dictionary values has
0679 /// semantic meaning and should be preserved where possible
0680 ARROW_EXPORT
0681 std::shared_ptr<DataType> dictionary(const std::shared_ptr<DataType>& index_type,
0682                                      const std::shared_ptr<DataType>& dict_type,
0683                                      bool ordered = false);
0684 
0685 /// @}
0686 
0687 /// \defgroup schema-factories Factory functions for fields and schemas
0688 ///
0689 /// Factory functions for fields and schemas
0690 /// @{
0691 
0692 /// \brief Create a Field instance
0693 ///
0694 /// \param name the field name
0695 /// \param type the field value type
0696 /// \param nullable whether the values are nullable, default true
0697 /// \param metadata any custom key-value metadata, default null
0698 ARROW_EXPORT std::shared_ptr<Field> field(
0699     std::string name, std::shared_ptr<DataType> type, bool nullable = true,
0700     std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
0701 
0702 /// \brief Create a Field instance with metadata
0703 ///
0704 /// The field will be assumed to be nullable.
0705 ///
0706 /// \param name the field name
0707 /// \param type the field value type
0708 /// \param metadata any custom key-value metadata
0709 ARROW_EXPORT std::shared_ptr<Field> field(
0710     std::string name, std::shared_ptr<DataType> type,
0711     std::shared_ptr<const KeyValueMetadata> metadata);
0712 
0713 /// \brief Create a Schema instance
0714 ///
0715 /// \param fields the schema's fields
0716 /// \param metadata any custom key-value metadata, default null
0717 /// \return schema shared_ptr to Schema
0718 ARROW_EXPORT
0719 std::shared_ptr<Schema> schema(
0720     FieldVector fields, std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
0721 
0722 /// \brief Create a Schema instance from (name, type) pairs
0723 ///
0724 /// The schema's fields will all be nullable with no associated metadata.
0725 ///
0726 /// \param fields (name, type) pairs of the schema's fields
0727 /// \param metadata any custom key-value metadata, default null
0728 /// \return schema shared_ptr to Schema
0729 ARROW_EXPORT
0730 std::shared_ptr<Schema> schema(
0731     std::initializer_list<std::pair<std::string, std::shared_ptr<DataType>>> fields,
0732     std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
0733 
0734 /// \brief Create a Schema instance
0735 ///
0736 /// \param fields the schema's fields
0737 /// \param endianness the endianness of the data
0738 /// \param metadata any custom key-value metadata, default null
0739 /// \return schema shared_ptr to Schema
0740 ARROW_EXPORT
0741 std::shared_ptr<Schema> schema(
0742     FieldVector fields, Endianness endianness,
0743     std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
0744 
0745 /// \brief Create a Schema instance
0746 ///
0747 /// The schema's fields will all be nullable with no associated metadata.
0748 ///
0749 /// \param fields (name, type) pairs of the schema's fields
0750 /// \param endianness the endianness of the data
0751 /// \param metadata any custom key-value metadata, default null
0752 /// \return schema shared_ptr to Schema
0753 ARROW_EXPORT
0754 std::shared_ptr<Schema> schema(
0755     std::initializer_list<std::pair<std::string, std::shared_ptr<DataType>>> fields,
0756     Endianness endianness, std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
0757 
0758 /// @}
0759 
0760 /// Return the process-wide default memory pool.
0761 ARROW_EXPORT MemoryPool* default_memory_pool();
0762 
0763 constexpr int64_t kDefaultBufferAlignment = 64;
0764 
0765 /// \brief EXPERIMENTAL: Device type enum which matches up with C Data Device types
0766 enum class DeviceAllocationType : char {
0767   kCPU = 1,
0768   kCUDA = 2,
0769   kCUDA_HOST = 3,
0770   kOPENCL = 4,
0771   kVULKAN = 7,
0772   kMETAL = 8,
0773   kVPI = 9,
0774   kROCM = 10,
0775   kROCM_HOST = 11,
0776   kEXT_DEV = 12,
0777   kCUDA_MANAGED = 13,
0778   kONEAPI = 14,
0779   kWEBGPU = 15,
0780   kHEXAGON = 16,
0781 };
0782 constexpr int kDeviceAllocationTypeMax = 16;
0783 
0784 class DeviceAllocationTypeSet;
0785 
0786 }  // namespace arrow