Add quote-to-bracket escaping for calculated measures with multiple ad-hoc measures#1
Conversation
added 2 commits
February 6, 2026 00:50
…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
a41cf41 to
fdd3851
Compare
e53f4e9 to
63599f0
Compare
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
This PR enhances the KQL dialect to properly handle calculated measures that contain multiple quoted column references combined with arithmetic operators or constants.
##Problem
Previously, expressions like "Measure 1" + "Measure 2" or "Measure 1" * 2 were not properly escaped. The quote-stripping logic would incorrectly process these expressions, breaking the KQL output. Also, measures containing operators in their names were incorrectly parsed
##Technical Details
_find_operator_outside_quotes()added to find operators not part of the measure name_escape_and_quote_columns()recursively on the left and right side of the operator. This ensures all parts of the expression get bracketed and quoted. Exclude numbers from getting quoted_is_number_literal()to include decimals that start and end with a number##UI Changes


Before:
After: