mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 18:42:26 +00:00
dbms: fixed error with removing temporary columns [#METR-18448].
This commit is contained in:
parent
3d7a3bcd92
commit
fc745dbfa1
@ -781,6 +781,9 @@ void ExpressionActions::finalize(const Names & output_columns)
|
|||||||
|
|
||||||
for (const auto & name : action.prerequisite_names)
|
for (const auto & name : action.prerequisite_names)
|
||||||
++columns_refcount[name];
|
++columns_refcount[name];
|
||||||
|
|
||||||
|
for (const auto & name_alias : action.projection)
|
||||||
|
++columns_refcount[name_alias.first];
|
||||||
}
|
}
|
||||||
|
|
||||||
Actions new_actions;
|
Actions new_actions;
|
||||||
@ -809,6 +812,8 @@ void ExpressionActions::finalize(const Names & output_columns)
|
|||||||
|
|
||||||
for (const auto & name : action.prerequisite_names)
|
for (const auto & name : action.prerequisite_names)
|
||||||
process(name);
|
process(name);
|
||||||
|
|
||||||
|
/// Для projection тут нет уменьшения refcount, так как действие project заменяет имена у столбцов, по сути, уже удаляя их под старыми именами.
|
||||||
}
|
}
|
||||||
|
|
||||||
actions.swap(new_actions);
|
actions.swap(new_actions);
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
1 0 0
|
||||||
|
2015-01-01 2015-01-01 01:02:03 111 123 456 789 456 9434005089510819894 9434005089510819894
|
@ -0,0 +1,23 @@
|
|||||||
|
DROP TABLE IF EXISTS test.defaults;
|
||||||
|
CREATE TABLE test.defaults (a UInt8, b DEFAULT 0, c DEFAULT identity(b)) ENGINE = Memory;
|
||||||
|
INSERT INTO test.defaults (a) VALUES (1);
|
||||||
|
SELECT * FROM test.defaults;
|
||||||
|
DROP TABLE test.defaults;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS test.elog_cut;
|
||||||
|
CREATE TABLE test.elog_cut
|
||||||
|
(
|
||||||
|
date Date DEFAULT toDate(uts),
|
||||||
|
uts DateTime,
|
||||||
|
pr UInt64,
|
||||||
|
ya_uid UInt64,
|
||||||
|
adf_uid UInt64,
|
||||||
|
owner_id UInt32,
|
||||||
|
eff_uid UInt64 DEFAULT if(adf_uid != 0, adf_uid, ya_uid),
|
||||||
|
page_session UInt64 DEFAULT cityHash64(eff_uid, pr),
|
||||||
|
sample_key UInt64 ALIAS page_session
|
||||||
|
) ENGINE = MergeTree(date, cityHash64(adf_uid, ya_uid, pr), (owner_id, date, cityHash64(adf_uid, ya_uid, pr)), 8192);
|
||||||
|
|
||||||
|
INSERT INTO test.elog_cut (uts, pr, ya_uid, adf_uid, owner_id) VALUES ('2015-01-01 01:02:03', 111, 123, 456, 789);
|
||||||
|
SELECT date, uts, pr, ya_uid, adf_uid, owner_id, eff_uid, page_session, sample_key FROM test.elog_cut;
|
||||||
|
DROP TABLE test.elog_cut;
|
Loading…
Reference in New Issue
Block a user