ALTER EXTERNAL TABLE 示例
以下示例将 SPECTRUM.SALES 外部表的 numRows 表属性设置为 170000 行。
alter table spectrum.sales set table properties ('numRows'='170000');
以下示例更改 SPECTRUM.SALES 外部表的位置。
alter table spectrum.sales set location 's3://awssampledbuswest2/tickit/spectrum/sales/';
以下示例将 SPECTRUM.SALES 外部表的格式更改为 Parquet。
alter table spectrum.sales set file format parquet;
以下示例为表 SPECTRUM.SALES_PART 添加一个分区。
alter table spectrum.sales_part add if not exists partition(saledate='2008-01-01') location 's3://awssampledbuswest2/tickit/spectrum/sales_partition/saledate=2008-01/';
以下示例为表 SPECTRUM.SALES_PART 添加三个分区。
alter table spectrum.sales_part add if not exists partition(saledate='2008-01-01') location 's3://awssampledbuswest2/tickit/spectrum/sales_partition/saledate=2008-01/' partition(saledate='2008-02-01') location 's3://awssampledbuswest2/tickit/spectrum/sales_partition/saledate=2008-02/' partition(saledate='2008-03-01') location 's3://awssampledbuswest2/tickit/spectrum/sales_partition/saledate=2008-03/';
以下示例修改 SPECTRUM.SALES_PART 以删除包含 saledate='2008-01-01'' 的分区。
alter table spectrum.sales_part drop partition(saledate='2008-01-01');
以下示例为包含 saledate='2008-01-01' 的分区设置新的 Simple Storage Service(Amazon S3)路径。
alter table spectrum.sales_part partition(saledate='2008-01-01') set location 's3://awssampledbuswest2/tickit/spectrum/sales_partition/saledate=2008-01-01/';
以下示例将 sales_date 的名称更改为 transaction_date。
alter table spectrum.sales rename column sales_date to transaction_date;
以下示例将列映射设置为使用优化行列式 (ORC) 格式的外部表的位置映射。
alter table spectrum.orc_example set table properties('orc.schema.resolution'='position');
以下示例将列映射设置为使用 ORC 格式的外部表的名称映射。
alter table spectrum.orc_example set table properties('orc.schema.resolution'='name');