opensearch-project / opensearch-project/sql

[BUG] PPL query return null when access valid inner json object

Open
#4,906 5 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug PPL
Dominant language
Java
Stars
176
Forks
229
Avg merge
2d 21h
Merged PRs (30d)
43

Description

How can one reproduce the bug?

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

{
  "mappings": {
    "properties": {
      "log": {
        "type": "object",
        "enabled": false
      }
    }
  }
}

###
POST {{baseUrl}}/log00001/_bulk
Content-Type: application/x-ndjson

{"index": {}}
{"log": {"a":1, "c": {"d": 2}}}

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

{
  "query": "source=log00001 | fields log.c.d"
}
  • Results
{
  "schema": [
    {
      "name": "log.c.d",
      "type": "undefined"
    }
  ],
  "datarows": [
    [
      null
    ]
  ],
  "total": 1,
  "size": 1
}

What is the expected behavior?
It should return

{
  "schema": [
    {
      "name": "log.c.d",
      "type": "int"
    }
  ],
  "datarows": [
    [
      2
    ]
  ],
  "total": 1,
  "size": 1
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.