Skip to content

[BUG] IF function contain equal expression return ExpressionEvaluationException #3992

@penghuo

Description

@penghuo

What is the bug?

  • = expression works as expected in eval
source=logs-otel | parse body 'HTTP/1.1 (?<httpstatus>\\d+)' | eval status200=httpstatus='200' | fields httpstatus, status200
  • = throw expression when used inside if expression
source=logs-otel | parse body 'HTTP/1.1 (?<httpstatus>\\d+)' | eval status200=if(httpstatus='200', 1, 0) | fields httpstatus, status200

{
  "error": {
    "reason": "Invalid Query",
    "details": "IF function expects {[BOOLEAN,ANY,ANY]}, but got [STRING,INTEGER,INTEGER]",
    "type": "ExpressionEvaluationException"
  },
  "status": 400
}

What is the expected behavior?
No exception.

Do you have any screenshots?
n/a

Do you have any additional context?

###
PUT {{baseUrl}}/_plugins/_query/settings
Content-Type: application/x-ndjson

{
  "transient" : {
    "plugins.calcite.enabled" : true
  }
}


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

{"index": {}}
{"regionId": 1, "body": "HTTP/1.1 200 UT response_timeout - \"-\" 380 24 15000"}
{"index": {}}
{"regionId": 1, "body": "HTTP/1.1 301 UT response_timeout - \"-\" 380 24 15000"}
{"index": {}}
{"regionId": 2, "body": "HTTP/1.1 404 UT response_timeout - \"-\" 380 24 15000"}
{"index": {}}
{"regionId": 2, "body": "HTTP/1.1 504 UT response_timeout - \"-\" 380 24 15000"}
{"index": {}}
{"regionId": 2, "body": "HTTP/1.1 900 UT response_timeout - \"-\" 380 24 15000"}

Metadata

Metadata

Assignees

Labels

PPLPiped processing languagePriority-HighbugSomething isn't workingcalcitecalcite migration releated

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions