name_masked
name_masked

Reputation: 9793

Excluding the partition field from select queries in Hive

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.

Upvotes: 4

Views: 4722

Answers (1)

srinivasan Hariharan
srinivasan Hariharan

Reputation: 365

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.

Upvotes: 9

Related Questions