80 void add_metadata(
const std::string& key,
const std::string& value);
95 void add_field(
const std::string& name, std::shared_ptr<arrow::DataType> type,
bool ignore_existing_name =
false);
109 void open_file(
const std::string& filename);
121 void set_value(
const std::string& column_name, int64_t value);
133 void set_value(
const std::string& column_name, int32_t value);
145 void set_value(
const std::string& column_name, int16_t value);
157 void set_value(
const std::string& column_name, int8_t value);
169 void set_value(
const std::string& column_name,
double value);
181 void set_value(
const std::string& column_name,
float value);
193 void set_value(
const std::string& column_name,
const std::string& value);
205 void set_value(
const std::string& column_name,
bool value);
242 using half_float_t = arrow::NumericBuilder<arrow::HalfFloatType>::value_type;
245 std::vector<std::shared_ptr<arrow::Field>> fields_;
247 std::shared_ptr<arrow::Schema> schema_;
249 std::shared_ptr<arrow::io::OutputStream> outfile_;
251 std::shared_ptr<arrow::ipc::RecordBatchWriter> writer_;
253 std::vector<std::shared_ptr<arrow::ArrayBuilder>> builders_;
255 std::unordered_map<std::string, size_t> column_indices_;
257 std::unordered_map<std::string, std::variant<int64_t, int32_t, int16_t, int8_t, float, double, std::string, bool, half_float_t>> row_values_;
259 bool file_opened_ =
false;
261 std::unordered_map<std::string, std::string> user_metadata_;
263 int64_t flush_row_count_ = 1024;
265 int64_t buffered_row_count_ = 0;
276 void check_column(
const std::string& column_name);
292 void initialize_builders();
301 void append_current_row_to_builders();
304 static half_float_t float_to_half_bits(
float f);
bool column_value_already_set(const std::string &column_name)
Checks if the specified column value has been set for the current row.
Definition data_logger.cpp:293
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:215
bool column_exists(const std::string &column_name)
Checks if the specified column exists.
Definition data_logger.cpp:289
void open_file(const std::string &filename)
Opens the output file for writing.
Definition data_logger.cpp:126
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:98
void add_field(const std::string &name, std::shared_ptr< arrow::DataType > type, bool ignore_existing_name=false)
Adds a new field to the schema.
Definition data_logger.cpp:112
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:175