manticoresoftware / manticoresearch

Easy to use open source fast database for search | Good alternative to Elasticsearch now | Drop-in replacement for E in the ELK soon
https://manticoresearch.com
GNU General Public License v3.0
8.93k stars 495 forks source link

Non-full-text matching doesn't work in JOINs via JSON #2562

Open sanikolaev opened 2 weeks ago

sanikolaev commented 2 weeks ago

Bug Description:

MRE:

snikolaev@dev2:~$ mysql -P9306 -h0 -e "drop table if exists t; create table t(i int); insert into t values(1, 2); drop table if exists t2; create table t2(i int); insert into t2 values(1, 3); select * from t left join t2 on t.id = t2.id where t2.i = 4";

curl -sX POST http://localhost:9308/search  -d '
{
  "index": "t",
  "join": [
    {
      "type": "left",
      "table": "t2",
      "on": [
        {
          "left": {
            "table": "t",
            "field": "id"
          },
          "operator": "eq",
          "right": {
            "table": "t2",
            "field": "id"
          }
        }
      ],
      "query": {
        "equals": {
          "t2.i": 4
        }
      }
    }
  ]
}
' |jq .
{
  "took": 0,
  "timed_out": false,
  "hits": {
    "total": 1,
    "total_relation": "eq",
    "hits": [
      {
        "_id": 1,
        "_score": 1,
        "_source": {
          "i": 2,
          "t2.id": 1,
          "t2.i": 3
        }
      }
    ]
  }
}

Expected: no hits since I filter by i=4.

Manticore Search Version:

Manticore 6.3.7 53ae190b8@24091306 dev (columnar 2.3.1 f9ef8b9@24090411) (secondary 2.3.1 f9ef8b9@24090411) (knn 2.3.1 f9ef8b9@24090411)

Operating System Version:

Ubuntu Jammy (dev2)

Have you tried the latest development version?

Yes

Internal Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

- [ ] Implementation completed - [ ] Tests developed - [ ] Documentation updated - [ ] Documentation reviewed - [ ] [Changelog](https://docs.google.com/spreadsheets/d/1mz_3dRWKs86FjRF7EIZUziUDK_2Hvhd97G0pLpxo05s/edit?pli=1&gid=1102439133) updated