Skip to content

RF02 issue from (x, acc) in aggregate function #6436

@kalebkemp

Description

@kalebkemp

Search before asking

  • I searched the 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
image

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:

[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

/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions