Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Enhance OS value parsing #3001

Open
bugmakerrrrrr opened this issue Sep 9, 2024 · 1 comment · May be fixed by #3002
Open

[BUG] Enhance OS value parsing #3001

bugmakerrrrrr opened this issue Sep 9, 2024 · 1 comment · May be fixed by #3002
Labels
bug Something isn't working

Comments

@bugmakerrrrrr
Copy link
Contributor

What is the bug?
In OS, the numeric/boolean fields can be indexed in text format, and the string field can be indexed in numeric format, but the sql plugin cannot parse these value correctly.

How can one reproduce the bug?

PUT test
{
  "mappings": {
    "properties": {
      "field1": {
        "type": "long"
      },
      "field2": {
        "type": "boolean"
      }
    }
  }
}

POST test/_bulk?refresh=true
{"index": {}}
{"field1": ["1", 1], "field2": ["true", true]}
{"index": {}}
{"field1": "1", "field2": "true"}

POST _plugins/_sql
{
  "query": "select field1, field2 from test"
}

#response
{
  "schema": [
    {
      "name": "field1",
      "type": "long"
    },
    {
      "name": "field2",
      "type": "boolean"
    }
  ],
  "datarows": [
    [
      "1",
      "true"
    ],
    [
      0,
      false
    ]
  ],
  "total": 2,
  "size": 2,
  "status": 200
}
@bugmakerrrrrr bugmakerrrrrr added bug Something isn't working untriaged labels Sep 9, 2024
@bugmakerrrrrr bugmakerrrrrr linked a pull request Sep 9, 2024 that will close this issue
7 tasks
@dai-chen
Copy link
Collaborator

PPL (or SQL v2) shows numerical field with string value as 0.

POST num_with_string_value/_doc
{
  "number": 123
}

POST num_with_string_value/_doc
{
  "number": "456"
}

POST _plugins/_ppl
{
  "query": "source = num_with_string_value | where number > 0"
}
{
  "schema": [
    {
      "name": "number",
      "type": "long"
    }
  ],
  "datarows": [
    [
      0
    ],
    [
      123
    ]
  ],
  "total": 2,
  "size": 2
}

@YANG-DB YANG-DB removed the untriaged label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants