add_field Action
Implement the add_field DoAction to support adding fields to STRUCT columns in your Arrow Flight server tables.
The add_field action adds a new field to a nested STRUCT column within a table. This action is invoked when executing an ALTER TABLE ... ADD COLUMN SQL statement that targets a field within a struct.
SQL Example
-- Add a field to a nested struct column
ALTER TABLE example.main.employees ADD COLUMN address.city VARCHAR;
ALTER TABLE example.main.employees ADD COLUMN IF NOT EXISTS metadata.created_by VARCHAR;Input Parameters
The action receives a single msgpack-serialized parameter:
// The base class for all alter parameters.
struct AirportAlterBase
{
//! Catalog name to alter
std::string catalog;
//! Schema name to alter
std::string schema;
//! Entry name to alter
std::string name;
bool ignore_not_found;
};
struct AirportAlterTableAddFieldParameters : AirportAlterBase
{
// Contains the path to the field and the Arrow type for the new field.
std::string column_schema;
bool if_field_not_exists;
MSGPACK_DEFINE_MAP(catalog, schema, name, ignore_not_found, if_field_not_exists, column_schema);
};Return Value
The action must return a single FlightInfo structure representing the modified table with the new field added to the struct column. The app_metadata field must be populated appropriately to identify the flight as a table.