-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Builds on #108.
When a saved query is created or a new version is added, we should automatically classify it by analyzing the SQL through DataFusion's logical plan. This gives us structured metadata about query shape without any manual tagging.
Classification fields
Derive from the logical plan at save time and store on saved_query_versions:
category— one of:full_scan,point_lookup,filtered_scan,aggregation,join,projectionnum_tables— number of table references in the planhas_predicate— plan contains aFilternodehas_join— plan contains aJoinnodehas_aggregation— plan contains anAggregatenodehas_group_by— aggregate node has group-by expressionshas_order_by— plan contains aSortnodehas_limit— plan contains aLimitnode
User-provided metadata
Store on saved_queries (not per-version):
tags— freeform text array for user-defined labels (e.g.baseline,regression_candidate)description— human-readable description
Override columns
Store on saved_query_versions alongside auto-classified fields:
category_override— nullable, takes precedence over auto-detected category when settable_size_override— nullable, takes precedence over auto-detected table size when set
Read APIs should return COALESCE(category_override, category) as the effective category.
Implementation approach
Classification runs in Rust where DataFusion's logical plan is already available. The flow is: parse SQL → build logical plan → walk the plan tree → populate classification columns. No external dependencies needed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels