banjara
banjara

Reputation: 3890

Using hive bucketing in select query

I have a hive table bucketed on userId, My select query contains userId in where clause but hive is doing full table scan. hive.enforce.bucketing is true Why don't hive take advantage of bucketing in such cases, is there any config to enable it??

Table Structure

userId int,
name int,
address String,
cell int,
......
......
......
......
CLUSTERED BY  (userId) SORTED BY (userId) INTO 20 BUCKETS

Select query

select cell from <table> where userId=<userId>

Upvotes: 0

Views: 1306

Answers (1)

banjara
banjara

Reputation: 3890

select cell from <table> TABLESAMPLE(BUCKET <n> OUT OF 20 ON userId) usertable where userId = <userId>

Upvotes: 1

Related Questions