Repository: sqlfluff/sqlfluff
Issue category: Bug Report

Issue:
RF02 issue from (x, acc) in aggregate function
### Search before asking

- [X] I searched the [issues](https://github.com/sqlfluff/sqlfluff/issues) and found no similar issues.


### What Happened

This is more of a question, really. I'm not sure if the issue is with sqlfluff, or if the issue is between the keyboard and the chair. I browsed issues and the web and couldn't find anyone with a similar issue, so I very well could be doing something wrong. I'm getting a linting error RF02 (references.qualification) anytime I'm using an aggregate (or reduce) function. Is there a setting somewhere that I am missing so that these parameters are recognized by sqlfluff as part of the function and not a column of the table?
A couple of example queries included.
![image](https://github.com/user-attachments/assets/6fa9fad7-b942-4624-a4bf-2bdebbf74c37)
![image](https://github.com/user-attachments/assets/3b688ab0-454e-472c-9dde-96c841be6d1e)



### Expected Behaviour

No linting errors within the lambda function when using aggregate

### Observed Behaviour

RF02 (references.qualification) error

### How to reproduce

simple select statement using aggregate(some_column, 0, (acc, x) -> acc + x)

### Dialect

databricks

### Version

sqlfluff, version 3.2.5
python version 3.12.7
dbt-core, dbt-databricks 1.8.5

I am, however, using sqlfluff templater jinja rather than dbt

### Configuration

.sqlfluff:
```yml
[sqlfluff]
# Custom rules
max_line_length = 100

# Supported dialects https://docs.sqlfluff.com/en/stable/dialects.html
# Or run 'sqlfluff dialects'
dialect = databricks

# One of [raw|jinja|python|placeholder]
templater = jinja

# Comma separated list of rules to exclude, or None
# See https://docs.sqlfluff.com/en/stable/configuration.html#enabling-and-disabling-rules
# AM04 (ambiguous.column_count) and ST06 (structure.column_order) are
# two of the more controversial rules included to illustrate usage.
exclude_rules = ambiguous.column_count, structure.column_order, aliasing.table

[sqlfluff:templater:jinja] 
load_macros_from_path = ./macros
```

.sqlfluffignore
```yml
/target/
dbt_modules/
dbt_packages/
macros/
```

### 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

- [X] I agree to follow this project's [Code of Conduct](https://github.com/sqlfluff/sqlfluff/blob/main/CODE_OF_CONDUCT.md)



Hints:

Patch:
diff --git a/src/sqlfluff/utils/analysis/select.py b/src/sqlfluff/utils/analysis/select.py
index 27b722acff1..3b9576c2aeb 100644
--- a/src/sqlfluff/utils/analysis/select.py
+++ b/src/sqlfluff/utils/analysis/select.py
@@ -212,7 +212,13 @@ def _get_pivot_table_columns(
 def _get_lambda_argument_columns(
     segment: BaseSegment, dialect: Optional[Dialect]
 ) -> List[BaseSegment]:
-    if not dialect or dialect.name not in ["athena", "sparksql", "duckdb", "trino"]:
+    if not dialect or dialect.name not in [
+        "athena",
+        "sparksql",
+        "duckdb",
+        "trino",
+        "databricks",
+    ]:
         # Only athena and sparksql are known to have lambda expressions,
         # so all other dialects will have zero lambda columns
         return []


Test patch:
diff --git a/test/fixtures/rules/std_rule_cases/RF02.yml b/test/fixtures/rules/std_rule_cases/RF02.yml
index 78c8b9ae814..fdc0e55e7ba 100644
--- a/test/fixtures/rules/std_rule_cases/RF02.yml
+++ b/test/fixtures/rules/std_rule_cases/RF02.yml
@@ -106,6 +106,18 @@ test_allow_unqualified_references_in_sparksql_lambdas:
     core:
       dialect: sparksql
 
+test_pass_databricks_lambdas:
+  pass_str: |
+    select
+        i.*,
+        aggregate(i.some_column, 0, (acc, x) -> acc + x) as y
+    from some_table as o
+    inner join some_other_table as i
+        on o.id = i.id;
+  configs:
+    core:
+      dialect: databricks
+
 test_allow_unqualified_references_in_athena_lambdas:
   pass_str: |
     select