当使用Hive在直线和使用简单 select
查询我想返回列名称中没有表名的表作为默认值。
示例
数据
在简单表(tutorialspoint)示例中:
CREATE TABLE IF NOT EXISTS employee ( eid int, name String,
salary String, destination String)
COMMENT 'Employee details'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;
这个 SELECT
查询返回:
SELECT * FROM employee;
+---------------+----------------+------------------+-----------------------+--+
| employee.eid | employee.name | employee.salary | employee.destination |
+---------------+----------------+------------------+-----------------------+--+
+---------------+----------------+------------------+-----------------------+--+
期望的结果
通过使用 AS
:
SELECT eid AS eid, name AS name, salary AS salary,
destination AS destination FROM employee;
+------+-------+---------+--------------+--+
| eid | name | salary | destination |
+------+-------+---------+--------------+--+
+------+-------+---------+--------------+--+
问题
我想避免打字 AS
每次我跑 select
作为默认行为,查询并返回列名中没有表名的结果。
1条答案
按热度按时间cnjp1d6j1#
set hive.resultset.use.unique.column.names=false
配置属性演示