2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
|
|
|
ID: issue-3970
|
|
|
|
ISSUE: 3970
|
|
|
|
TITLE: Window Function: cume_dist()
|
|
|
|
DESCRIPTION:
|
|
|
|
Could not find any interesting sample with this function. Decided to use string
|
|
|
|
comparison with unicode_ci_ai collation.
|
|
|
|
JIRA: CORE-3617
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_3617
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
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 = """
|
2021-04-26 20:07:00 +02:00
|
|
|
create domain dm_utf8 varchar(20) character set utf8 collate unicode_ci_ai;
|
|
|
|
commit;
|
|
|
|
recreate table test_ciai( id int, s dm_utf8 );
|
|
|
|
commit;
|
|
|
|
|
|
|
|
insert into test_ciai values(1, 'CANción');
|
|
|
|
insert into test_ciai values(2, 'peluqueria');
|
|
|
|
insert into test_ciai values(3, 'peluQUEría');
|
|
|
|
insert into test_ciai values(4, 'cancíON');
|
|
|
|
commit;
|
|
|
|
|
|
|
|
set list on;
|
|
|
|
|
|
|
|
select s, id, cume_dist()over(order by s) as c_dist
|
|
|
|
from test_ciai
|
|
|
|
order by cume_dist()over(order by id desc);
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
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
|
|
|
S cancíON
|
|
|
|
ID 4
|
|
|
|
C_DIST 0.5000000000000000
|
2022-01-22 21:59:15 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
S peluQUEría
|
|
|
|
ID 3
|
|
|
|
C_DIST 1.000000000000000
|
|
|
|
|
|
|
|
S peluqueria
|
|
|
|
ID 2
|
|
|
|
C_DIST 1.000000000000000
|
|
|
|
|
|
|
|
S CANción
|
|
|
|
ID 1
|
|
|
|
C_DIST 0.5000000000000000
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=4.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
|
|
|
|