Skip to content

[BUG] Parsing fails after aggregation when field types are transformed to non-numeric strings #4115

Closed

Description

@ahkcs

What is the bug?
When operations transform numeric fields to produce non-numeric string values (e.g., "30-40", "20-25"), the response parser fails. The aggregation itself executes correctly in OpenSearch, but parsing the response fails because the parser uses type information that is not updated.

How can one reproduce the bug?
This issue affects multiple operations that transform field types:

Example 1: bin command produces range strings

  curl -X POST "localhost:9200/_plugins/_ppl" \
    -H "Content-Type: application/json" \
    -d '{"query":"source=accounts | bin age span=10 | stats count() by age"}'
  Error: For input string: "30-40"

Example 2: eval with string concatenation

  curl -X POST "localhost:9200/_plugins/_ppl" \
    -H "Content-Type: application/json" \
    -d '{"query":"source=accounts | eval age = CAST(age AS STRING) + \"-25\" | stats count() by age | head 3"}'
  Error: For input string: "20-25"

Both fail with:

  {
    "error": {
      "reason": "There was internal problem at backend",
      "details": "java.sql.SQLException: exception while executing query: For input string: \"20-25\"",
      "type": "RuntimeException"
    },
    "status": 500
  }

What is the expected behavior?
Expected for bin command:

  {
    "schema": [
      {"name": "count()", "type": "bigint"},
      {"name": "age", "type": "string"}
    ],
    "datarows": [
      [451, "20-30"],
      [504, "30-40"],
      [45, "40-50"]
    ]
  }

Expected for eval with concatenation:

  {
    "schema": [
      {"name": "count()", "type": "bigint"},
      {"name": "age", "type": "string"}
    ],
    "datarows": [
      [44, "20-25"],
      [46, "21-25"],
      [51, "22-25"]
    ]
  }

Do you have any additional context?

  • This issue was initially discovered with the bin command but affects any operation that transforms field types to produce non-numeric strings
  • The extendTypeMapping method uses putIfAbsent which was designed to prevent overwriting field types

Activity

  1. added
    bug
    on Aug 22, 2025
  2. changed the title [-][BUG] Aggregation pushdown fails when field type changes to produce non-numeric strings[/-] [+][BUG] Parsing fails after aggregation when field types are transformed to non-numeric strings[/+] on Aug 22, 2025
  3. added
    PPL
    and removed on Aug 25, 2025
  4. self-assigned this
    on Sep 22, 2025
  5. moved this from Not Started to Done in PPL Trackeron Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PPLbug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions