45 void add_metadata(
const std::string& key,
const std::string& value);
58 void add_field(
const std::string& name, std::shared_ptr<arrow::DataType> type);
71 void open_file(
const std::string& filename);
83 void set_value(
const std::string& column_name, int64_t value);
95 void set_value(
const std::string& column_name, int32_t value);
107 void set_value(
const std::string& column_name, int16_t value);
119 void set_value(
const std::string& column_name, int8_t value);
131 void set_value(
const std::string& column_name,
double value);
143 void set_value(
const std::string& column_name,
const std::string& value);
155 void set_value(
const std::string& column_name,
bool value);
184 using half_float_t = arrow::NumericBuilder<arrow::HalfFloatType>::value_type;
187 std::vector<std::shared_ptr<arrow::Field>> fields_;
189 std::shared_ptr<arrow::Schema> schema_;
191 std::shared_ptr<arrow::io::OutputStream> outfile_;
193 std::shared_ptr<arrow::ipc::RecordBatchWriter> writer_;
195 std::unordered_map<std::string, size_t> column_indices_;
197 std::unordered_map<std::string, std::variant<int64_t, int32_t, int16_t, int8_t, double, std::string, bool, half_float_t>> row_values_;
199 bool file_opened_ =
false;
201 std::unordered_map<std::string, std::string> user_metadata_;
212 void check_column(
const std::string& column_name);
222 static half_float_t float_to_half_bits(
float f);
void set_value_float16(const std::string &column_name, float value)
Sets the value for a specified column in the current row.
Definition data_logger.cpp:186
void open_file(const std::string &filename)
Opens the output file for writing.
Definition data_logger.cpp:112
void add_metadata(const std::string &key, const std::string &value)
Adds arbitrary string metadata to be embedded in the Feather file.
Definition data_logger.cpp:86
void set_value(const std::string &column_name, int64_t value)
Sets the value for a specified column in the current row.
Definition data_logger.cpp:157
void add_field(const std::string &name, std::shared_ptr< arrow::DataType > type)
Adds a new field to the schema.
Definition data_logger.cpp:100