GitHub user aertoria opened a pull request: https://github.com/apache/phoenix/pull/262
PHOENIX 153 implement TABLESAMPLE clause table sampling on each Table basis (at the 'FROM' part of the query). Sample size decided by the input sampling rate applies on Primary Key's frequency. Syntax: `select name from person SAMPLE(0.10) where name='ethan'` ++ ++Belows are SUPPORTED ++ ===BASE CASE==== select * from Person; select * from PERSON TABLESAMPLE 0.45; ===WHERE CLAUSE==== select * from PERSON where ADDRESS = 'CA' OR name>'tina3'; select * from PERSON TABLESAMPLE 0.49 where ADDRESS = 'CA' OR name>'tina3'; select * from PERSON TABLESAMPLE 0.49 where ADDRESS = 'CA' OR name>'tina3' LIMIT 1; ===Wired Table=== select * from LOCAL_ADDRESS TABLESAMPLE 0.79; select * from SYSTEM.STATS TABLESAMPLE 0.41; ===CORNER CASE=== select * from PERSON TABLESAMPLE 0; select * from PERSON TABLESAMPLE 1.45; select * from PERSON TABLESAMPLE kko; ===AGGREGATION=== select count(*) from PERSON TABLESAMPLE 0.5 LIMIT 2 select count(*) from (select NAME from PERSON limit 20) ===SUB QUERY=== select * from (select /*+NO_INDEX*/ * from PERSON tablesample 0.1 where Name > 'tina10') where ADDRESS = 'CA' ===JOINS=== select * from PERSON1, PERSON2 tablesample 0.7 where PERSON1.Name = PERSON2.NAME ===QUERY being OPTMIZED=== select * from PERSON tablesample 0.8 (goes to IDX_ADDRESS_PERSON index table, table sample carry on) ===INSERT SELECT==== upsert into personbig(ID, ADDRESS) select id, address from personbig tablesample 0.01; You can merge this pull request into a Git repository by running: $ git pull https://github.com/aertoria/phoenix master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/phoenix/pull/262.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #262 ---- commit c872defc5cc3ef7f4d264b207d831ceb3a71ef2d Author: aertoria <casti...@gmail.com> Date: 2017-06-16T20:21:34Z PHOENIX 153 implement TABLESAMPLE clause ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---