remove_field Action

Implement the remove_field DoAction to support removing fields from STRUCT columns in your Arrow Flight server tables.

The remove_field action removes a field from a nested STRUCT column within a table. This action is invoked when executing an ALTER TABLE ... DROP COLUMN SQL statement that targets a field within a struct.

SQL Example

-- Remove a field from a nested struct column
ALTER TABLE example.main.employees DROP COLUMN address.apartment;
ALTER TABLE example.main.employees DROP COLUMN IF EXISTS metadata.legacy_id CASCADE;

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 AirportAlterTableRemoveFieldParameters : AirportAlterBase
{
  std::vector<std::string> column_path;
  bool if_column_exists;
  bool cascade;

  MSGPACK_DEFINE_MAP(catalog, schema, name, ignore_not_found, column_path, if_column_exists, cascade);
};

Return Value

The action must return a single FlightInfo structure representing the modified table with the field removed from the struct column. The app_metadata field must be populated appropriately to identify the flight as a table.