mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 07:01:59 +00:00
add test
fix fix
This commit is contained in:
parent
5d7a77c207
commit
c0b5f847d9
@ -216,22 +216,22 @@ static inline void columnUpdate(Block & old_block, const Block & new_block)
|
||||
|
||||
void StorageMemory::mutate(const MutationCommands & commands, const Context & context)
|
||||
{
|
||||
auto metadata_snapshot_ = getInMemoryMetadataPtr();
|
||||
auto storage_id_ = getStorageID();
|
||||
auto storage_ptr_ = DatabaseCatalog::instance().getTable(storage_id_, context);
|
||||
auto interpreter = std::make_unique<MutationsInterpreter>(storage_ptr_, metadata_snapshot_, commands, context, true);
|
||||
auto metadata_snapshot = getInMemoryMetadataPtr();
|
||||
auto storage = getStorageID();
|
||||
auto storage_ptr = DatabaseCatalog::instance().getTable(storage, context);
|
||||
auto interpreter = std::make_unique<MutationsInterpreter>(storage_ptr, metadata_snapshot, commands, context, true);
|
||||
auto in = interpreter->execute();
|
||||
|
||||
in->readPrefix();
|
||||
BlocksList out;
|
||||
Block block;
|
||||
while (block = in->read())
|
||||
while ((block = in->read()))
|
||||
{
|
||||
out.push_back(block);
|
||||
}
|
||||
in->readSuffix();
|
||||
|
||||
std::lock_guard lock(mutex);
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
// all column affected
|
||||
if (interpreter->isAffectingAllColumns())
|
||||
|
@ -0,0 +1,14 @@
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
100 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
@ -0,0 +1,20 @@
|
||||
DROP TABLE IF EXISTS defaults;
|
||||
CREATE TABLE defaults
|
||||
(
|
||||
n Int32,
|
||||
s String
|
||||
)ENGINE = Memory();
|
||||
|
||||
INSERT INTO defaults VALUES(1, '1') (2, '2') (3, '3') (4, '4') (5, '5');
|
||||
|
||||
SELECT * FROM defaults;
|
||||
|
||||
ALTER TABLE defaults UPDATE n = 100 WHERE s = '1';
|
||||
|
||||
SELECT * FROM defaults;
|
||||
|
||||
ALTER TABLE defaults DELETE WHERE n = 100;
|
||||
|
||||
SELECT * FROM defaults;
|
||||
|
||||
DROP TABLE defaults;
|
Loading…
Reference in New Issue
Block a user