Support for SAMPLE BY in schema creation, SAMPLE clause, and toStartOfDay datetime function #135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi all, just quickly hacked in support for SAMPLE BY support when creating models and added a missing datetime function. I also implemented support for the SAMPLE clause.
This adds a new "sample_by" parameter to the constructor of BaseMergeTree, which can be used to enable sampling on your table.
You can query using the SAMPLE clause using the new
.sample
function like so:The new sample function takes two parameters:
which generates either a
SAMPLE k
orSAMPLE k OFFSET m
clause as per the Clickhouse docs on SAMPLE.I didn't include unit tests because I'm too lazy to spin up all the docker stuff and I'm in a hurry to get some bare minimum thing here working. I'm hoping this is PR is useful for others and could be useful for the project. Thanks!