2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
|
|
|
ID: issue-3909
|
|
|
|
ISSUE: 3909
|
|
|
|
TITLE: Nested loop plan is chosen instead of the sort merge for joining independent streams using keys of different types
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-3553
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
test_script = """SET PLAN ON;
|
2021-04-26 20:07:00 +02:00
|
|
|
select count(*)
|
|
|
|
from rdb$database d1 join rdb$database d2
|
|
|
|
on cast(d1.rdb$relation_id as char(10)) = cast(d2.rdb$relation_id as char(20));
|
|
|
|
"""
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
PLAN HASH (D2 NATURAL, D1 NATURAL)
|
|
|
|
|
|
|
|
COUNT
|
|
|
|
=====================
|
|
|
|
1
|
|
|
|
"""
|
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-22 21:59:15 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|