Skip to content

Instantly share code, notes, and snippets.

@nileema
Last active December 22, 2015 10:19
Show Gist options
  • Save nileema/6458383 to your computer and use it in GitHub Desktop.
Save nileema/6458383 to your computer and use it in GitHub Desktop.
select * from foo tablesample system (10)
(QUERY
(QUERY_SPEC
(select (SELECT_LIST ALL_COLUMNS))
(from
(SAMPLED_RELATION
(TABLE (QNAME foo)) system 10))))
Query{queryBody=QuerySpecification{select=Select{distinct=false, selectItems=[*]}, from=[SampledRelation{relation=Table{foo}, type=SYSTEM, samplePercentage=10}], where=null, groupBy=[], having=null, orderBy=[], limit=null}, orderBy=[]}
SELECT *
FROM foo
TABLESAMPLE SYSTEM (10)
============================================================
select * from foo tablesample system (10) join bar tablesample bernoulli (30) on a.id = b .id
(QUERY
(QUERY_SPEC
(select (SELECT_LIST ALL_COLUMNS))
(from
(QUALIFIED_JOIN INNER_JOIN
(on
(= (QNAME a id) (QNAME b id)))
(SAMPLED_RELATION
(TABLE (QNAME foo)) system 10)
(SAMPLED_RELATION
(TABLE (QNAME bar)) bernoulli 30)))))
Query{queryBody=QuerySpecification{select=Select{distinct=false, selectItems=[*]}, from=[Join{type=INNER, left=SampledRelation{relation=Table{foo}, type=SYSTEM, samplePercentage=10}, right=SampledRelation{relation=Table{bar}, type=BERNOULLI, samplePercentage=30}, criteria=JoinOn{("a"."id" = "b"."id")}}], where=null, groupBy=[], having=null, orderBy=[], limit=null}, orderBy=[]}
SELECT *
FROM (foo
TABLESAMPLE SYSTEM (10)
INNER JOIN bar
TABLESAMPLE BERNOULLI (30) ON (("a"."id" = "b"."id")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment