Uh oh!
There was an error while loading. Please reload this page.
feat: Supporting SAMPLE parsing - #1566
Conversation
iffyio
commented
Dec 6, 2024
Hi @seve-martinez! It sounds like the parsing can be done while parsing the select body instead? Probably here before looking for a WHERE clause? |
yoavcloud
commented
Jan 12, 2025
I did not notice this PR when I started working on parsing the SAMPLE option, but since then it was merged: #1580 I can share that we used to parse the SAMPLE option as part of the TableFactor but it wasn't ideal, and moving it to the select made more sense. |
seve-martinez
commented
Jan 15, 2025
Oh awesome! Thanks for taking care of it, I wasn't in love with my solution and what you have there looks very sound. 👍 |
Snowflake, Databricks, Postgres, and others all support some from of table sampling.
This commonly takes on the form
where
Different dialects support one, the other, or both sample keywords and only some of the methods. The current PR follows the snowflake paradigm.
Outstanding questions
Parsercode would make me think it should be part of theparse_table_factor()logic since it always trails a relation. However this would then require each variant ofTableFactorthat supportsSAMPLEto have a placeholder for it. Is that the right approach?