Skip to content

[BUG] Tolerant type mismatch between field type and actual data #4330

Closed as duplicate

Description

@penghuo

What is the bug?
search source=log* | eval xx=flags * 100 returns HTTP 500 with ClassCastException when some documents have flags as a multi-valued field (array) despite the mapping being integer. The operation should be type-tolerant: compute for numeric scalars; return null for non-numeric or non-scalar values—never a 500.

How can one reproduce the bug?

###
POST {{baseUrl}}/_plugins/_ppl
Content-Type: application/x-ndjson

{
  "query": "search source=log* | eval xx=flags * 100 "
}

{
  "error": {
    "reason": "There was internal problem at backend",
    "details": "class java.util.ArrayList cannot be cast to class java.lang.Integer (java.util.ArrayList and java.lang.Integer are in module java.base of loader 'bootstrap')",
    "type": "ClassCastException"
  },
  "status": 500
}

What is the expected behavior?

  • Row with flags=1 → xx=100
  • Row with flags=[1,2,3] (non-scalar) → xx=null

Do you have any additional context?

###
PUT {{baseUrl}}/log-001
Content-Type: application/x-ndjson

{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 1
  },
  "mappings": {
    "properties": {
      "traceId": {"type": "text"},
      "flags": {"type": "integer"},
      "@timestamp": {"type": "date"}
    }
  }
}

### 
POST {{baseUrl}}/log-001/_doc
Content-Type: application/x-ndjson

{
    "traceId": "1",
    "flags": 1,
    "@timestamp": "2025-09-04T16:17:39.133Z"
}

###
POST {{baseUrl}}/log-001/_doc
Content-Type: application/x-ndjson

{
    "traceId": 1
    "flags": [1,2,3],
    "@timestamp": "2025-09-04T16:17:39.133Z"
}

Activity

  1. added
    bug
    PPL
    and removed on Sep 18, 2025
  2. LantaoJin commented on Sep 22, 2025

    @LantaoJin
    Member

    need a further discussion? no idea for now

  3. penghuo commented on Sep 23, 2025

    @penghuo
    CollaboratorAuthor

    need a further discussion? no idea for now

    Let's discuss in #4349

  4. moved this from Not Started to In progress in PPL Trackeron Nov 10, 2025
  5. moved this from In progress to Done in PPL Trackeron Jan 5, 2026
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