Skip to content

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

@yuancu

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.

Metadata

Metadata

Assignees

Labels

PPLPiped processing languagebugSomething isn't workingcalcitecalcite migration releated

Type

No type

Projects

Status

Not Started

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions