rajnish
rajnish

Reputation: 780

HIVE: enforce where clause in the query

we have a HIVE table that is partitioned by date, we want end user to always use where clause in the query, if they are not using it, it should throw exception.

Is there any setting in HIVE, that could enforce it?

Upvotes: 0

Views: 809

Answers (1)

David דודו Markovitz
David דודו Markovitz

Reputation: 44921

1

hive.metastore.limit.partition.request

  • Default value: -1
  • Added In: Hive 2.2.0 with HIVE-13884

This limits the number of partitions that can be requested from the Metastore for a given table. A query will not be executed if it attempts to fetch more partitions per table than the limit configured. A value of "-1" means unlimited. This parameter is preferred over hive.limit.query.max.table.partition (deprecated).

https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties#ConfigurationProperties-hive.metastore.limit.partition.request

2

Let your users access the data through views, e.g. -

create view mytable_last_year
as
select  *
from    mytable
where   dt >= add_months(current_date,-12)
;

Upvotes: 2

Related Questions