File indexing completed on 2025-08-27 08:47:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
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 }
0043 template <typename T = internal::Empty>
0044 class Future;
0045
0046 namespace util {
0047 class Codec;
0048 class CodecOptions;
0049 }
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
0266 enum type { SECOND = 0, MILLI = 1, MICRO = 2, NANO = 3 };
0267
0268
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
0319
0320
0321
0322 enum type {
0323
0324 NA = 0,
0325
0326
0327 BOOL = 1,
0328
0329
0330 UINT8 = 2,
0331
0332
0333 INT8 = 3,
0334
0335
0336 UINT16 = 4,
0337
0338
0339 INT16 = 5,
0340
0341
0342 UINT32 = 6,
0343
0344
0345 INT32 = 7,
0346
0347
0348 UINT64 = 8,
0349
0350
0351 INT64 = 9,
0352
0353
0354 HALF_FLOAT = 10,
0355
0356
0357 FLOAT = 11,
0358
0359
0360 DOUBLE = 12,
0361
0362
0363 STRING = 13,
0364
0365
0366 BINARY = 14,
0367
0368
0369 FIXED_SIZE_BINARY = 15,
0370
0371
0372 DATE32 = 16,
0373
0374
0375 DATE64 = 17,
0376
0377
0378
0379 TIMESTAMP = 18,
0380
0381
0382
0383 TIME32 = 19,
0384
0385
0386
0387 TIME64 = 20,
0388
0389
0390 INTERVAL_MONTHS = 21,
0391
0392
0393 INTERVAL_DAY_TIME = 22,
0394
0395
0396 DECIMAL128 = 23,
0397
0398
0399 DECIMAL = DECIMAL128,
0400
0401
0402 DECIMAL256 = 24,
0403
0404
0405 LIST = 25,
0406
0407
0408 STRUCT = 26,
0409
0410
0411 SPARSE_UNION = 27,
0412
0413
0414 DENSE_UNION = 28,
0415
0416
0417
0418
0419
0420 DICTIONARY = 29,
0421
0422
0423 MAP = 30,
0424
0425
0426 EXTENSION = 31,
0427
0428
0429 FIXED_SIZE_LIST = 32,
0430
0431
0432
0433 DURATION = 33,
0434
0435
0436 LARGE_STRING = 34,
0437
0438
0439 LARGE_BINARY = 35,
0440
0441
0442 LARGE_LIST = 36,
0443
0444
0445 INTERVAL_MONTH_DAY_NANO = 37,
0446
0447
0448 RUN_END_ENCODED = 38,
0449
0450
0451
0452 STRING_VIEW = 39,
0453
0454
0455 BINARY_VIEW = 40,
0456
0457
0458 LIST_VIEW = 41,
0459
0460
0461 LARGE_LIST_VIEW = 42,
0462
0463
0464 DECIMAL32 = 43,
0465
0466
0467 DECIMAL64 = 44,
0468
0469
0470 MAX_ID
0471 };
0472 };
0473
0474
0475 ARROW_EXPORT std::vector<Type::type> AllTypeIds();
0476
0477
0478
0479
0480
0481
0482
0483 ARROW_EXPORT const std::shared_ptr<DataType>& null();
0484
0485 ARROW_EXPORT const std::shared_ptr<DataType>& boolean();
0486
0487 ARROW_EXPORT const std::shared_ptr<DataType>& int8();
0488
0489 ARROW_EXPORT const std::shared_ptr<DataType>& int16();
0490
0491 ARROW_EXPORT const std::shared_ptr<DataType>& int32();
0492
0493 ARROW_EXPORT const std::shared_ptr<DataType>& int64();
0494
0495 ARROW_EXPORT const std::shared_ptr<DataType>& uint8();
0496
0497 ARROW_EXPORT const std::shared_ptr<DataType>& uint16();
0498
0499 ARROW_EXPORT const std::shared_ptr<DataType>& uint32();
0500
0501 ARROW_EXPORT const std::shared_ptr<DataType>& uint64();
0502
0503 ARROW_EXPORT const std::shared_ptr<DataType>& float16();
0504
0505 ARROW_EXPORT const std::shared_ptr<DataType>& float32();
0506
0507 ARROW_EXPORT const std::shared_ptr<DataType>& float64();
0508
0509 ARROW_EXPORT const std::shared_ptr<DataType>& utf8();
0510
0511 ARROW_EXPORT const std::shared_ptr<DataType>& utf8_view();
0512
0513 ARROW_EXPORT const std::shared_ptr<DataType>& large_utf8();
0514
0515 ARROW_EXPORT const std::shared_ptr<DataType>& binary();
0516
0517 ARROW_EXPORT const std::shared_ptr<DataType>& binary_view();
0518
0519 ARROW_EXPORT const std::shared_ptr<DataType>& large_binary();
0520
0521 ARROW_EXPORT const std::shared_ptr<DataType>& date32();
0522
0523 ARROW_EXPORT const std::shared_ptr<DataType>& date64();
0524
0525
0526 ARROW_EXPORT
0527 std::shared_ptr<DataType> fixed_size_binary(int32_t byte_width);
0528
0529
0530
0531
0532
0533
0534
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
0540
0541
0542
0543
0544
0545 ARROW_EXPORT
0546 std::shared_ptr<DataType> smallest_decimal(int32_t precision, int32_t scale);
0547
0548
0549 ARROW_EXPORT
0550 std::shared_ptr<DataType> decimal32(int32_t precision, int32_t scale);
0551
0552
0553 ARROW_EXPORT
0554 std::shared_ptr<DataType> decimal64(int32_t precision, int32_t scale);
0555
0556
0557 ARROW_EXPORT
0558 std::shared_ptr<DataType> decimal128(int32_t precision, int32_t scale);
0559
0560
0561 ARROW_EXPORT
0562 std::shared_ptr<DataType> decimal256(int32_t precision, int32_t scale);
0563
0564
0565 ARROW_EXPORT
0566 std::shared_ptr<DataType> list(std::shared_ptr<Field> value_type);
0567
0568
0569 ARROW_EXPORT
0570 std::shared_ptr<DataType> list(std::shared_ptr<DataType> value_type);
0571
0572
0573 ARROW_EXPORT
0574 std::shared_ptr<DataType> large_list(std::shared_ptr<Field> value_type);
0575
0576
0577 ARROW_EXPORT
0578 std::shared_ptr<DataType> large_list(std::shared_ptr<DataType> value_type);
0579
0580
0581 ARROW_EXPORT std::shared_ptr<DataType> list_view(std::shared_ptr<DataType> value_type);
0582
0583
0584 ARROW_EXPORT std::shared_ptr<DataType> list_view(std::shared_ptr<Field> value_type);
0585
0586
0587 ARROW_EXPORT std::shared_ptr<DataType> large_list_view(
0588 std::shared_ptr<DataType> value_type);
0589
0590
0591 ARROW_EXPORT std::shared_ptr<DataType> large_list_view(std::shared_ptr<Field> value_type);
0592
0593
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
0600
0601
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
0608 ARROW_EXPORT
0609 std::shared_ptr<DataType> fixed_size_list(std::shared_ptr<Field> value_type,
0610 int32_t list_size);
0611
0612
0613 ARROW_EXPORT
0614 std::shared_ptr<DataType> fixed_size_list(std::shared_ptr<DataType> value_type,
0615 int32_t list_size);
0616
0617
0618 ARROW_EXPORT std::shared_ptr<DataType> duration(TimeUnit::type unit);
0619
0620
0621 ARROW_EXPORT std::shared_ptr<DataType> day_time_interval();
0622
0623
0624 ARROW_EXPORT std::shared_ptr<DataType> month_interval();
0625
0626
0627 ARROW_EXPORT std::shared_ptr<DataType> month_day_nano_interval();
0628
0629
0630 ARROW_EXPORT
0631 std::shared_ptr<DataType> timestamp(TimeUnit::type unit);
0632
0633
0634 ARROW_EXPORT
0635 std::shared_ptr<DataType> timestamp(TimeUnit::type unit, const std::string& timezone);
0636
0637
0638
0639
0640 ARROW_EXPORT std::shared_ptr<DataType> time32(TimeUnit::type unit);
0641
0642
0643
0644
0645 ARROW_EXPORT std::shared_ptr<DataType> time64(TimeUnit::type unit);
0646
0647
0648 ARROW_EXPORT std::shared_ptr<DataType> struct_(const FieldVector& fields);
0649
0650
0651 ARROW_EXPORT std::shared_ptr<DataType> struct_(
0652 std::initializer_list<std::pair<std::string, std::shared_ptr<DataType>>> fields);
0653
0654
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
0659 ARROW_EXPORT std::shared_ptr<DataType> sparse_union(FieldVector child_fields,
0660 std::vector<int8_t> type_codes = {});
0661
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
0667 ARROW_EXPORT std::shared_ptr<DataType> dense_union(FieldVector child_fields,
0668 std::vector<int8_t> type_codes = {});
0669
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
0675
0676
0677
0678
0679
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
0688
0689
0690
0691
0692
0693
0694
0695
0696
0697
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
0703
0704
0705
0706
0707
0708
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
0714
0715
0716
0717
0718 ARROW_EXPORT
0719 std::shared_ptr<Schema> schema(
0720 FieldVector fields, std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
0721
0722
0723
0724
0725
0726
0727
0728
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
0735
0736
0737
0738
0739
0740 ARROW_EXPORT
0741 std::shared_ptr<Schema> schema(
0742 FieldVector fields, Endianness endianness,
0743 std::shared_ptr<const KeyValueMetadata> metadata = NULLPTR);
0744
0745
0746
0747
0748
0749
0750
0751
0752
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
0761 ARROW_EXPORT MemoryPool* default_memory_pool();
0762
0763 constexpr int64_t kDefaultBufferAlignment = 64;
0764
0765
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 }