Skip to content

[BUG] Agg pushdown not work with two equivalent count(FIELD) #4347

Closed

Description

@LantaoJin

What is the bug?

source=accounts 
| eval account_number_alias = account_number 
| stats count(account_number), count(account_number_alias) as c2 by gender

Explain

{
  "calcite": {
    "logical": """LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])
  LogicalProject(count(account_number)=[$1], c2=[$2], gender=[$0])
    LogicalAggregate(group=[{0}], count(account_number)=[COUNT($1)], c2=[COUNT($2)])
      LogicalProject(gender=[$4], account_number=[$0], account_number_alias=[$0])
        CalciteLogicalIndexScan(table=[[OpenSearch, accounts]])
""",
    "physical": """EnumerableLimit(fetch=[10000])
  EnumerableCalc(expr#0..2=[{inputs}], count(account_number)=[$t1], c2=[$t2], gender=[$t0])
    EnumerableAggregate(group=[{0}], count(account_number)=[COUNT($1)], c2=[COUNT($1)])
      CalciteEnumerableIndexScan(table=[[OpenSearch, accounts]], PushDownContext=[[PROJECT->[gender, account_number]], OpenSearchRequestBuilder(sourceBuilder={"from":0,"timeout":"1m","_source":{"includes":["gender","account_number"],"excludes":[]}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
"""
  }
}

What is the expected behavior?
Two count aggregations should be pushed down.

Activity

  1. added
    bug
    pushdown
    and removed on Sep 22, 2025
  2. self-assigned this
    on Sep 22, 2025
  3. changed the title [-][BUG] Agg pushdown not work with two count(FIELD)[/-] [+][BUG] Agg pushdown not work with two equivalent count(FIELD)[/+] on Sep 22, 2025
  4. moved this from Not Started to Done in PPL Trackeron Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpushdown

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions