Skip to content

[BUG] bin then chart with null values causes NullPointerException in compareTo #5174

Closed

Description

@penghuo

Query Information

PPL Command/Query:

source=bounty-numbers | bin value span=50 as val_bin | chart count() over val_bin by category

Expected Result:
Rows with null value should be handled safely (skipped or grouped) without server crash.

Actual Result:
HTTP 500 with NPE:
Cannot invoke "java.lang.Comparable.compareTo(Object)" because "v0" is null.

Dataset Information

Dataset/Schema Type

  • OpenTelemetry (OTEL)
  • Simple Schema for Observability (SS4O)
  • Open Cybersecurity Schema Framework (OCSF)
  • Custom (details below)

Index Mapping

{
  "mappings": {
    "properties": {
      "count": { "type": "integer" },
      "category": { "type": "keyword" },
      "subcategory": { "type": "keyword" },
      "value": { "type": "double" },
      "ts": { "type": "date" }
    }
  }
}

Sample Data

[
  { "count": 1, "category": "A", "subcategory": "X", "value": 10.5, "ts": "2024-01-01" },
  { "count": 2, "category": "A", "subcategory": "Y", "value": 20.3, "ts": "2024-01-02" },
  { "count": 10, "category": "B", "subcategory": "X", "value": 100.0, "ts": "2024-01-03" },
  { "count": null, "category": "B", "subcategory": "Y", "value": null, "ts": "2024-01-04" }
]

Bug Description

Issue Summary:
bin + chart crashes when null bin values exist.

Steps to Reproduce:

  1. Create index and include at least one document with value = null.
  2. Run the query above.
  3. Observe HTTP 500 NPE.

Impact:
Charting queries become unstable on sparse real-world data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PPLbuggood-for-agent

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions