Skip to content

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

Closed

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?

Activity

  1. added
    bug
    on Jul 24, 2025
  2. added
    enhancement
    calcite
    and removed on Jul 24, 2025
  3. moved this from Not Started to Done in PPL Trackeron Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugcalciteenhancement

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions