Skip to content

[BUG] Casting to IP is not supported with Calcite #3918

@yuancu

Description

@yuancu

What is the bug?

With Calcite, when I try to cast a value to IP, it fails with the following error:

os> source=weblogs | where cast('1.1.1.1' as ip)
{
  "error": {
    "reason": "Invalid Query",
    "details": "Was not expecting value 'OTHER' for enumeration 'org.apache.calcite.sql.type.SqlTypeName' in this context",
    "type": "CalciteUnsupportedException"
  },
  "status": 400
}

How can one reproduce the bug?

curl --location 'http://localhost:9200/_plugins/_ppl' \
--header 'Content-Type: application/json' \
--data '{
  "query" : "source=weblogs | head 1 | eval ip = cast('1.1.1.1' as ip) | fields ip"
}
'

What is the expected behavior?
Return with the following schema and data (as in V2):

{
    "schema": [
        {
            "name": "ip",
            "type": "ip"
        }
    ],
    "datarows": [
        [
            "1.1.1.1"
        ]
    ],
    "total": 1,
    "size": 1
}

What is your host/environment?

  • OS: MacOS
  • Version: 3.1.0
  • Plugins: sql

Do you have any screenshots?

Do you have any additional context?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcalcitecalcite migration releatedenhancementNew feature or request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions