使用直线时避免在列名称中打印 table 名称
Avoid printing table name in column name while using beeline
在直线中使用配置单元时使用简单的 select
查询我想 return table 没有 table 默认列名中的名称。
例子
数据
关于一个简单的例子 table (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
查询returns:
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 |
+------+-------+---------+--------------+--+
+------+-------+---------+--------------+--+
问题
我想避免在每次 运行 select
查询时输入 AS
并且 return 结果没有 table 列名称中的名称作为默认行为。
set hive.resultset.use.unique.column.names=false
演示
hive> create table t (i int,j int,k int);
hive> select * from t;
t.i t.j t.k
hive> set hive.resultset.use.unique.column.names=false;
hive> select * from t;
i j k
在直线中使用配置单元时使用简单的 select
查询我想 return table 没有 table 默认列名中的名称。
例子
数据
关于一个简单的例子 table (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
查询returns:
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 |
+------+-------+---------+--------------+--+
+------+-------+---------+--------------+--+
问题
我想避免在每次 运行 select
查询时输入 AS
并且 return 结果没有 table 列名称中的名称作为默认行为。
set hive.resultset.use.unique.column.names=false
演示
hive> create table t (i int,j int,k int);
hive> select * from t;
t.i t.j t.k
hive> set hive.resultset.use.unique.column.names=false;
hive> select * from t;
i j k