有没有办法在 Hive 中将 "second name" 赋予 table,以便用户可以引用 table 的任一名称并检索相同的内容?

Is there a way to give a "second name" to a table in Hive so that a user can refer to either name of the table and would retrieve the same thing?

我希望能够引用具有特定命名模式的 tables 以使我的代码统一,但我从具有不同命名模式的不同环境中提取 tables。如果我希望我所有的 table 都具有 example_table_1example_table_2 之类的名称,但第二个名称类似于 TB_ex_2,有没有办法让 [=23] =] 一个属性,这样我也可以调用 select * from database.example_table_2,它会知道引用 TB_ex_2?

我知道我可以为 table 起别名,例如select * from TB_ex_2 example_table_2,但我正在努力避免这种情况。重命名每个 table 也不是一种选择,因为需要保留这些名称以识别它们来自哪个环境。

Hive 不支持同义词。解决方法是 create a view:

CREATE VIEW table2 
  AS SELECT * from table1;

你也可以create many tables on top of the same location(data).