温馨提示×

impala创建临时表的方法是什么

小亿
247
2024-01-08 10:07:39
栏目: 大数据

在Impala中,可以使用CREATE TABLE语句来创建临时表。创建临时表的语法如下:

CREATE [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name [(col_name data_type [COMMENT ‘col_comment’] [col_constraint_spec] [,…])] [COMMENT ‘table_comment’] [PARTITIONED BY (col_name data_type [COMMENT ‘col_comment’] [col_constraint_spec] [,…])] [CLUSTERED BY (col_name,…) [SORTED BY (col_name [ASC|DESC],…)] INTO num_buckets BUCKETS] [STORED AS file_format] [LOCATION ‘hdfs_path’] [TBLPROPERTIES (‘key1’=‘value1’, ‘key2’=‘value2’, …)] [AS select_statement]

其中,CREATE TEMPORARY TABLE语句创建的是临时表。临时表在Impala会话结束时被自动删除。如果需要在多个Impala会话之间共享临时表,可以使用CREATE TABLE语句创建一个普通表,并在使用完后手动删除。

0