Merge branch 'master' into max-rows-to-sort

This commit is contained in:
Alexey Milovidov 2020-05-17 09:08:46 +03:00
commit f7087c721e
40 changed files with 112 additions and 86 deletions

View File

@ -1,8 +1,8 @@
set (CMAKE_SYSTEM_NAME "FreeBSD")
set (CMAKE_SYSTEM_PROCESSOR "x86_64")
set (CMAKE_C_COMPILER_TARGET "x86_64-pc-freebsd12.1")
set (CMAKE_CXX_COMPILER_TARGET "x86_64-pc-freebsd12.1")
set (CMAKE_ASM_COMPILER_TARGET "x86_64-pc-freebsd12.1")
set (CMAKE_C_COMPILER_TARGET "x86_64-pc-freebsd11")
set (CMAKE_CXX_COMPILER_TARGET "x86_64-pc-freebsd11")
set (CMAKE_ASM_COMPILER_TARGET "x86_64-pc-freebsd11")
set (CMAKE_SYSROOT "${CMAKE_CURRENT_LIST_DIR}/../toolchain/freebsd-x86_64")
set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) # disable linkage check - it doesn't work in CMake

View File

@ -858,7 +858,7 @@ public:
ColumnPtr new_nested_column = nested_model->generate(nested_column);
return ColumnArray::create((*std::move(new_nested_column)).mutate(), (*std::move(column_array.getOffsetsPtr())).mutate());
return ColumnArray::create(IColumn::mutate(std::move(new_nested_column)), IColumn::mutate(std::move(column_array.getOffsetsPtr())));
}
void updateSeed() override
@ -896,7 +896,7 @@ public:
ColumnPtr new_nested_column = nested_model->generate(nested_column);
return ColumnNullable::create((*std::move(new_nested_column)).mutate(), (*std::move(column_nullable.getNullMapColumnPtr())).mutate());
return ColumnNullable::create(IColumn::mutate(std::move(new_nested_column)), IColumn::mutate(std::move(column_nullable.getNullMapColumnPtr())));
}
void updateSeed() override

View File

@ -80,20 +80,28 @@ struct VarMoments
readPODBinary(*this, buf);
}
T NO_SANITIZE_UNDEFINED getPopulation() const
{
return (m[2] - m[1] * m[1] / m[0]) / m[0];
}
T NO_SANITIZE_UNDEFINED getSample() const
T getPopulation() const
{
if (m[0] == 0)
return std::numeric_limits<T>::quiet_NaN();
return (m[2] - m[1] * m[1] / m[0]) / (m[0] - 1);
/// Due to numerical errors, the result can be slightly less than zero,
/// but it should be impossible. Trim to zero.
return std::max(T{}, (m[2] - m[1] * m[1] / m[0]) / m[0]);
}
T NO_SANITIZE_UNDEFINED getMoment3() const
T getSample() const
{
if (m[0] <= 1)
return std::numeric_limits<T>::quiet_NaN();
return std::max(T{}, (m[2] - m[1] * m[1] / m[0]) / (m[0] - 1));
}
T getMoment3() const
{
if (m[0] == 0)
return std::numeric_limits<T>::quiet_NaN();
// to avoid accuracy problem
if (m[0] == 1)
return 0;
@ -104,8 +112,10 @@ struct VarMoments
) / m[0];
}
T NO_SANITIZE_UNDEFINED getMoment4() const
T getMoment4() const
{
if (m[0] == 0)
return std::numeric_limits<T>::quiet_NaN();
// to avoid accuracy problem
if (m[0] == 1)
return 0;
@ -180,7 +190,7 @@ struct VarMomentsDecimal
if (common::mulOverflow(getM(1), getM(1), tmp) ||
common::subOverflow(getM(2), NativeType(tmp / m0), tmp))
throw Exception("Decimal math overflow", ErrorCodes::DECIMAL_OVERFLOW);
return convertFromDecimal<DataTypeDecimal<T>, DataTypeNumber<Float64>>(tmp / m0, scale);
return std::max(Float64{}, convertFromDecimal<DataTypeDecimal<T>, DataTypeNumber<Float64>>(tmp / m0, scale));
}
Float64 getSample(UInt32 scale) const
@ -194,7 +204,7 @@ struct VarMomentsDecimal
if (common::mulOverflow(getM(1), getM(1), tmp) ||
common::subOverflow(getM(2), NativeType(tmp / m0), tmp))
throw Exception("Decimal math overflow", ErrorCodes::DECIMAL_OVERFLOW);
return convertFromDecimal<DataTypeDecimal<T>, DataTypeNumber<Float64>>(tmp / (m0 - 1), scale);
return std::max(Float64{}, convertFromDecimal<DataTypeDecimal<T>, DataTypeNumber<Float64>>(tmp / (m0 - 1), scale));
}
Float64 getMoment3(UInt32 scale) const

