tidb-0001: partition drop name lookup O(P×D) → O(P+D) (27x at P=8192) tidb-0002: predicate simplification (merged into tidb-0002 in prior commit) tidb-0003: list partition group intersect O(G²) → O(G) (renumbered from 0002) scylladb-0001: UNDF stamp added
20 lines
939 B
Diff
20 lines
939 B
Diff
# UNDF: UNDF-2026-000000529
|
||
# UNDF: (leave blank)
|
||
--- a/cql3/selection/selection.cc
|
||
+++ b/cql3/selection/selection.cc
|
||
@@ -499,11 +499,15 @@ selection::from_selectors(data_dictionary::database db, schema_ptr schema, const
|
||
std::vector<const column_definition*> defs;
|
||
|
||
+ // Use an unordered_set for O(1) deduplication instead of O(D) linear
|
||
+ // std::find scan per column reference. For a SELECT with S column
|
||
+ // references over D distinct columns the old code was O(S×D); the patch
|
||
+ // makes it O(S).
|
||
+ std::unordered_set<const column_definition*> defs_seen;
|
||
for (auto&& [sel, alias] : prepared_selectors) {
|
||
expr::for_each_expression<expr::column_value>(sel, [&] (const expr::column_value& cv) {
|
||
- if (std::find(defs.begin(), defs.end(), cv.col) == defs.end()) {
|
||
+ if (defs_seen.insert(cv.col).second) {
|
||
defs.push_back(cv.col);
|
||
}
|
||
});
|
||
}
|