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 <memory>
0021 #include <string>
0022
0023 #include "arrow/status.h"
0024 #include "arrow/util/macros.h"
0025 #include "arrow/util/visibility.h"
0026
0027 namespace arrow {
0028
0029 class Array;
0030 class DataType;
0031 class Field;
0032 class MemoryPool;
0033
0034 namespace json {
0035
0036
0037
0038
0039
0040 class ARROW_EXPORT Converter {
0041 public:
0042 virtual ~Converter() = default;
0043
0044
0045
0046
0047 virtual Status Convert(const std::shared_ptr<Array>& in,
0048 std::shared_ptr<Array>* out) = 0;
0049
0050 std::shared_ptr<DataType> out_type() const { return out_type_; }
0051
0052 MemoryPool* pool() { return pool_; }
0053
0054 protected:
0055 ARROW_DISALLOW_COPY_AND_ASSIGN(Converter);
0056
0057 Converter(MemoryPool* pool, const std::shared_ptr<DataType>& out_type)
0058 : pool_(pool), out_type_(out_type) {}
0059
0060 MemoryPool* pool_;
0061 std::shared_ptr<DataType> out_type_;
0062 };
0063
0064
0065 ARROW_EXPORT Status MakeConverter(const std::shared_ptr<DataType>& out_type,
0066 MemoryPool* pool, std::shared_ptr<Converter>* out);
0067
0068 class ARROW_EXPORT PromotionGraph {
0069 public:
0070 virtual ~PromotionGraph() = default;
0071
0072
0073 virtual std::shared_ptr<Field> Null(const std::string& name) const = 0;
0074
0075
0076
0077 virtual std::shared_ptr<DataType> Infer(
0078 const std::shared_ptr<Field>& unexpected_field) const = 0;
0079
0080
0081
0082 virtual std::shared_ptr<DataType> Promote(
0083 const std::shared_ptr<DataType>& failed,
0084 const std::shared_ptr<Field>& unexpected_field) const = 0;
0085
0086 protected:
0087 ARROW_DISALLOW_COPY_AND_ASSIGN(PromotionGraph);
0088 PromotionGraph() = default;
0089 };
0090
0091 ARROW_EXPORT const PromotionGraph* GetPromotionGraph();
0092
0093 }
0094 }