Aggregate value should be true for any_value operator#61
Merged
mayank0109 merged 2 commits intomasterfrom Jun 13, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates QueryHelper to ensure that the aggregate value is correctly detected when using the any_value operator.
- Bumps the library version from 0.4.3 to 0.4.4.
- Extends the SQL parsing regex to cover the any_value operator by explicitly including both lower- and uppercase variants.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/query_helper/version.rb | Version updated to reflect a new release |
| lib/query_helper/sql_parser.rb | Regex altered to recognize any_value aggregate operator |
| alias_name: sql_alias, | ||
| sql_expression: sql_expression.squish, | ||
| aggregate: /\b(array_agg|avg|bit_and|bit_or|bool_and|bool_or|boolor_agg|booland_agg|count|every|json_agg|jsonb_agg|json_object_agg|jsonb_object_agg|max|min|string_agg|sum|xmlagg)\((.*)\)/.match?(sql_expression) | ||
| aggregate: /\b(array_agg|avg|bit_and|bit_or|bool_and|bool_or|boolor_agg|booland_agg|count|every|json_agg|jsonb_agg|json_object_agg|jsonb_object_agg|max|min|string_agg|sum|xmlagg|any_value|ANY_VALUE)\((.*)\)/.match?(sql_expression) |
There was a problem hiding this comment.
[nitpick] Consider using a case-insensitive regex flag to handle operator variations (e.g., /i flag), rather than listing both lower and uppercase versions explicitly.
Suggested change
| aggregate: /\b(array_agg|avg|bit_and|bit_or|bool_and|bool_or|boolor_agg|booland_agg|count|every|json_agg|jsonb_agg|json_object_agg|jsonb_object_agg|max|min|string_agg|sum|xmlagg|any_value|ANY_VALUE)\((.*)\)/.match?(sql_expression) | |
| aggregate: /\b(array_agg|avg|bit_and|bit_or|bool_and|bool_or|boolor_agg|booland_agg|count|every|json_agg|jsonb_agg|json_object_agg|jsonb_object_agg|max|min|string_agg|sum|xmlagg|any_value)\((.*)\)/i.match?(sql_expression) |
mayank0109
commented
Jun 13, 2025
| ColumnMap.new( | ||
| alias_name: sql_alias, | ||
| sql_expression: sql_expression.squish, | ||
| aggregate: /\b(array_agg|avg|bit_and|bit_or|bool_and|bool_or|boolor_agg|booland_agg|count|every|json_agg|jsonb_agg|json_object_agg|jsonb_object_agg|max|min|string_agg|sum|xmlagg)\((.*)\)/.match?(sql_expression) |
Contributor
Author
There was a problem hiding this comment.
If a search field is fetched using any_value then this regex will return aggregate false for that field due to which filter was applied on where and snowflake query was failing, hence added any_value support in this regex.
smriti154
approved these changes
Jun 13, 2025
satishaher
approved these changes
Jun 13, 2025
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.
Clickup - https://app.clickup.com/t/2323726/PRED-13029