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

LOCATE function fails in a very specific way #49557

Closed
astefan opened this issue Nov 25, 2019 · 2 comments · Fixed by #49666
Closed

LOCATE function fails in a very specific way #49557

astefan opened this issue Nov 25, 2019 · 2 comments · Fixed by #49666
Assignees
Labels

Comments

@astefan
Copy link
Contributor

astefan commented Nov 25, 2019

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.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/SQL)

@astefan
Copy link
Contributor Author

astefan commented Dec 3, 2019

master (8.0.0): dd3aeb8
7.x (7.6.0): astefan@4dc83a7
7.5 (7.5.1): e14d00c

@jpountz jpountz changed the title SQL: LOCATE function fails in a very specific way LOCATE function fails in a very specific way Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants