Skip to content

Instantly share code, notes, and snippets.

@PMeinshausen
Created September 29, 2014 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PMeinshausen/60c35cb9b4fe6bfed873 to your computer and use it in GitHub Desktop.
Save PMeinshausen/60c35cb9b4fe6bfed873 to your computer and use it in GitHub Desktop.
--Syntax (version 1.0)
--Unconditional sampling, single sample rate
select * from sample(
ON ...
SAMPLEFRACTION('fraction')
[Seed('seed')]
--Unconditional sampling, total approximate sample size
select * from sample (
ON ... as data PARTITION BY ANY
ON ... as summary DIMENSION
ApproximateSampleSize('size')
[Seed('seed')]
--conditional simple sampling, single sample rate
select * from sample (
ON ...
CONDITIONONCOLUMN('column')
CONDITIONON('cond1'[,'cond2',...])
SAMPLEFRACTION('fraction')
[SEED('seed')]
--Conditional sampling, variable sample rates
select * from sample (
ON ...
CONDITIONONCOLUMN('column')
CONDITIONON('cond1'[,'cond2',...])
SAMPLEFRACTION('f1'[,'f2','f3',...])
[SEED('seed')]
--Conditional sampling, total approximate sample size
select * from sample (
ON ... as data PARTITION BY ANY
ON ... as summary DIMENSION
CONDITIONONCOLUMN('column')
CONDITIONON('cond1'[,'cond2',...])
ApproximateSampleSize('total_sample_size')
[SEED('seed')]
--Conditional sampling, variable approximate sample sizes
select * from sample (
ON ... as data PARTITION BY ANY
ON ... as summary DIMENSION
CONDITIONONCOLUMN('column')
CONDITIONON('cond1'[,'cond2',...])
APPROXIMATESAMPLESIZE('s1'[,'s2',...])
[SEED('seed')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment