Commit b665ffc
Task LAV-2439: validate SAMPLE / TABLESAMPLE arguments (#2871)
Enforce Snowflake's documented value space for every SAMPLE / TABLESAMPLE
argument position, producing the verbatim Snowflake errors:
- Range/type checks in the sample rewriter: probability 0..=100 and fixed
size 0..=1,000,000 (001817), seed 0..=2^31-1 (001817) and integer-only
(001007). Fractional fixed sizes truncate toward zero so the generated
LIMIT is integral.
- A new pre-pipeline `sample_arg_check` gate emits Snowflake's positioned
001003 syntax error for a leading `-`, a PERCENT unit, and the
unsupported BUCKET form (the vendored parser over-accepts all three),
which also makes the rewriter's BUCKET bail path unreachable.
- The vendored parser now accepts a sampled VALUES list
(`FROM VALUES (...) SAMPLE (p)`).
Compat tests in test_table_samples.py cover the full value space with
snapshots recorded against real Snowflake.
Co-authored-by: Wojciech Padło <wojciech.padlo@localstack.cloud>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent f0ad4bb commit b665ffc
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18050 | 18050 | | |
18051 | 18051 | | |
18052 | 18052 | | |
| 18053 | + | |
| 18054 | + | |
| 18055 | + | |
| 18056 | + | |
| 18057 | + | |
18053 | 18058 | | |
18054 | 18059 | | |
18055 | 18060 | | |
| |||
18065 | 18070 | | |
18066 | 18071 | | |
18067 | 18072 | | |
18068 | | - | |
| 18073 | + | |
18069 | 18074 | | |
18070 | 18075 | | |
18071 | 18076 | | |
| |||
0 commit comments