feat: type-aware partitioning, SummingMergeTree + LowCardinality, --stdout#30
Merged
Merged
Conversation
…tdout Fix a correctness bug and land several quick wins that build on classifiers already present in the codebase. - generator: decide PARTITION BY from the column's inferred type (DateTime64) instead of its name, so a scan -> table flow can no longer emit PARTITION BY toYYYYMM(<String column>), which ClickHouse rejects. Removes the timestamp heuristic that was duplicated between generator and scanner. - scanner: suggest SummingMergeTree when numeric metrics and a dimension exist, with a narrow grouping key (one primary id + one timestamp) and the metric columns as SUM COLUMNS. - inference/schema: detect low-cardinality String columns (capped distinct-value tracking, conservative thresholds) and render them as LowCardinality(String); applied across table/kafka/diff output. - cli/main: add --stdout to kafka/table/diff to print migrations instead of writing files. - docs: document the above in README; bump version 0.4.0 -> 0.5.0. Adds 8 unit tests (18 -> 26). cargo fmt, clippy -D warnings, and tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes one correctness bug and lands four low-risk quick wins that build on classifiers already present in the codebase. No new dependencies.
PARTITION BY—tablenow decidesPARTITION BY toYYYYMM(...)from the column's inferred type (DateTime64) instead of its name. Previously ascan → tableflow could emitPARTITION BY toYYYYMM(<String column>), which ClickHouse rejects (date-only strings stayString, yet any field merely named like a timestamp qualified). Also removes the timestamp heuristic that was duplicated betweengeneratorandscanner.SummingMergeTree—scansuggests it when numeric metrics and a dimension (id/timestamp) exist, with a narrow grouping key (one primary id + one timestamp) and the metric columns asSUM COLUMNS.LowCardinality(String)detection — inference tracks capped distinct string values and flags low-cardinality columns (conservative thresholds: ≥20 records, ≤100 distinct, distinct < records/2); rendered asLowCardinality(String)acrosstable/kafka/diff.--stdoutflag —kafka/table/diffcan print migrations (with-- up/-- downheaders) instead of writing files.0.4.0 → 0.5.0.