Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excluding the partition field from select queries in Hive

Tags:

hadoop

hiveql

Suppose I have a table definition as follows in Hive(the actual table has around 65 columns):

CREATE EXTERNAL TABLE S.TEST (
    COL1 STRING,
    COL2 STRING
)
PARTITIONED BY (extract_date STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\007'
LOCATION 'xxx';

Once the table is created, when I run hive -e "describe s.test", I see extract_date as being one of the columns on the table. Doing a select * from s.test also returns extract_date column values. Is it possible to exclude this virtual(?) column when running select queries in Hive.

like image 206
name_masked Avatar asked Jan 07 '23 22:01

name_masked


1 Answers

Change this property

 set hive.support.quoted.identifiers=none;

and run the query as

SELECT `(extract_date)?+.+` FROM <table_name>;

I tested it working fine.

like image 98
srinivasan Hariharan Avatar answered Feb 06 '23 11:02

srinivasan Hariharan