Avoid printing table name in column name when using beeline

When using hive in beeline using a simple query, select

I would like to return the table value without in the default column name.

Example

Data

An 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 request select

returns:

SELECT * FROM employee;
+---------------+----------------+------------------+-----------------------+--+
| employee.eid  | employee.name  | employee.salary  | employee.destination  |
+---------------+----------------+------------------+-----------------------+--+
+---------------+----------------+------------------+-----------------------+--+

      

Desired results

The desired results are achieved using : AS

SELECT eid AS eid, name AS name, salary AS salary, 
       destination AS destination FROM employee;

+------+-------+---------+--------------+--+
| eid  | name  | salary  | destination  |
+------+-------+---------+--------------+--+
+------+-------+---------+--------------+--+

      

Problem

I would not want to type every time I run a query and return results without table names in column names as the default behavior. AS

select

+3


source to share


1 answer


set hive.resultset.use.unique.column.names=false

Configuration properties

Demo

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

      

+3


source







All Articles