19#if defined(__cpp_lib_format)
52 template <
class F,
class N,
class M>
53 requires std::constructible_from<arrow_schema_private_data::FormatType, F>
54 && std::constructible_from<arrow_schema_private_data::NameType, N>
55 && std::constructible_from<arrow_schema_private_data::MetadataType, M>
60 std::optional<ArrowFlag> flags,
62 ArrowSchema** children,
63 ArrowSchema* dictionary
77 template <
class F,
class N,
class M>
78 requires std::constructible_from<arrow_schema_private_data::FormatType, F>
79 && std::constructible_from<arrow_schema_private_data::NameType, N>
80 && std::constructible_from<arrow_schema_private_data::MetadataType, M>
86 std::optional<ArrowFlag> flags,
97 for (int64_t i = 0; i < n_children; ++i)
103 schema.
flags = flags.has_value() ?
static_cast<int64_t
>(flags.value()) : 0;
110 static_cast<std::size_t
>(n_children)
114 schema.
format = private_data->format_ptr();
115 schema.
name = private_data->name_ptr();
116 schema.
metadata = private_data->metadata_ptr();
122 template <
class F,
class N,
class M>
123 requires std::constructible_from<arrow_schema_private_data::FormatType, F>
124 && std::constructible_from<arrow_schema_private_data::NameType, N>
125 && std::constructible_from<arrow_schema_private_data::MetadataType, M>
130 std::optional<ArrowFlag> flags,
141 for (int64_t i = 0; i < n_children; ++i)
148 fill_arrow_schema(schema, format, name, metadata, flags, n_children, children, dictionary);
154 return make_arrow_schema(std::string_view(
"n"),
"",
"", std::nullopt, 0,
nullptr,
nullptr);
188 swap(source, target);
202#if defined(__cpp_lib_format)
207 constexpr auto parse(std::format_parse_context& ctx)
212 auto format(
const ArrowSchema& obj, std::format_context& ctx)
const
214 std::string children_str = std::format(
"{}",
static_cast<void*
>(obj.
children));
217 children_str += std::format(
"\n-{}",
static_cast<void*
>(obj.
children[i]));
220 const std::string format = obj.
format ? obj.
format :
"nullptr";
221 const std::string name = obj.
name ? obj.
name :
"nullptr";
224 return std::format_to(
226 "ArrowSchema - ptr address: {}\n- format: {}\n- name: {}\n- metadata: {}\n- flags: {}\n- n_children: {}\n- children: {}\n- dictionary: {}\n- release: {}\n- private_data: {}\n",
227 static_cast<const void*
>(&obj),
235 static_cast<const void*
>(std::addressof(obj.
release)),
243 os << std::format(
"{}", value);
Private data for ArrowSchema.
#define SPARROW_ASSERT_TRUE(expr__)
#define SPARROW_ASSERT_FALSE(expr__)
ArrowSchema make_arrow_schema(F format, N name, M metadata, std::optional< ArrowFlag > flags, int64_t n_children, ArrowSchema **children, ArrowSchema *dictionary)
Creates an ArrowSchema owned by a unique_ptr and holding the provided data.
SPARROW_API void copy_schema(const ArrowSchema &source, ArrowSchema &target)
Fills the target ArrowSchema with a deep copy of the data from the source ArrowSchema.
SPARROW_API void release_arrow_schema(ArrowSchema *schema)
Release function to use for the ArrowSchema.release member.
SPARROW_API void swap(ArrowArray &lhs, ArrowArray &rhs)
Swaps the contents of the two ArrowArray objects.
SPARROW_API void empty_release_arrow_schema(ArrowSchema *schema)
Empty release function to use for the ArrowSchema.release member.
ArrowSchema move_schema(ArrowSchema &&source)
Moves the content of source into a stack-allocated array, and reset the source to an empty ArrowSchem...
std::ostream & operator<<(std::ostream &stream, T n)
void fill_arrow_schema(ArrowSchema &schema, F format, N name, M metadata, std::optional< ArrowFlag > flags, int64_t n_children, ArrowSchema **children, ArrowSchema *dictionary)
ArrowSchema make_empty_arrow_schema()
struct ArrowSchema * dictionary
void(* release)(struct ArrowSchema *)
struct ArrowSchema ** children