Users/alison needs copilot/add intermediary measures calculated measures - #2
Open
AlisonNeedsCopilot wants to merge 8 commits into
Open
Conversation
added 4 commits
February 5, 2026 20:49
This ensures that extend operations (which may reference summarized columns) are executed after the summarize clause in the generated KQL query.
…d hoc measures - Add _find_operator_outside_quotes() helper to find operators not inside quoted strings - Update _escape_and_quote_columns() to recursively escape both sides of operators - Update _is_number_literal() to match integers and decimals with digits on both sides - Add tests for: - Two quoted measures: "Measure 1" + "Measure 2" -> ["Measure 1"] + ["Measure 2"] - Measure with constant: "Measure 1" * 2 -> ["Measure 1"] * 2 - Measure with operator in name: "Measure 1-2" -> ["Measure 1-2"] - _is_number_literal function validation
- Add comprehensive unit tests for new helper functions: - TestIsInsideQuotesOrBrackets (10 tests) - TestFindMatchingParen (8 tests) - TestHasOperatorsOutsideQuotes (8 tests) - TestExtractAndReplaceAggregates (10 tests) - TestContainsAggregateFunction (10 tests) - Add comment explaining existing_aggs registration logic - Apply black formatting
AlisonNeedsCopilot
changed the base branch from
main
to
Users/AlisonNeedsCopilot/quote-escape-bracket-multiple-ad-hoc-measures-calculated-measures
February 9, 2026 22:52
added 4 commits
February 10, 2026 01:34
Prevents double-escaping of expressions like (count(a) + count(b)) by detecting matching outer parentheses, processing the inner content recursively, and re-adding the parentheses.
AlisonNeedsCopilot
force-pushed
the
Users/AlisonNeedsCopilot/add-intermediary-measures-calculated-measures
branch
from
February 10, 2026 04:55
30fa542 to
b64cf11
Compare
AlisonNeedsCopilot
changed the base branch from
Users/AlisonNeedsCopilot/quote-escape-bracket-multiple-ad-hoc-measures-calculated-measures
to
main
February 10, 2026 23:42
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.
##Overview
Previously, having predefined measures in a calculated measure would incorrectly generate the query.
Calculated measures using predefined measures without filters would exclude one of the predefined measures in the resulting query. Calculated measures using predefined measures with filters would mangle the query.
The calculated measure with multiple predefined measures would have multiple aggregate expressions; we only matched to one of them during the compilation process, resulting in the other expression getting mangled or omitted.
In this development, we fix this by following this flow:
summarize;extenddoes not support operating on multiple aggregates in one expression.##Technical Details
_extract_and_replace_aggregates(): For each aggregate expression within a given expression, add it to the list of intermediary aggregate expressions encountered if it does not already exist in the list. Replace the aggregate expressions in the original expression with their intermediary expressions._get_projection_or_summarize(): Handle 4 difference cases when adding expressions to the query:projectandsummarize. Also add expression to the list of existing aggregates in case it appears in a calculated measure later onextendextend. Add intermediary expressions tosummarizeproject##UI Changes
