Users/alison needs copilot/support parentheses for calculated measures#3
Open
Conversation
added 3 commits
February 10, 2026 05:05
- Add _ParseState class for unified parsing state tracking - Add _find_top_level_operator to find operators at depth 0 (outside quotes, brackets, and parens) - Add _count_outer_parens to handle nested parentheses in expressions - Add _wrap_column_refs_in_parens for arithmetic precedence - Update _escape_and_quote_columns to handle parenthesized expressions - Update _has_operators_outside_quotes to use new top-level operator detection - Refactor _is_inside_quotes_or_brackets and _find_matching_paren to use _ParseState - Remove old _find_operator_outside_quotes (replaced by _find_top_level_operator) - Update tests to reflect correct behavior for count(*) - no longer seen as expression with operators
- Add position constants to TestFindTopLevelOperator class - Add paren count constants to TestCountOuterParens class - Add closing position constants to TestFindMatchingParen class - Add aggregate count constants to TestExtractAndReplaceAggregates class - Add integration tests for parentheses preservation, quoted identifiers, uppercase functions, and extend after summarize
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, calculated measures with parentheses were not parsed correctly resulting in mangled queries that produced