Skip to content

LOCATE function fails in a very specific way #49557

Closed
@astefan

Description

@astefan

SELECT LOCATE(CASE WHEN FALSE THEN NULL ELSE LEFT(first_name, 1) END, first_name) > 0 AS x FROM test_emp

fails with

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "expected [3] children but received [2]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "expected [3] children but received [2]"
  },
  "status" : 400
}

No stack trace in logs...
Failed to simplify the failing test more than SELECT LOCATE(CASE WHEN FALSE THEN NULL ELSE 'x' END, first_name) > 0 AS x FROM test_emp, it seems it really needs to have a CASE WHEN that goes on a FALSE branch.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions