-
-
Notifications
You must be signed in to change notification settings - Fork 873
Description
Search before asking
- I searched the issues and found no similar issues.
What Happened
The higher-order functions TRANSFORM()
, REDUCE()
and FILTER()
in Snowflake require the use of a lambda expressions. However, the syntax below wrongly triggers RF02 & RF03 with the anonymous being flagged as an unqualified reference.
SELECT TRANSFORM(tbl.array, a INT -> a * 2) FROM table AS tbl
Expected Behaviour
SELECT TRANSFORM(tbl.array, a INT -> a * 2) FROM table AS tbl
This is valid SQL which shouldn't trigger rules RF02 and RF03.
Observed Behaviour
SELECT TRANSFORM(tbl.array, a INT -> a * 2) FROM table AS tbl
This is triggers rules RF02 & RF03.
Note that there is no workaround since the syntax below returns as syntax error.
SELECT TRANSFORM(tbl.array, tbl.a INT -> tbl.a * 2) FROM table AS tbl
How to reproduce
Simply use sqlfluff on any Snowflake sql using a higher-order function with a lambda expression.
Dialect
Snowflake
Version
3.2.5
Configuration
[sqlfluff]
# The dialect of SQL you're using (e.g., postgres, mysql, snowflake)
dialect = snowflake
# Linter behavior
exclude_rules = ST02,ST06,ST07
# Formatting settings
indent_unit = space
tab_space_size = 4
max_line_length = 120
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upper
[sqlfluff:rules:capitalisation.identifiers]
capitalisation_policy = lower
[sqlfluff:templater:jinja]
load_macros_from_path = dbt/macros
[sqlfluff:templater:jinja:context]
target={"name":"prod"}
Are you willing to work on and submit a PR to address the issue?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct