Skip to content

Commit 3fe5b42

Browse files
committed
test: regression test for LadybugDB/ladybug#1067 ORDER BY STRING then numeric
Merging sorted key blocks ignored trailing keys once all STRING keys tied, misordering the second key (deterministic with multiple key blocks, e.g. 20k rows).
1 parent 0176c78 commit 3fe5b42

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎test/test_issue.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@
1010
# required by python-lint
1111

1212

13+
def test_issue_1067_order_by_string_then_numeric(conn_db_readwrite: ConnDB) -> None:
14+
# https://github.com/LadybugDB/ladybug/issues/1067
15+
# KeyBlockMerger::compareTuplePtrWithStringCol ignored trailing keys once all
16+
# STRING keys tied, misordering e.g. ORDER BY <STRING>, <numeric> when merging
17+
# sorted key blocks (deterministic once the sort spills to multiple key blocks).
18+
conn, _ = conn_db_readwrite
19+
conn.execute(
20+
"CREATE NODE TABLE Obs(id INT64, name STRING, value DOUBLE, PRIMARY KEY(id))"
21+
)
22+
conn.execute(
23+
"COPY Obs FROM (UNWIND range(0, 19999) AS o RETURN o, "
24+
"'item' + CAST(o % 3 AS STRING), CAST((o * 7919) % 100003 AS DOUBLE))"
25+
)
26+
result = conn.execute(
27+
"MATCH (o:Obs) RETURN o.name, o.value ORDER BY o.name, o.value"
28+
)
29+
rows = result.get_all()
30+
result.close()
31+
assert rows == sorted(rows)
32+
33+
1334
def test_param_empty(conn_db_readwrite: ConnDB) -> None:
1435
conn, _ = conn_db_readwrite
1536
lst = [[]]

0 commit comments

Comments
 (0)