fix(actions): use type-appropriate Column Profiler query for Array/Map/Tuple columns - #71
Merged
Conversation
…p/Tuple columns. Closes #60 column.stats always ran min()/max()/topK() on the raw column and column.top_10 always ran a plain GROUP BY on it, both of which ClickHouse rejects for Array/Map/Tuple columns (ILLEGAL_TYPE_OF_ARGUMENT on min/max/topK, and Map isn't groupable/hashable for GROUP BY). get_context_actions_for_node now takes the column's ClickHouse type (looked up from system.columns in handle_context_actions, skipped for mock/test connections) and, for Array/Map/Tuple columns, builds column.stats around min(length())/max(length()) instead of min()/max()/ topK(), and omits column.top_10 entirely since exact-value grouping on a collection column isn't meaningful. Scalar columns keep the original query unchanged.
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
column.statsinsrc/sdui/actions.rsalways emittedmin()/max()/topK(5)()on the raw column, andcolumn.top_10always emitted a plainGROUP BYon it. ClickHouse rejects both forArray/Map/Tuplecolumns:min/max/topKabort withILLEGAL_TYPE_OF_ARGUMENT, andMapadditionally isn't groupable/hashable forGROUP BY.get_context_actions_for_nodenow takes an optionalcolumn_type(the ClickHouse type string).handle_context_actionslooks it up fromsystem.columnsbefore generating actions (skipped for mock/test connections, where it staysNone).Array/Map/Tuple(includingNullable(...)-wrapped) columns,column.statsis rebuilt aroundmin(length(...))/max(length(...))instead ofmin/max/topK, andcolumn.top_10is omitted entirely, since exact-value grouping on a collection column isn't meaningful and would still fail forMap.None) keep the exact original query, unchanged.Closes #60
Test plan
cargo test— 95/95 passing, including new regression tests for both the pureget_context_actions_for_nodefunction (Array/Map/Tuple/Nullable-wrapped types) and thehandle_context_actionsmock-connection pathcargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warnings