classTableSample
final class TableSample
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The TABLESAMPLE clause of a table reference (MySQL 9.x grammars): the sampling method and the percentage.
The percentage is a number, a user variable or a parameter marker. The statement that holds the table derives it; it sees no column. Source: https://dev.mysql.com/doc/refman/9.1/en/select.html.
$query = (new \SqlSemantics\Platform\MySql\Semantics('mysql-9.1.0'))->analyze('SELECT a FROM t TABLESAMPLE BERNOULLI (10)');
[$query->statement->from->sample->method, $query->statement->from->sample->percentage->text] // => [\SqlSemantics\Platform\MySql\Statement\Relation\Hint\SamplingMethod::Bernoulli, '10']new \SqlSemantics\Platform\MySql\Statement\Relation\Hint\TableSample(\SqlSemantics\Platform\MySql\Statement\Relation\Hint\SamplingMethod::System, new \SqlSemantics\Platform\MySql\Statement\Literal\NullLiteral()) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstructionProperties§
public SamplingMethod $methodpublic Scalar $percentageMethods§
public function __construct(public SamplingMethod $method, public Scalar $percentage)Parameters
$method | SamplingMethod | The sampling method |
$percentage | Scalar | The percentage of rows to sample |
Calls 1
- static-call Check::input() line 40
public function render(Output $out): voidTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.