Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test/test_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,27 @@ def test_issue_866_repeated_parameterized_write_then_vector_read(
# assert result.get_next() == [2]
# assert not result.has_next()
# result.close()


def test_issue_1067_order_by_string_then_numeric(conn_db_readwrite: ConnDB) -> None:
# https://github.com/LadybugDB/ladybug/issues/1067
# KeyBlockMerger::compareTuplePtrWithStringCol ignored trailing keys once all
# STRING keys tied, misordering e.g. ORDER BY <STRING>, <numeric> when merging
# sorted key blocks (deterministic once the sort spills to multiple key blocks).
conn, _ = conn_db_readwrite
conn.execute(
"CREATE NODE TABLE Obs(id INT64, name STRING, value DOUBLE, PRIMARY KEY(id))"
)
conn.execute(
"COPY Obs FROM (UNWIND range(0, 19999) AS o RETURN o, "
"'item' + CAST(o % 3 AS STRING), CAST((o * 7919) % 100003 AS DOUBLE))"
)
result = conn.execute(
"MATCH (o:Obs) RETURN o.name, o.value ORDER BY o.name, o.value"
)
rows = result.get_all()
result.close()
# Fail loudly if ingestion ever changes: the bug only reproduces once the
# sort spills to multiple key blocks.
assert len(rows) == 20000
assert rows == sorted(rows)
Loading