在 Hive 中使用 FROM_UNIXTIME(UNIX_TIMESTAMP() 时出错
Error while using FROM_UNIXTIME(UNIX_TIMESTAMP() in Hive
我正在尝试 运行 此函数来获取 Hive 中的当前日期,但出现以下错误:
Error while compiling statement: FAILED: SemanticException No valid privileges Required privileges for this query: Server=server1->Db=_dummy_database->Table=_dummy_table->action=select;
我已经在线搜索并被建议使用以下函数来获取 Hive 中的当前日期,但都给出相同的错误:
SELECT from_unixtime(unix_timestamp()); --/Selecting Current Time stamp/
SELECT CURRENT_DATE; --/Selecting Current Date/
SELECT CURRENT_TIMESTAMP; --/Selecting Current Time stamp/
但是如果我 运行 给出它们,它们都显示错误。
select unix_timestamp(current_timestamp) from table_name;
正确答案:
1. SELECT from_unixtime(unix_timestamp()); - 仅适用于 Impala
- SELECT from_unixtime(unix_timestamp()) 来自 any_table_name; - 在 HIVE 中工作
注意:必须将 FROM 子句与数据库中存在的 any_table_name 一起用于 HIVE
我正在尝试 运行 此函数来获取 Hive 中的当前日期,但出现以下错误:
Error while compiling statement: FAILED: SemanticException No valid privileges Required privileges for this query: Server=server1->Db=_dummy_database->Table=_dummy_table->action=select;
我已经在线搜索并被建议使用以下函数来获取 Hive 中的当前日期,但都给出相同的错误:
SELECT from_unixtime(unix_timestamp()); --/Selecting Current Time stamp/
SELECT CURRENT_DATE; --/Selecting Current Date/
SELECT CURRENT_TIMESTAMP; --/Selecting Current Time stamp/
但是如果我 运行 给出它们,它们都显示错误。
select unix_timestamp(current_timestamp) from table_name;
正确答案: 1. SELECT from_unixtime(unix_timestamp()); - 仅适用于 Impala
- SELECT from_unixtime(unix_timestamp()) 来自 any_table_name; - 在 HIVE 中工作
注意:必须将 FROM 子句与数据库中存在的 any_table_name 一起用于 HIVE