-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver_action_rename_column.qmd
More file actions
44 lines (33 loc) · 1.33 KB
/
server_action_rename_column.qmd
File metadata and controls
44 lines (33 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
title: "`rename_column` Action"
description: "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
```sql
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:
```c++
// 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`](https://github.com/apache/arrow/blob/ac1f05f28e18e85ee55cf7aaf3c8ae1ffe0e92d7/format/Flight.proto#L275) structure representing the modified table with the column renamed. The `app_metadata` field must be populated appropriately to identify the flight as a table.