Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/query_helper/sql_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor Author

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.

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)
Copy link

Copilot AI Jun 13, 2025

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.

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)

Copilot uses AI. Check for mistakes.
) if sql_alias
end
column_maps.compact
Expand Down
2 changes: 1 addition & 1 deletion lib/query_helper/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class QueryHelper
VERSION = "0.4.3"
VERSION = "0.4.4"
end
Loading