diff options
author | gatorsmile <gatorsmile@gmail.com> | 2016-02-23 16:13:09 +0800 |
---|---|---|
committer | Cheng Lian <lian@databricks.com> | 2016-02-23 16:13:09 +0800 |
commit | 87250580f214cb7c4dff01c5a3498ea6cb79a27e (patch) | |
tree | 67871439e3b12e5114ff7bff5acdc880f8dd0336 /docs | |
parent | 5cd3e6f60b839909210500b319cf312de026dd49 (diff) | |
download | spark-87250580f214cb7c4dff01c5a3498ea6cb79a27e.tar.gz spark-87250580f214cb7c4dff01c5a3498ea6cb79a27e.tar.bz2 spark-87250580f214cb7c4dff01c5a3498ea6cb79a27e.zip |
[SPARK-13263][SQL] SQL Generation Support for Tablesample
In the parser, tableSample clause is part of tableSource.
```
tableSource
init { gParent.pushMsg("table source", state); }
after { gParent.popMsg(state); }
: tabname=tableName
((tableProperties) => props=tableProperties)?
((tableSample) => ts=tableSample)?
((KW_AS) => (KW_AS alias=Identifier)
|
(Identifier) => (alias=Identifier))?
-> ^(TOK_TABREF $tabname $props? $ts? $alias?)
;
```
Two typical query samples using TABLESAMPLE are:
```
"SELECT s.id FROM t0 TABLESAMPLE(10 PERCENT) s"
"SELECT * FROM t0 TABLESAMPLE(0.1 PERCENT)"
```
FYI, the logical plan of a TABLESAMPLE query:
```
sql("SELECT * FROM t0 TABLESAMPLE(0.1 PERCENT)").explain(true)
== Analyzed Logical Plan ==
id: bigint
Project [id#16L]
+- Sample 0.0, 0.001, false, 381
+- Subquery t0
+- Relation[id#16L] ParquetRelation
```
Thanks! cc liancheng
Author: gatorsmile <gatorsmile@gmail.com>
Author: xiaoli <lixiao1983@gmail.com>
Author: Xiao Li <xiaoli@Xiaos-MacBook-Pro.local>
This patch had conflicts when merged, resolved by
Committer: Cheng Lian <lian@databricks.com>
Closes #11148 from gatorsmile/tablesplitsample.
Diffstat (limited to 'docs')
0 files changed, 0 insertions, 0 deletions