Bug in mutation

This commit is contained in:
alesapin 2020-09-09 19:47:06 +03:00
parent 3973a17530
commit 62428845a0
3 changed files with 21 additions and 3 deletions

View File

@ -7,6 +7,7 @@
#include <common/unaligned.h>
#include <Core/Field.h>
#include <Core/BigInt.h>
#include <Common/assert_cast.h>
namespace DB
@ -130,7 +131,7 @@ public:
void insertFrom(const IColumn & src, size_t n) override
{
data.push_back(static_cast<const Self &>(src).getData()[n]);
data.push_back(assert_cast<const Self &>(src).getData()[n]);
}
void insertData(const char * pos, size_t) override
@ -205,14 +206,14 @@ public:
/// This method implemented in header because it could be possibly devirtualized.
int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override
{
return CompareHelper<T>::compare(data[n], static_cast<const Self &>(rhs_).data[m], nan_direction_hint);
return CompareHelper<T>::compare(data[n], assert_cast<const Self &>(rhs_).data[m], nan_direction_hint);
}
void compareColumn(const IColumn & rhs, size_t rhs_row_num,
PaddedPODArray<UInt64> * row_indexes, PaddedPODArray<Int8> & compare_results,
int direction, int nan_direction_hint) const override
{
return this->template doCompareColumn<Self>(static_cast<const Self &>(rhs), rhs_row_num, row_indexes,
return this->template doCompareColumn<Self>(assert_cast<const Self &>(rhs), rhs_row_num, row_indexes,
compare_results, direction, nan_direction_hint);
}

View File

@ -0,0 +1 @@
1 150

View File

@ -0,0 +1,16 @@
DROP TABLE IF EXISTS mutation_table;
CREATE TABLE mutation_table (
id int,
price Nullable(Int32)
)
ENGINE = MergeTree()
PARTITION BY id
ORDER BY id;
INSERT INTO mutation_table (id, price) VALUES (1, 100);
ALTER TABLE mutation_table UPDATE price = 150 WHERE id = 1 SETTINGS mutations_sync = 2;
SELECT * FROM mutation_table;
DROP TABLE IF EXISTS mutation_table;