While using hive in beeline an using simple select
query I would like to return table without table name in column name as a default.
On example of a simple 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;
The SELECT
query returns:
SELECT * FROM employee;
+---------------+----------------+------------------+-----------------------+--+
| employee.eid | employee.name | employee.salary | employee.destination |
+---------------+----------------+------------------+-----------------------+--+
+---------------+----------------+------------------+-----------------------+--+
The desired results are achieved with use of AS
:
SELECT eid AS eid, name AS name, salary AS salary,
destination AS destination FROM employee;
+------+-------+---------+--------------+--+
| eid | name | salary | destination |
+------+-------+---------+--------------+--+
+------+-------+---------+--------------+--+
I would like to avoid typing AS
each time I run select
query and return results without table names in column names as default behaviour.
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