table_function_flight_info Action

Implement the table_function_flight_info DoAction to retrieve schema and metadata for table-valued functions with dynamic return types.

The table_function_flight_info action retrieves the schema and metadata for a table-returning function. Since table functions can return different schemas based on their input parameters, this action is invoked with the actual parameter values to determine the appropriate output schema.

Input Parameters

The action receives a single msgpack-encoded parameter:

struct AirportTableFunctionFlightInfoParameters
{
  std::string catalog;
  std::string schema_name;
  std::string action_name;
  std::string parameters;
  std::string table_input_schema;

  // Specify the point in time information if not specified
  // these fields are empty strings.
  std::string at_unit;
  std::string at_value;


  MSGPACK_DEFINE_MAP(catalog, schema_name, action_name, parameters, table_input_schema, at_unit, at_value)
};

The parameters field contains a serialized Arrow Record Batch with the parameter values. The field names of the record batch are the same as defined by the input schema of the function.

Return Value

The action must return a single serialized Arrow FlightInfo structure representing the table function’s output for the given parameters. This custom action is used instead of the standard GetFlightInfo RPC because it supports additional context such as function parameters and time travel information.