-
Notifications
You must be signed in to change notification settings - Fork 3
Aggregate value should be true for any_value operator #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
@@ -188,7 +188,7 @@ def find_aliases | |||
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) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
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) |
Copilot uses AI. Check for mistakes.
@@ -188,7 +188,7 @@ def find_aliases | |||
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Clickup - https://app.clickup.com/t/2323726/PRED-13029