15#pragma GCC diagnostic push
16#pragma GCC diagnostic ignored "-Wshadow"
18#include <arrow/builder.h>
19#include <arrow/memory_pool.h>
20#include <arrow/record_batch.h>
21#include <arrow/status.h>
22#include <arrow/table.h>
23#include <arrow/type_traits.h>
24#include <arrow/util/key_value_metadata.h>
26#pragma GCC diagnostic pop
35template <
typename TYPE,
typename C_TYPE>
36void ArrayFromVector(
const std::vector<C_TYPE>&
values, std::shared_ptr<arrow::Array>* out)
38 typename arrow::TypeTraits<TYPE>::BuilderType builder;
39 for (
size_t i = 0;
i <
values.size(); ++
i) {
40 auto status = builder.Append(
values[
i]);
43 auto status = builder.Finish(out);
54 std::make_shared<arrow::KeyValueMetadata>(
55 std::vector{std::string{
"label"}},
56 std::vector{std::string{
label}}));
59std::shared_ptr<arrow::Table>
62 bool status = mFinalizer(mArrays, mHolders);
66 assert(mSchema->num_fields() > 0 &&
"Schema needs to be non-empty");
67 return arrow::Table::Make(mSchema, mArrays);
75void TableBuilder::validate()
const
77 if (mHolders !=
nullptr) {
78 throwError(
runtime_error(
"TableBuilder::persist can only be invoked once per instance"));
89template class arrow::NumericBuilder<arrow::UInt8Type>;
90template class arrow::NumericBuilder<arrow::UInt32Type>;
91template class arrow::NumericBuilder<arrow::FloatType>;
92template class arrow::NumericBuilder<arrow::Int32Type>;
93template class arrow::NumericBuilder<arrow::Int8Type>;
std::shared_ptr< arrow::Schema > schema
void setLabel(const char *label)
std::shared_ptr< arrow::Table > finalize()
GLenum GLsizei GLsizei GLint * values
GLuint GLsizei const GLchar * label
Defining PrimaryVertex explicitly as messageable.
void addLabelToSchema(std::shared_ptr< arrow::Schema > &schema, const char *label)
RuntimeErrorRef runtime_error(const char *)