Skip to content

Commit a41cf41

Browse files
author
Alison Gim
committed
Add calculated measures support for expressions with aggregates
This commit adds functionality for handling: - Calculated measures with a simple predefined measure + operator + constant (e.g., count(*) * 2) - Calculated measures with two simple predefined measures + operator (e.g., count(*) + sum(col)) Key changes: - Add _ParseState class for tracking quote/bracket/paren state - Add _find_top_level_operator to find operators at depth 0 - Add _find_matching_paren, _is_inside_quotes_or_brackets helpers - Add _count_outer_parens helper for parenthesis handling - Add _has_operators_outside_quotes helper - Add _extract_aggregates_from_expression to extract aggregates from calculated measures and replace with references - Add _contains_aggregate_function for optimized aggregate detection - Add pre-compiled KQL_AGG_PATTERN for performance - Update _convert_quoted_columns to also convert standalone "col" -> ["col"] - Update _escape_and_quote_columns to check operators BEFORE stripping quotes - Update _get_projection_or_summarize to handle calculated measure cases - Update _extract_maybe_agg_column_parts for multi-arg KQL aggregates Test updates: - Update test_group_by_text for new extend column ordering - Update test_function_text for new extend column ordering - Update test_group_by_text_vaccine_dataset to not expect redundant extend Deleted original.py reference file to fix lint errors.
1 parent fdd3851 commit a41cf41

2 files changed

Lines changed: 390 additions & 58 deletions

File tree

0 commit comments

Comments
 (0)