View File

@ -190,7 +190,7 @@ void ColumnLowCardinality::insertRangeFrom(const IColumn & src, size_t start, si
/// TODO: Support native insertion from other unique column. It will help to avoid null map creation.
auto sub_idx = (*low_cardinality_src->getIndexes().cut(start, length)).mutate();
auto sub_idx = IColumn::mutate(low_cardinality_src->getIndexes().cut(start, length));
auto idx_map = mapUniqueIndex(*sub_idx);
auto src_nested = low_cardinality_src->getDictionary().getNestedColumn();
@ -268,7 +268,7 @@ MutableColumnPtr ColumnLowCardinality::cloneResized(size_t size) const
if (size == 0)
unique_ptr = unique_ptr->cloneEmpty();
return ColumnLowCardinality::create((*std::move(unique_ptr)).mutate(), getIndexes().cloneResized(size));
return ColumnLowCardinality::create(IColumn::mutate(std::move(unique_ptr)), getIndexes().cloneResized(size));
}
int ColumnLowCardinality::compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
@ -320,7 +320,7 @@ std::vector<MutableColumnPtr> ColumnLowCardinality::scatter(ColumnIndex num_colu
for (auto & column : columns)
{
auto unique_ptr = dictionary.getColumnUniquePtr();
column = ColumnLowCardinality::create((*std::move(unique_ptr)).mutate(), std::move(column));
column = ColumnLowCardinality::create(IColumn::mutate(std::move(unique_ptr)), std::move(column));
}
return columns;
@ -337,7 +337,7 @@ void ColumnLowCardinality::setSharedDictionary(const ColumnPtr & column_unique)
ColumnLowCardinality::MutablePtr ColumnLowCardinality::cutAndCompact(size_t start, size_t length) const
{
auto sub_positions = (*idx.getPositions()->cut(start, length)).mutate();
auto sub_positions = IColumn::mutate(idx.getPositions()->cut(start, length));
/// Create column with new indexes and old dictionary.
/// Dictionary is shared, but will be recreated after compactInplace call.
auto column = ColumnLowCardinality::create(getDictionary().assumeMutable(), std::move(sub_positions));
@ -364,7 +364,7 @@ void ColumnLowCardinality::compactIfSharedDictionary()
ColumnLowCardinality::DictionaryEncodedColumn
ColumnLowCardinality::getMinimalDictionaryEncodedColumn(UInt64 offset, UInt64 limit) const
{
MutableColumnPtr sub_indexes = (*std::move(idx.getPositions()->cut(offset, limit))).mutate();
MutableColumnPtr sub_indexes = IColumn::mutate(idx.getPositions()->cut(offset, limit));
auto indexes_map = mapUniqueIndex(*sub_indexes);
auto sub_keys = getDictionary().getNestedColumn()->index(*indexes_map, 0);
@ -710,7 +710,7 @@ void ColumnLowCardinality::Dictionary::compact(ColumnPtr & positions)
auto sub_keys = unique.getNestedColumn()->index(*indexes, 0);
auto new_indexes = new_unique.uniqueInsertRangeFrom(*sub_keys, 0, sub_keys->size());
positions = (*new_indexes->index(*positions, 0)).mutate();
positions = IColumn::mutate(new_indexes->index(*positions, 0));
column_unique = std::move(new_column_unique);
shared = false;

View File

@ -64,7 +64,7 @@ FilterDescription::FilterDescription(const IColumn & column_)
if (const auto * nullable_column = checkAndGetColumn<ColumnNullable>(column))
{
ColumnPtr nested_column = nullable_column->getNestedColumnPtr();
MutableColumnPtr mutable_holder = (*std::move(nested_column)).mutate();
MutableColumnPtr mutable_holder = IColumn::mutate(std::move(nested_column));
ColumnUInt8 * concrete_column = typeid_cast<ColumnUInt8 *>(mutable_holder.get());
if (!concrete_column)

View File

@ -304,10 +304,10 @@ public:
}
MutablePtr mutate() const &&
static MutablePtr mutate(Ptr ptr)
{
MutablePtr res = shallowMutate();
res->forEachSubcolumn([](WrappedPtr & subcolumn) { subcolumn = std::move(*subcolumn).mutate(); });
MutablePtr res = ptr->shallowMutate();
res->forEachSubcolumn([](WrappedPtr & subcolumn) { subcolumn = IColumn::mutate(std::move(subcolumn)); });
return res;
}

View File

@ -50,7 +50,7 @@
/// Change value of x.
{
/// Creating mutable ptr. It can clone an object under the hood if it was shared.
Column::MutablePtr mutate_x = std::move(*x).mutate();
Column::MutablePtr mutate_x = IColumn::mutate(std::move(x));
/// Using non-const methods of an object.
mutate_x->set(2);
/// Assigning pointer 'x' to mutated object.
@ -79,22 +79,12 @@ private:
Derived * derived() { return static_cast<Derived *>(this); }
const Derived * derived() const { return static_cast<const Derived *>(this); }
template <typename T>
class IntrusivePtr : public boost::intrusive_ptr<T>
{
public:
using boost::intrusive_ptr<T>::intrusive_ptr;
T & operator*() const & { return boost::intrusive_ptr<T>::operator*(); }
T && operator*() const && { return const_cast<typename std::remove_const<T>::type &&>(*boost::intrusive_ptr<T>::get()); }
};
protected:
template <typename T>
class mutable_ptr : public IntrusivePtr<T>
class mutable_ptr : public boost::intrusive_ptr<T>
{
private:
using Base = IntrusivePtr<T>;
using Base = boost::intrusive_ptr<T>;
template <typename> friend class COW;
template <typename, typename> friend class COWHelper;
@ -123,10 +113,10 @@ public:
protected:
template <typename T>
class immutable_ptr : public IntrusivePtr<const T>
class immutable_ptr : public boost::intrusive_ptr<const T>
{
private:
using Base = IntrusivePtr<const T>;
using Base = boost::intrusive_ptr<const T>;
template <typename> friend class COW;
template <typename, typename> friend class COWHelper;
@ -185,9 +175,9 @@ protected:
}
public:
MutablePtr mutate() const &&
static MutablePtr mutate(Ptr ptr)
{
return shallowMutate();
return ptr->shallowMutate();
}
MutablePtr assumeMutable() const

View File

@ -53,7 +53,7 @@ int main(int, char **)
std::cerr << "addresses: " << x.get() << ", " << y.get() << "\n";
{
MutableColumnPtr mut = std::move(*y).mutate();
MutableColumnPtr mut = IColumn::mutate(std::move(y));
mut->set(2);
std::cerr << "refcounts: " << x->use_count() << ", " << y->use_count() << ", " << mut->use_count() << "\n";
@ -72,7 +72,7 @@ int main(int, char **)
std::cerr << "addresses: " << x.get() << ", " << y.get() << "\n";
{
MutableColumnPtr mut = std::move(*y).mutate();
MutableColumnPtr mut = IColumn::mutate(std::move(y));
mut->set(3);
std::cerr << "refcounts: " << x->use_count() << ", " << y->use_count() << ", " << mut->use_count() << "\n";

View File

@ -18,7 +18,7 @@ public:
virtual int get() const = 0;
virtual void set(int value) = 0;
MutablePtr mutate() const && { return deepMutate(); }
static MutablePtr mutate(Ptr ptr) { return ptr->deepMutate(); }
};
using ColumnPtr = IColumn::Ptr;
@ -52,7 +52,7 @@ private:
{
std::cerr << "Mutating\n";
auto res = shallowMutate();
res->wrapped = std::move(*wrapped).mutate();
res->wrapped = IColumn::mutate(std::move(wrapped));
return res;
}
@ -72,7 +72,7 @@ int main(int, char **)
std::cerr << "addresses: " << x.get() << ", " << y.get() << "\n";
{
MutableColumnPtr mut = std::move(*y).mutate();
MutableColumnPtr mut = IColumn::mutate(std::move(y));
mut->set(2);
std::cerr << "refcounts: " << x->use_count() << ", " << y->use_count() << ", " << mut->use_count() << "\n";
@ -91,7 +91,7 @@ int main(int, char **)
std::cerr << "addresses: " << x.get() << ", " << y.get() << "\n";
{
MutableColumnPtr mut = std::move(*y).mutate();
MutableColumnPtr mut = IColumn::mutate(std::move(y));
mut->set(3);
std::cerr << "refcounts: " << x->use_count() << ", " << y->use_count() << ", " << mut->use_count() << "\n";

View File

@ -335,7 +335,7 @@ MutableColumns Block::mutateColumns()
size_t num_columns = data.size();
MutableColumns columns(num_columns);
for (size_t i = 0; i < num_columns; ++i)
columns[i] = data[i].column ? (*std::move(data[i].column)).mutate() : data[i].type->createColumn();
columns[i] = data[i].column ? IColumn::mutate(std::move(data[i].column)) : data[i].type->createColumn();
return columns;
}

View File

@ -189,7 +189,7 @@ struct Settings : public SettingsCollection<Settings>
M(SettingUInt64, max_http_get_redirects, 0, "Max number of http GET redirects hops allowed. Make sure additional security measures are in place to prevent a malicious server to redirect your requests to unexpected services.", 0) \
\
M(SettingBool, input_format_skip_unknown_fields, false, "Skip columns with unknown names from input data (it works for JSONEachRow, CSVWithNames, TSVWithNames and TSKV formats).", 0) \
M(SettingBool, input_format_with_names_use_header, false, "For TSVWithNames and CSVWithNames input formats this controls whether format parser is to assume that column data appear in the input exactly as they are specified in the header.", 0) \
M(SettingBool, input_format_with_names_use_header, true, "For TSVWithNames and CSVWithNames input formats this controls whether format parser is to assume that column data appear in the input exactly as they are specified in the header.", 0) \
M(SettingBool, input_format_import_nested_json, false, "Map nested JSON data to nested tables (it works for JSONEachRow format).", 0) \
M(SettingBool, input_format_defaults_for_omitted_fields, true, "For input data calculate default expressions for omitted fields (it works for JSONEachRow, CSV and TSV formats).", IMPORTANT) \
M(SettingBool, input_format_tsv_empty_as_default, false, "Treat empty fields in TSV input as default values.", 0) \

View File

@ -191,7 +191,7 @@ Block AddingDefaultsBlockInputStream::readImpl()
/// TODO: FixedString
if (isColumnedAsNumber(column_read.type) || isDecimal(column_read.type))
{
MutableColumnPtr column_mixed = (*std::move(column_read.column)).mutate();
MutableColumnPtr column_mixed = IColumn::mutate(std::move(column_read.column));
mixNumberColumns(column_read.type->getTypeId(), column_mixed, column_def.column, defaults_mask);
column_read.column = std::move(column_mixed);
}

View File

@ -185,7 +185,7 @@ void MergingSortedBlockInputStream::merge(MutableColumns & merged_columns, TSort
throw Exception("Logical error in MergingSortedBlockInputStream", ErrorCodes::LOGICAL_ERROR);
for (size_t i = 0; i < num_columns; ++i)
merged_columns[i] = (*std::move(source_blocks[source_num].getByPosition(i).column)).mutate();
merged_columns[i] = IColumn::mutate(std::move(source_blocks[source_num].getByPosition(i).column));
// std::cerr << "copied columns\n";
@ -198,7 +198,7 @@ void MergingSortedBlockInputStream::merge(MutableColumns & merged_columns, TSort
for (size_t i = 0; i < num_columns; ++i)
{
auto & column = merged_columns[i];
column = (*column->cut(0, merged_rows)).mutate();
column = IColumn::mutate(column->cut(0, merged_rows));
}
cancel(false);

View File

@ -95,8 +95,7 @@ void SquashingTransform::append(ReferenceType input_block)
{
const auto source_column = input_block.getByPosition(i).column;
auto mutable_column = (*std::move(
accumulated_block.getByPosition(i).column)).mutate();
auto mutable_column = IColumn::mutate(std::move(accumulated_block.getByPosition(i).column));
if (reserve_memory)
{

View File

@ -18,7 +18,7 @@ namespace DB
current.type = unfinalized_type->getReturnType();
if (current.column)
{
auto mut_column = (*std::move(current.column)).mutate();
auto mut_column = IColumn::mutate(std::move(current.column));
current.column = ColumnAggregateFunction::convertToValues(std::move(mut_column));
}
}

View File

@ -80,7 +80,7 @@ int main(int argc, char ** argv)
{
for (size_t i = 0; i < block.columns(); ++i)
{
MutableColumnPtr ptr = (*std::move(res_block.getByPosition(i).column)).mutate();
MutableColumnPtr ptr = IColumn::mutate(std::move(res_block.getByPosition(i).column));
ptr->insertRangeFrom(*block.getByPosition(i).column.get(), 0, block.rows());
}
}

View File

@ -672,7 +672,7 @@ void DataTypeLowCardinality::deserializeBinaryBulkWithMultipleStreams(
ColumnLowCardinality::Index(indexes_column->getPtr()).check(
maps.dictionary_map->size() + maps.additional_keys_map->size());
auto used_keys = (*std::move(global_dictionary->getNestedColumn()->index(*maps.dictionary_map, 0))).mutate();
auto used_keys = IColumn::mutate(global_dictionary->getNestedColumn()->index(*maps.dictionary_map, 0));
if (!maps.additional_keys_map->empty())
{

View File

@ -200,7 +200,7 @@ void IPolygonDictionary::blockToAttributes(const DB::Block &block)
const auto & column = block.safeGetByPosition(i + 1);
if (attributes[i])
{
MutableColumnPtr mutated = std::move(*attributes[i]).mutate();
MutableColumnPtr mutated = IColumn::mutate(std::move(attributes[i]));
mutated->insertRangeFrom(*column.column, 0, column.column->size());
attributes[i] = std::move(mutated);
}

View File

@ -100,7 +100,7 @@ void FunctionModelEvaluate::executeImpl(Block & block, const ColumnNumbers & arg
null_map = col_nullable->getNullMapColumnPtr();
else
{
auto mut_null_map = (*std::move(null_map)).mutate();
auto mut_null_map = IColumn::mutate(std::move(null_map));
NullMap & result_null_map = assert_cast<ColumnUInt8 &>(*mut_null_map).getData();
const NullMap & src_null_map = col_nullable->getNullMapColumn().getData();

View File

@ -147,7 +147,7 @@ ColumnPtr wrapInNullable(const ColumnPtr & src, const Block & block, const Colum
}
else
{
MutableColumnPtr mutable_result_null_map_column = (*std::move(result_null_map_column)).mutate();
MutableColumnPtr mutable_result_null_map_column = IColumn::mutate(std::move(result_null_map_column));
NullMap & result_null_map = assert_cast<ColumnUInt8 &>(*mutable_result_null_map_column).getData();
const NullMap & src_null_map = assert_cast<const ColumnUInt8 &>(*null_map_column).getData();

View File

@ -222,7 +222,7 @@ public:
}
/// Put all the necessary columns multiplied by the sizes of arrays into the block.
auto replicated_column_function_ptr = (*column_function->replicate(column_first_array->getOffsets())).mutate();
auto replicated_column_function_ptr = IColumn::mutate(column_function->replicate(column_first_array->getOffsets()));
auto * replicated_column_function = typeid_cast<ColumnFunction *>(replicated_column_function_ptr.get());
replicated_column_function->appendArguments(arrays);

View File

@ -119,7 +119,8 @@ private:
void FunctionArrayUniq::executeImpl(Block & block, const ColumnNumbers & arguments, size_t result, size_t /*input_rows_count*/)
{
const ColumnArray::Offsets * offsets = nullptr;
size_t num_arguments = arguments.size();
const size_t num_arguments = arguments.size();
assert(num_arguments > 0);
ColumnRawPtrs data_columns(num_arguments);
Columns array_holders;

View File

@ -116,14 +116,17 @@ private:
void executeFormatImpl(Block & block, const ColumnNumbers & arguments, const size_t result, size_t input_rows_count)
{
const size_t num_arguments = arguments.size();
assert(num_arguments >= 2);
auto c_res = ColumnString::create();
std::vector<const ColumnString::Chars *> data(arguments.size());
std::vector<const ColumnString::Offsets *> offsets(arguments.size());
std::vector<size_t> fixed_string_sizes(arguments.size());
std::vector<String> constant_strings(arguments.size());
std::vector<const ColumnString::Chars *> data(num_arguments);
std::vector<const ColumnString::Offsets *> offsets(num_arguments);
std::vector<size_t> fixed_string_sizes(num_arguments);
std::vector<String> constant_strings(num_arguments);
bool has_column_string = false;
bool has_column_fixed_string = false;
for (size_t i = 0; i < arguments.size(); ++i)
for (size_t i = 0; i < num_arguments; ++i)
{
const ColumnPtr & column = block.getByPosition(arguments[i]).column;
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column.get()))
@ -148,9 +151,9 @@ private:
}
String pattern;
pattern.reserve(2 * arguments.size());
pattern.reserve(2 * num_arguments);
for (size_t i = 0; i < arguments.size(); ++i)
for (size_t i = 0; i < num_arguments; ++i)
pattern += "{}";
FormatImpl::formatExecute(

View File

@ -65,7 +65,7 @@ public:
ErrorCodes::ILLEGAL_COLUMN);
/// Column is copied here, because there is no guarantee that we own it.
auto mut_column = (*std::move(column)).mutate();
auto mut_column = IColumn::mutate(std::move(column));
block.getByPosition(result).column = ColumnAggregateFunction::convertToValues(std::move(mut_column));
}
};

View File

@ -816,7 +816,7 @@ private:
if (isColumnNullable(*arg_else.column))
{
auto arg_else_column = arg_else.column;
auto result_column = (*std::move(arg_else_column)).mutate();
auto result_column = IColumn::mutate(std::move(arg_else_column));
assert_cast<ColumnNullable &>(*result_column).applyNullMap(assert_cast<const ColumnUInt8 &>(*arg_cond.column));
block.getByPosition(result).column = std::move(result_column);
}
@ -858,7 +858,7 @@ private:
if (isColumnNullable(*arg_then.column))
{
auto arg_then_column = arg_then.column;
auto result_column = (*std::move(arg_then_column)).mutate();
auto result_column = IColumn::mutate(std::move(arg_then_column));
assert_cast<ColumnNullable &>(*result_column).applyNegatedNullMap(assert_cast<const ColumnUInt8 &>(*arg_cond.column));
block.getByPosition(result).column = std::move(result_column);
}

View File

@ -119,7 +119,7 @@ void DictionaryReader::readKeys(const IColumn & keys, Block & out_block, ColumnV
/// calculate and extract dictHas()
function_has->execute(working_block, size);
ColumnWithTypeAndName & has_column = working_block.getByPosition(has_position);
auto mutable_has = (*std::move(has_column.column)).mutate();
auto mutable_has = IColumn::mutate(std::move(has_column.column));
found.swap(typeid_cast<ColumnVector<UInt8> &>(*mutable_has).getData());
has_column.column = nullptr;

View File

@ -108,7 +108,7 @@ static ColumnWithTypeAndName correctNullability(ColumnWithTypeAndName && column,
JoinCommon::convertColumnToNullable(column);
if (column.type->isNullable() && !negative_null_map.empty())
{
MutableColumnPtr mutable_column = (*std::move(column.column)).mutate();
MutableColumnPtr mutable_column = IColumn::mutate(std::move(column.column));
assert_cast<ColumnNullable &>(*mutable_column).applyNegatedNullMap(negative_null_map);
column.column = std::move(mutable_column);
}
@ -127,7 +127,7 @@ static void changeNullability(MutableColumnPtr & mutable_column)
else
column = makeNullable(column);
mutable_column = (*std::move(column)).mutate();
mutable_column = IColumn::mutate(std::move(column));
}
static ColumnPtr emptyNotNullableClone(const ColumnPtr & column)

View File

@ -50,6 +50,8 @@ void MetricLogElement::appendToBlock(Block & block) const
for (size_t i = 0, end = CurrentMetrics::end(); i < end; ++i)
columns[column_idx++]->insert(current_metrics[i]);
block.setColumns(std::move(columns));
}

View File

@ -33,7 +33,7 @@ ColumnPtr extractNestedColumnsAndNullMap(ColumnRawPtrs & key_columns, ConstNullM
}
else
{
MutableColumnPtr mutable_null_map_holder = (*std::move(null_map_holder)).mutate();
MutableColumnPtr mutable_null_map_holder = IColumn::mutate(std::move(null_map_holder));
PaddedPODArray<UInt8> & mutable_null_map = assert_cast<ColumnUInt8 &>(*mutable_null_map_holder).getData();
const PaddedPODArray<UInt8> & other_null_map = column_nullable->getNullMapData();

View File

@ -107,6 +107,8 @@ void QueryThreadLogElement::appendToBlock(Block & block) const
columns[i++]->insertDefault();
columns[i++]->insertDefault();
}
block.setColumns(std::move(columns));
}
}

View File

@ -68,6 +68,8 @@ void TextLogElement::appendToBlock(Block & block) const
columns[i++]->insert(source_file);
columns[i++]->insert(source_line);
block.setColumns(std::move(columns));
}
TextLog::TextLog(Context & context_, const String & database_name_,

View File

@ -43,7 +43,7 @@ void removeColumnNullability(ColumnWithTypeAndName & column)
{
const auto * nullable_column = checkAndGetColumn<ColumnNullable>(*column.column);
ColumnPtr nested_column = nullable_column->getNestedColumnPtr();
MutableColumnPtr mutable_column = (*std::move(nested_column)).mutate();
MutableColumnPtr mutable_column = IColumn::mutate(std::move(nested_column));
column.column = std::move(mutable_column);
}
}

View File

@ -76,7 +76,7 @@ MutableColumns Chunk::mutateColumns()
size_t num_columns = columns.size();
MutableColumns mut_columns(num_columns);
for (size_t i = 0; i < num_columns; ++i)
mut_columns[i] = (*std::move(columns[i])).mutate();
mut_columns[i] = IColumn::mutate(std::move(columns[i]));
columns.clear();
num_rows = 0;

View File

@ -70,7 +70,7 @@ Chunk ValuesBlockInputFormat::generate()
if (!templates[i] || !templates[i]->rowsCount())
continue;
if (columns[i]->empty())
columns[i] = std::move(*templates[i]->evaluateAll(block_missing_values, i)).mutate();
columns[i] = IColumn::mutate(templates[i]->evaluateAll(block_missing_values, i));
else
{
ColumnPtr evaluated = templates[i]->evaluateAll(block_missing_values, i, columns[i]->size());
@ -134,7 +134,7 @@ bool ValuesBlockInputFormat::tryParseExpressionUsingTemplate(MutableColumnPtr &
/// Expression in the current row is not match template deduced on the first row.
/// Evaluate expressions, which were parsed using this template.
if (column->empty())
column = std::move(*templates[column_idx]->evaluateAll(block_missing_values, column_idx)).mutate();
column = IColumn::mutate(templates[column_idx]->evaluateAll(block_missing_values, column_idx));
else
{
ColumnPtr evaluated = templates[column_idx]->evaluateAll(block_missing_values, column_idx, column->size());

View File

@ -44,7 +44,7 @@ public:
{
num_rows = limit_rows;
for (auto & column : columns)
column = (*column->cut(0, num_rows)).mutate();
column = IColumn::mutate(column->cut(0, num_rows));
}
need_flush = true;

View File

@ -24,7 +24,7 @@ void finalizeChunk(Chunk & chunk)
{
if (typeid_cast<const ColumnAggregateFunction *>(column.get()))
{
auto mut_column = (*std::move(column)).mutate();
auto mut_column = IColumn::mutate(std::move(column));
column = ColumnAggregateFunction::convertToValues(std::move(mut_column));
}
}

View File

@ -286,7 +286,7 @@ static void appendBlock(const Block & from, Block & to)
for (size_t column_no = 0, columns = to.columns(); column_no < columns; ++column_no)
{
const IColumn & col_from = *from.getByPosition(column_no).column.get();
MutableColumnPtr col_to = (*std::move(to.getByPosition(column_no).column)).mutate();
MutableColumnPtr col_to = IColumn::mutate(std::move(to.getByPosition(column_no).column));
col_to->insertRangeFrom(col_from, 0, rows);
@ -302,7 +302,7 @@ static void appendBlock(const Block & from, Block & to)
{
ColumnPtr & col_to = to.getByPosition(column_no).column;
if (col_to->size() != old_rows)
col_to = (*std::move(col_to)).mutate()->cut(0, old_rows);
col_to = col_to->cut(0, old_rows);
}
}
catch (...)

View File

@ -0,0 +1,8 @@
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,9 @@
SELECT varSamp(0.1) FROM numbers(1000000);
SELECT varPop(0.1) FROM numbers(1000000);
SELECT stddevSamp(0.1) FROM numbers(1000000);
SELECT stddevPop(0.1) FROM numbers(1000000);
SELECT varSampStable(0.1) FROM numbers(1000000);
SELECT varPopStable(0.1) FROM numbers(1000000);
SELECT stddevSampStable(0.1) FROM numbers(1000000);
SELECT stddevPopStable(0.1) FROM numbers(1000000);