rename_column Action

Implement the rename_column DoAction to support ALTER TABLE RENAME COLUMN statements for renaming table columns.

The rename_column action renames an existing column in a table. This action is invoked when executing an ALTER TABLE ... RENAME COLUMN SQL statement.

SQL Example

ALTER TABLE example.main.employees RENAME COLUMN emp_id TO employee_id;
ALTER TABLE example.main.employees RENAME COLUMN dept TO department;

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 AirportAlterTableRenameColumnParameters : AirportAlterBase
{
  std::string old_name;
  std::string new_name;

  MSGPACK_DEFINE_MAP(catalog, schema, name, ignore_not_found, new_name, old_name);
};

Return Value

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