Skip to content

[BUG] Group-by fields can not be aliased to the original field names with Calcite #4580

Closed

Description

@yuancu

What is the bug?

Queries that rename the group-by fields to their original field names will report errors when Calcite is enabled:

source=time_test | stats count() by span(value, 2000) as value
source=time_test | stats count() by span(timestamp, 1h) as timestamp

The error reports something like field [field_name] not found, input fields are [field_name0, ...]

{
  "error": {
    "reason": "Invalid Query",
    "details": "field [value] not found; input fields are: [value0, count()]",
    "type": "IllegalArgumentException"
  },
  "status": 400
}

This prohibits queries like by field_name span=xxx, where the output field name remains the same with the original field (field_name in this case).

How can one reproduce the bug?

POST /_plugins/_ppl
{
  "query" : "source=time_test | stats count() by span(value, 2000) as value"
}

What is the expected behavior?

The query can be executed when Calcite is disabled:

Output:

{
  "schema": [
    {
      "name": "count()",
      "type": "bigint"
    },
    {
      "name": "value",
      "type": "int"
    }
  ],
  "datarows": [
    [
      49,
      6000
    ],
    [
      51,
      8000
    ]
  ],
  "total": 2,
  "size": 2
}

What is your host/environment?

  • OS: macOS
  • Version: 3.3.0
  • Plugins

Do you have any additional context?
Add any other context about the problem.

Activity

  1. added
    bug
    and removed on Oct 16, 2025
  2. added
    calcite
    PPL
    and removed on Oct 16, 2025
  3. self-assigned this
    on Oct 16, 2025
  4. moved this from Not Started to Done in PPL Trackeron Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PPLbugcalcite

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions