Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Does Impala support TABLESAMPLE like Hive?

Highlighted

Does Impala support TABLESAMPLE like Hive?

New Contributor

Does Impala support TABLESAMPLE like Hive? Thanks.

3 REPLIES 3

Re: Does Impala support TABLESAMPLE like Hive?

Explorer

Sorry for the delay, Impala does not currently support TABLESAMPLE or bucketing.

 

Highlighted

Re: Does Impala support TABLESAMPLE like Hive?

New Contributor

Two years later: it appears impala still does not support bucketing? I could really use that for some performance improvements on a join across three multi billion row tables.

Highlighted

Re: Does Impala support TABLESAMPLE like Hive?

Cloudera Employee

There is now a TABLESAMPLE clause in CDH 5.12. It uses DBMS-like syntax rather than the Hive bucketing notion.  Syntax is like:

 

select c1, c2 from t1 tablesample system([percentage 0-100]) [repeatable(integer)] <rest of query>

 

The TABLESAMPLE clause can go immediately after any table name in the query, although not after a view name or a subquery.

 

The percentage represents the volume of data in the table, in bytes. Impala brings in files in arbitrary order until it reaches the specified percentage.

 

If the query involves partition pruning, the percentage applies to the data volume of just the relevant partitions, e.g.

 

-- Only sample 10% of the data for year 2017, if the table is partitioned by year

select c1, c2 from t1 tablesample system(10) where year = 2017;

Don't have an account?
Coming from Hortonworks? Activate your account here