Repository navigation
Conversation
|
Workflow [PR], commit [f34341a] Summary: ❌
AI ReviewSummaryThis PR fixes Final Verdict✅ No blocking findings. |
| -- which depends on internal allocation sizes. | ||
| CREATE TABLE check_system_tables Engine=Set() AS SELECT * FROM numbers(50); | ||
| SELECT total_bytes, total_rows FROM system.tables WHERE name = 'check_system_tables' AND database = currentDatabase(); | ||
| SELECT total_bytes BETWEEN 2048 AND 15000, total_rows FROM system.tables WHERE name = 'check_system_tables' AND database = currentDatabase(); |
There was a problem hiding this comment.
It is deterministic. This pattern is copied from the JOIN test below:
CREATE TABLE check_system_tables Engine=Join(ANY, LEFT, number) AS SELECT * FROM numbers(50);
SELECT total_bytes BETWEEN 4000 AND 15000, total_rows FROM system.tables WHERE name = 'check_system_tables' AND database = currentDatabase();
INSERT INTO check_system_tables SELECT number+50 FROM numbers(50);
SELECT total_bytes BETWEEN 4000 AND 15000, total_rows FROM system.tables WHERE name = 'check_system_tables' AND database = currentDatabase();This is written this way to emphasis the fact that total_bytes is more than 2048 (which is exactly the bytes used by the HashTable). If you prefer the version without BETWEEN 2048 AND 15000, I can simplify it.
There was a problem hiding this comment.
Yes, let's just match the "total_bytes" here (w/o BETWEEN). If it is deterministic it looks better.
There was a problem hiding this comment.
Okay, I will change both.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 6/7 (85.71%) · Uncovered code |
SizeLimits::checkforDISTINCTandINsets was called withgetTotalByteCount, which returned only the hash table buffer size and ignored thestring_poolarena where the actual bytes ofString/FixedStringkeys are stored. For string keys the limit therefore compared ~16 bytes per key against the budget while the real memory grew unbounded.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
max_bytes_in_distinctandmax_bytes_in_setnot counting the bytes ofStringandFixedStringkeys. The keys themselves are stored in the set's string pool, but only the hash table buffer (about 16 bytes per key) was checked against the limit, so for string keys the limits were exceeded by an unbounded factor before tripping. Queries running close to these limits on string keys now stop or throw where they previously did not.