对 Hive SELECT 的质疑 SQL
Doubts on SELECT of Hive SQL
我正在阅读一些 Hive QL 脚本并发现这一行:
SELECT 'Start time:',from_unixtime(unix_timestamp());
这是什么意思?它看起来不像真正的 "select" 语句?
没有 FROM 的 HIVE-178 SELECT 应该假定没有列的单行 table
... People use this all the time with SQL Server. I expect people to
like it if it is added to Hive ...
... The Hive Language Manual now states, "As of Hive 0.13.0, FROM is
optional (for example, SELECT 1+1)."
没什么新鲜的 -- 该语法是 Sybase Transact-SQL 30 年前引入的,在他们将 "SQL Server" 代码库(和产品名称)卖给 Microsoft 之前,并且在他们很久之前剩下的卖给了 SAP。
备用语法使用 DUAL
(Oracle) 或 SYSDUMMY1
(DB2) 伪 table.
这不会查询数据库。这只是一个 Print 语句。
如果我们 运行 命令:SELECT 'Start time:',from_unixtime(unix_timestamp());
输出将是:
Col1: Start time:
Col2: 2017-08-29 01:36:11
我正在阅读一些 Hive QL 脚本并发现这一行: SELECT 'Start time:',from_unixtime(unix_timestamp());
这是什么意思?它看起来不像真正的 "select" 语句?
HIVE-178 SELECT 应该假定没有列的单行 table
... People use this all the time with SQL Server. I expect people to like it if it is added to Hive ...
... The Hive Language Manual now states, "As of Hive 0.13.0, FROM is optional (for example, SELECT 1+1)."
没什么新鲜的 -- 该语法是 Sybase Transact-SQL 30 年前引入的,在他们将 "SQL Server" 代码库(和产品名称)卖给 Microsoft 之前,并且在他们很久之前剩下的卖给了 SAP。
备用语法使用 DUAL
(Oracle) 或 SYSDUMMY1
(DB2) 伪 table.
这不会查询数据库。这只是一个 Print 语句。
如果我们 运行 命令:SELECT 'Start time:',from_unixtime(unix_timestamp());
输出将是:
Col1: Start time:
Col2: 2017-08-29 01:36:11