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

[BUG] Join query doesn't support multi_match function #3135

Open
dai-chen opened this issue Oct 29, 2024 · 0 comments
Open

[BUG] Join query doesn't support multi_match function #3135

dai-chen opened this issue Oct 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dai-chen
Copy link
Collaborator

What is the bug?

The JOIN query does not support the multi_match function in the WHERE clause due to table alias missing. This limitation arises due to two primary reasons:

  1. A validation step requires that the left side of the expression use a table alias.
  2. The optimizer relies on the alias to determine which table should receive the filtering condition.

How can one reproduce the bug?

  @Test
  public void multiMatchQuerySingleField() throws IOException {
    assertThat(
        query(
            "SELECT a.firstname",
            FROM_ACCOUNTS + " AS a INNER JOIN " + TEST_INDEX_ACCOUNT + " AS b ON a.firstname = b.firstname",
            "WHERE MULTI_MATCH('query'='Ayers', 'fields'='firstname')"),
        hits(hasValueForFields("Ayers", "firstname")));
  }

{
  "error": {
    "reason": "Invalid SQL query",
    "details": "Field ['query' = 'Ayers'] with condition [AND 'query' = 'Ayers' EQ
MULTI_MATCH(com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr@101a1ce6,
com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr@b5dbbdc4)] does not contain an alias",
    "type": "SqlParseException"
  },
  "status": 400
}

What is the expected behavior?

The JOIN query should support the multi_match function in the WHERE clause without problem.

Do you have any additional context?

N/A

@dai-chen dai-chen added bug Something isn't working untriaged and removed untriaged labels Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant