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

Left join returns not-matching entries with match() over right table #2344

Closed
5 tasks done
glookka opened this issue Jun 28, 2024 · 1 comment
Closed
5 tasks done
Assignees

Comments

@glookka
Copy link
Contributor

glookka commented Jun 28, 2024

Bug Description:

Left join returns not matching entries with nulled out data when match() is specified for the right table:

drop table if exists join1;
drop table if exists join2;

create table join1 ( id bigint, title text, string_id integer, tmp string attribute, j json ) engine='columnar';
create table join2 ( id bigint, title text, string_id integer, name string attribute engine='columnar', j json );

insert into join1 values (1, 'title1', 1, 'tmp1', '{"sort":5,"a":1,"table":"join1"}');
insert into join1 values (2, 'title2', 2, 'tmp2', '{"sort":6,"b":2,"table":"join1"}');
insert into join1 values (3, 'title3', 3, 'tmp3', '{"sort":7,"c":3,"table":"join1"}');
insert into join1 values (4, 'title4', 4, 'tmp4', '{"sort":8,"d":4,"table":"join1"}');

insert into join2 values (1, 'title1', 1, 'name1', '{"sort":10,"a":1,"table":"join2"}');
insert into join2 values (2, 'title2', 2, 'name2', '{"sort":5,"b":2,"table":"join2"}');

Query:

select title, join2.title, uint(join2.j.sort) as table2, weight() * (j.sort + table2) as test2 from join1 left join join2 on join1.string_id = join2.string_id where match('title2', join2) order by test2 desc;

Result:

+--------+-------------+--------+-------+
| title  | join2.title | table2 | test2 |
+--------+-------------+--------+-------+
| title2 | title2      |      5 |    11 |
| title4 | NULL        |   NULL |     8 |
| title3 | NULL        |   NULL |     7 |
| title1 | NULL        |   NULL |     5 |
+--------+-------------+--------+-------+
4 rows in set (0.00 sec)

Manticore Search Version:

6.3.1

Operating System Version:

Any

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 updated
@glookka glookka added the bug label Jun 28, 2024
@glookka glookka self-assigned this Jun 28, 2024
@glookka
Copy link
Contributor Author

glookka commented Jun 28, 2024

Fixed in 5b77336

@glookka glookka closed this as completed Jun 28, 2024
@sanikolaev sanikolaev added the rel::upcoming Upcoming release label Jun 28, 2024
@sanikolaev sanikolaev added rel::6.3.4 and removed rel::upcoming Upcoming release labels Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants