Skip to content

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

@penghuo

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"
}

Metadata

Metadata

Assignees

Labels

PPLPiped processing languagebugSomething isn't working

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions