如何知道对象是Imapla / Hive中的视图还是表

时间:2018-04-12 17:39:00

标签: hive impala

我们是否有系统表/命令来了解对象是Impala中的表或视图? 我可以使用show table但它也会返回视图。 这个问题是关于hive 1.1

2 个答案:

答案 0 :(得分:1)

使用describe命令:

DESCRIBE [FORMATTED] [db_name.]table_name[.complex_col_name ...]

对于视图,它将显示视图定义中的查询文本。

见这里:DESCRIBE

答案 1 :(得分:0)

列出Hive中的VIEWS

SHOW VIEWS [IN/FROM database_name] [LIKE 'pattern_with_wildcards'];

Hive manual

中的使用示例
SHOW VIEWS;                                -- show all views in the current database
SHOW VIEWS 'test_*';                       -- show all views that start with "test_"
SHOW VIEWS '*view2';                       -- show all views that end in "view2"
SHOW VIEWS LIKE 'test_view1|test_view2';   -- show views named either "test_view1" or "test_view2"
SHOW VIEWS FROM test1;                     -- show views from database test1
SHOW VIEWS IN test1;                       -- show views from database test1 (FROM and IN are same)
SHOW VIEWS IN test1 "test_*";              -- show views from database test2 that start with "test_"