Merge pull request #69503 from ClickHouse/backport/24.8/69451

Backport #69451 to 24.8: Fix crash in `sqidDecode`
This commit is contained in:
robot-ch-test-poll 2024-09-11 15:12:57 +02:00 committed by GitHub
commit 3b20cade2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View File

@ -124,7 +124,7 @@ public:
std::string_view sqid = col_non_const->getDataAt(i).toView();
std::vector<UInt64> integers = sqids.decode(String(sqid));
res_nested_data.insert(integers.begin(), integers.end());
res_offsets_data.push_back(integers.size());
res_offsets_data.push_back(res_offsets_data.back() + integers.size());
}
}
else

View File

@ -13,5 +13,6 @@ Td1EnWQo [1,2,3,4]
XMbT
-- invalid sqid
[]
-- bug 69450
-- alias
XMbT

View File

@ -25,5 +25,12 @@ SELECT sqidEncode(toNullable(materialize(1)), toLowCardinality(materialize(2)));
SELECT '-- invalid sqid';
SELECT sqidDecode('invalid sqid');
SELECT '-- bug 69450';
DROP TABLE IF EXISTS tab;
CREATE TABLE tab (id String) ENGINE = MergeTree ORDER BY id;
INSERT INTO tab SELECT * FROM generateRandom() LIMIT 1000000;
SELECT sqidDecode(id) FROM tab FORMAT Null;
DROP TABLE tab;
SELECT '-- alias';
SELECT sqid(1, 2);