mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
Merge branch 'master' into processors-2
This commit is contained in:
commit
4c9c4a9707
20
CHANGELOG.md
20
CHANGELOG.md
@ -1,3 +1,13 @@
|
||||
## ClickHouse release 19.13.3.26, 2019-08-22
|
||||
|
||||
### Bug Fix
|
||||
* Fix `ALTER TABLE ... UPDATE` query for tables with `enable_mixed_granularity_parts=1`. [#6543](https://github.com/yandex/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin))
|
||||
* Fix NPE when using IN clause with a subquery with a tuple. [#6125](https://github.com/yandex/ClickHouse/issues/6125) [#6550](https://github.com/yandex/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix))
|
||||
* Fixed an issue that if a stale replica becomes alive, it may still have data parts that were removed by DROP PARTITION. [#6522](https://github.com/yandex/ClickHouse/issues/6522) [#6523](https://github.com/yandex/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix))
|
||||
* Fixed issue with parsing CSV [#6426](https://github.com/yandex/ClickHouse/issues/6426) [#6559](https://github.com/yandex/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix))
|
||||
* Fixed data race in system.parts table and ALTER query. This fixes [#6245](https://github.com/yandex/ClickHouse/issues/6245). [#6513](https://github.com/yandex/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
||||
* Fixed wrong code in mutations that may lead to memory corruption. Fixed segfault with read of address `0x14c0` that may happed due to concurrent `DROP TABLE` and `SELECT` from `system.parts` or `system.parts_columns`. Fixed race condition in preparation of mutation queries. Fixed deadlock caused by `OPTIMIZE` of Replicated tables and concurrent modification operations like ALTERs. [#6514](https://github.com/yandex/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
||||
|
||||
## ClickHouse release 19.13.2.19, 2019-08-14
|
||||
|
||||
### New Feature
|
||||
@ -31,6 +41,16 @@
|
||||
* Fix build with external `libcxx` [#6010](https://github.com/yandex/ClickHouse/pull/6010) ([Ivan](https://github.com/abyss7))
|
||||
* Fix shared build with `rdkafka` library [#6101](https://github.com/yandex/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7))
|
||||
|
||||
## ClickHouse release 19.11.8.46, 2019-08-22
|
||||
|
||||
### Bug Fix
|
||||
* Fix `ALTER TABLE ... UPDATE` query for tables with `enable_mixed_granularity_parts=1`. [#6543](https://github.com/yandex/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin))
|
||||
* Fix NPE when using IN clause with a subquery with a tuple. [#6125](https://github.com/yandex/ClickHouse/issues/6125) [#6550](https://github.com/yandex/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix))
|
||||
* Fixed an issue that if a stale replica becomes alive, it may still have data parts that were removed by DROP PARTITION. [#6522](https://github.com/yandex/ClickHouse/issues/6522) [#6523](https://github.com/yandex/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix))
|
||||
* Fixed issue with parsing CSV [#6426](https://github.com/yandex/ClickHouse/issues/6426) [#6559](https://github.com/yandex/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix))
|
||||
* Fixed data race in system.parts table and ALTER query. This fixes [#6245](https://github.com/yandex/ClickHouse/issues/6245). [#6513](https://github.com/yandex/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
||||
* Fixed wrong code in mutations that may lead to memory corruption. Fixed segfault with read of address `0x14c0` that may happed due to concurrent `DROP TABLE` and `SELECT` from `system.parts` or `system.parts_columns`. Fixed race condition in preparation of mutation queries. Fixed deadlock caused by `OPTIMIZE` of Replicated tables and concurrent modification operations like ALTERs. [#6514](https://github.com/yandex/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
||||
|
||||
## ClickHouse release 19.11.7.40, 2019-08-14
|
||||
|
||||
### Bug fix
|
||||
|
@ -14,6 +14,7 @@ ClickHouse is an open-source column-oriented database management system that all
|
||||
|
||||
## Upcoming Events
|
||||
* [ClickHouse Meetup in Moscow](https://yandex.ru/promo/clickhouse/moscow-2019) on September 5.
|
||||
* [ClickHouse Meetup in Munich](https://www.meetup.com/ClickHouse-Meetup-Munich/events/264185199/) on September 17.
|
||||
* [ClickHouse Meetup in Paris](https://www.eventbrite.com/e/clickhouse-paris-meetup-2019-registration-68493270215) on October 3.
|
||||
* [ClickHouse Meetup in Hong Kong](https://www.meetup.com/Hong-Kong-Machine-Learning-Meetup/events/263580542/) on October 17.
|
||||
* [ClickHouse Meetup in Shenzhen](https://www.huodongxing.com/event/3483759917300) on October 20.
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <Common/StringUtils/StringUtils.h>
|
||||
#include <Common/HashTable/HashMap.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Core/Block.h>
|
||||
#include <common/StringRef.h>
|
||||
#include <common/DateLUT.h>
|
||||
@ -263,11 +264,11 @@ public:
|
||||
|
||||
ColumnPtr generate(const IColumn & column) override
|
||||
{
|
||||
const auto & src_data = static_cast<const ColumnVector<Float> &>(column).getData();
|
||||
const auto & src_data = assert_cast<const ColumnVector<Float> &>(column).getData();
|
||||
size_t size = src_data.size();
|
||||
|
||||
auto res_column = ColumnVector<Float>::create(size);
|
||||
auto & res_data = static_cast<ColumnVector<Float> &>(*res_column).getData();
|
||||
auto & res_data = assert_cast<ColumnVector<Float> &>(*res_column).getData();
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -355,7 +356,7 @@ public:
|
||||
|
||||
ColumnPtr generate(const IColumn & column) override
|
||||
{
|
||||
const ColumnFixedString & column_fixed_string = static_cast<const ColumnFixedString &>(column);
|
||||
const ColumnFixedString & column_fixed_string = assert_cast<const ColumnFixedString &>(column);
|
||||
const size_t string_size = column_fixed_string.getN();
|
||||
|
||||
const auto & src_data = column_fixed_string.getChars();
|
||||
@ -392,11 +393,11 @@ public:
|
||||
|
||||
ColumnPtr generate(const IColumn & column) override
|
||||
{
|
||||
const auto & src_data = static_cast<const ColumnVector<UInt32> &>(column).getData();
|
||||
const auto & src_data = assert_cast<const ColumnVector<UInt32> &>(column).getData();
|
||||
size_t size = src_data.size();
|
||||
|
||||
auto res_column = ColumnVector<UInt32>::create(size);
|
||||
auto & res_data = static_cast<ColumnVector<UInt32> &>(*res_column).getData();
|
||||
auto & res_data = assert_cast<ColumnVector<UInt32> &>(*res_column).getData();
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -749,7 +750,7 @@ public:
|
||||
|
||||
void train(const IColumn & column) override
|
||||
{
|
||||
const ColumnString & column_string = static_cast<const ColumnString &>(column);
|
||||
const ColumnString & column_string = assert_cast<const ColumnString &>(column);
|
||||
size_t size = column_string.size();
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
@ -766,7 +767,7 @@ public:
|
||||
|
||||
ColumnPtr generate(const IColumn & column) override
|
||||
{
|
||||
const ColumnString & column_string = static_cast<const ColumnString &>(column);
|
||||
const ColumnString & column_string = assert_cast<const ColumnString &>(column);
|
||||
size_t size = column_string.size();
|
||||
|
||||
auto res_column = ColumnString::create();
|
||||
@ -801,7 +802,7 @@ public:
|
||||
|
||||
void train(const IColumn & column) override
|
||||
{
|
||||
const ColumnArray & column_array = static_cast<const ColumnArray &>(column);
|
||||
const ColumnArray & column_array = assert_cast<const ColumnArray &>(column);
|
||||
const IColumn & nested_column = column_array.getData();
|
||||
|
||||
nested_model->train(nested_column);
|
||||
@ -814,7 +815,7 @@ public:
|
||||
|
||||
ColumnPtr generate(const IColumn & column) override
|
||||
{
|
||||
const ColumnArray & column_array = static_cast<const ColumnArray &>(column);
|
||||
const ColumnArray & column_array = assert_cast<const ColumnArray &>(column);
|
||||
const IColumn & nested_column = column_array.getData();
|
||||
|
||||
ColumnPtr new_nested_column = nested_model->generate(nested_column);
|
||||
@ -834,7 +835,7 @@ public:
|
||||
|
||||
void train(const IColumn & column) override
|
||||
{
|
||||
const ColumnNullable & column_nullable = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & column_nullable = assert_cast<const ColumnNullable &>(column);
|
||||
const IColumn & nested_column = column_nullable.getNestedColumn();
|
||||
|
||||
nested_model->train(nested_column);
|
||||
@ -847,7 +848,7 @@ public:
|
||||
|
||||
ColumnPtr generate(const IColumn & column) override
|
||||
{
|
||||
const ColumnNullable & column_nullable = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & column_nullable = assert_cast<const ColumnNullable &>(column);
|
||||
const IColumn & nested_column = column_nullable.getNestedColumn();
|
||||
|
||||
ColumnPtr new_nested_column = nested_model->generate(nested_column);
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <common/logger_useful.h>
|
||||
@ -44,46 +45,46 @@ namespace
|
||||
switch (type)
|
||||
{
|
||||
case ValueType::vtUInt8:
|
||||
static_cast<ColumnUInt8 &>(column).insertValue(value.convert<UInt64>());
|
||||
assert_cast<ColumnUInt8 &>(column).insertValue(value.convert<UInt64>());
|
||||
break;
|
||||
case ValueType::vtUInt16:
|
||||
static_cast<ColumnUInt16 &>(column).insertValue(value.convert<UInt64>());
|
||||
assert_cast<ColumnUInt16 &>(column).insertValue(value.convert<UInt64>());
|
||||
break;
|
||||
case ValueType::vtUInt32:
|
||||
static_cast<ColumnUInt32 &>(column).insertValue(value.convert<UInt64>());
|
||||
assert_cast<ColumnUInt32 &>(column).insertValue(value.convert<UInt64>());
|
||||
break;
|
||||
case ValueType::vtUInt64:
|
||||
static_cast<ColumnUInt64 &>(column).insertValue(value.convert<UInt64>());
|
||||
assert_cast<ColumnUInt64 &>(column).insertValue(value.convert<UInt64>());
|
||||
break;
|
||||
case ValueType::vtInt8:
|
||||
static_cast<ColumnInt8 &>(column).insertValue(value.convert<Int64>());
|
||||
assert_cast<ColumnInt8 &>(column).insertValue(value.convert<Int64>());
|
||||
break;
|
||||
case ValueType::vtInt16:
|
||||
static_cast<ColumnInt16 &>(column).insertValue(value.convert<Int64>());
|
||||
assert_cast<ColumnInt16 &>(column).insertValue(value.convert<Int64>());
|
||||
break;
|
||||
case ValueType::vtInt32:
|
||||
static_cast<ColumnInt32 &>(column).insertValue(value.convert<Int64>());
|
||||
assert_cast<ColumnInt32 &>(column).insertValue(value.convert<Int64>());
|
||||
break;
|
||||
case ValueType::vtInt64:
|
||||
static_cast<ColumnInt64 &>(column).insertValue(value.convert<Int64>());
|
||||
assert_cast<ColumnInt64 &>(column).insertValue(value.convert<Int64>());
|
||||
break;
|
||||
case ValueType::vtFloat32:
|
||||
static_cast<ColumnFloat32 &>(column).insertValue(value.convert<Float64>());
|
||||
assert_cast<ColumnFloat32 &>(column).insertValue(value.convert<Float64>());
|
||||
break;
|
||||
case ValueType::vtFloat64:
|
||||
static_cast<ColumnFloat64 &>(column).insertValue(value.convert<Float64>());
|
||||
assert_cast<ColumnFloat64 &>(column).insertValue(value.convert<Float64>());
|
||||
break;
|
||||
case ValueType::vtString:
|
||||
static_cast<ColumnString &>(column).insert(value.convert<String>());
|
||||
assert_cast<ColumnString &>(column).insert(value.convert<String>());
|
||||
break;
|
||||
case ValueType::vtDate:
|
||||
static_cast<ColumnUInt16 &>(column).insertValue(UInt16{LocalDate{value.convert<String>()}.getDayNum()});
|
||||
assert_cast<ColumnUInt16 &>(column).insertValue(UInt16{LocalDate{value.convert<String>()}.getDayNum()});
|
||||
break;
|
||||
case ValueType::vtDateTime:
|
||||
static_cast<ColumnUInt32 &>(column).insertValue(time_t{LocalDateTime{value.convert<String>()}});
|
||||
assert_cast<ColumnUInt32 &>(column).insertValue(time_t{LocalDateTime{value.convert<String>()}});
|
||||
break;
|
||||
case ValueType::vtUUID:
|
||||
static_cast<ColumnUInt128 &>(column).insert(parse<UUID>(value.convert<std::string>()));
|
||||
assert_cast<ColumnUInt128 &>(column).insert(parse<UUID>(value.convert<std::string>()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -114,7 +115,7 @@ Block ODBCBlockInputStream::readImpl()
|
||||
{
|
||||
if (description.types[idx].second)
|
||||
{
|
||||
ColumnNullable & column_nullable = static_cast<ColumnNullable &>(*columns[idx]);
|
||||
ColumnNullable & column_nullable = assert_cast<ColumnNullable &>(*columns[idx]);
|
||||
insertValue(column_nullable.getNestedColumn(), description.types[idx].first, value);
|
||||
column_nullable.getNullMapData().emplace_back(0);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Columns/ColumnArray.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/DataTypeArray.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
@ -81,9 +82,9 @@ public:
|
||||
const IColumn * nested[num_arguments];
|
||||
|
||||
for (size_t i = 0; i < num_arguments; ++i)
|
||||
nested[i] = &static_cast<const ColumnArray &>(*columns[i]).getData();
|
||||
nested[i] = &assert_cast<const ColumnArray &>(*columns[i]).getData();
|
||||
|
||||
const ColumnArray & first_array_column = static_cast<const ColumnArray &>(*columns[0]);
|
||||
const ColumnArray & first_array_column = assert_cast<const ColumnArray &>(*columns[0]);
|
||||
const IColumn::Offsets & offsets = first_array_column.getOffsets();
|
||||
|
||||
size_t begin = offsets[row_num - 1];
|
||||
@ -92,7 +93,7 @@ public:
|
||||
/// Sanity check. NOTE We can implement specialization for a case with single argument, if the check will hurt performance.
|
||||
for (size_t i = 1; i < num_arguments; ++i)
|
||||
{
|
||||
const ColumnArray & ith_column = static_cast<const ColumnArray &>(*columns[i]);
|
||||
const ColumnArray & ith_column = assert_cast<const ColumnArray &>(*columns[i]);
|
||||
const IColumn::Offsets & ith_offsets = ith_column.getOffsets();
|
||||
|
||||
if (ith_offsets[row_num] != end || (row_num != 0 && ith_offsets[row_num - 1] != begin))
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <Columns/ColumnVector.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -55,7 +56,7 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena *) const override
|
||||
{
|
||||
this->data(place).update(static_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num]);
|
||||
this->data(place).update(assert_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num]);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena *) const override
|
||||
@ -75,7 +76,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnVector<T> &>(to).getData().push_back(this->data(place).value);
|
||||
assert_cast<ColumnVector<T> &>(to).getData().push_back(this->data(place).value);
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override { return __FILE__; }
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <AggregateFunctions/Helpers.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -151,7 +152,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnFloat64 &>(to).getData().push_back(getBoundingRatio(data(place)));
|
||||
assert_cast<ColumnFloat64 &>(to).getData().push_back(getBoundingRatio(data(place)));
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -59,7 +60,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(data(place).count);
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(data(place).count);
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override { return __FILE__; }
|
||||
@ -86,7 +87,7 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena *) const override
|
||||
{
|
||||
data(place).count += !static_cast<const ColumnNullable &>(*columns[0]).isNullAt(row_num);
|
||||
data(place).count += !assert_cast<const ColumnNullable &>(*columns[0]).isNullAt(row_num);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena *) const override
|
||||
@ -106,7 +107,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(data(place).count);
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(data(place).count);
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override { return __FILE__; }
|
||||
@ -143,7 +144,7 @@ public:
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena *) const override
|
||||
{
|
||||
for (size_t i = 0; i < number_of_arguments; ++i)
|
||||
if (is_nullable[i] && static_cast<const ColumnNullable &>(*columns[i]).isNullAt(row_num))
|
||||
if (is_nullable[i] && assert_cast<const ColumnNullable &>(*columns[i]).isNullAt(row_num))
|
||||
return;
|
||||
|
||||
++data(place).count;
|
||||
@ -166,7 +167,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(data(place).count);
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(data(place).count);
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override { return __FILE__; }
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <AggregateFunctions/UniqVariadicHash.h>
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <Columns/ColumnVector.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
@ -115,7 +116,7 @@ public:
|
||||
if constexpr (!std::is_same_v<UInt128, Value>)
|
||||
{
|
||||
/// Here we manage only with numerical types
|
||||
const auto & column = static_cast<const ColumnVector <Value> &>(*columns[0]);
|
||||
const auto & column = assert_cast<const ColumnVector <Value> &>(*columns[0]);
|
||||
this->data(place).add(column.getData()[row_num]);
|
||||
}
|
||||
else
|
||||
@ -141,7 +142,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
auto & column = static_cast<ColumnVector<Float64> &>(to);
|
||||
auto & column = assert_cast<ColumnVector<Float64> &>(to);
|
||||
column.getData().push_back(this->data(place).get());
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Columns/ColumnArray.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/DataTypeArray.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -149,9 +150,9 @@ public:
|
||||
const IColumn * nested[num_arguments];
|
||||
|
||||
for (size_t i = 0; i < num_arguments; ++i)
|
||||
nested[i] = &static_cast<const ColumnArray &>(*columns[i]).getData();
|
||||
nested[i] = &assert_cast<const ColumnArray &>(*columns[i]).getData();
|
||||
|
||||
const ColumnArray & first_array_column = static_cast<const ColumnArray &>(*columns[0]);
|
||||
const ColumnArray & first_array_column = assert_cast<const ColumnArray &>(*columns[0]);
|
||||
const IColumn::Offsets & offsets = first_array_column.getOffsets();
|
||||
|
||||
size_t begin = offsets[row_num - 1];
|
||||
@ -160,7 +161,7 @@ public:
|
||||
/// Sanity check. NOTE We can implement specialization for a case with single argument, if the check will hurt performance.
|
||||
for (size_t i = 1; i < num_arguments; ++i)
|
||||
{
|
||||
const ColumnArray & ith_column = static_cast<const ColumnArray &>(*columns[i]);
|
||||
const ColumnArray & ith_column = assert_cast<const ColumnArray &>(*columns[i]);
|
||||
const IColumn::Offsets & ith_offsets = ith_column.getOffsets();
|
||||
|
||||
if (ith_offsets[row_num] != end || (row_num != 0 && ith_offsets[row_num - 1] != begin))
|
||||
@ -228,7 +229,7 @@ public:
|
||||
{
|
||||
const AggregateFunctionForEachData & state = data(place);
|
||||
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
IColumn & elems_to = arr_to.getData();
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <Columns/ColumnString.h>
|
||||
|
||||
#include <Common/ArenaAllocator.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -68,7 +69,7 @@ public:
|
||||
if (limit_num_elems && this->data(place).value.size() >= max_elems)
|
||||
return;
|
||||
|
||||
this->data(place).value.push_back(static_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num], arena);
|
||||
this->data(place).value.push_back(assert_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num], arena);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena * arena) const override
|
||||
@ -119,14 +120,14 @@ public:
|
||||
const auto & value = this->data(place).value;
|
||||
size_t size = value.size();
|
||||
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
|
||||
offsets_to.push_back(offsets_to.back() + size);
|
||||
|
||||
if (size)
|
||||
{
|
||||
typename ColumnVector<T>::Container & data_to = static_cast<ColumnVector<T> &>(arr_to.getData()).getData();
|
||||
typename ColumnVector<T>::Container & data_to = assert_cast<ColumnVector<T> &>(arr_to.getData()).getData();
|
||||
data_to.insert(this->data(place).value.begin(), this->data(place).value.end());
|
||||
}
|
||||
}
|
||||
@ -191,7 +192,7 @@ struct GroupArrayListNodeString : public GroupArrayListNodeBase<GroupArrayListNo
|
||||
/// Create node from string
|
||||
static Node * allocate(const IColumn & column, size_t row_num, Arena * arena)
|
||||
{
|
||||
StringRef string = static_cast<const ColumnString &>(column).getDataAt(row_num);
|
||||
StringRef string = assert_cast<const ColumnString &>(column).getDataAt(row_num);
|
||||
|
||||
Node * node = reinterpret_cast<Node *>(arena->alignedAlloc(sizeof(Node) + string.size, alignof(Node)));
|
||||
node->next = nullptr;
|
||||
@ -203,7 +204,7 @@ struct GroupArrayListNodeString : public GroupArrayListNodeBase<GroupArrayListNo
|
||||
|
||||
void insertInto(IColumn & column)
|
||||
{
|
||||
static_cast<ColumnString &>(column).insertData(data(), size);
|
||||
assert_cast<ColumnString &>(column).insertData(data(), size);
|
||||
}
|
||||
};
|
||||
|
||||
@ -374,7 +375,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
auto & column_array = static_cast<ColumnArray &>(to);
|
||||
auto & column_array = assert_cast<ColumnArray &>(to);
|
||||
|
||||
auto & offsets = column_array.getOffsets();
|
||||
offsets.push_back(offsets.back() + data(place).elems);
|
||||
@ -383,7 +384,7 @@ public:
|
||||
|
||||
if (std::is_same_v<Node, GroupArrayListNodeString>)
|
||||
{
|
||||
auto & string_offsets = static_cast<ColumnString &>(column_data).getOffsets();
|
||||
auto & string_offsets = assert_cast<ColumnString &>(column_data).getOffsets();
|
||||
string_offsets.reserve(string_offsets.size() + data(place).elems);
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <Columns/ColumnVector.h>
|
||||
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Interpreters/convertFieldToType.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
@ -180,7 +181,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
ColumnArray & to_array = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & to_array = assert_cast<ColumnArray &>(to);
|
||||
IColumn & to_data = to_array.getData();
|
||||
ColumnArray::Offsets & to_offsets = to_array.getOffsets();
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <Columns/ColumnArray.h>
|
||||
|
||||
#include <Common/ArenaAllocator.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -164,7 +165,7 @@ public:
|
||||
const auto & data = this->data(place);
|
||||
size_t size = data.value.size();
|
||||
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
|
||||
offsets_to.push_back(offsets_to.back() + size);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Columns/ColumnVector.h>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <AggregateFunctions/AggregateFunctionGroupBitmapData.h>
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
@ -26,7 +26,7 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena *) const override
|
||||
{
|
||||
this->data(place).rbs.add(static_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num]);
|
||||
this->data(place).rbs.add(assert_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num]);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena *) const override
|
||||
@ -46,7 +46,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnVector<T> &>(to).getData().push_back(this->data(place).rbs.size());
|
||||
assert_cast<ColumnVector<T> &>(to).getData().push_back(this->data(place).rbs.size());
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override { return __FILE__; }
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <Columns/ColumnArray.h>
|
||||
|
||||
#include <Common/HashTable/HashSet.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -63,7 +64,7 @@ public:
|
||||
{
|
||||
if (limit_num_elems && this->data(place).value.size() >= max_elems)
|
||||
return;
|
||||
this->data(place).value.insert(static_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num]);
|
||||
this->data(place).value.insert(assert_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num]);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena *) const override
|
||||
@ -100,7 +101,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
|
||||
const typename State::Set & set = this->data(place).value;
|
||||
@ -108,7 +109,7 @@ public:
|
||||
|
||||
offsets_to.push_back(offsets_to.back() + size);
|
||||
|
||||
typename ColumnVector<T>::Container & data_to = static_cast<ColumnVector<T> &>(arr_to.getData()).getData();
|
||||
typename ColumnVector<T>::Container & data_to = assert_cast<ColumnVector<T> &>(arr_to.getData()).getData();
|
||||
size_t old_size = data_to.size();
|
||||
data_to.resize(old_size + size);
|
||||
|
||||
@ -254,7 +255,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
IColumn & data_to = arr_to.getData();
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <Columns/ColumnVector.h>
|
||||
#include <Columns/ColumnTuple.h>
|
||||
#include <Columns/ColumnArray.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <DataTypes/DataTypeArray.h>
|
||||
@ -333,7 +334,7 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena *) const override
|
||||
{
|
||||
auto val = static_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num];
|
||||
auto val = assert_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num];
|
||||
this->data(place).add(static_cast<Data::Mean>(val), 1, max_bins);
|
||||
}
|
||||
|
||||
@ -356,13 +357,13 @@ public:
|
||||
{
|
||||
auto & data = this->data(const_cast<AggregateDataPtr>(place));
|
||||
|
||||
auto & to_array = static_cast<ColumnArray &>(to);
|
||||
auto & to_array = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = to_array.getOffsets();
|
||||
auto & to_tuple = static_cast<ColumnTuple &>(to_array.getData());
|
||||
auto & to_tuple = assert_cast<ColumnTuple &>(to_array.getData());
|
||||
|
||||
auto & to_lower = static_cast<ColumnVector<Data::Mean> &>(to_tuple.getColumn(0));
|
||||
auto & to_upper = static_cast<ColumnVector<Data::Mean> &>(to_tuple.getColumn(1));
|
||||
auto & to_weights = static_cast<ColumnVector<Data::Weight> &>(to_tuple.getColumn(2));
|
||||
auto & to_lower = assert_cast<ColumnVector<Data::Mean> &>(to_tuple.getColumn(0));
|
||||
auto & to_upper = assert_cast<ColumnVector<Data::Mean> &>(to_tuple.getColumn(1));
|
||||
auto & to_weights = assert_cast<ColumnVector<Data::Weight> &>(to_tuple.getColumn(2));
|
||||
data.insertResultInto(to_lower, to_upper, to_weights, max_bins);
|
||||
|
||||
offsets_to.push_back(to_tuple.size());
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
|
||||
@ -75,7 +76,7 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena * arena) const override
|
||||
{
|
||||
if (static_cast<const ColumnUInt8 &>(*columns[num_arguments - 1]).getData()[row_num])
|
||||
if (assert_cast<const ColumnUInt8 &>(*columns[num_arguments - 1]).getData()[row_num])
|
||||
nested_func->add(place, columns, row_num, arena);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <Columns/ColumnTuple.h>
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include "AggregateFunctionFactory.h"
|
||||
#include "FactoryHelpers.h"
|
||||
#include "Helpers.h"
|
||||
@ -147,14 +148,14 @@ void LinearModelData::returnWeights(IColumn & to) const
|
||||
{
|
||||
size_t size = weights.size() + 1;
|
||||
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
|
||||
size_t old_size = offsets_to.back();
|
||||
offsets_to.push_back(old_size + size);
|
||||
|
||||
typename ColumnFloat64::Container & val_to
|
||||
= static_cast<ColumnFloat64 &>(arr_to.getData()).getData();
|
||||
= assert_cast<ColumnFloat64 &>(arr_to.getData()).getData();
|
||||
|
||||
val_to.reserve(old_size + size);
|
||||
for (size_t i = 0; i + 1 < size; ++i)
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include <Common/ArenaAllocator.h>
|
||||
#include <Common/NaNUtils.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -88,8 +89,8 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena * arena) const override
|
||||
{
|
||||
PointType left = static_cast<const ColumnVector<PointType> &>(*columns[0]).getData()[row_num];
|
||||
PointType right = static_cast<const ColumnVector<PointType> &>(*columns[1]).getData()[row_num];
|
||||
PointType left = assert_cast<const ColumnVector<PointType> &>(*columns[0]).getData()[row_num];
|
||||
PointType right = assert_cast<const ColumnVector<PointType> &>(*columns[1]).getData()[row_num];
|
||||
|
||||
if (!isNaN(left))
|
||||
this->data(place).value.push_back(std::make_pair(left, Int64(1)), arena);
|
||||
@ -152,12 +153,12 @@ public:
|
||||
|
||||
if (kind == AggregateFunctionIntersectionsKind::Count)
|
||||
{
|
||||
auto & result_column = static_cast<ColumnUInt64 &>(to).getData();
|
||||
auto & result_column = assert_cast<ColumnUInt64 &>(to).getData();
|
||||
result_column.push_back(max_intersections);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto & result_column = static_cast<ColumnVector<PointType> &>(to).getData();
|
||||
auto & result_column = assert_cast<ColumnVector<PointType> &>(to).getData();
|
||||
result_column.push_back(position_of_max_intersections);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <Columns/ColumnAggregateFunction.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -70,7 +71,7 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena * arena) const override
|
||||
{
|
||||
nested_func->merge(place, static_cast<const ColumnAggregateFunction &>(*columns[0]).getData()[row_num], arena);
|
||||
nested_func->merge(place, assert_cast<const ColumnAggregateFunction &>(*columns[0]).getData()[row_num], arena);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena * arena) const override
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <DataTypes/IDataType.h>
|
||||
#include <common/StringRef.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -38,9 +39,9 @@ public:
|
||||
void insertResultInto(IColumn & to) const
|
||||
{
|
||||
if (has())
|
||||
static_cast<ColumnVector<T> &>(to).getData().push_back(value);
|
||||
assert_cast<ColumnVector<T> &>(to).getData().push_back(value);
|
||||
else
|
||||
static_cast<ColumnVector<T> &>(to).insertDefault();
|
||||
assert_cast<ColumnVector<T> &>(to).insertDefault();
|
||||
}
|
||||
|
||||
void write(WriteBuffer & buf, const IDataType & /*data_type*/) const
|
||||
@ -61,7 +62,7 @@ public:
|
||||
void change(const IColumn & column, size_t row_num, Arena *)
|
||||
{
|
||||
has_value = true;
|
||||
value = static_cast<const ColumnVector<T> &>(column).getData()[row_num];
|
||||
value = assert_cast<const ColumnVector<T> &>(column).getData()[row_num];
|
||||
}
|
||||
|
||||
/// Assuming to.has()
|
||||
@ -112,7 +113,7 @@ public:
|
||||
|
||||
bool changeIfLess(const IColumn & column, size_t row_num, Arena * arena)
|
||||
{
|
||||
if (!has() || static_cast<const ColumnVector<T> &>(column).getData()[row_num] < value)
|
||||
if (!has() || assert_cast<const ColumnVector<T> &>(column).getData()[row_num] < value)
|
||||
{
|
||||
change(column, row_num, arena);
|
||||
return true;
|
||||
@ -134,7 +135,7 @@ public:
|
||||
|
||||
bool changeIfGreater(const IColumn & column, size_t row_num, Arena * arena)
|
||||
{
|
||||
if (!has() || static_cast<const ColumnVector<T> &>(column).getData()[row_num] > value)
|
||||
if (!has() || assert_cast<const ColumnVector<T> &>(column).getData()[row_num] > value)
|
||||
{
|
||||
change(column, row_num, arena);
|
||||
return true;
|
||||
@ -161,7 +162,7 @@ public:
|
||||
|
||||
bool isEqualTo(const IColumn & column, size_t row_num) const
|
||||
{
|
||||
return has() && static_cast<const ColumnVector<T> &>(column).getData()[row_num] == value;
|
||||
return has() && assert_cast<const ColumnVector<T> &>(column).getData()[row_num] == value;
|
||||
}
|
||||
};
|
||||
|
||||
@ -204,9 +205,9 @@ public:
|
||||
void insertResultInto(IColumn & to) const
|
||||
{
|
||||
if (has())
|
||||
static_cast<ColumnString &>(to).insertDataWithTerminatingZero(getData(), size);
|
||||
assert_cast<ColumnString &>(to).insertDataWithTerminatingZero(getData(), size);
|
||||
else
|
||||
static_cast<ColumnString &>(to).insertDefault();
|
||||
assert_cast<ColumnString &>(to).insertDefault();
|
||||
}
|
||||
|
||||
void write(WriteBuffer & buf, const IDataType & /*data_type*/) const
|
||||
@ -281,7 +282,7 @@ public:
|
||||
|
||||
void change(const IColumn & column, size_t row_num, Arena * arena)
|
||||
{
|
||||
changeImpl(static_cast<const ColumnString &>(column).getDataAtWithTerminatingZero(row_num), arena);
|
||||
changeImpl(assert_cast<const ColumnString &>(column).getDataAtWithTerminatingZero(row_num), arena);
|
||||
}
|
||||
|
||||
void change(const Self & to, Arena * arena)
|
||||
@ -330,7 +331,7 @@ public:
|
||||
|
||||
bool changeIfLess(const IColumn & column, size_t row_num, Arena * arena)
|
||||
{
|
||||
if (!has() || static_cast<const ColumnString &>(column).getDataAtWithTerminatingZero(row_num) < getStringRef())
|
||||
if (!has() || assert_cast<const ColumnString &>(column).getDataAtWithTerminatingZero(row_num) < getStringRef())
|
||||
{
|
||||
change(column, row_num, arena);
|
||||
return true;
|
||||
@ -352,7 +353,7 @@ public:
|
||||
|
||||
bool changeIfGreater(const IColumn & column, size_t row_num, Arena * arena)
|
||||
{
|
||||
if (!has() || static_cast<const ColumnString &>(column).getDataAtWithTerminatingZero(row_num) > getStringRef())
|
||||
if (!has() || assert_cast<const ColumnString &>(column).getDataAtWithTerminatingZero(row_num) > getStringRef())
|
||||
{
|
||||
change(column, row_num, arena);
|
||||
return true;
|
||||
@ -379,7 +380,7 @@ public:
|
||||
|
||||
bool isEqualTo(const IColumn & column, size_t row_num) const
|
||||
{
|
||||
return has() && static_cast<const ColumnString &>(column).getDataAtWithTerminatingZero(row_num) == getStringRef();
|
||||
return has() && assert_cast<const ColumnString &>(column).getDataAtWithTerminatingZero(row_num) == getStringRef();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <array>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/DataTypeNullable.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
@ -149,7 +150,7 @@ public:
|
||||
{
|
||||
if (result_is_nullable)
|
||||
{
|
||||
ColumnNullable & to_concrete = static_cast<ColumnNullable &>(to);
|
||||
ColumnNullable & to_concrete = assert_cast<ColumnNullable &>(to);
|
||||
if (getFlag(place))
|
||||
{
|
||||
nested_function->insertResultInto(nestedPlace(place), to_concrete.getNestedColumn());
|
||||
@ -194,7 +195,7 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena * arena) const override
|
||||
{
|
||||
const ColumnNullable * column = static_cast<const ColumnNullable *>(columns[0]);
|
||||
const ColumnNullable * column = assert_cast<const ColumnNullable *>(columns[0]);
|
||||
if (!column->isNullAt(row_num))
|
||||
{
|
||||
this->setFlag(place);
|
||||
@ -233,7 +234,7 @@ public:
|
||||
{
|
||||
if (is_nullable[i])
|
||||
{
|
||||
const ColumnNullable & nullable_col = static_cast<const ColumnNullable &>(*columns[i]);
|
||||
const ColumnNullable & nullable_col = assert_cast<const ColumnNullable &>(*columns[i]);
|
||||
if (nullable_col.isNullAt(row_num))
|
||||
{
|
||||
/// If at least one column has a null value in the current row,
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@ -143,7 +144,7 @@ public:
|
||||
|
||||
if constexpr (returns_many)
|
||||
{
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
|
||||
size_t size = levels.size();
|
||||
@ -154,7 +155,7 @@ public:
|
||||
|
||||
if constexpr (returns_float)
|
||||
{
|
||||
auto & data_to = static_cast<ColumnVector<FloatReturnType> &>(arr_to.getData()).getData();
|
||||
auto & data_to = assert_cast<ColumnVector<FloatReturnType> &>(arr_to.getData()).getData();
|
||||
size_t old_size = data_to.size();
|
||||
data_to.resize(data_to.size() + size);
|
||||
|
||||
@ -172,7 +173,7 @@ public:
|
||||
else
|
||||
{
|
||||
if constexpr (returns_float)
|
||||
static_cast<ColumnVector<FloatReturnType> &>(to).getData().push_back(data.getFloat(level));
|
||||
assert_cast<ColumnVector<FloatReturnType> &>(to).getData().push_back(data.getFloat(level));
|
||||
else
|
||||
static_cast<ColVecType &>(to).getData().push_back(data.get(level));
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <Columns/ColumnArray.h>
|
||||
#include <DataTypes/DataTypeArray.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -169,8 +170,8 @@ public:
|
||||
ConstAggregateDataPtr place,
|
||||
IColumn & to) const override
|
||||
{
|
||||
auto & col = static_cast<ColumnArray &>(to);
|
||||
auto & col_offsets = static_cast<ColumnArray::ColumnOffsets &>(col.getOffsetsColumn());
|
||||
auto & col = assert_cast<ColumnArray &>(to);
|
||||
auto & col_offsets = assert_cast<ColumnArray::ColumnOffsets &>(col.getOffsetsColumn());
|
||||
|
||||
for (size_t i = 0; i < total; ++i)
|
||||
nested_function->insertResultInto(place + i * sod, col.getData());
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <unordered_set>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Columns/ColumnArray.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <DataTypes/DataTypeArray.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
@ -100,7 +101,7 @@ public:
|
||||
{
|
||||
for (const auto i : ext::range(0, events_size))
|
||||
{
|
||||
auto event = static_cast<const ColumnVector<UInt8> *>(columns[i])->getData()[row_num];
|
||||
auto event = assert_cast<const ColumnVector<UInt8> *>(columns[i])->getData()[row_num];
|
||||
if (event)
|
||||
{
|
||||
this->data(place).add(i);
|
||||
@ -125,8 +126,8 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
auto & data_to = static_cast<ColumnUInt8 &>(static_cast<ColumnArray &>(to).getData()).getData();
|
||||
auto & offsets_to = static_cast<ColumnArray &>(to).getOffsets();
|
||||
auto & data_to = assert_cast<ColumnUInt8 &>(assert_cast<ColumnArray &>(to).getData()).getData();
|
||||
auto & offsets_to = assert_cast<ColumnArray &>(to).getOffsets();
|
||||
|
||||
ColumnArray::Offset current_offset = data_to.size();
|
||||
data_to.resize(current_offset + events_size);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <DataTypes/DataTypeDateTime.h>
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <ext/range.h>
|
||||
#include <Common/PODArray.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
@ -152,12 +153,12 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, const size_t row_num, Arena *) const override
|
||||
{
|
||||
const auto timestamp = static_cast<const ColumnVector<T> *>(columns[0])->getData()[row_num];
|
||||
const auto timestamp = assert_cast<const ColumnVector<T> *>(columns[0])->getData()[row_num];
|
||||
|
||||
typename Data::Events events;
|
||||
for (const auto i : ext::range(1, arg_count))
|
||||
{
|
||||
const auto event = static_cast<const ColumnUInt8 *>(columns[i])->getData()[row_num];
|
||||
const auto event = assert_cast<const ColumnUInt8 *>(columns[i])->getData()[row_num];
|
||||
events.set(i - 1, event);
|
||||
}
|
||||
|
||||
@ -574,7 +575,7 @@ public:
|
||||
auto events_it = events_begin;
|
||||
|
||||
bool match = this->pattern_has_time ? this->backtrackingMatch(events_it, events_end) : this->dfaMatch(events_it, events_end);
|
||||
static_cast<ColumnUInt8 &>(to).getData().push_back(match);
|
||||
assert_cast<ColumnUInt8 &>(to).getData().push_back(match);
|
||||
}
|
||||
};
|
||||
|
||||
@ -594,7 +595,7 @@ public:
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
const_cast<Data &>(this->data(place)).sort();
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(count(place));
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(count(place));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <Columns/ColumnVector.h>
|
||||
#include <Columns/ColumnTuple.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/DataTypeNullable.h>
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <DataTypes/DataTypeTuple.h>
|
||||
@ -120,8 +121,8 @@ public:
|
||||
Arena *
|
||||
) const override
|
||||
{
|
||||
auto col_x = static_cast<const ColumnVector<X> *>(columns[0]);
|
||||
auto col_y = static_cast<const ColumnVector<Y> *>(columns[1]);
|
||||
auto col_x = assert_cast<const ColumnVector<X> *>(columns[0]);
|
||||
auto col_y = assert_cast<const ColumnVector<Y> *>(columns[1]);
|
||||
|
||||
X x = col_x->getData()[row_num];
|
||||
Y y = col_y->getData()[row_num];
|
||||
@ -181,9 +182,9 @@ public:
|
||||
Ret k = this->data(place).getK();
|
||||
Ret b = this->data(place).getB(k);
|
||||
|
||||
auto & col_tuple = static_cast<ColumnTuple &>(to);
|
||||
auto & col_k = static_cast<ColumnVector<Ret> &>(col_tuple.getColumn(0));
|
||||
auto & col_b = static_cast<ColumnVector<Ret> &>(col_tuple.getColumn(1));
|
||||
auto & col_tuple = assert_cast<ColumnTuple &>(to);
|
||||
auto & col_k = assert_cast<ColumnVector<Ret> &>(col_tuple.getColumn(0));
|
||||
auto & col_b = assert_cast<ColumnVector<Ret> &>(col_tuple.getColumn(1));
|
||||
|
||||
col_k.getData().push_back(k);
|
||||
col_b.getData().push_back(b);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <DataTypes/DataTypeAggregateFunction.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <Columns/ColumnAggregateFunction.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -81,7 +82,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnAggregateFunction &>(to).getData().push_back(const_cast<AggregateDataPtr>(place));
|
||||
assert_cast<ColumnAggregateFunction &>(to).getData().push_back(const_cast<AggregateDataPtr>(place));
|
||||
}
|
||||
|
||||
/// Aggregate function or aggregate function state.
|
||||
|
@ -5,9 +5,11 @@
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -52,7 +54,7 @@ class AggregateFunctionVarianceData
|
||||
public:
|
||||
void update(const IColumn & column, size_t row_num)
|
||||
{
|
||||
T received = static_cast<const ColumnVector<T> &>(column).getData()[row_num];
|
||||
T received = assert_cast<const ColumnVector<T> &>(column).getData()[row_num];
|
||||
Float64 val = static_cast<Float64>(received);
|
||||
Float64 delta = val - mean;
|
||||
|
||||
@ -95,7 +97,7 @@ public:
|
||||
|
||||
void publish(IColumn & to) const
|
||||
{
|
||||
static_cast<ColumnFloat64 &>(to).getData().push_back(Op::apply(m2, count));
|
||||
assert_cast<ColumnFloat64 &>(to).getData().push_back(Op::apply(m2, count));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -265,11 +267,11 @@ private:
|
||||
public:
|
||||
void update(const IColumn & column_left, const IColumn & column_right, size_t row_num)
|
||||
{
|
||||
T left_received = static_cast<const ColumnVector<T> &>(column_left).getData()[row_num];
|
||||
T left_received = assert_cast<const ColumnVector<T> &>(column_left).getData()[row_num];
|
||||
Float64 left_val = static_cast<Float64>(left_received);
|
||||
Float64 left_delta = left_val - left_mean;
|
||||
|
||||
U right_received = static_cast<const ColumnVector<U> &>(column_right).getData()[row_num];
|
||||
U right_received = assert_cast<const ColumnVector<U> &>(column_right).getData()[row_num];
|
||||
Float64 right_val = static_cast<Float64>(right_received);
|
||||
Float64 right_delta = right_val - right_mean;
|
||||
|
||||
@ -345,9 +347,9 @@ public:
|
||||
void publish(IColumn & to) const
|
||||
{
|
||||
if constexpr (compute_marginal_moments)
|
||||
static_cast<ColumnFloat64 &>(to).getData().push_back(Op::apply(co_moment, Base::left_m2, Base::right_m2, count));
|
||||
assert_cast<ColumnFloat64 &>(to).getData().push_back(Op::apply(co_moment, Base::left_m2, Base::right_m2, count));
|
||||
else
|
||||
static_cast<ColumnFloat64 &>(to).getData().push_back(Op::apply(co_moment, count));
|
||||
assert_cast<ColumnFloat64 &>(to).getData().push_back(Op::apply(co_moment, count));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <Columns/ColumnDecimal.h>
|
||||
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <map>
|
||||
|
||||
@ -83,7 +84,7 @@ public:
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, const size_t row_num, Arena *) const override
|
||||
{
|
||||
// Column 0 contains array of keys of known type
|
||||
const ColumnArray & array_column0 = static_cast<const ColumnArray &>(*columns[0]);
|
||||
const ColumnArray & array_column0 = assert_cast<const ColumnArray &>(*columns[0]);
|
||||
const IColumn::Offsets & offsets0 = array_column0.getOffsets();
|
||||
const auto & keys_vec = static_cast<const ColVecType &>(array_column0.getData());
|
||||
const size_t keys_vec_offset = offsets0[row_num - 1];
|
||||
@ -94,7 +95,7 @@ public:
|
||||
for (size_t col = 0, size = values_types.size(); col < size; ++col)
|
||||
{
|
||||
Field value;
|
||||
const ColumnArray & array_column = static_cast<const ColumnArray &>(*columns[col + 1]);
|
||||
const ColumnArray & array_column = assert_cast<const ColumnArray &>(*columns[col + 1]);
|
||||
const IColumn::Offsets & offsets = array_column.getOffsets();
|
||||
const size_t values_vec_offset = offsets[row_num - 1];
|
||||
const size_t values_vec_size = (offsets[row_num] - values_vec_offset);
|
||||
@ -228,8 +229,8 @@ public:
|
||||
|
||||
size_t size = merged_maps.size();
|
||||
|
||||
auto & to_tuple = static_cast<ColumnTuple &>(to);
|
||||
auto & to_keys_arr = static_cast<ColumnArray &>(to_tuple.getColumn(0));
|
||||
auto & to_tuple = assert_cast<ColumnTuple &>(to);
|
||||
auto & to_keys_arr = assert_cast<ColumnArray &>(to_tuple.getColumn(0));
|
||||
auto & to_keys_col = to_keys_arr.getData();
|
||||
|
||||
// Advance column offsets
|
||||
@ -239,7 +240,7 @@ public:
|
||||
|
||||
for (size_t col = 0; col < values_types.size(); ++col)
|
||||
{
|
||||
auto & to_values_arr = static_cast<ColumnArray &>(to_tuple.getColumn(col + 1));
|
||||
auto & to_values_arr = assert_cast<ColumnArray &>(to_tuple.getColumn(col + 1));
|
||||
auto & to_values_offsets = to_values_arr.getOffsets();
|
||||
to_values_offsets.push_back(to_values_offsets.back() + size);
|
||||
to_values_arr.getData().reserve(size);
|
||||
@ -254,7 +255,7 @@ public:
|
||||
// Write 0..n arrays of values
|
||||
for (size_t col = 0; col < values_types.size(); ++col)
|
||||
{
|
||||
auto & to_values_col = static_cast<ColumnArray &>(to_tuple.getColumn(col + 1)).getData();
|
||||
auto & to_values_col = assert_cast<ColumnArray &>(to_tuple.getColumn(col + 1)).getData();
|
||||
to_values_col.insert(elem.second[col]);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <Common/ArenaAllocator.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <ext/range.h>
|
||||
#include "IAggregateFunction.h"
|
||||
|
||||
@ -235,9 +236,9 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, const size_t row_num, Arena *) const override
|
||||
{
|
||||
auto uid = static_cast<const ColumnVector<UInt64> *>(columns[0])->getData()[row_num];
|
||||
auto ts = static_cast<const ColumnVector<Int64> *>(columns[1])->getData()[row_num];
|
||||
auto val = static_cast<const ColumnVector<Float64> *>(columns[2])->getData()[row_num];
|
||||
auto uid = assert_cast<const ColumnVector<UInt64> *>(columns[0])->getData()[row_num];
|
||||
auto ts = assert_cast<const ColumnVector<Int64> *>(columns[1])->getData()[row_num];
|
||||
auto val = assert_cast<const ColumnVector<Float64> *>(columns[2])->getData()[row_num];
|
||||
if (uid && ts && val)
|
||||
{
|
||||
this->data(place).add(uid, ts, val);
|
||||
@ -255,7 +256,7 @@ public:
|
||||
const auto & value = this->data(place).result;
|
||||
size_t size = value.size();
|
||||
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
size_t old_size = offsets_to.back();
|
||||
|
||||
@ -264,9 +265,9 @@ public:
|
||||
if (size)
|
||||
{
|
||||
typename ColumnInt64::Container & ts_to
|
||||
= static_cast<ColumnInt64 &>(static_cast<ColumnTuple &>(arr_to.getData()).getColumn(0)).getData();
|
||||
= assert_cast<ColumnInt64 &>(assert_cast<ColumnTuple &>(arr_to.getData()).getColumn(0)).getData();
|
||||
typename ColumnFloat64::Container & val_to
|
||||
= static_cast<ColumnFloat64 &>(static_cast<ColumnTuple &>(arr_to.getData()).getColumn(1)).getData();
|
||||
= assert_cast<ColumnFloat64 &>(assert_cast<ColumnTuple &>(arr_to.getData()).getColumn(1)).getData();
|
||||
ts_to.reserve(old_size + size);
|
||||
val_to.reserve(old_size + size);
|
||||
size_t i = 0;
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include <Columns/ColumnArray.h>
|
||||
|
||||
#include <Common/SpaceSaving.h>
|
||||
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -62,9 +62,9 @@ public:
|
||||
set.resize(reserved);
|
||||
|
||||
if constexpr (is_weighted)
|
||||
set.insert(static_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num], columns[1]->getUInt(row_num));
|
||||
set.insert(assert_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num], columns[1]->getUInt(row_num));
|
||||
else
|
||||
set.insert(static_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num]);
|
||||
set.insert(assert_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num]);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena *) const override
|
||||
@ -86,7 +86,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
|
||||
const typename State::Set & set = this->data(place).value;
|
||||
@ -95,7 +95,7 @@ public:
|
||||
|
||||
offsets_to.push_back(offsets_to.back() + size);
|
||||
|
||||
typename ColumnVector<T>::Container & data_to = static_cast<ColumnVector<T> &>(arr_to.getData()).getData();
|
||||
typename ColumnVector<T>::Container & data_to = assert_cast<ColumnVector<T> &>(arr_to.getData()).getData();
|
||||
size_t old_size = data_to.size();
|
||||
data_to.resize(old_size + size);
|
||||
|
||||
@ -215,7 +215,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
ColumnArray & arr_to = static_cast<ColumnArray &>(to);
|
||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
||||
IColumn & data_to = arr_to.getData();
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <Common/HyperLogLogWithSmallSetOptimization.h>
|
||||
#include <Common/CombinedCardinalityEstimator.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/UniquesHashSet.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
@ -170,7 +171,7 @@ struct OneAdder
|
||||
{
|
||||
if constexpr (!std::is_same_v<T, String>)
|
||||
{
|
||||
const auto & value = static_cast<const ColumnVector<T> &>(column).getData()[row_num];
|
||||
const auto & value = assert_cast<const ColumnVector<T> &>(column).getData()[row_num];
|
||||
data.set.insert(AggregateFunctionUniqTraits<T>::hash(value));
|
||||
}
|
||||
else
|
||||
@ -183,7 +184,7 @@ struct OneAdder
|
||||
{
|
||||
if constexpr (!std::is_same_v<T, String>)
|
||||
{
|
||||
data.set.insert(static_cast<const ColumnVector<T> &>(column).getData()[row_num]);
|
||||
data.set.insert(assert_cast<const ColumnVector<T> &>(column).getData()[row_num]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -240,7 +241,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).set.size());
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).set.size());
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override { return __FILE__; }
|
||||
@ -296,7 +297,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).set.size());
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).set.size());
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override { return __FILE__; }
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <DataTypes/DataTypeTuple.h>
|
||||
#include <DataTypes/DataTypeUUID.h>
|
||||
@ -131,7 +132,7 @@ public:
|
||||
{
|
||||
if constexpr (!std::is_same_v<T, String>)
|
||||
{
|
||||
const auto & value = static_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num];
|
||||
const auto & value = assert_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num];
|
||||
this->data(place).set.insert(detail::AggregateFunctionUniqCombinedTraits<T>::hash(value));
|
||||
}
|
||||
else
|
||||
@ -158,7 +159,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).set.size());
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).set.size());
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override
|
||||
@ -222,7 +223,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).set.size());
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).set.size());
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <AggregateFunctions/UniqVariadicHash.h>
|
||||
@ -101,7 +102,7 @@ struct __attribute__((__packed__)) AggregateFunctionUniqUpToData
|
||||
|
||||
void add(const IColumn & column, size_t row_num, UInt8 threshold)
|
||||
{
|
||||
insert(static_cast<const ColumnVector<T> &>(column).getData()[row_num], threshold);
|
||||
insert(assert_cast<const ColumnVector<T> &>(column).getData()[row_num], threshold);
|
||||
}
|
||||
};
|
||||
|
||||
@ -123,7 +124,7 @@ struct AggregateFunctionUniqUpToData<UInt128> : AggregateFunctionUniqUpToData<UI
|
||||
{
|
||||
void add(const IColumn & column, size_t row_num, UInt8 threshold)
|
||||
{
|
||||
UInt128 value = static_cast<const ColumnVector<UInt128> &>(column).getData()[row_num];
|
||||
UInt128 value = assert_cast<const ColumnVector<UInt128> &>(column).getData()[row_num];
|
||||
insert(sipHash64(value), threshold);
|
||||
}
|
||||
};
|
||||
@ -176,7 +177,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).size());
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).size());
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override { return __FILE__; }
|
||||
@ -240,7 +241,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).size());
|
||||
assert_cast<ColumnUInt64 &>(to).getData().push_back(this->data(place).size());
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override { return __FILE__; }
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <Common/ArenaAllocator.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -215,11 +216,11 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, const size_t row_num, Arena *) const override
|
||||
{
|
||||
const auto timestamp = static_cast<const ColumnVector<T> *>(columns[0])->getData()[row_num];
|
||||
const auto timestamp = assert_cast<const ColumnVector<T> *>(columns[0])->getData()[row_num];
|
||||
// reverse iteration and stable sorting are needed for events that are qualified by more than one condition.
|
||||
for (auto i = events_size; i > 0; --i)
|
||||
{
|
||||
auto event = static_cast<const ColumnVector<UInt8> *>(columns[i])->getData()[row_num];
|
||||
auto event = assert_cast<const ColumnVector<UInt8> *>(columns[i])->getData()[row_num];
|
||||
if (event)
|
||||
this->data(place).add(timestamp, i);
|
||||
}
|
||||
@ -242,7 +243,7 @@ public:
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const override
|
||||
{
|
||||
static_cast<ColumnUInt8 &>(to).getData().push_back(getEventLevel(this->data(place)));
|
||||
assert_cast<ColumnUInt8 &>(to).getData().push_back(getEventLevel(this->data(place)));
|
||||
}
|
||||
|
||||
const char * getHeaderFilePath() const override
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Core/Defines.h>
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/UInt128.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Columns/ColumnTuple.h>
|
||||
|
||||
|
||||
@ -67,7 +68,7 @@ struct UniqVariadicHash<false, true>
|
||||
{
|
||||
UInt64 hash;
|
||||
|
||||
const auto & tuple_columns = static_cast<const ColumnTuple *>(columns[0])->getColumns();
|
||||
const auto & tuple_columns = assert_cast<const ColumnTuple *>(columns[0])->getColumns();
|
||||
|
||||
const auto * column = tuple_columns.data();
|
||||
const auto * columns_end = column + num_args;
|
||||
@ -116,7 +117,7 @@ struct UniqVariadicHash<true, true>
|
||||
{
|
||||
static inline UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
||||
{
|
||||
const auto & tuple_columns = static_cast<const ColumnTuple *>(columns[0])->getColumns();
|
||||
const auto & tuple_columns = assert_cast<const ColumnTuple *>(columns[0])->getColumns();
|
||||
|
||||
const auto * column = tuple_columns.data();
|
||||
const auto * columns_end = column + num_args;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <Columns/ColumnAggregateFunction.h>
|
||||
#include <Columns/ColumnsCommon.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <AggregateFunctions/AggregateFunctionState.h>
|
||||
#include <DataStreams/ColumnGathererStream.h>
|
||||
#include <IO/WriteBufferFromArena.h>
|
||||
@ -158,7 +159,7 @@ void ColumnAggregateFunction::ensureOwnership()
|
||||
|
||||
void ColumnAggregateFunction::insertRangeFrom(const IColumn & from, size_t start, size_t length)
|
||||
{
|
||||
const ColumnAggregateFunction & from_concrete = static_cast<const ColumnAggregateFunction &>(from);
|
||||
const ColumnAggregateFunction & from_concrete = assert_cast<const ColumnAggregateFunction &>(from);
|
||||
|
||||
if (start + length > from_concrete.data.size())
|
||||
throw Exception("Parameters start = " + toString(start) + ", length = " + toString(length)
|
||||
@ -353,7 +354,7 @@ void ColumnAggregateFunction::insertMergeFrom(ConstAggregateDataPtr place)
|
||||
|
||||
void ColumnAggregateFunction::insertMergeFrom(const IColumn & from, size_t n)
|
||||
{
|
||||
insertMergeFrom(static_cast<const ColumnAggregateFunction &>(from).data[n]);
|
||||
insertMergeFrom(assert_cast<const ColumnAggregateFunction &>(from).data[n]);
|
||||
}
|
||||
|
||||
Arena & ColumnAggregateFunction::createOrGetArena()
|
||||
@ -492,7 +493,7 @@ MutableColumns ColumnAggregateFunction::scatter(IColumn::ColumnIndex num_columns
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < num_rows; ++i)
|
||||
static_cast<ColumnAggregateFunction &>(*columns[selector[i]]).data.push_back(data[i]);
|
||||
assert_cast<ColumnAggregateFunction &>(*columns[selector[i]]).data.push_back(data[i]);
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <Common/Arena.h>
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -227,7 +227,7 @@ void ColumnArray::insert(const Field & x)
|
||||
|
||||
void ColumnArray::insertFrom(const IColumn & src_, size_t n)
|
||||
{
|
||||
const ColumnArray & src = static_cast<const ColumnArray &>(src_);
|
||||
const ColumnArray & src = assert_cast<const ColumnArray &>(src_);
|
||||
size_t size = src.sizeAt(n);
|
||||
size_t offset = src.offsetAt(n);
|
||||
|
||||
@ -257,7 +257,7 @@ void ColumnArray::popBack(size_t n)
|
||||
|
||||
int ColumnArray::compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const
|
||||
{
|
||||
const ColumnArray & rhs = static_cast<const ColumnArray &>(rhs_);
|
||||
const ColumnArray & rhs = assert_cast<const ColumnArray &>(rhs_);
|
||||
|
||||
/// Suboptimal
|
||||
size_t lhs_size = sizeAt(n);
|
||||
@ -373,7 +373,7 @@ void ColumnArray::insertRangeFrom(const IColumn & src, size_t start, size_t leng
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
const ColumnArray & src_concrete = static_cast<const ColumnArray &>(src);
|
||||
const ColumnArray & src_concrete = assert_cast<const ColumnArray &>(src);
|
||||
|
||||
if (start + length > src_concrete.getOffsets().size())
|
||||
throw Exception("Parameter out of bound in ColumnArray::insertRangeFrom method. [start(" + std::to_string(start) + ") + length(" + std::to_string(length) + ") > offsets.size(" + std::to_string(src_concrete.getOffsets().size()) + ")]",
|
||||
@ -429,10 +429,10 @@ ColumnPtr ColumnArray::filterNumber(const Filter & filt, ssize_t result_size_hin
|
||||
|
||||
auto res = ColumnArray::create(data->cloneEmpty());
|
||||
|
||||
auto & res_elems = static_cast<ColumnVector<T> &>(res->getData()).getData();
|
||||
auto & res_elems = assert_cast<ColumnVector<T> &>(res->getData()).getData();
|
||||
Offsets & res_offsets = res->getOffsets();
|
||||
|
||||
filterArraysImpl<T>(static_cast<const ColumnVector<T> &>(*data).getData(), getOffsets(), res_elems, res_offsets, filt, result_size_hint);
|
||||
filterArraysImpl<T>(assert_cast<const ColumnVector<T> &>(*data).getData(), getOffsets(), res_elems, res_offsets, filt, result_size_hint);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -554,11 +554,11 @@ ColumnPtr ColumnArray::filterNullable(const Filter & filt, ssize_t result_size_h
|
||||
if (getOffsets().size() == 0)
|
||||
return ColumnArray::create(data);
|
||||
|
||||
const ColumnNullable & nullable_elems = static_cast<const ColumnNullable &>(*data);
|
||||
const ColumnNullable & nullable_elems = assert_cast<const ColumnNullable &>(*data);
|
||||
|
||||
auto array_of_nested = ColumnArray::create(nullable_elems.getNestedColumnPtr(), offsets);
|
||||
auto filtered_array_of_nested_owner = array_of_nested->filter(filt, result_size_hint);
|
||||
auto & filtered_array_of_nested = static_cast<const ColumnArray &>(*filtered_array_of_nested_owner);
|
||||
auto & filtered_array_of_nested = assert_cast<const ColumnArray &>(*filtered_array_of_nested_owner);
|
||||
auto & filtered_offsets = filtered_array_of_nested.getOffsetsPtr();
|
||||
|
||||
auto res_null_map = ColumnUInt8::create();
|
||||
@ -577,7 +577,7 @@ ColumnPtr ColumnArray::filterTuple(const Filter & filt, ssize_t result_size_hint
|
||||
if (getOffsets().size() == 0)
|
||||
return ColumnArray::create(data);
|
||||
|
||||
const ColumnTuple & tuple = static_cast<const ColumnTuple &>(*data);
|
||||
const ColumnTuple & tuple = assert_cast<const ColumnTuple &>(*data);
|
||||
|
||||
/// Make temporary arrays for each components of Tuple, then filter and collect back.
|
||||
|
||||
@ -593,11 +593,11 @@ ColumnPtr ColumnArray::filterTuple(const Filter & filt, ssize_t result_size_hint
|
||||
|
||||
Columns tuple_columns(tuple_size);
|
||||
for (size_t i = 0; i < tuple_size; ++i)
|
||||
tuple_columns[i] = static_cast<const ColumnArray &>(*temporary_arrays[i]).getDataPtr();
|
||||
tuple_columns[i] = assert_cast<const ColumnArray &>(*temporary_arrays[i]).getDataPtr();
|
||||
|
||||
return ColumnArray::create(
|
||||
ColumnTuple::create(tuple_columns),
|
||||
static_cast<const ColumnArray &>(*temporary_arrays.front()).getOffsetsPtr());
|
||||
assert_cast<const ColumnArray &>(*temporary_arrays.front()).getOffsetsPtr());
|
||||
}
|
||||
|
||||
|
||||
@ -789,7 +789,7 @@ ColumnPtr ColumnArray::replicateString(const Offsets & replicate_offsets) const
|
||||
if (0 == col_size)
|
||||
return res;
|
||||
|
||||
ColumnArray & res_ = static_cast<ColumnArray &>(*res);
|
||||
ColumnArray & res_ = assert_cast<ColumnArray &>(*res);
|
||||
|
||||
const ColumnString & src_string = typeid_cast<const ColumnString &>(*data);
|
||||
const ColumnString::Chars & src_chars = src_string.getChars();
|
||||
@ -901,7 +901,7 @@ ColumnPtr ColumnArray::replicateGeneric(const Offsets & replicate_offsets) const
|
||||
throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||||
|
||||
MutableColumnPtr res = cloneEmpty();
|
||||
ColumnArray & res_concrete = static_cast<ColumnArray &>(*res);
|
||||
ColumnArray & res_concrete = assert_cast<ColumnArray &>(*res);
|
||||
|
||||
if (0 == col_size)
|
||||
return res;
|
||||
@ -922,7 +922,7 @@ ColumnPtr ColumnArray::replicateGeneric(const Offsets & replicate_offsets) const
|
||||
|
||||
ColumnPtr ColumnArray::replicateNullable(const Offsets & replicate_offsets) const
|
||||
{
|
||||
const ColumnNullable & nullable = static_cast<const ColumnNullable &>(*data);
|
||||
const ColumnNullable & nullable = assert_cast<const ColumnNullable &>(*data);
|
||||
|
||||
/// Make temporary arrays for each components of Nullable. Then replicate them independently and collect back to result.
|
||||
/// NOTE Offsets are calculated twice and it is redundant.
|
||||
@ -934,15 +934,15 @@ ColumnPtr ColumnArray::replicateNullable(const Offsets & replicate_offsets) cons
|
||||
|
||||
return ColumnArray::create(
|
||||
ColumnNullable::create(
|
||||
static_cast<const ColumnArray &>(*array_of_nested).getDataPtr(),
|
||||
static_cast<const ColumnArray &>(*array_of_null_map).getDataPtr()),
|
||||
static_cast<const ColumnArray &>(*array_of_nested).getOffsetsPtr());
|
||||
assert_cast<const ColumnArray &>(*array_of_nested).getDataPtr(),
|
||||
assert_cast<const ColumnArray &>(*array_of_null_map).getDataPtr()),
|
||||
assert_cast<const ColumnArray &>(*array_of_nested).getOffsetsPtr());
|
||||
}
|
||||
|
||||
|
||||
ColumnPtr ColumnArray::replicateTuple(const Offsets & replicate_offsets) const
|
||||
{
|
||||
const ColumnTuple & tuple = static_cast<const ColumnTuple &>(*data);
|
||||
const ColumnTuple & tuple = assert_cast<const ColumnTuple &>(*data);
|
||||
|
||||
/// Make temporary arrays for each components of Tuple. In the same way as for Nullable.
|
||||
|
||||
@ -958,11 +958,11 @@ ColumnPtr ColumnArray::replicateTuple(const Offsets & replicate_offsets) const
|
||||
|
||||
Columns tuple_columns(tuple_size);
|
||||
for (size_t i = 0; i < tuple_size; ++i)
|
||||
tuple_columns[i] = static_cast<const ColumnArray &>(*temporary_arrays[i]).getDataPtr();
|
||||
tuple_columns[i] = assert_cast<const ColumnArray &>(*temporary_arrays[i]).getDataPtr();
|
||||
|
||||
return ColumnArray::create(
|
||||
ColumnTuple::create(tuple_columns),
|
||||
static_cast<const ColumnArray &>(*temporary_arrays.front()).getOffsetsPtr());
|
||||
assert_cast<const ColumnArray &>(*temporary_arrays.front()).getOffsetsPtr());
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Columns/ColumnVector.h>
|
||||
#include <Core/Defines.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -89,12 +90,12 @@ public:
|
||||
|
||||
Offsets & ALWAYS_INLINE getOffsets()
|
||||
{
|
||||
return static_cast<ColumnOffsets &>(*offsets).getData();
|
||||
return assert_cast<ColumnOffsets &>(*offsets).getData();
|
||||
}
|
||||
|
||||
const Offsets & ALWAYS_INLINE getOffsets() const
|
||||
{
|
||||
return static_cast<const ColumnOffsets &>(*offsets).getData();
|
||||
return assert_cast<const ColumnOffsets &>(*offsets).getData();
|
||||
}
|
||||
|
||||
const ColumnPtr & getDataPtr() const { return data; }
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Common/Exception.h>
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -175,7 +176,7 @@ public:
|
||||
|
||||
int compareAt(size_t, size_t, const IColumn & rhs, int nan_direction_hint) const override
|
||||
{
|
||||
return data->compareAt(0, 0, *static_cast<const ColumnConst &>(rhs).data, nan_direction_hint);
|
||||
return data->compareAt(0, 0, *assert_cast<const ColumnConst &>(rhs).data, nan_direction_hint);
|
||||
}
|
||||
|
||||
MutableColumns scatter(ColumnIndex num_columns, const Selector & selector) const override;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <Common/Exception.h>
|
||||
#include <Common/Arena.h>
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <common/unaligned.h>
|
||||
|
||||
@ -133,7 +134,7 @@ void ColumnDecimal<T>::insertData(const char * src, size_t /*length*/)
|
||||
template <typename T>
|
||||
void ColumnDecimal<T>::insertRangeFrom(const IColumn & src, size_t start, size_t length)
|
||||
{
|
||||
const ColumnDecimal & src_vec = static_cast<const ColumnDecimal &>(src);
|
||||
const ColumnDecimal & src_vec = assert_cast<const ColumnDecimal &>(src);
|
||||
|
||||
if (start + length > src_vec.data.size())
|
||||
throw Exception("Parameters start = " + toString(start) + ", length = " + toString(length) +
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/memcpySmall.h>
|
||||
#include <Common/memcmpSmall.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <DataStreams/ColumnGathererStream.h>
|
||||
|
||||
@ -33,7 +34,7 @@ MutableColumnPtr ColumnFixedString::cloneResized(size_t size) const
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
auto & new_col = static_cast<ColumnFixedString &>(*new_col_holder);
|
||||
auto & new_col = assert_cast<ColumnFixedString &>(*new_col_holder);
|
||||
new_col.chars.resize(size * n);
|
||||
|
||||
size_t count = std::min(this->size(), size);
|
||||
@ -60,7 +61,7 @@ void ColumnFixedString::insert(const Field & x)
|
||||
|
||||
void ColumnFixedString::insertFrom(const IColumn & src_, size_t index)
|
||||
{
|
||||
const ColumnFixedString & src = static_cast<const ColumnFixedString &>(src_);
|
||||
const ColumnFixedString & src = assert_cast<const ColumnFixedString &>(src_);
|
||||
|
||||
if (n != src.getN())
|
||||
throw Exception("Size of FixedString doesn't match", ErrorCodes::SIZE_OF_FIXED_STRING_DOESNT_MATCH);
|
||||
@ -140,7 +141,7 @@ void ColumnFixedString::getPermutation(bool reverse, size_t limit, int /*nan_dir
|
||||
|
||||
void ColumnFixedString::insertRangeFrom(const IColumn & src, size_t start, size_t length)
|
||||
{
|
||||
const ColumnFixedString & src_concrete = static_cast<const ColumnFixedString &>(src);
|
||||
const ColumnFixedString & src_concrete = assert_cast<const ColumnFixedString &>(src);
|
||||
|
||||
if (start + length > src_concrete.size())
|
||||
throw Exception("Parameters start = "
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <Common/PODArray.h>
|
||||
#include <Common/memcmpSmall.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Columns/ColumnVectorHelper.h>
|
||||
|
||||
@ -102,7 +103,7 @@ public:
|
||||
|
||||
int compareAt(size_t p1, size_t p2, const IColumn & rhs_, int /*nan_direction_hint*/) const override
|
||||
{
|
||||
const ColumnFixedString & rhs = static_cast<const ColumnFixedString &>(rhs_);
|
||||
const ColumnFixedString & rhs = assert_cast<const ColumnFixedString &>(rhs_);
|
||||
return memcmpSmallAllowOverflow15(chars.data() + p1 * n, rhs.chars.data() + p2 * n, n);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <DataStreams/ColumnGathererStream.h>
|
||||
#include <DataTypes/NumberTraits.h>
|
||||
#include <Common/HashTable/HashMap.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -244,7 +246,7 @@ MutableColumnPtr ColumnLowCardinality::cloneResized(size_t size) const
|
||||
|
||||
int ColumnLowCardinality::compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
|
||||
{
|
||||
const auto & low_cardinality_column = static_cast<const ColumnLowCardinality &>(rhs);
|
||||
const auto & low_cardinality_column = assert_cast<const ColumnLowCardinality &>(rhs);
|
||||
size_t n_index = getIndexes().getUInt(n);
|
||||
size_t m_index = low_cardinality_column.getIndexes().getUInt(m);
|
||||
return getDictionary().compareAt(n_index, m_index, low_cardinality_column.getDictionary(), nan_direction_hint);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Columns/IColumnUnique.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <AggregateFunctions/AggregateFunctionCount.h>
|
||||
#include "ColumnsNumber.h"
|
||||
|
||||
@ -166,10 +167,10 @@ public:
|
||||
|
||||
switch (idx.getSizeOfIndexType())
|
||||
{
|
||||
case sizeof(UInt8): return static_cast<const ColumnUInt8 *>(indexes)->getElement(row);
|
||||
case sizeof(UInt16): return static_cast<const ColumnUInt16 *>(indexes)->getElement(row);
|
||||
case sizeof(UInt32): return static_cast<const ColumnUInt32 *>(indexes)->getElement(row);
|
||||
case sizeof(UInt64): return static_cast<const ColumnUInt64 *>(indexes)->getElement(row);
|
||||
case sizeof(UInt8): return assert_cast<const ColumnUInt8 *>(indexes)->getElement(row);
|
||||
case sizeof(UInt16): return assert_cast<const ColumnUInt16 *>(indexes)->getElement(row);
|
||||
case sizeof(UInt32): return assert_cast<const ColumnUInt32 *>(indexes)->getElement(row);
|
||||
case sizeof(UInt64): return assert_cast<const ColumnUInt64 *>(indexes)->getElement(row);
|
||||
default: throw Exception("Unexpected size of index type for low cardinality column.", ErrorCodes::LOGICAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/NaNUtils.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <DataStreams/ColumnGathererStream.h>
|
||||
@ -129,7 +130,7 @@ const char * ColumnNullable::deserializeAndInsertFromArena(const char * pos)
|
||||
|
||||
void ColumnNullable::insertRangeFrom(const IColumn & src, size_t start, size_t length)
|
||||
{
|
||||
const ColumnNullable & nullable_col = static_cast<const ColumnNullable &>(src);
|
||||
const ColumnNullable & nullable_col = assert_cast<const ColumnNullable &>(src);
|
||||
getNullMapColumn().insertRangeFrom(*nullable_col.null_map, start, length);
|
||||
getNestedColumn().insertRangeFrom(*nullable_col.nested_column, start, length);
|
||||
}
|
||||
@ -150,7 +151,7 @@ void ColumnNullable::insert(const Field & x)
|
||||
|
||||
void ColumnNullable::insertFrom(const IColumn & src, size_t n)
|
||||
{
|
||||
const ColumnNullable & src_concrete = static_cast<const ColumnNullable &>(src);
|
||||
const ColumnNullable & src_concrete = assert_cast<const ColumnNullable &>(src);
|
||||
getNestedColumn().insertFrom(src_concrete.getNestedColumn(), n);
|
||||
getNullMapData().push_back(src_concrete.getNullMapData()[n]);
|
||||
}
|
||||
@ -190,7 +191,7 @@ int ColumnNullable::compareAt(size_t n, size_t m, const IColumn & rhs_, int null
|
||||
/// the ordering specified by either NULLS FIRST or NULLS LAST in the
|
||||
/// ORDER BY construction.
|
||||
|
||||
const ColumnNullable & nullable_rhs = static_cast<const ColumnNullable &>(rhs_);
|
||||
const ColumnNullable & nullable_rhs = assert_cast<const ColumnNullable &>(rhs_);
|
||||
|
||||
bool lval_is_null = isNullAt(n);
|
||||
bool rval_is_null = nullable_rhs.isNullAt(m);
|
||||
@ -458,7 +459,7 @@ ColumnPtr makeNullable(const ColumnPtr & column)
|
||||
return column;
|
||||
|
||||
if (isColumnConst(*column))
|
||||
return ColumnConst::create(makeNullable(static_cast<const ColumnConst &>(*column).getDataColumnPtr()), column->size());
|
||||
return ColumnConst::create(makeNullable(assert_cast<const ColumnConst &>(*column).getDataColumnPtr()), column->size());
|
||||
|
||||
return ColumnNullable::create(column, ColumnUInt8::create(column->size(), 0));
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -45,7 +46,7 @@ public:
|
||||
std::string getName() const override { return "Nullable(" + nested_column->getName() + ")"; }
|
||||
MutableColumnPtr cloneResized(size_t size) const override;
|
||||
size_t size() const override { return nested_column->size(); }
|
||||
bool isNullAt(size_t n) const override { return static_cast<const ColumnUInt8 &>(*null_map).getData()[n] != 0;}
|
||||
bool isNullAt(size_t n) const override { return assert_cast<const ColumnUInt8 &>(*null_map).getData()[n] != 0;}
|
||||
Field operator[](size_t n) const override;
|
||||
void get(size_t n, Field & res) const override;
|
||||
bool getBool(size_t n) const override { return isNullAt(n) ? 0 : nested_column->getBool(n); }
|
||||
@ -116,8 +117,8 @@ public:
|
||||
/// Return the column that represents the byte map.
|
||||
const ColumnPtr & getNullMapColumnPtr() const { return null_map; }
|
||||
|
||||
ColumnUInt8 & getNullMapColumn() { return static_cast<ColumnUInt8 &>(*null_map); }
|
||||
const ColumnUInt8 & getNullMapColumn() const { return static_cast<const ColumnUInt8 &>(*null_map); }
|
||||
ColumnUInt8 & getNullMapColumn() { return assert_cast<ColumnUInt8 &>(*null_map); }
|
||||
const ColumnUInt8 & getNullMapColumn() const { return assert_cast<const ColumnUInt8 &>(*null_map); }
|
||||
|
||||
NullMap & getNullMapData() { return getNullMapColumn().getData(); }
|
||||
const NullMap & getNullMapData() const { return getNullMapColumn().getData(); }
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <Core/Defines.h>
|
||||
#include <Common/Arena.h>
|
||||
#include <Common/memcmpSmall.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Columns/Collator.h>
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Columns/ColumnsCommon.h>
|
||||
@ -68,7 +69,7 @@ void ColumnString::insertRangeFrom(const IColumn & src, size_t start, size_t len
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
const ColumnString & src_concrete = static_cast<const ColumnString &>(src);
|
||||
const ColumnString & src_concrete = assert_cast<const ColumnString &>(src);
|
||||
|
||||
if (start + length > src_concrete.offsets.size())
|
||||
throw Exception("Parameter out of bound in IColumnString::insertRangeFrom method.",
|
||||
@ -360,7 +361,7 @@ void ColumnString::getExtremes(Field & min, Field & max) const
|
||||
|
||||
int ColumnString::compareAtWithCollation(size_t n, size_t m, const IColumn & rhs_, const Collator & collator) const
|
||||
{
|
||||
const ColumnString & rhs = static_cast<const ColumnString &>(rhs_);
|
||||
const ColumnString & rhs = assert_cast<const ColumnString &>(rhs_);
|
||||
|
||||
return collator.compare(
|
||||
reinterpret_cast<const char *>(&chars[offsetAt(n)]), sizeAt(n),
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/memcpySmall.h>
|
||||
#include <Common/memcmpSmall.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
class Collator;
|
||||
@ -121,7 +122,7 @@ public:
|
||||
|
||||
void insertFrom(const IColumn & src_, size_t n) override
|
||||
{
|
||||
const ColumnString & src = static_cast<const ColumnString &>(src_);
|
||||
const ColumnString & src = assert_cast<const ColumnString &>(src_);
|
||||
const size_t size_to_append = src.offsets[n] - src.offsets[n - 1]; /// -1th index is Ok, see PaddedPODArray.
|
||||
|
||||
if (size_to_append == 1)
|
||||
@ -204,7 +205,7 @@ public:
|
||||
|
||||
int compareAt(size_t n, size_t m, const IColumn & rhs_, int /*nan_direction_hint*/) const override
|
||||
{
|
||||
const ColumnString & rhs = static_cast<const ColumnString &>(rhs_);
|
||||
const ColumnString & rhs = assert_cast<const ColumnString &>(rhs_);
|
||||
return memcmpSmallAllowOverflow15(chars.data() + offsetAt(n), sizeAt(n) - 1, rhs.chars.data() + rhs.offsetAt(m), rhs.sizeAt(m) - 1);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <ext/map.h>
|
||||
#include <ext/range.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -118,7 +119,7 @@ void ColumnTuple::insert(const Field & x)
|
||||
|
||||
void ColumnTuple::insertFrom(const IColumn & src_, size_t n)
|
||||
{
|
||||
const ColumnTuple & src = static_cast<const ColumnTuple &>(src_);
|
||||
const ColumnTuple & src = assert_cast<const ColumnTuple &>(src_);
|
||||
|
||||
const size_t tuple_size = columns.size();
|
||||
if (src.columns.size() != tuple_size)
|
||||
@ -172,7 +173,7 @@ void ColumnTuple::insertRangeFrom(const IColumn & src, size_t start, size_t leng
|
||||
const size_t tuple_size = columns.size();
|
||||
for (size_t i = 0; i < tuple_size; ++i)
|
||||
columns[i]->insertRangeFrom(
|
||||
*static_cast<const ColumnTuple &>(src).columns[i],
|
||||
*assert_cast<const ColumnTuple &>(src).columns[i],
|
||||
start, length);
|
||||
}
|
||||
|
||||
@ -245,7 +246,7 @@ int ColumnTuple::compareAt(size_t n, size_t m, const IColumn & rhs, int nan_dire
|
||||
{
|
||||
const size_t tuple_size = columns.size();
|
||||
for (size_t i = 0; i < tuple_size; ++i)
|
||||
if (int res = columns[i]->compareAt(n, m, *static_cast<const ColumnTuple &>(rhs).columns[i], nan_direction_hint))
|
||||
if (int res = columns[i]->compareAt(n, m, *assert_cast<const ColumnTuple &>(rhs).columns[i], nan_direction_hint))
|
||||
return res;
|
||||
|
||||
return 0;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <DataTypes/NumberTraits.h>
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <ext/range.h>
|
||||
|
||||
#include <common/unaligned.h>
|
||||
@ -140,8 +141,8 @@ private:
|
||||
static size_t numSpecialValues(bool is_nullable) { return is_nullable ? 2 : 1; }
|
||||
size_t numSpecialValues() const { return numSpecialValues(is_nullable); }
|
||||
|
||||
ColumnType * getRawColumnPtr() { return static_cast<ColumnType *>(column_holder.get()); }
|
||||
const ColumnType * getRawColumnPtr() const { return static_cast<const ColumnType *>(column_holder.get()); }
|
||||
ColumnType * getRawColumnPtr() { return assert_cast<ColumnType *>(column_holder.get()); }
|
||||
const ColumnType * getRawColumnPtr() const { return assert_cast<const ColumnType *>(column_holder.get()); }
|
||||
|
||||
template <typename IndexType>
|
||||
MutableColumnPtr uniqueInsertRangeImpl(
|
||||
@ -232,7 +233,7 @@ void ColumnUnique<ColumnType>::updateNullMask()
|
||||
size_t size = getRawColumnPtr()->size();
|
||||
|
||||
if (nested_null_mask->size() != size)
|
||||
static_cast<ColumnUInt8 &>(*nested_null_mask).getData().resize_fill(size);
|
||||
assert_cast<ColumnUInt8 &>(*nested_null_mask).getData().resize_fill(size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/NaNUtils.h>
|
||||
#include <Common/RadixSort.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <IO/WriteBuffer.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <Columns/ColumnsCommon.h>
|
||||
@ -224,7 +225,7 @@ Float64 ColumnVector<T>::getFloat64(size_t n) const
|
||||
template <typename T>
|
||||
void ColumnVector<T>::insertRangeFrom(const IColumn & src, size_t start, size_t length)
|
||||
{
|
||||
const ColumnVector & src_vec = static_cast<const ColumnVector &>(src);
|
||||
const ColumnVector & src_vec = assert_cast<const ColumnVector &>(src);
|
||||
|
||||
if (start + length > src_vec.data.size())
|
||||
throw Exception("Parameters start = "
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Columns/FilterDescription.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Columns/ColumnNullable.h>
|
||||
@ -25,7 +26,7 @@ ConstantFilterDescription::ConstantFilterDescription(const IColumn & column)
|
||||
|
||||
if (isColumnConst(column))
|
||||
{
|
||||
const ColumnConst & column_const = static_cast<const ColumnConst &>(column);
|
||||
const ColumnConst & column_const = assert_cast<const ColumnConst &>(column);
|
||||
ColumnPtr column_nested = column_const.getDataColumnPtr()->convertToFullColumnIfLowCardinality();
|
||||
|
||||
if (!typeid_cast<const ColumnUInt8 *>(column_nested.get()))
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <Common/HashTable/HashTableAllocator.h>
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <ext/range.h>
|
||||
#include <common/unaligned.h>
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <Columns/getLeastSuperColumn.h>
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/getLeastSupertype.h>
|
||||
|
||||
|
||||
@ -14,7 +15,7 @@ namespace ErrorCodes
|
||||
|
||||
static bool sameConstants(const IColumn & a, const IColumn & b)
|
||||
{
|
||||
return static_cast<const ColumnConst &>(a).getField() == static_cast<const ColumnConst &>(b).getField();
|
||||
return assert_cast<const ColumnConst &>(a).getField() == assert_cast<const ColumnConst &>(b).getField();
|
||||
}
|
||||
|
||||
ColumnWithTypeAndName getLeastSuperColumn(std::vector<const ColumnWithTypeAndName *> columns)
|
||||
@ -57,7 +58,7 @@ ColumnWithTypeAndName getLeastSuperColumn(std::vector<const ColumnWithTypeAndNam
|
||||
}
|
||||
|
||||
if (save_constness)
|
||||
result.column = result.type->createColumnConst(0, static_cast<const ColumnConst &>(*columns[0]->column).getField());
|
||||
result.column = result.type->createColumnConst(0, assert_cast<const ColumnConst &>(*columns[0]->column).getField());
|
||||
else
|
||||
result.column = result.type->createColumn();
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Common/ColumnsHashingImpl.h>
|
||||
#include <Common/Arena.h>
|
||||
#include <Common/LRUCache.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <common/unaligned.h>
|
||||
|
||||
#include <Columns/ColumnString.h>
|
||||
@ -80,7 +81,7 @@ struct HashMethodString
|
||||
HashMethodString(const ColumnRawPtrs & key_columns, const Sizes & /*key_sizes*/, const HashMethodContextPtr &)
|
||||
{
|
||||
const IColumn & column = *key_columns[0];
|
||||
const ColumnString & column_string = static_cast<const ColumnString &>(column);
|
||||
const ColumnString & column_string = assert_cast<const ColumnString &>(column);
|
||||
offsets = column_string.getOffsets().data();
|
||||
chars = column_string.getChars().data();
|
||||
}
|
||||
@ -120,7 +121,7 @@ struct HashMethodFixedString
|
||||
HashMethodFixedString(const ColumnRawPtrs & key_columns, const Sizes & /*key_sizes*/, const HashMethodContextPtr &)
|
||||
{
|
||||
const IColumn & column = *key_columns[0];
|
||||
const ColumnFixedString & column_string = static_cast<const ColumnFixedString &>(column);
|
||||
const ColumnFixedString & column_string = assert_cast<const ColumnFixedString &>(column);
|
||||
n = column_string.getN();
|
||||
chars = &column_string.getChars();
|
||||
}
|
||||
@ -307,10 +308,10 @@ struct HashMethodSingleLowCardinalityColumn : public SingleColumnMethod
|
||||
{
|
||||
switch (size_of_index_type)
|
||||
{
|
||||
case sizeof(UInt8): return static_cast<const ColumnUInt8 *>(positions)->getElement(row);
|
||||
case sizeof(UInt16): return static_cast<const ColumnUInt16 *>(positions)->getElement(row);
|
||||
case sizeof(UInt32): return static_cast<const ColumnUInt32 *>(positions)->getElement(row);
|
||||
case sizeof(UInt64): return static_cast<const ColumnUInt64 *>(positions)->getElement(row);
|
||||
case sizeof(UInt8): return assert_cast<const ColumnUInt8 *>(positions)->getElement(row);
|
||||
case sizeof(UInt16): return assert_cast<const ColumnUInt16 *>(positions)->getElement(row);
|
||||
case sizeof(UInt32): return assert_cast<const ColumnUInt32 *>(positions)->getElement(row);
|
||||
case sizeof(UInt64): return assert_cast<const ColumnUInt64 *>(positions)->getElement(row);
|
||||
default: throw Exception("Unexpected size of index type for low cardinality column.", ErrorCodes::LOGICAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Interpreters/AggregationCommon.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -310,7 +312,7 @@ protected:
|
||||
{
|
||||
if (null_maps[k] != nullptr)
|
||||
{
|
||||
const auto & null_map = static_cast<const ColumnUInt8 &>(*null_maps[k]).getData();
|
||||
const auto & null_map = assert_cast<const ColumnUInt8 &>(*null_maps[k]).getData();
|
||||
if (null_map[row] == 1)
|
||||
{
|
||||
size_t bucket = k / 8;
|
||||
|
@ -49,6 +49,7 @@
|
||||
M(GlobalThreadActive, "Number of threads in global thread pool running a task.") \
|
||||
M(LocalThread, "Number of threads in local thread pools. Should be similar to GlobalThreadActive.") \
|
||||
M(LocalThreadActive, "Number of threads in local thread pools running a task.") \
|
||||
M(DistributedFilesToInsert, "Number of pending files to process for asynchronous insertion into Distributed tables. Number of files for every shard is summed.") \
|
||||
|
||||
|
||||
namespace CurrentMetrics
|
||||
|
@ -10,6 +10,49 @@
|
||||
//#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
/**
|
||||
|
||||
ELF object can contain three different places with symbol names and addresses:
|
||||
|
||||
1. Symbol table in section headers. It is used for static linking and usually left in executable.
|
||||
It is not loaded in memory and they are not necessary for program to run.
|
||||
It does not relate to debug info and present regardless to -g flag.
|
||||
You can use strip to get rid of this symbol table.
|
||||
If you have this symbol table in your binary, you can manually read it and get symbol names, even for symbols from anonymous namespaces.
|
||||
|
||||
2. Hashes in program headers such as DT_HASH and DT_GNU_HASH.
|
||||
It is necessary for dynamic object (.so libraries and any dynamically linked executable that depend on .so libraries)
|
||||
because it is used for dynamic linking that happens in runtime and performed by dynamic loader.
|
||||
Only exported symbols will be presented in that hash tables. Symbols from anonymous namespaces are not.
|
||||
This part of executable binary is loaded in memory and accessible via 'dl_iterate_phdr', 'dladdr' and 'backtrace_symbols' functions from libc.
|
||||
ClickHouse versions prior to 19.13 has used just these symbol names to symbolize stack traces
|
||||
and stack traces may be incomplete due to lack of symbols with internal linkage.
|
||||
But because ClickHouse is linked with most of the symbols exported (-rdynamic flag) it can still provide good enough stack traces.
|
||||
|
||||
3. DWARF debug info. It contains the most detailed information about symbols and everything else.
|
||||
It allows to get source file names and line numbers from addresses. Only available if you use -g option for compiler.
|
||||
It is also used by default for ClickHouse builds, but because of its weight (about two gigabytes)
|
||||
it is splitted to separate binary and provided in clickhouse-common-static-dbg package.
|
||||
This separate binary is placed in /usr/lib/debug/usr/bin/clickhouse and is loaded automatically by tools like gdb, addr2line.
|
||||
When you build ClickHouse by yourself, debug info is not splitted and present in a single huge binary.
|
||||
|
||||
What ClickHouse is using to provide good stack traces?
|
||||
|
||||
In versions prior to 19.13, only "program headers" (2) was used.
|
||||
|
||||
In version 19.13, ClickHouse will read program headers (2) and cache them,
|
||||
also it will read itself as ELF binary and extract symbol tables from section headers (1)
|
||||
to also symbolize functions that are not exported for dynamic linking.
|
||||
And finally, it will read DWARF info (3) if available to display file names and line numbers.
|
||||
|
||||
What detail can you obtain depending on your binary?
|
||||
|
||||
If you have debug info (you build ClickHouse by yourself or install clickhouse-common-static-dbg package), you will get source file names and line numbers.
|
||||
Otherwise you will get only symbol names. If your binary contains symbol table in section headers (the default, unless stripped), you will get all symbol names.
|
||||
Otherwise you will get only exported symbols from program headers.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -64,13 +107,14 @@ void collectSymbolsFromProgramHeaders(dl_phdr_info * info,
|
||||
size_t sym_cnt = 0;
|
||||
for (auto it = dyn_begin; it->d_tag != DT_NULL; ++it)
|
||||
{
|
||||
if (it->d_tag == DT_HASH)
|
||||
{
|
||||
const ElfW(Word) * hash = reinterpret_cast<const ElfW(Word) *>(correct_address(info->dlpi_addr, it->d_un.d_ptr));
|
||||
sym_cnt = hash[1];
|
||||
break;
|
||||
}
|
||||
else if (it->d_tag == DT_GNU_HASH)
|
||||
// TODO: this branch leads to invalid address of the hash table. Need further investigation.
|
||||
// if (it->d_tag == DT_HASH)
|
||||
// {
|
||||
// const ElfW(Word) * hash = reinterpret_cast<const ElfW(Word) *>(correct_address(info->dlpi_addr, it->d_un.d_ptr));
|
||||
// sym_cnt = hash[1];
|
||||
// break;
|
||||
// }
|
||||
if (it->d_tag == DT_GNU_HASH)
|
||||
{
|
||||
/// This code based on Musl-libc.
|
||||
|
||||
|
52
dbms/src/Common/assert_cast.h
Normal file
52
dbms/src/Common/assert_cast.h
Normal file
@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include <typeinfo>
|
||||
#include <typeindex>
|
||||
#include <string>
|
||||
|
||||
#include <Common/Exception.h>
|
||||
#include <common/demangle.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int BAD_CAST;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Perform static_cast in release build.
|
||||
* Checks type by comparing typeid and throw an exception in debug build.
|
||||
* The exact match of the type is checked. That is, cast to the ancestor will be unsuccessful.
|
||||
*/
|
||||
template <typename To, typename From>
|
||||
To assert_cast(From && from)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
try
|
||||
{
|
||||
if constexpr (std::is_pointer_v<To>)
|
||||
{
|
||||
if (typeid(*from) == typeid(std::remove_pointer_t<To>))
|
||||
return static_cast<To>(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (typeid(from) == typeid(To))
|
||||
return static_cast<To>(from);
|
||||
}
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
throw DB::Exception(e.what(), DB::ErrorCodes::BAD_CAST);
|
||||
}
|
||||
|
||||
throw DB::Exception("Bad cast from type " + demangle(typeid(from).name()) + " to " + demangle(typeid(To).name()),
|
||||
DB::ErrorCodes::BAD_CAST);
|
||||
#else
|
||||
return static_cast<To>(from);
|
||||
#endif
|
||||
}
|
@ -5,7 +5,9 @@
|
||||
|
||||
#include <IO/WriteBufferFromString.h>
|
||||
#include <IO/Operators.h>
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <Columns/ColumnConst.h>
|
||||
|
||||
@ -484,8 +486,8 @@ static ReturnType checkBlockStructure(const Block & lhs, const Block & rhs, cons
|
||||
|
||||
if (isColumnConst(*actual.column) && isColumnConst(*expected.column))
|
||||
{
|
||||
Field actual_value = static_cast<const ColumnConst &>(*actual.column).getField();
|
||||
Field expected_value = static_cast<const ColumnConst &>(*expected.column).getField();
|
||||
Field actual_value = assert_cast<const ColumnConst &>(*actual.column).getField();
|
||||
Field expected_value = assert_cast<const ColumnConst &>(*expected.column).getField();
|
||||
|
||||
if (actual_value != expected_value)
|
||||
return on_error("Block structure mismatch in " + context_description + " stream: different values of constants, actual: "
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Core/SortDescription.h>
|
||||
#include <Core/Block.h>
|
||||
#include <Core/ColumnNumbers.h>
|
||||
@ -167,7 +168,7 @@ struct SortCursorWithCollation
|
||||
int res;
|
||||
if (impl->need_collation[i])
|
||||
{
|
||||
const ColumnString & column_string = static_cast<const ColumnString &>(*impl->sort_columns[i]);
|
||||
const ColumnString & column_string = assert_cast<const ColumnString &>(*impl->sort_columns[i]);
|
||||
res = column_string.compareAtWithCollation(lhs_pos, rhs_pos, *(rhs.impl->sort_columns[i]), *impl->desc[i].collator);
|
||||
}
|
||||
else
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataStreams/CollapsingSortedBlockInputStream.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
|
||||
@ -118,7 +119,7 @@ void CollapsingSortedBlockInputStream::merge(MutableColumns & merged_columns, st
|
||||
if (current_key.empty())
|
||||
setPrimaryKeyRef(current_key, current);
|
||||
|
||||
Int8 sign = static_cast<const ColumnInt8 &>(*current->all_columns[sign_column_number]).getData()[current->pos];
|
||||
Int8 sign = assert_cast<const ColumnInt8 &>(*current->all_columns[sign_column_number]).getData()[current->pos];
|
||||
setPrimaryKeyRef(next_key, current);
|
||||
|
||||
bool key_differs = next_key != current_key;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <DataStreams/ConvertingBlockInputStream.h>
|
||||
#include <Interpreters/castColumn.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Parsers/IAST.h>
|
||||
|
||||
|
||||
@ -75,7 +76,7 @@ ConvertingBlockInputStream::ConvertingBlockInputStream(
|
||||
throw Exception("Cannot convert column " + backQuoteIfNeed(res_elem.name)
|
||||
+ " because it is non constant in source stream but must be constant in result",
|
||||
ErrorCodes::BLOCKS_HAVE_DIFFERENT_STRUCTURE);
|
||||
else if (static_cast<const ColumnConst &>(*src_elem.column).getField() != static_cast<const ColumnConst &>(*res_elem.column).getField())
|
||||
else if (assert_cast<const ColumnConst &>(*src_elem.column).getField() != assert_cast<const ColumnConst &>(*res_elem.column).getField())
|
||||
throw Exception("Cannot convert column " + backQuoteIfNeed(res_elem.name)
|
||||
+ " because it is constant but values of constants are different in source and result",
|
||||
ErrorCodes::BLOCKS_HAVE_DIFFERENT_STRUCTURE);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <common/logger_useful.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <AggregateFunctions/AggregateFunctionFactory.h>
|
||||
#include <Functions/FunctionFactory.h>
|
||||
@ -297,7 +298,7 @@ Block SummingSortedBlockInputStream::readImpl()
|
||||
/// Unpack tuple into block.
|
||||
size_t tuple_size = desc.column_numbers.size();
|
||||
for (size_t i = 0; i < tuple_size; ++i)
|
||||
res.getByPosition(desc.column_numbers[i]).column = static_cast<const ColumnTuple &>(*desc.merged_column).getColumnPtr(i);
|
||||
res.getByPosition(desc.column_numbers[i]).column = assert_cast<const ColumnTuple &>(*desc.merged_column).getColumnPtr(i);
|
||||
}
|
||||
else
|
||||
res.getByPosition(desc.column_numbers[0]).column = std::move(desc.merged_column);
|
||||
@ -491,7 +492,7 @@ void SummingSortedBlockInputStream::addRow(SortCursor & cursor)
|
||||
{
|
||||
// desc.state is not used for AggregateFunction types
|
||||
auto & col = cursor->all_columns[desc.column_numbers[0]];
|
||||
static_cast<ColumnAggregateFunction &>(*desc.merged_column).insertMergeFrom(*col, cursor->pos);
|
||||
assert_cast<ColumnAggregateFunction &>(*desc.merged_column).insertMergeFrom(*col, cursor->pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <Columns/ColumnAggregateFunction.h>
|
||||
#include <Columns/FilterDescription.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Common/Arena.h>
|
||||
|
||||
|
||||
@ -155,7 +156,7 @@ void TotalsHavingBlockInputStream::addToTotals(const Block & source_block, const
|
||||
continue;
|
||||
}
|
||||
|
||||
auto & totals_column = static_cast<ColumnAggregateFunction &>(*current_totals[i]);
|
||||
auto & totals_column = assert_cast<ColumnAggregateFunction &>(*current_totals[i]);
|
||||
assert(totals_column.size() == 1);
|
||||
|
||||
/// Accumulate all aggregate states from a column of a source block into
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataStreams/VersionedCollapsingSortedBlockInputStream.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
|
||||
@ -112,7 +113,7 @@ void VersionedCollapsingSortedBlockInputStream::merge(MutableColumns & merged_co
|
||||
|
||||
RowRef next_key;
|
||||
|
||||
Int8 sign = static_cast<const ColumnInt8 &>(*current->all_columns[sign_column_number]).getData()[current->pos];
|
||||
Int8 sign = assert_cast<const ColumnInt8 &>(*current->all_columns[sign_column_number]).getData()[current->pos];
|
||||
|
||||
setPrimaryKeyRef(next_key, current);
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <Columns/ColumnAggregateFunction.h>
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Common/AlignedBuffer.h>
|
||||
|
||||
#include <Formats/FormatSettings.h>
|
||||
@ -77,12 +78,12 @@ void DataTypeAggregateFunction::deserializeBinary(Field & field, ReadBuffer & is
|
||||
|
||||
void DataTypeAggregateFunction::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
|
||||
{
|
||||
function->serialize(static_cast<const ColumnAggregateFunction &>(column).getData()[row_num], ostr);
|
||||
function->serialize(assert_cast<const ColumnAggregateFunction &>(column).getData()[row_num], ostr);
|
||||
}
|
||||
|
||||
void DataTypeAggregateFunction::deserializeBinary(IColumn & column, ReadBuffer & istr) const
|
||||
{
|
||||
ColumnAggregateFunction & column_concrete = static_cast<ColumnAggregateFunction &>(column);
|
||||
ColumnAggregateFunction & column_concrete = assert_cast<ColumnAggregateFunction &>(column);
|
||||
|
||||
Arena & arena = column_concrete.createOrGetArena();
|
||||
size_t size_of_state = function->sizeOfData();
|
||||
@ -155,13 +156,13 @@ void DataTypeAggregateFunction::deserializeBinaryBulk(IColumn & column, ReadBuff
|
||||
static String serializeToString(const AggregateFunctionPtr & function, const IColumn & column, size_t row_num)
|
||||
{
|
||||
WriteBufferFromOwnString buffer;
|
||||
function->serialize(static_cast<const ColumnAggregateFunction &>(column).getData()[row_num], buffer);
|
||||
function->serialize(assert_cast<const ColumnAggregateFunction &>(column).getData()[row_num], buffer);
|
||||
return buffer.str();
|
||||
}
|
||||
|
||||
static void deserializeFromString(const AggregateFunctionPtr & function, IColumn & column, const String & s)
|
||||
{
|
||||
ColumnAggregateFunction & column_concrete = static_cast<ColumnAggregateFunction &>(column);
|
||||
ColumnAggregateFunction & column_concrete = assert_cast<ColumnAggregateFunction &>(column);
|
||||
|
||||
Arena & arena = column_concrete.createOrGetArena();
|
||||
size_t size_of_state = function->sizeOfData();
|
||||
@ -262,13 +263,13 @@ void DataTypeAggregateFunction::serializeProtobuf(const IColumn & column, size_t
|
||||
if (value_index)
|
||||
return;
|
||||
value_index = static_cast<bool>(
|
||||
protobuf.writeAggregateFunction(function, static_cast<const ColumnAggregateFunction &>(column).getData()[row_num]));
|
||||
protobuf.writeAggregateFunction(function, assert_cast<const ColumnAggregateFunction &>(column).getData()[row_num]));
|
||||
}
|
||||
|
||||
void DataTypeAggregateFunction::deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const
|
||||
{
|
||||
row_added = false;
|
||||
ColumnAggregateFunction & column_concrete = static_cast<ColumnAggregateFunction &>(column);
|
||||
ColumnAggregateFunction & column_concrete = assert_cast<ColumnAggregateFunction &>(column);
|
||||
Arena & arena = column_concrete.createOrGetArena();
|
||||
size_t size_of_state = function->sizeOfData();
|
||||
AggregateDataPtr place = arena.alignedAlloc(size_of_state, function->alignOfData());
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <Parsers/IAST.h>
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -57,7 +58,7 @@ void DataTypeArray::deserializeBinary(Field & field, ReadBuffer & istr) const
|
||||
|
||||
void DataTypeArray::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
|
||||
{
|
||||
const ColumnArray & column_array = static_cast<const ColumnArray &>(column);
|
||||
const ColumnArray & column_array = assert_cast<const ColumnArray &>(column);
|
||||
const ColumnArray::Offsets & offsets = column_array.getOffsets();
|
||||
|
||||
size_t offset = offsets[row_num - 1];
|
||||
@ -74,7 +75,7 @@ void DataTypeArray::serializeBinary(const IColumn & column, size_t row_num, Writ
|
||||
|
||||
void DataTypeArray::deserializeBinary(IColumn & column, ReadBuffer & istr) const
|
||||
{
|
||||
ColumnArray & column_array = static_cast<ColumnArray &>(column);
|
||||
ColumnArray & column_array = assert_cast<ColumnArray &>(column);
|
||||
ColumnArray::Offsets & offsets = column_array.getOffsets();
|
||||
|
||||
size_t size;
|
||||
@ -278,7 +279,7 @@ void DataTypeArray::deserializeBinaryBulkWithMultipleStreams(
|
||||
template <typename Writer>
|
||||
static void serializeTextImpl(const IColumn & column, size_t row_num, WriteBuffer & ostr, Writer && write_nested)
|
||||
{
|
||||
const ColumnArray & column_array = static_cast<const ColumnArray &>(column);
|
||||
const ColumnArray & column_array = assert_cast<const ColumnArray &>(column);
|
||||
const ColumnArray::Offsets & offsets = column_array.getOffsets();
|
||||
|
||||
size_t offset = offsets[row_num - 1];
|
||||
@ -300,7 +301,7 @@ static void serializeTextImpl(const IColumn & column, size_t row_num, WriteBuffe
|
||||
template <typename Reader>
|
||||
static void deserializeTextImpl(IColumn & column, ReadBuffer & istr, Reader && read_nested)
|
||||
{
|
||||
ColumnArray & column_array = static_cast<ColumnArray &>(column);
|
||||
ColumnArray & column_array = assert_cast<ColumnArray &>(column);
|
||||
ColumnArray::Offsets & offsets = column_array.getOffsets();
|
||||
|
||||
IColumn & nested_column = column_array.getData();
|
||||
@ -367,7 +368,7 @@ void DataTypeArray::deserializeText(IColumn & column, ReadBuffer & istr, const F
|
||||
|
||||
void DataTypeArray::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
const ColumnArray & column_array = static_cast<const ColumnArray &>(column);
|
||||
const ColumnArray & column_array = assert_cast<const ColumnArray &>(column);
|
||||
const ColumnArray::Offsets & offsets = column_array.getOffsets();
|
||||
|
||||
size_t offset = offsets[row_num - 1];
|
||||
@ -394,7 +395,7 @@ void DataTypeArray::deserializeTextJSON(IColumn & column, ReadBuffer & istr, con
|
||||
|
||||
void DataTypeArray::serializeTextXML(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
const ColumnArray & column_array = static_cast<const ColumnArray &>(column);
|
||||
const ColumnArray & column_array = assert_cast<const ColumnArray &>(column);
|
||||
const ColumnArray::Offsets & offsets = column_array.getOffsets();
|
||||
|
||||
size_t offset = offsets[row_num - 1];
|
||||
@ -433,7 +434,7 @@ void DataTypeArray::deserializeTextCSV(IColumn & column, ReadBuffer & istr, cons
|
||||
|
||||
void DataTypeArray::serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf, size_t & value_index) const
|
||||
{
|
||||
const ColumnArray & column_array = static_cast<const ColumnArray &>(column);
|
||||
const ColumnArray & column_array = assert_cast<const ColumnArray &>(column);
|
||||
const ColumnArray::Offsets & offsets = column_array.getOffsets();
|
||||
size_t offset = offsets[row_num - 1] + value_index;
|
||||
size_t next_offset = offsets[row_num];
|
||||
@ -453,7 +454,7 @@ void DataTypeArray::serializeProtobuf(const IColumn & column, size_t row_num, Pr
|
||||
void DataTypeArray::deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const
|
||||
{
|
||||
row_added = false;
|
||||
ColumnArray & column_array = static_cast<ColumnArray &>(column);
|
||||
ColumnArray & column_array = assert_cast<ColumnArray &>(column);
|
||||
IColumn & nested_column = column_array.getData();
|
||||
ColumnArray::Offsets & offsets = column_array.getOffsets();
|
||||
size_t old_size = offsets.size();
|
||||
|
@ -7,13 +7,15 @@
|
||||
#include <Formats/ProtobufReader.h>
|
||||
#include <Formats/ProtobufWriter.h>
|
||||
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
void DataTypeDate::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeDateText(DayNum(static_cast<const ColumnUInt16 &>(column).getData()[row_num]), ostr);
|
||||
writeDateText(DayNum(assert_cast<const ColumnUInt16 &>(column).getData()[row_num]), ostr);
|
||||
}
|
||||
|
||||
void DataTypeDate::deserializeWholeText(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const
|
||||
@ -25,7 +27,7 @@ void DataTypeDate::deserializeTextEscaped(IColumn & column, ReadBuffer & istr, c
|
||||
{
|
||||
DayNum x;
|
||||
readDateText(x, istr);
|
||||
static_cast<ColumnUInt16 &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnUInt16 &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
void DataTypeDate::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -46,7 +48,7 @@ void DataTypeDate::deserializeTextQuoted(IColumn & column, ReadBuffer & istr, co
|
||||
assertChar('\'', istr);
|
||||
readDateText(x, istr);
|
||||
assertChar('\'', istr);
|
||||
static_cast<ColumnUInt16 &>(column).getData().push_back(x); /// It's important to do this at the end - for exception safety.
|
||||
assert_cast<ColumnUInt16 &>(column).getData().push_back(x); /// It's important to do this at the end - for exception safety.
|
||||
}
|
||||
|
||||
void DataTypeDate::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -62,7 +64,7 @@ void DataTypeDate::deserializeTextJSON(IColumn & column, ReadBuffer & istr, cons
|
||||
assertChar('"', istr);
|
||||
readDateText(x, istr);
|
||||
assertChar('"', istr);
|
||||
static_cast<ColumnUInt16 &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnUInt16 &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
void DataTypeDate::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -76,14 +78,14 @@ void DataTypeDate::deserializeTextCSV(IColumn & column, ReadBuffer & istr, const
|
||||
{
|
||||
LocalDate value;
|
||||
readCSV(value, istr);
|
||||
static_cast<ColumnUInt16 &>(column).getData().push_back(value.getDayNum());
|
||||
assert_cast<ColumnUInt16 &>(column).getData().push_back(value.getDayNum());
|
||||
}
|
||||
|
||||
void DataTypeDate::serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf, size_t & value_index) const
|
||||
{
|
||||
if (value_index)
|
||||
return;
|
||||
value_index = static_cast<bool>(protobuf.writeDate(DayNum(static_cast<const ColumnUInt16 &>(column).getData()[row_num])));
|
||||
value_index = static_cast<bool>(protobuf.writeDate(DayNum(assert_cast<const ColumnUInt16 &>(column).getData()[row_num])));
|
||||
}
|
||||
|
||||
void DataTypeDate::deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const
|
||||
@ -93,7 +95,7 @@ void DataTypeDate::deserializeProtobuf(IColumn & column, ProtobufReader & protob
|
||||
if (!protobuf.readDate(d))
|
||||
return;
|
||||
|
||||
auto & container = static_cast<ColumnUInt16 &>(column).getData();
|
||||
auto & container = assert_cast<ColumnUInt16 &>(column).getData();
|
||||
if (allow_add_row)
|
||||
{
|
||||
container.emplace_back(d);
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <common/DateLUT.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Formats/FormatSettings.h>
|
||||
#include <Formats/ProtobufReader.h>
|
||||
@ -39,7 +40,7 @@ std::string DataTypeDateTime::doGetName() const
|
||||
|
||||
void DataTypeDateTime::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeDateTimeText(static_cast<const ColumnUInt32 &>(column).getData()[row_num], ostr, time_zone);
|
||||
writeDateTimeText(assert_cast<const ColumnUInt32 &>(column).getData()[row_num], ostr, time_zone);
|
||||
}
|
||||
|
||||
void DataTypeDateTime::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -71,7 +72,7 @@ void DataTypeDateTime::deserializeTextEscaped(IColumn & column, ReadBuffer & ist
|
||||
{
|
||||
time_t x;
|
||||
readText(x, istr, settings, time_zone, utc_time_zone);
|
||||
static_cast<ColumnUInt32 &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnUInt32 &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
void DataTypeDateTime::serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -93,7 +94,7 @@ void DataTypeDateTime::deserializeTextQuoted(IColumn & column, ReadBuffer & istr
|
||||
{
|
||||
readIntText(x, istr);
|
||||
}
|
||||
static_cast<ColumnUInt32 &>(column).getData().push_back(x); /// It's important to do this at the end - for exception safety.
|
||||
assert_cast<ColumnUInt32 &>(column).getData().push_back(x); /// It's important to do this at the end - for exception safety.
|
||||
}
|
||||
|
||||
void DataTypeDateTime::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -115,7 +116,7 @@ void DataTypeDateTime::deserializeTextJSON(IColumn & column, ReadBuffer & istr,
|
||||
{
|
||||
readIntText(x, istr);
|
||||
}
|
||||
static_cast<ColumnUInt32 &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnUInt32 &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
void DataTypeDateTime::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -142,14 +143,14 @@ void DataTypeDateTime::deserializeTextCSV(IColumn & column, ReadBuffer & istr, c
|
||||
if (maybe_quote == '\'' || maybe_quote == '\"')
|
||||
assertChar(maybe_quote, istr);
|
||||
|
||||
static_cast<ColumnUInt32 &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnUInt32 &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
void DataTypeDateTime::serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf, size_t & value_index) const
|
||||
{
|
||||
if (value_index)
|
||||
return;
|
||||
value_index = static_cast<bool>(protobuf.writeDateTime(static_cast<const ColumnUInt32 &>(column).getData()[row_num]));
|
||||
value_index = static_cast<bool>(protobuf.writeDateTime(assert_cast<const ColumnUInt32 &>(column).getData()[row_num]));
|
||||
}
|
||||
|
||||
void DataTypeDateTime::deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const
|
||||
@ -159,7 +160,7 @@ void DataTypeDateTime::deserializeProtobuf(IColumn & column, ProtobufReader & pr
|
||||
if (!protobuf.readDateTime(t))
|
||||
return;
|
||||
|
||||
auto & container = static_cast<ColumnUInt32 &>(column).getData();
|
||||
auto & container = assert_cast<ColumnUInt32 &>(column).getData();
|
||||
if (allow_add_row)
|
||||
{
|
||||
container.emplace_back(t);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <Parsers/ASTFunction.h>
|
||||
#include <Parsers/ASTLiteral.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Common/UTF8Helpers.h>
|
||||
#include <Poco/UTF8Encoding.h>
|
||||
|
||||
@ -120,7 +121,7 @@ void DataTypeEnum<Type>::deserializeBinary(Field & field, ReadBuffer & istr) con
|
||||
template <typename Type>
|
||||
void DataTypeEnum<Type>::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
|
||||
{
|
||||
writeBinary(static_cast<const ColumnType &>(column).getData()[row_num], ostr);
|
||||
writeBinary(assert_cast<const ColumnType &>(column).getData()[row_num], ostr);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
@ -128,19 +129,19 @@ void DataTypeEnum<Type>::deserializeBinary(IColumn & column, ReadBuffer & istr)
|
||||
{
|
||||
typename ColumnType::value_type x;
|
||||
readBinary(x, istr);
|
||||
static_cast<ColumnType &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnType &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
void DataTypeEnum<Type>::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeString(getNameForValue(static_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
writeString(getNameForValue(assert_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
void DataTypeEnum<Type>::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeEscapedString(getNameForValue(static_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
writeEscapedString(getNameForValue(assert_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
@ -149,13 +150,13 @@ void DataTypeEnum<Type>::deserializeTextEscaped(IColumn & column, ReadBuffer & i
|
||||
/// NOTE It would be nice to do without creating a temporary object - at least extract std::string out.
|
||||
std::string field_name;
|
||||
readEscapedString(field_name, istr);
|
||||
static_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
assert_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
void DataTypeEnum<Type>::serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeQuotedString(getNameForValue(static_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
writeQuotedString(getNameForValue(assert_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
@ -163,7 +164,7 @@ void DataTypeEnum<Type>::deserializeTextQuoted(IColumn & column, ReadBuffer & is
|
||||
{
|
||||
std::string field_name;
|
||||
readQuotedStringWithSQLStyle(field_name, istr);
|
||||
static_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
assert_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
@ -171,19 +172,19 @@ void DataTypeEnum<Type>::deserializeWholeText(IColumn & column, ReadBuffer & ist
|
||||
{
|
||||
std::string field_name;
|
||||
readString(field_name, istr);
|
||||
static_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
assert_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
void DataTypeEnum<Type>::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
writeJSONString(getNameForValue(static_cast<const ColumnType &>(column).getData()[row_num]), ostr, settings);
|
||||
writeJSONString(getNameForValue(assert_cast<const ColumnType &>(column).getData()[row_num]), ostr, settings);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
void DataTypeEnum<Type>::serializeTextXML(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeXMLString(getNameForValue(static_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
writeXMLString(getNameForValue(assert_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
@ -191,13 +192,13 @@ void DataTypeEnum<Type>::deserializeTextJSON(IColumn & column, ReadBuffer & istr
|
||||
{
|
||||
std::string field_name;
|
||||
readJSONString(field_name, istr);
|
||||
static_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
assert_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
void DataTypeEnum<Type>::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeCSVString(getNameForValue(static_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
writeCSVString(getNameForValue(assert_cast<const ColumnType &>(column).getData()[row_num]), ostr);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
@ -205,7 +206,7 @@ void DataTypeEnum<Type>::deserializeTextCSV(IColumn & column, ReadBuffer & istr,
|
||||
{
|
||||
std::string field_name;
|
||||
readCSVString(field_name, istr, settings.csv);
|
||||
static_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
assert_cast<ColumnType &>(column).getData().push_back(getValue(StringRef(field_name)));
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
@ -238,7 +239,7 @@ void DataTypeEnum<Type>::serializeProtobuf(const IColumn & column, size_t row_nu
|
||||
if (value_index)
|
||||
return;
|
||||
protobuf.prepareEnumMapping(values);
|
||||
value_index = static_cast<bool>(protobuf.writeEnum(static_cast<const ColumnType &>(column).getData()[row_num]));
|
||||
value_index = static_cast<bool>(protobuf.writeEnum(assert_cast<const ColumnType &>(column).getData()[row_num]));
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
@ -250,7 +251,7 @@ void DataTypeEnum<Type>::deserializeProtobuf(IColumn & column, ProtobufReader &
|
||||
if (!protobuf.readEnum(value))
|
||||
return;
|
||||
|
||||
auto & container = static_cast<ColumnType &>(column).getData();
|
||||
auto & container = assert_cast<ColumnType &>(column).getData();
|
||||
if (allow_add_row)
|
||||
{
|
||||
container.emplace_back(value);
|
||||
@ -269,7 +270,7 @@ Field DataTypeEnum<Type>::getDefault() const
|
||||
template <typename Type>
|
||||
void DataTypeEnum<Type>::insertDefaultInto(IColumn & column) const
|
||||
{
|
||||
static_cast<ColumnType &>(column).getData().push_back(values.front().second);
|
||||
assert_cast<ColumnType &>(column).getData().push_back(values.front().second);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <Parsers/ASTLiteral.h>
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -58,13 +59,13 @@ void DataTypeFixedString::deserializeBinary(Field & field, ReadBuffer & istr) co
|
||||
|
||||
void DataTypeFixedString::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
|
||||
{
|
||||
ostr.write(reinterpret_cast<const char *>(&static_cast<const ColumnFixedString &>(column).getChars()[n * row_num]), n);
|
||||
ostr.write(reinterpret_cast<const char *>(&assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num]), n);
|
||||
}
|
||||
|
||||
|
||||
void DataTypeFixedString::deserializeBinary(IColumn & column, ReadBuffer & istr) const
|
||||
{
|
||||
ColumnFixedString::Chars & data = static_cast<ColumnFixedString &>(column).getChars();
|
||||
ColumnFixedString::Chars & data = assert_cast<ColumnFixedString &>(column).getChars();
|
||||
size_t old_size = data.size();
|
||||
data.resize(old_size + n);
|
||||
try
|
||||
@ -112,13 +113,13 @@ void DataTypeFixedString::deserializeBinaryBulk(IColumn & column, ReadBuffer & i
|
||||
|
||||
void DataTypeFixedString::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeString(reinterpret_cast<const char *>(&static_cast<const ColumnFixedString &>(column).getChars()[n * row_num]), n, ostr);
|
||||
writeString(reinterpret_cast<const char *>(&assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num]), n, ostr);
|
||||
}
|
||||
|
||||
|
||||
void DataTypeFixedString::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
const char * pos = reinterpret_cast<const char *>(&static_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
const char * pos = reinterpret_cast<const char *>(&assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
writeAnyEscapedString<'\''>(pos, pos + n, ostr);
|
||||
}
|
||||
|
||||
@ -165,7 +166,7 @@ void DataTypeFixedString::deserializeTextEscaped(IColumn & column, ReadBuffer &
|
||||
|
||||
void DataTypeFixedString::serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
const char * pos = reinterpret_cast<const char *>(&static_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
const char * pos = reinterpret_cast<const char *>(&assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
writeAnyQuotedString<'\''>(pos, pos + n, ostr);
|
||||
}
|
||||
|
||||
@ -184,7 +185,7 @@ void DataTypeFixedString::deserializeWholeText(IColumn & column, ReadBuffer & is
|
||||
|
||||
void DataTypeFixedString::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
const char * pos = reinterpret_cast<const char *>(&static_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
const char * pos = reinterpret_cast<const char *>(&assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
writeJSONString(pos, pos + n, ostr, settings);
|
||||
}
|
||||
|
||||
@ -197,14 +198,14 @@ void DataTypeFixedString::deserializeTextJSON(IColumn & column, ReadBuffer & ist
|
||||
|
||||
void DataTypeFixedString::serializeTextXML(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
const char * pos = reinterpret_cast<const char *>(&static_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
const char * pos = reinterpret_cast<const char *>(&assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
writeXMLString(pos, pos + n, ostr);
|
||||
}
|
||||
|
||||
|
||||
void DataTypeFixedString::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
const char * pos = reinterpret_cast<const char *>(&static_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
const char * pos = reinterpret_cast<const char *>(&assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
writeCSVString(pos, pos + n, ostr);
|
||||
}
|
||||
|
||||
@ -219,7 +220,7 @@ void DataTypeFixedString::serializeProtobuf(const IColumn & column, size_t row_n
|
||||
{
|
||||
if (value_index)
|
||||
return;
|
||||
const char * pos = reinterpret_cast<const char *>(&static_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
const char * pos = reinterpret_cast<const char *>(&assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num]);
|
||||
value_index = static_cast<bool>(protobuf.writeString(StringRef(pos, n)));
|
||||
}
|
||||
|
||||
@ -227,7 +228,7 @@ void DataTypeFixedString::serializeProtobuf(const IColumn & column, size_t row_n
|
||||
void DataTypeFixedString::deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const
|
||||
{
|
||||
row_added = false;
|
||||
auto & column_string = static_cast<ColumnFixedString &>(column);
|
||||
auto & column_string = assert_cast<ColumnFixedString &>(column);
|
||||
ColumnFixedString::Chars & data = column_string.getChars();
|
||||
size_t old_size = data.size();
|
||||
try
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Columns/ColumnsCommon.h>
|
||||
#include <Common/HashTable/HashMap.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Core/TypeListNumber.h>
|
||||
#include <DataTypes/DataTypeFactory.h>
|
||||
#include <DataTypes/DataTypeLowCardinality.h>
|
||||
|
@ -7,6 +7,9 @@
|
||||
#include <DataTypes/DataTypeArray.h>
|
||||
#include <DataTypes/DataTypeTuple.h>
|
||||
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -110,7 +113,7 @@ ColumnPtr recursiveLowCardinalityConversion(const ColumnPtr & column, const Data
|
||||
if (from_type->equals(*low_cardinality_type->getDictionaryType()))
|
||||
{
|
||||
auto col = low_cardinality_type->createColumn();
|
||||
static_cast<ColumnLowCardinality &>(*col).insertRangeFromFullColumn(*column, 0, column->size());
|
||||
assert_cast<ColumnLowCardinality &>(*col).insertRangeFromFullColumn(*column, 0, column->size());
|
||||
return col;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <IO/ConcatReadBuffer.h>
|
||||
#include <Parsers/IAST.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -84,7 +85,7 @@ void DataTypeNullable::serializeBinaryBulkWithMultipleStreams(
|
||||
SerializeBinaryBulkSettings & settings,
|
||||
SerializeBinaryBulkStatePtr & state) const
|
||||
{
|
||||
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
col.checkConsistency();
|
||||
|
||||
/// First serialize null map.
|
||||
@ -105,7 +106,7 @@ void DataTypeNullable::deserializeBinaryBulkWithMultipleStreams(
|
||||
DeserializeBinaryBulkSettings & settings,
|
||||
DeserializeBinaryBulkStatePtr & state) const
|
||||
{
|
||||
ColumnNullable & col = static_cast<ColumnNullable &>(column);
|
||||
ColumnNullable & col = assert_cast<ColumnNullable &>(column);
|
||||
|
||||
settings.path.push_back(Substream::NullMap);
|
||||
if (auto stream = settings.getter(settings.path))
|
||||
@ -119,7 +120,7 @@ void DataTypeNullable::deserializeBinaryBulkWithMultipleStreams(
|
||||
|
||||
void DataTypeNullable::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
|
||||
{
|
||||
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
|
||||
bool is_null = col.isNullAt(row_num);
|
||||
writeBinary(is_null, ostr);
|
||||
@ -134,7 +135,7 @@ static void safeDeserialize(
|
||||
IColumn & column,
|
||||
CheckForNull && check_for_null, DeserializeNested && deserialize_nested)
|
||||
{
|
||||
ColumnNullable & col = static_cast<ColumnNullable &>(column);
|
||||
ColumnNullable & col = assert_cast<ColumnNullable &>(column);
|
||||
|
||||
if (check_for_null())
|
||||
{
|
||||
@ -167,7 +168,7 @@ void DataTypeNullable::deserializeBinary(IColumn & column, ReadBuffer & istr) co
|
||||
|
||||
void DataTypeNullable::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
|
||||
if (col.isNullAt(row_num))
|
||||
writeCString("\\N", ostr);
|
||||
@ -235,7 +236,7 @@ void DataTypeNullable::deserializeTextEscaped(IColumn & column, ReadBuffer & ist
|
||||
|
||||
void DataTypeNullable::serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
|
||||
if (col.isNullAt(row_num))
|
||||
writeCString("NULL", ostr);
|
||||
@ -262,7 +263,7 @@ void DataTypeNullable::deserializeWholeText(IColumn & column, ReadBuffer & istr,
|
||||
|
||||
void DataTypeNullable::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
|
||||
if (col.isNullAt(row_num))
|
||||
writeCString("\\N", ostr);
|
||||
@ -342,7 +343,7 @@ void DataTypeNullable::deserializeTextCSV(IColumn & column, ReadBuffer & istr, c
|
||||
|
||||
void DataTypeNullable::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
|
||||
/// In simple text format (like 'Pretty' format) (these formats are suitable only for output and cannot be parsed back),
|
||||
/// data is printed without escaping.
|
||||
@ -358,7 +359,7 @@ void DataTypeNullable::serializeText(const IColumn & column, size_t row_num, Wri
|
||||
|
||||
void DataTypeNullable::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
|
||||
if (col.isNullAt(row_num))
|
||||
writeCString("null", ostr);
|
||||
@ -375,7 +376,7 @@ void DataTypeNullable::deserializeTextJSON(IColumn & column, ReadBuffer & istr,
|
||||
|
||||
void DataTypeNullable::serializeTextXML(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
|
||||
if (col.isNullAt(row_num))
|
||||
writeCString("\\N", ostr);
|
||||
@ -385,14 +386,14 @@ void DataTypeNullable::serializeTextXML(const IColumn & column, size_t row_num,
|
||||
|
||||
void DataTypeNullable::serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf, size_t & value_index) const
|
||||
{
|
||||
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
if (!col.isNullAt(row_num))
|
||||
nested_data_type->serializeProtobuf(col.getNestedColumn(), row_num, protobuf, value_index);
|
||||
}
|
||||
|
||||
void DataTypeNullable::deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const
|
||||
{
|
||||
ColumnNullable & col = static_cast<ColumnNullable &>(column);
|
||||
ColumnNullable & col = assert_cast<ColumnNullable &>(column);
|
||||
IColumn & nested_column = col.getNestedColumn();
|
||||
size_t old_size = nested_column.size();
|
||||
try
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <Common/NaNUtils.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Formats/FormatSettings.h>
|
||||
#include <Formats/ProtobufReader.h>
|
||||
#include <Formats/ProtobufWriter.h>
|
||||
@ -17,7 +18,7 @@ namespace DB
|
||||
template <typename T>
|
||||
void DataTypeNumberBase<T>::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeText(static_cast<const ColumnVector<T> &>(column).getData()[row_num], ostr);
|
||||
writeText(assert_cast<const ColumnVector<T> &>(column).getData()[row_num], ostr);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -30,7 +31,7 @@ void DataTypeNumberBase<T>::deserializeText(IColumn & column, ReadBuffer & istr,
|
||||
else
|
||||
readText(x, istr);
|
||||
|
||||
static_cast<ColumnVector<T> &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnVector<T> &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -64,7 +65,7 @@ static inline void writeDenormalNumber(T x, WriteBuffer & ostr)
|
||||
template <typename T>
|
||||
void DataTypeNumberBase<T>::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
auto x = static_cast<const ColumnVector<T> &>(column).getData()[row_num];
|
||||
auto x = assert_cast<const ColumnVector<T> &>(column).getData()[row_num];
|
||||
bool is_finite = isFinite(x);
|
||||
|
||||
const bool need_quote = (std::is_integral_v<T> && (sizeof(T) == 8) && settings.json.quote_64bit_integers)
|
||||
@ -132,7 +133,7 @@ void DataTypeNumberBase<T>::deserializeTextJSON(IColumn & column, ReadBuffer & i
|
||||
assertChar('"', istr);
|
||||
}
|
||||
|
||||
static_cast<ColumnVector<T> &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnVector<T> &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -140,7 +141,7 @@ void DataTypeNumberBase<T>::deserializeTextCSV(IColumn & column, ReadBuffer & is
|
||||
{
|
||||
FieldType x;
|
||||
readCSV(x, istr);
|
||||
static_cast<ColumnVector<T> &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnVector<T> &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -168,7 +169,7 @@ void DataTypeNumberBase<T>::deserializeBinary(Field & field, ReadBuffer & istr)
|
||||
template <typename T>
|
||||
void DataTypeNumberBase<T>::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
|
||||
{
|
||||
writeBinary(static_cast<const ColumnVector<T> &>(column).getData()[row_num], ostr);
|
||||
writeBinary(assert_cast<const ColumnVector<T> &>(column).getData()[row_num], ostr);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -176,7 +177,7 @@ void DataTypeNumberBase<T>::deserializeBinary(IColumn & column, ReadBuffer & ist
|
||||
{
|
||||
typename ColumnVector<T>::value_type x;
|
||||
readBinary(x, istr);
|
||||
static_cast<ColumnVector<T> &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnVector<T> &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -209,7 +210,7 @@ void DataTypeNumberBase<T>::serializeProtobuf(const IColumn & column, size_t row
|
||||
{
|
||||
if (value_index)
|
||||
return;
|
||||
value_index = static_cast<bool>(protobuf.writeNumber(static_cast<const ColumnVector<T> &>(column).getData()[row_num]));
|
||||
value_index = static_cast<bool>(protobuf.writeNumber(assert_cast<const ColumnVector<T> &>(column).getData()[row_num]));
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <Columns/ColumnConst.h>
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <Formats/FormatSettings.h>
|
||||
#include <Formats/ProtobufReader.h>
|
||||
@ -45,7 +46,7 @@ void DataTypeString::deserializeBinary(Field & field, ReadBuffer & istr) const
|
||||
|
||||
void DataTypeString::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
|
||||
{
|
||||
const StringRef & s = static_cast<const ColumnString &>(column).getDataAt(row_num);
|
||||
const StringRef & s = assert_cast<const ColumnString &>(column).getDataAt(row_num);
|
||||
writeVarUInt(s.size, ostr);
|
||||
writeString(s, ostr);
|
||||
}
|
||||
@ -53,7 +54,7 @@ void DataTypeString::serializeBinary(const IColumn & column, size_t row_num, Wri
|
||||
|
||||
void DataTypeString::deserializeBinary(IColumn & column, ReadBuffer & istr) const
|
||||
{
|
||||
ColumnString & column_string = static_cast<ColumnString &>(column);
|
||||
ColumnString & column_string = assert_cast<ColumnString &>(column);
|
||||
ColumnString::Chars & data = column_string.getChars();
|
||||
ColumnString::Offsets & offsets = column_string.getOffsets();
|
||||
|
||||
@ -211,20 +212,20 @@ void DataTypeString::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr,
|
||||
|
||||
void DataTypeString::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeString(static_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
writeString(assert_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
}
|
||||
|
||||
|
||||
void DataTypeString::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeEscapedString(static_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
writeEscapedString(assert_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
}
|
||||
|
||||
|
||||
template <typename Reader>
|
||||
static inline void read(IColumn & column, Reader && reader)
|
||||
{
|
||||
ColumnString & column_string = static_cast<ColumnString &>(column);
|
||||
ColumnString & column_string = assert_cast<ColumnString &>(column);
|
||||
ColumnString::Chars & data = column_string.getChars();
|
||||
ColumnString::Offsets & offsets = column_string.getOffsets();
|
||||
size_t old_chars_size = data.size();
|
||||
@ -258,7 +259,7 @@ void DataTypeString::deserializeTextEscaped(IColumn & column, ReadBuffer & istr,
|
||||
|
||||
void DataTypeString::serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeQuotedString(static_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
writeQuotedString(assert_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
}
|
||||
|
||||
|
||||
@ -270,7 +271,7 @@ void DataTypeString::deserializeTextQuoted(IColumn & column, ReadBuffer & istr,
|
||||
|
||||
void DataTypeString::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
{
|
||||
writeJSONString(static_cast<const ColumnString &>(column).getDataAt(row_num), ostr, settings);
|
||||
writeJSONString(assert_cast<const ColumnString &>(column).getDataAt(row_num), ostr, settings);
|
||||
}
|
||||
|
||||
|
||||
@ -282,13 +283,13 @@ void DataTypeString::deserializeTextJSON(IColumn & column, ReadBuffer & istr, co
|
||||
|
||||
void DataTypeString::serializeTextXML(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeXMLString(static_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
writeXMLString(assert_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
}
|
||||
|
||||
|
||||
void DataTypeString::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeCSVString<>(static_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
writeCSVString<>(assert_cast<const ColumnString &>(column).getDataAt(row_num), ostr);
|
||||
}
|
||||
|
||||
|
||||
@ -302,14 +303,14 @@ void DataTypeString::serializeProtobuf(const IColumn & column, size_t row_num, P
|
||||
{
|
||||
if (value_index)
|
||||
return;
|
||||
value_index = static_cast<bool>(protobuf.writeString(static_cast<const ColumnString &>(column).getDataAt(row_num)));
|
||||
value_index = static_cast<bool>(protobuf.writeString(assert_cast<const ColumnString &>(column).getDataAt(row_num)));
|
||||
}
|
||||
|
||||
|
||||
void DataTypeString::deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const
|
||||
{
|
||||
row_added = false;
|
||||
auto & column_string = static_cast<ColumnString &>(column);
|
||||
auto & column_string = assert_cast<ColumnString &>(column);
|
||||
ColumnString::Chars & data = column_string.getChars();
|
||||
ColumnString::Offsets & offsets = column_string.getOffsets();
|
||||
size_t old_size = offsets.size();
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <Parsers/IAST.h>
|
||||
#include <Parsers/ASTNameTypePair.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <IO/WriteBufferFromString.h>
|
||||
@ -88,12 +89,12 @@ std::string DataTypeTuple::doGetName() const
|
||||
|
||||
static inline IColumn & extractElementColumn(IColumn & column, size_t idx)
|
||||
{
|
||||
return static_cast<ColumnTuple &>(column).getColumn(idx);
|
||||
return assert_cast<ColumnTuple &>(column).getColumn(idx);
|
||||
}
|
||||
|
||||
static inline const IColumn & extractElementColumn(const IColumn & column, size_t idx)
|
||||
{
|
||||
return static_cast<const ColumnTuple &>(column).getColumn(idx);
|
||||
return assert_cast<const ColumnTuple &>(column).getColumn(idx);
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <Formats/ProtobufWriter.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -12,14 +13,14 @@ namespace DB
|
||||
|
||||
void DataTypeUUID::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
writeText(UUID(static_cast<const ColumnUInt128 &>(column).getData()[row_num]), ostr);
|
||||
writeText(UUID(assert_cast<const ColumnUInt128 &>(column).getData()[row_num]), ostr);
|
||||
}
|
||||
|
||||
void DataTypeUUID::deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings &) const
|
||||
{
|
||||
UUID x;
|
||||
readText(x, istr);
|
||||
static_cast<ColumnUInt128 &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnUInt128 &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
void DataTypeUUID::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -40,7 +41,7 @@ void DataTypeUUID::deserializeTextQuoted(IColumn & column, ReadBuffer & istr, co
|
||||
assertChar('\'', istr);
|
||||
readText(x, istr);
|
||||
assertChar('\'', istr);
|
||||
static_cast<ColumnUInt128 &>(column).getData().push_back(x); /// It's important to do this at the end - for exception safety.
|
||||
assert_cast<ColumnUInt128 &>(column).getData().push_back(x); /// It's important to do this at the end - for exception safety.
|
||||
}
|
||||
|
||||
void DataTypeUUID::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -56,7 +57,7 @@ void DataTypeUUID::deserializeTextJSON(IColumn & column, ReadBuffer & istr, cons
|
||||
assertChar('"', istr);
|
||||
readText(x, istr);
|
||||
assertChar('"', istr);
|
||||
static_cast<ColumnUInt128 &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnUInt128 &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
void DataTypeUUID::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
|
||||
@ -70,14 +71,14 @@ void DataTypeUUID::deserializeTextCSV(IColumn & column, ReadBuffer & istr, const
|
||||
{
|
||||
UUID value;
|
||||
readCSV(value, istr);
|
||||
static_cast<ColumnUInt128 &>(column).getData().push_back(value);
|
||||
assert_cast<ColumnUInt128 &>(column).getData().push_back(value);
|
||||
}
|
||||
|
||||
void DataTypeUUID::serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf, size_t & value_index) const
|
||||
{
|
||||
if (value_index)
|
||||
return;
|
||||
value_index = static_cast<bool>(protobuf.writeUUID(UUID(static_cast<const ColumnUInt128 &>(column).getData()[row_num])));
|
||||
value_index = static_cast<bool>(protobuf.writeUUID(UUID(assert_cast<const ColumnUInt128 &>(column).getData()[row_num])));
|
||||
}
|
||||
|
||||
void DataTypeUUID::deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const
|
||||
@ -87,7 +88,7 @@ void DataTypeUUID::deserializeProtobuf(IColumn & column, ProtobufReader & protob
|
||||
if (!protobuf.readUUID(uuid))
|
||||
return;
|
||||
|
||||
auto & container = static_cast<ColumnUInt128 &>(column).getData();
|
||||
auto & container = assert_cast<ColumnUInt128 &>(column).getData();
|
||||
if (allow_add_row)
|
||||
{
|
||||
container.emplace_back(uuid);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <type_traits>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/DataTypesDecimal.h>
|
||||
#include <DataTypes/DataTypeFactory.h>
|
||||
#include <Formats/ProtobufReader.h>
|
||||
@ -11,6 +12,7 @@
|
||||
#include <Parsers/ASTLiteral.h>
|
||||
#include <Interpreters/Context.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -47,7 +49,7 @@ bool DataTypeDecimal<T>::equals(const IDataType & rhs) const
|
||||
template <typename T>
|
||||
void DataTypeDecimal<T>::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const
|
||||
{
|
||||
T value = static_cast<const ColumnType &>(column).getData()[row_num];
|
||||
T value = assert_cast<const ColumnType &>(column).getData()[row_num];
|
||||
writeText(value, scale, ostr);
|
||||
}
|
||||
|
||||
@ -76,7 +78,7 @@ void DataTypeDecimal<T>::deserializeText(IColumn & column, ReadBuffer & istr, co
|
||||
{
|
||||
T x;
|
||||
readText(x, istr);
|
||||
static_cast<ColumnType &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnType &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -84,7 +86,7 @@ void DataTypeDecimal<T>::deserializeTextCSV(IColumn & column, ReadBuffer & istr,
|
||||
{
|
||||
T x;
|
||||
readText(x, istr, true);
|
||||
static_cast<ColumnType &>(column).getData().push_back(x);
|
||||
assert_cast<ColumnType &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -109,7 +111,7 @@ void DataTypeDecimal<T>::serializeBinary(const Field & field, WriteBuffer & ostr
|
||||
template <typename T>
|
||||
void DataTypeDecimal<T>::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
|
||||
{
|
||||
const FieldType & x = static_cast<const ColumnType &>(column).getData()[row_num];
|
||||
const FieldType & x = assert_cast<const ColumnType &>(column).getData()[row_num];
|
||||
writeBinary(x, ostr);
|
||||
}
|
||||
|
||||
@ -140,7 +142,7 @@ void DataTypeDecimal<T>::deserializeBinary(IColumn & column, ReadBuffer & istr)
|
||||
{
|
||||
typename FieldType::NativeType x;
|
||||
readBinary(x, istr);
|
||||
static_cast<ColumnType &>(column).getData().push_back(FieldType(x));
|
||||
assert_cast<ColumnType &>(column).getData().push_back(FieldType(x));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -159,7 +161,7 @@ void DataTypeDecimal<T>::serializeProtobuf(const IColumn & column, size_t row_nu
|
||||
{
|
||||
if (value_index)
|
||||
return;
|
||||
value_index = static_cast<bool>(protobuf.writeDecimal(static_cast<const ColumnType &>(column).getData()[row_num], scale));
|
||||
value_index = static_cast<bool>(protobuf.writeDecimal(assert_cast<const ColumnType &>(column).getData()[row_num], scale));
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +173,7 @@ void DataTypeDecimal<T>::deserializeProtobuf(IColumn & column, ProtobufReader &
|
||||
if (!protobuf.readDecimal(decimal, precision, scale))
|
||||
return;
|
||||
|
||||
auto & container = static_cast<ColumnType &>(column).getData();
|
||||
auto & container = assert_cast<ColumnType &>(column).getData();
|
||||
if (allow_add_row)
|
||||
{
|
||||
container.emplace_back(decimal);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Common/StringUtils/StringUtils.h>
|
||||
|
||||
#include <DataTypes/DataTypeArray.h>
|
||||
@ -94,7 +95,7 @@ Block flatten(const Block & block)
|
||||
bool is_const = isColumnConst(*elem.column);
|
||||
const ColumnArray * column_array;
|
||||
if (is_const)
|
||||
column_array = typeid_cast<const ColumnArray *>(&static_cast<const ColumnConst &>(*elem.column).getDataColumn());
|
||||
column_array = typeid_cast<const ColumnArray *>(&assert_cast<const ColumnConst &>(*elem.column).getDataColumn());
|
||||
else
|
||||
column_array = typeid_cast<const ColumnArray *>(elem.column.get());
|
||||
|
||||
@ -181,8 +182,8 @@ void validateArraySizes(const Block & block)
|
||||
/// It's not the first column of Nested data structure.
|
||||
if (!inserted)
|
||||
{
|
||||
const ColumnArray & first_array_column = static_cast<const ColumnArray &>(*block.getByPosition(it->second).column);
|
||||
const ColumnArray & another_array_column = static_cast<const ColumnArray &>(*elem.column);
|
||||
const ColumnArray & first_array_column = assert_cast<const ColumnArray &>(*block.getByPosition(it->second).column);
|
||||
const ColumnArray & another_array_column = assert_cast<const ColumnArray &>(*elem.column);
|
||||
|
||||
if (!first_array_column.hasEqualOffsets(another_array_column))
|
||||
throw Exception("Elements '" + block.getByPosition(it->second).name
|
||||
|
@ -1,24 +1,25 @@
|
||||
#include "config_core.h"
|
||||
#if USE_POCO_MONGODB
|
||||
|
||||
# include <sstream>
|
||||
# include <string>
|
||||
# include <vector>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
# include <Poco/MongoDB/Connection.h>
|
||||
# include <Poco/MongoDB/Cursor.h>
|
||||
# include <Poco/MongoDB/Element.h>
|
||||
# include <Poco/MongoDB/ObjectId.h>
|
||||
#include <Poco/MongoDB/Connection.h>
|
||||
#include <Poco/MongoDB/Cursor.h>
|
||||
#include <Poco/MongoDB/Element.h>
|
||||
#include <Poco/MongoDB/ObjectId.h>
|
||||
|
||||
# include <Columns/ColumnNullable.h>
|
||||
# include <Columns/ColumnString.h>
|
||||
# include <Columns/ColumnsNumber.h>
|
||||
# include <IO/ReadHelpers.h>
|
||||
# include <IO/WriteHelpers.h>
|
||||
# include <Common/FieldVisitors.h>
|
||||
# include <ext/range.h>
|
||||
# include "DictionaryStructure.h"
|
||||
# include "MongoDBBlockInputStream.h"
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <ext/range.h>
|
||||
#include "DictionaryStructure.h"
|
||||
#include "MongoDBBlockInputStream.h"
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -54,26 +55,26 @@ namespace
|
||||
switch (value.type())
|
||||
{
|
||||
case Poco::MongoDB::ElementTraits<Int32>::TypeId:
|
||||
static_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
assert_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
static_cast<const Poco::MongoDB::ConcreteElement<Int32> &>(value).value());
|
||||
break;
|
||||
case Poco::MongoDB::ElementTraits<Poco::Int64>::TypeId:
|
||||
static_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
assert_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
static_cast<const Poco::MongoDB::ConcreteElement<Poco::Int64> &>(value).value());
|
||||
break;
|
||||
case Poco::MongoDB::ElementTraits<Float64>::TypeId:
|
||||
static_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
assert_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
static_cast<const Poco::MongoDB::ConcreteElement<Float64> &>(value).value());
|
||||
break;
|
||||
case Poco::MongoDB::ElementTraits<bool>::TypeId:
|
||||
static_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
assert_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
static_cast<const Poco::MongoDB::ConcreteElement<bool> &>(value).value());
|
||||
break;
|
||||
case Poco::MongoDB::ElementTraits<Poco::MongoDB::NullValue>::TypeId:
|
||||
static_cast<ColumnVector<T> &>(column).getData().emplace_back();
|
||||
assert_cast<ColumnVector<T> &>(column).getData().emplace_back();
|
||||
break;
|
||||
case Poco::MongoDB::ElementTraits<String>::TypeId:
|
||||
static_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
assert_cast<ColumnVector<T> &>(column).getData().push_back(
|
||||
parse<T>(static_cast<const Poco::MongoDB::ConcreteElement<String> &>(value).value()));
|
||||
break;
|
||||
default:
|
||||
@ -123,13 +124,13 @@ namespace
|
||||
if (value.type() == Poco::MongoDB::ElementTraits<ObjectId::Ptr>::TypeId)
|
||||
{
|
||||
std::string string_id = value.toString();
|
||||
static_cast<ColumnString &>(column).insertDataWithTerminatingZero(string_id.data(), string_id.size() + 1);
|
||||
assert_cast<ColumnString &>(column).insertDataWithTerminatingZero(string_id.data(), string_id.size() + 1);
|
||||
break;
|
||||
}
|
||||
else if (value.type() == Poco::MongoDB::ElementTraits<String>::TypeId)
|
||||
{
|
||||
String string = static_cast<const Poco::MongoDB::ConcreteElement<String> &>(value).value();
|
||||
static_cast<ColumnString &>(column).insertDataWithTerminatingZero(string.data(), string.size() + 1);
|
||||
assert_cast<ColumnString &>(column).insertDataWithTerminatingZero(string.data(), string.size() + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -143,7 +144,7 @@ namespace
|
||||
throw Exception{"Type mismatch, expected Timestamp, got type id = " + toString(value.type()) + " for column " + name,
|
||||
ErrorCodes::TYPE_MISMATCH};
|
||||
|
||||
static_cast<ColumnUInt16 &>(column).getData().push_back(UInt16{DateLUT::instance().toDayNum(
|
||||
assert_cast<ColumnUInt16 &>(column).getData().push_back(UInt16{DateLUT::instance().toDayNum(
|
||||
static_cast<const Poco::MongoDB::ConcreteElement<Poco::Timestamp> &>(value).value().epochTime())});
|
||||
break;
|
||||
}
|
||||
@ -154,7 +155,7 @@ namespace
|
||||
throw Exception{"Type mismatch, expected Timestamp, got type id = " + toString(value.type()) + " for column " + name,
|
||||
ErrorCodes::TYPE_MISMATCH};
|
||||
|
||||
static_cast<ColumnUInt32 &>(column).getData().push_back(
|
||||
assert_cast<ColumnUInt32 &>(column).getData().push_back(
|
||||
static_cast<const Poco::MongoDB::ConcreteElement<Poco::Timestamp> &>(value).value().epochTime());
|
||||
break;
|
||||
}
|
||||
@ -163,7 +164,7 @@ namespace
|
||||
if (value.type() == Poco::MongoDB::ElementTraits<String>::TypeId)
|
||||
{
|
||||
String string = static_cast<const Poco::MongoDB::ConcreteElement<String> &>(value).value();
|
||||
static_cast<ColumnUInt128 &>(column).getData().push_back(parse<UUID>(string));
|
||||
assert_cast<ColumnUInt128 &>(column).getData().push_back(parse<UUID>(string));
|
||||
}
|
||||
else
|
||||
throw Exception{"Type mismatch, expected String (UUID), got type id = " + toString(value.type()) + " for column "
|
||||
@ -209,7 +210,7 @@ Block MongoDBBlockInputStream::readImpl()
|
||||
{
|
||||
if (description.types[idx].second)
|
||||
{
|
||||
ColumnNullable & column_nullable = static_cast<ColumnNullable &>(*columns[idx]);
|
||||
ColumnNullable & column_nullable = assert_cast<ColumnNullable &>(*columns[idx]);
|
||||
insertValue(column_nullable.getNestedColumn(), description.types[idx].first, *value, name);
|
||||
column_nullable.getNullMapData().emplace_back(0);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "TrieDictionary.h"
|
||||
#include <iostream>
|
||||
#include <stack>
|
||||
#include <Columns/ColumnFixedString.h>
|
||||
#include <Columns/ColumnVector.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/DataTypeFixedString.h>
|
||||
#include <DataTypes/DataTypeString.h>
|
||||
#include <IO/WriteIntText.h>
|
||||
@ -731,8 +731,8 @@ BlockInputStreamPtr TrieDictionary::getBlockInputStream(const Names & column_nam
|
||||
auto getView = [](const Columns & columns, const std::vector<DictionaryAttribute> & dict_attributes)
|
||||
{
|
||||
auto column = ColumnString::create();
|
||||
const auto & ip_column = static_cast<const ColumnFixedString &>(*columns.front());
|
||||
const auto & mask_column = static_cast<const ColumnVector<UInt8> &>(*columns.back());
|
||||
const auto & ip_column = assert_cast<const ColumnFixedString &>(*columns.front());
|
||||
const auto & mask_column = assert_cast<const ColumnVector<UInt8> &>(*columns.back());
|
||||
char buffer[48];
|
||||
for (size_t row : ext::range(0, ip_column.size()))
|
||||
{
|
||||
|
@ -1,14 +1,15 @@
|
||||
#include "config_core.h"
|
||||
#if USE_MYSQL
|
||||
|
||||
# include <vector>
|
||||
# include <Columns/ColumnNullable.h>
|
||||
# include <Columns/ColumnString.h>
|
||||
# include <Columns/ColumnsNumber.h>
|
||||
# include <IO/ReadHelpers.h>
|
||||
# include <IO/WriteHelpers.h>
|
||||
# include <ext/range.h>
|
||||
# include "MySQLBlockInputStream.h"
|
||||
#include <vector>
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <ext/range.h>
|
||||
#include "MySQLBlockInputStream.h"
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -41,46 +42,46 @@ namespace
|
||||
switch (type)
|
||||
{
|
||||
case ValueType::vtUInt8:
|
||||
static_cast<ColumnUInt8 &>(column).insertValue(value.getUInt());
|
||||
assert_cast<ColumnUInt8 &>(column).insertValue(value.getUInt());
|
||||
break;
|
||||
case ValueType::vtUInt16:
|
||||
static_cast<ColumnUInt16 &>(column).insertValue(value.getUInt());
|
||||
assert_cast<ColumnUInt16 &>(column).insertValue(value.getUInt());
|
||||
break;
|
||||
case ValueType::vtUInt32:
|
||||
static_cast<ColumnUInt32 &>(column).insertValue(value.getUInt());
|
||||
assert_cast<ColumnUInt32 &>(column).insertValue(value.getUInt());
|
||||
break;
|
||||
case ValueType::vtUInt64:
|
||||
static_cast<ColumnUInt64 &>(column).insertValue(value.getUInt());
|
||||
assert_cast<ColumnUInt64 &>(column).insertValue(value.getUInt());
|
||||
break;
|
||||
case ValueType::vtInt8:
|
||||
static_cast<ColumnInt8 &>(column).insertValue(value.getInt());
|
||||
assert_cast<ColumnInt8 &>(column).insertValue(value.getInt());
|
||||
break;
|
||||
case ValueType::vtInt16:
|
||||
static_cast<ColumnInt16 &>(column).insertValue(value.getInt());
|
||||
assert_cast<ColumnInt16 &>(column).insertValue(value.getInt());
|
||||
break;
|
||||
case ValueType::vtInt32:
|
||||
static_cast<ColumnInt32 &>(column).insertValue(value.getInt());
|
||||
assert_cast<ColumnInt32 &>(column).insertValue(value.getInt());
|
||||
break;
|
||||
case ValueType::vtInt64:
|
||||
static_cast<ColumnInt64 &>(column).insertValue(value.getInt());
|
||||
assert_cast<ColumnInt64 &>(column).insertValue(value.getInt());
|
||||
break;
|
||||
case ValueType::vtFloat32:
|
||||
static_cast<ColumnFloat32 &>(column).insertValue(value.getDouble());
|
||||
assert_cast<ColumnFloat32 &>(column).insertValue(value.getDouble());
|
||||
break;
|
||||
case ValueType::vtFloat64:
|
||||
static_cast<ColumnFloat64 &>(column).insertValue(value.getDouble());
|
||||
assert_cast<ColumnFloat64 &>(column).insertValue(value.getDouble());
|
||||
break;
|
||||
case ValueType::vtString:
|
||||
static_cast<ColumnString &>(column).insertData(value.data(), value.size());
|
||||
assert_cast<ColumnString &>(column).insertData(value.data(), value.size());
|
||||
break;
|
||||
case ValueType::vtDate:
|
||||
static_cast<ColumnUInt16 &>(column).insertValue(UInt16(value.getDate().getDayNum()));
|
||||
assert_cast<ColumnUInt16 &>(column).insertValue(UInt16(value.getDate().getDayNum()));
|
||||
break;
|
||||
case ValueType::vtDateTime:
|
||||
static_cast<ColumnUInt32 &>(column).insertValue(UInt32(value.getDateTime()));
|
||||
assert_cast<ColumnUInt32 &>(column).insertValue(UInt32(value.getDateTime()));
|
||||
break;
|
||||
case ValueType::vtUUID:
|
||||
static_cast<ColumnUInt128 &>(column).insert(parse<UUID>(value.data(), value.size()));
|
||||
assert_cast<ColumnUInt128 &>(column).insert(parse<UUID>(value.data(), value.size()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -113,7 +114,7 @@ Block MySQLBlockInputStream::readImpl()
|
||||
{
|
||||
if (description.types[idx].second)
|
||||
{
|
||||
ColumnNullable & column_nullable = static_cast<ColumnNullable &>(*columns[idx]);
|
||||
ColumnNullable & column_nullable = assert_cast<ColumnNullable &>(*columns[idx]);
|
||||
insertValue(column_nullable.getNestedColumn(), description.types[idx].first, value);
|
||||
column_nullable.getNullMapData().emplace_back(0);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "castTypeToEither.h"
|
||||
#include "FunctionFactory.h"
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Common/config.h>
|
||||
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
@ -549,7 +550,7 @@ class FunctionBinaryArithmetic : public IFunction
|
||||
const IColumn & agg_state_column = *block.getByPosition(new_arguments[0]).column;
|
||||
bool agg_state_is_const = isColumnConst(agg_state_column);
|
||||
const ColumnAggregateFunction & column = typeid_cast<const ColumnAggregateFunction &>(
|
||||
agg_state_is_const ? static_cast<const ColumnConst &>(agg_state_column).getDataColumn() : agg_state_column);
|
||||
agg_state_is_const ? assert_cast<const ColumnConst &>(agg_state_column).getDataColumn() : agg_state_column);
|
||||
|
||||
AggregateFunctionPtr function = column.getAggregateFunction();
|
||||
|
||||
@ -613,9 +614,9 @@ class FunctionBinaryArithmetic : public IFunction
|
||||
bool rhs_is_const = isColumnConst(rhs_column);
|
||||
|
||||
const ColumnAggregateFunction & lhs = typeid_cast<const ColumnAggregateFunction &>(
|
||||
lhs_is_const ? static_cast<const ColumnConst &>(lhs_column).getDataColumn() : lhs_column);
|
||||
lhs_is_const ? assert_cast<const ColumnConst &>(lhs_column).getDataColumn() : lhs_column);
|
||||
const ColumnAggregateFunction & rhs = typeid_cast<const ColumnAggregateFunction &>(
|
||||
rhs_is_const ? static_cast<const ColumnConst &>(rhs_column).getDataColumn() : rhs_column);
|
||||
rhs_is_const ? assert_cast<const ColumnConst &>(rhs_column).getDataColumn() : rhs_column);
|
||||
|
||||
AggregateFunctionPtr function = lhs.getAggregateFunction();
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Columns/ColumnFixedString.h>
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/DataTypeNullable.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
|
||||
@ -22,7 +23,7 @@ const ColumnConst * checkAndGetColumnConstStringOrFixedString(const IColumn * co
|
||||
if (!isColumnConst(*column))
|
||||
return {};
|
||||
|
||||
const ColumnConst * res = static_cast<const ColumnConst *>(column);
|
||||
const ColumnConst * res = assert_cast<const ColumnConst *>(column);
|
||||
|
||||
if (checkColumn<ColumnString>(&res->getDataColumn())
|
||||
|| checkColumn<ColumnFixedString>(&res->getDataColumn()))
|
||||
@ -34,7 +35,7 @@ const ColumnConst * checkAndGetColumnConstStringOrFixedString(const IColumn * co
|
||||
|
||||
Columns convertConstTupleToConstantElements(const ColumnConst & column)
|
||||
{
|
||||
const ColumnTuple & src_tuple = static_cast<const ColumnTuple &>(column.getDataColumn());
|
||||
const ColumnTuple & src_tuple = assert_cast<const ColumnTuple &>(column.getDataColumn());
|
||||
const auto & src_tuple_columns = src_tuple.getColumns();
|
||||
size_t tuple_size = src_tuple_columns.size();
|
||||
size_t rows = column.size();
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/IDataType.h>
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
@ -28,7 +29,7 @@ const ColumnConst * checkAndGetColumnConst(const IColumn * column)
|
||||
if (!column || !isColumnConst(*column))
|
||||
return {};
|
||||
|
||||
const ColumnConst * res = static_cast<const ColumnConst *>(column);
|
||||
const ColumnConst * res = assert_cast<const ColumnConst *>(column);
|
||||
|
||||
if (!checkColumn<Type>(&res->getDataColumn()))
|
||||
return {};
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <Functions/FunctionHelpers.h>
|
||||
#include <Functions/IFunction.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -195,7 +196,7 @@ public:
|
||||
// input data
|
||||
const auto & return_type = block.getByPosition(result).type;
|
||||
auto res_ptr = return_type->createColumn();
|
||||
ColumnArray & res = static_cast<ColumnArray &>(*res_ptr);
|
||||
ColumnArray & res = assert_cast<ColumnArray &>(*res_ptr);
|
||||
|
||||
IColumn & res_data = res.getData();
|
||||
ColumnArray::Offsets & res_offsets = res.getOffsets();
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Common/memcmpSmall.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
@ -838,7 +839,7 @@ private:
|
||||
throw Exception("String is too long for Date: " + string_value.toString(), ErrorCodes::TOO_LARGE_STRING_SIZE);
|
||||
|
||||
ColumnPtr parsed_const_date_holder = DataTypeDate().createColumnConst(input_rows_count, date);
|
||||
const ColumnConst * parsed_const_date = static_cast<const ColumnConst *>(parsed_const_date_holder.get());
|
||||
const ColumnConst * parsed_const_date = assert_cast<const ColumnConst *>(parsed_const_date_holder.get());
|
||||
executeNumLeftType<DataTypeDate::FieldType>(block, result,
|
||||
left_is_num ? col_left_untyped : parsed_const_date,
|
||||
left_is_num ? parsed_const_date : col_right_untyped);
|
||||
@ -852,7 +853,7 @@ private:
|
||||
throw Exception("String is too long for DateTime: " + string_value.toString(), ErrorCodes::TOO_LARGE_STRING_SIZE);
|
||||
|
||||
ColumnPtr parsed_const_date_time_holder = DataTypeDateTime().createColumnConst(input_rows_count, UInt64(date_time));
|
||||
const ColumnConst * parsed_const_date_time = static_cast<const ColumnConst *>(parsed_const_date_time_holder.get());
|
||||
const ColumnConst * parsed_const_date_time = assert_cast<const ColumnConst *>(parsed_const_date_time_holder.get());
|
||||
executeNumLeftType<DataTypeDateTime::FieldType>(block, result,
|
||||
left_is_num ? col_left_untyped : parsed_const_date_time,
|
||||
left_is_num ? parsed_const_date_time : col_right_untyped);
|
||||
@ -866,7 +867,7 @@ private:
|
||||
throw Exception("String is too long for UUID: " + string_value.toString(), ErrorCodes::TOO_LARGE_STRING_SIZE);
|
||||
|
||||
ColumnPtr parsed_const_uuid_holder = DataTypeUUID().createColumnConst(input_rows_count, uuid);
|
||||
const ColumnConst * parsed_const_uuid = static_cast<const ColumnConst *>(parsed_const_uuid_holder.get());
|
||||
const ColumnConst * parsed_const_uuid = assert_cast<const ColumnConst *>(parsed_const_uuid_holder.get());
|
||||
executeNumLeftType<DataTypeUUID::FieldType>(block, result,
|
||||
left_is_num ? col_left_untyped : parsed_const_uuid,
|
||||
left_is_num ? parsed_const_uuid : col_right_untyped);
|
||||
@ -932,12 +933,12 @@ private:
|
||||
if (x_const)
|
||||
x_columns = convertConstTupleToConstantElements(*x_const);
|
||||
else
|
||||
x_columns = static_cast<const ColumnTuple &>(*c0.column).getColumnsCopy();
|
||||
x_columns = assert_cast<const ColumnTuple &>(*c0.column).getColumnsCopy();
|
||||
|
||||
if (y_const)
|
||||
y_columns = convertConstTupleToConstantElements(*y_const);
|
||||
else
|
||||
y_columns = static_cast<const ColumnTuple &>(*c1.column).getColumnsCopy();
|
||||
y_columns = assert_cast<const ColumnTuple &>(*c1.column).getColumnsCopy();
|
||||
|
||||
for (size_t i = 0; i < tuple_size; ++i)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <Columns/ColumnTuple.h>
|
||||
#include <Columns/ColumnsCommon.h>
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Interpreters/ExpressionActions.h>
|
||||
#include <Functions/IFunction.h>
|
||||
#include <Functions/FunctionsMiscellaneous.h>
|
||||
@ -2053,7 +2054,7 @@ private:
|
||||
if (!skip_not_null_check)
|
||||
{
|
||||
const auto & col = block.getByPosition(arguments[0]).column;
|
||||
const auto & nullable_col = static_cast<const ColumnNullable &>(*col);
|
||||
const auto & nullable_col = assert_cast<const ColumnNullable &>(*col);
|
||||
const auto & null_map = nullable_col.getNullMapData();
|
||||
|
||||
if (!memoryIsZero(null_map.data(), null_map.size()))
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <DataTypes/DataTypeUUID.h>
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
@ -168,7 +169,7 @@ private:
|
||||
|
||||
if (checkColumn<ColumnTuple>(key_col.get()))
|
||||
{
|
||||
const auto & key_columns = static_cast<const ColumnTuple &>(*key_col).getColumnsCopy();
|
||||
const auto & key_columns = assert_cast<const ColumnTuple &>(*key_col).getColumnsCopy();
|
||||
const auto & key_types = static_cast<const DataTypeTuple &>(*key_col_with_type.type).getElements();
|
||||
|
||||
auto out = ColumnUInt8::create(key_col_with_type.column->size());
|
||||
@ -354,7 +355,7 @@ private:
|
||||
|
||||
if (checkColumn<ColumnTuple>(key_col.get()))
|
||||
{
|
||||
const auto & key_columns = static_cast<const ColumnTuple &>(*key_col).getColumnsCopy();
|
||||
const auto & key_columns = assert_cast<const ColumnTuple &>(*key_col).getColumnsCopy();
|
||||
const auto & key_types = static_cast<const DataTypeTuple &>(*key_col_with_type.type).getElements();
|
||||
|
||||
auto out = ColumnString::create();
|
||||
@ -891,7 +892,7 @@ private:
|
||||
|
||||
if (checkColumn<ColumnTuple>(key_col.get()))
|
||||
{
|
||||
const auto & key_columns = static_cast<const ColumnTuple &>(*key_col).getColumnsCopy();
|
||||
const auto & key_columns = assert_cast<const ColumnTuple &>(*key_col).getColumnsCopy();
|
||||
const auto & key_types = static_cast<const DataTypeTuple &>(*key_col_with_type.type).getElements();
|
||||
|
||||
typename ColVec::MutablePtr out;
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <Columns/ColumnTuple.h>
|
||||
#include <DataTypes/DataTypeTuple.h>
|
||||
#include <Common/assert_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -100,7 +102,7 @@ void FunctionModelEvaluate::executeImpl(Block & block, const ColumnNumbers & arg
|
||||
{
|
||||
auto mut_null_map = (*std::move(null_map)).mutate();
|
||||
|
||||
NullMap & result_null_map = static_cast<ColumnUInt8 &>(*mut_null_map).getData();
|
||||
NullMap & result_null_map = assert_cast<ColumnUInt8 &>(*mut_null_map).getData();
|
||||
const NullMap & src_null_map = col_nullable->getNullMapColumn().getData();
|
||||
|
||||
for (size_t i = 0, size = result_null_map.size(); i < size; ++i)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "config_functions.h"
|
||||
#include <Common/CpuId.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Core/AccurateComparison.h>
|
||||
#include <Core/Settings.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
@ -215,7 +216,7 @@ private:
|
||||
|
||||
if (isColumnConst(*column.column))
|
||||
{
|
||||
const auto & column_const = static_cast<const ColumnConst &>(*column.column);
|
||||
const auto & column_const = assert_cast<const ColumnConst &>(*column.column);
|
||||
if (isString(column.type))
|
||||
moves.emplace_back(MoveType::ConstKey, column_const.getField().get<String>());
|
||||
else
|
||||
@ -300,7 +301,7 @@ public:
|
||||
using Iterator = typename JSONParser::Iterator;
|
||||
static bool addValueToColumn(IColumn & dest, const Iterator &)
|
||||
{
|
||||
ColumnVector<UInt8> & col_vec = static_cast<ColumnVector<UInt8> &>(dest);
|
||||
ColumnVector<UInt8> & col_vec = assert_cast<ColumnVector<UInt8> &>(dest);
|
||||
col_vec.insertValue(1);
|
||||
return true;
|
||||
}
|
||||
@ -330,7 +331,7 @@ public:
|
||||
else
|
||||
return false;
|
||||
|
||||
ColumnVector<UInt64> & col_vec = static_cast<ColumnVector<UInt64> &>(dest);
|
||||
ColumnVector<UInt64> & col_vec = assert_cast<ColumnVector<UInt64> &>(dest);
|
||||
col_vec.insertValue(size);
|
||||
return true;
|
||||
}
|
||||
@ -355,7 +356,7 @@ public:
|
||||
if (!JSONParser::isObjectMember(it))
|
||||
return false;
|
||||
StringRef key = JSONParser::getKey(it);
|
||||
ColumnString & col_str = static_cast<ColumnString &>(dest);
|
||||
ColumnString & col_str = assert_cast<ColumnString &>(dest);
|
||||
col_str.insertData(key.data, key.size);
|
||||
return true;
|
||||
}
|
||||
@ -407,7 +408,7 @@ public:
|
||||
else
|
||||
return false;
|
||||
|
||||
ColumnVector<Int8> & col_vec = static_cast<ColumnVector<Int8> &>(dest);
|
||||
ColumnVector<Int8> & col_vec = assert_cast<ColumnVector<Int8> &>(dest);
|
||||
col_vec.insertValue(type);
|
||||
return true;
|
||||
}
|
||||
@ -451,7 +452,7 @@ public:
|
||||
else
|
||||
return false;
|
||||
|
||||
auto & col_vec = static_cast<ColumnVector<NumberType> &>(dest);
|
||||
auto & col_vec = assert_cast<ColumnVector<NumberType> &>(dest);
|
||||
col_vec.insertValue(value);
|
||||
return true;
|
||||
}
|
||||
@ -497,7 +498,7 @@ public:
|
||||
if (!JSONParser::isBool(it))
|
||||
return false;
|
||||
|
||||
auto & col_vec = static_cast<ColumnVector<UInt8> &>(dest);
|
||||
auto & col_vec = assert_cast<ColumnVector<UInt8> &>(dest);
|
||||
col_vec.insertValue(static_cast<UInt8>(JSONParser::getBool(it)));
|
||||
return true;
|
||||
}
|
||||
@ -523,7 +524,7 @@ public:
|
||||
return false;
|
||||
|
||||
StringRef str = JSONParser::getString(it);
|
||||
ColumnString & col_str = static_cast<ColumnString &>(dest);
|
||||
ColumnString & col_str = assert_cast<ColumnString &>(dest);
|
||||
col_str.insertData(str.data, str.size);
|
||||
return true;
|
||||
}
|
||||
@ -573,7 +574,7 @@ struct JSONExtractTree
|
||||
{
|
||||
if (!JSONParser::isString(it))
|
||||
return false;
|
||||
auto & col_str = static_cast<ColumnFixedString &>(dest);
|
||||
auto & col_str = assert_cast<ColumnFixedString &>(dest);
|
||||
StringRef str = JSONParser::getString(it);
|
||||
if (str.size > col_str.getN())
|
||||
return false;
|
||||
@ -597,7 +598,7 @@ struct JSONExtractTree
|
||||
|
||||
bool addValueToColumn(IColumn & dest, const Iterator & it) override
|
||||
{
|
||||
auto & col_vec = static_cast<ColumnVector<Type> &>(dest);
|
||||
auto & col_vec = assert_cast<ColumnVector<Type> &>(dest);
|
||||
|
||||
if (JSONParser::isInt64(it))
|
||||
{
|
||||
@ -642,7 +643,7 @@ struct JSONExtractTree
|
||||
|
||||
bool addValueToColumn(IColumn & dest, const Iterator & it) override
|
||||
{
|
||||
ColumnNullable & col_null = static_cast<ColumnNullable &>(dest);
|
||||
ColumnNullable & col_null = assert_cast<ColumnNullable &>(dest);
|
||||
if (!nested->addValueToColumn(col_null.getNestedColumn(), it))
|
||||
return false;
|
||||
col_null.getNullMapColumn().insertValue(0);
|
||||
@ -667,7 +668,7 @@ struct JSONExtractTree
|
||||
if (!JSONParser::firstArrayElement(it2))
|
||||
return false;
|
||||
|
||||
ColumnArray & col_arr = static_cast<ColumnArray &>(dest);
|
||||
ColumnArray & col_arr = assert_cast<ColumnArray &>(dest);
|
||||
auto & data = col_arr.getData();
|
||||
size_t old_size = data.size();
|
||||
bool were_valid_elements = false;
|
||||
@ -706,7 +707,7 @@ struct JSONExtractTree
|
||||
|
||||
bool addValueToColumn(IColumn & dest, const Iterator & it) override
|
||||
{
|
||||
ColumnTuple & tuple = static_cast<ColumnTuple &>(dest);
|
||||
ColumnTuple & tuple = assert_cast<ColumnTuple &>(dest);
|
||||
size_t old_size = dest.size();
|
||||
bool were_valid_elements = false;
|
||||
|
||||
@ -916,10 +917,10 @@ public:
|
||||
if (!JSONParser::isObject(it))
|
||||
return false;
|
||||
|
||||
auto & col_arr = static_cast<ColumnArray &>(dest);
|
||||
auto & col_tuple = static_cast<ColumnTuple &>(col_arr.getData());
|
||||
auto & col_arr = assert_cast<ColumnArray &>(dest);
|
||||
auto & col_tuple = assert_cast<ColumnTuple &>(col_arr.getData());
|
||||
size_t old_size = col_tuple.size();
|
||||
auto & col_key = static_cast<ColumnString &>(col_tuple.getColumn(0));
|
||||
auto & col_key = assert_cast<ColumnString &>(col_tuple.getColumn(0));
|
||||
auto & col_value = col_tuple.getColumn(1);
|
||||
|
||||
StringRef key;
|
||||
@ -958,7 +959,7 @@ public:
|
||||
using Iterator = typename JSONParser::Iterator;
|
||||
static bool addValueToColumn(IColumn & dest, const Iterator & it)
|
||||
{
|
||||
ColumnString & col_str = static_cast<ColumnString &>(dest);
|
||||
ColumnString & col_str = assert_cast<ColumnString &>(dest);
|
||||
auto & chars = col_str.getChars();
|
||||
WriteBufferFromVector<ColumnString::Chars> buf(chars, WriteBufferFromVector<ColumnString::Chars>::AppendModeTag());
|
||||
traverse(it, buf);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <Interpreters/castColumn.h>
|
||||
#include "IFunction.h"
|
||||
#include <Common/intExp.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <cmath>
|
||||
#include <type_traits>
|
||||
#include <array>
|
||||
@ -515,7 +516,7 @@ public:
|
||||
if (!isColumnConst(scale_column))
|
||||
throw Exception("Scale argument for rounding functions must be constant.", ErrorCodes::ILLEGAL_COLUMN);
|
||||
|
||||
Field scale_field = static_cast<const ColumnConst &>(scale_column).getField();
|
||||
Field scale_field = assert_cast<const ColumnConst &>(scale_column).getField();
|
||||
if (scale_field.getType() != Field::Types::UInt64
|
||||
&& scale_field.getType() != Field::Types::Int64)
|
||||
throw Exception("Scale argument for rounding functions must have integer type.", ErrorCodes::ILLEGAL_COLUMN);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <Columns/ColumnArray.h>
|
||||
#include <Common/StringUtils/StringUtils.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Functions/IFunction.h>
|
||||
#include <Functions/Regexps.h>
|
||||
#include <Functions/FunctionHelpers.h>
|
||||
@ -551,8 +552,8 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
const ColumnArray & col_arr = static_cast<const ColumnArray &>(*block.getByPosition(arguments[0]).column);
|
||||
const ColumnString & col_string = static_cast<const ColumnString &>(col_arr.getData());
|
||||
const ColumnArray & col_arr = assert_cast<const ColumnArray &>(*block.getByPosition(arguments[0]).column);
|
||||
const ColumnString & col_string = assert_cast<const ColumnString &>(col_arr.getData());
|
||||
|
||||
auto col_res = ColumnString::create();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <Common/config.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Common/LRUCache.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Columns/ColumnNullable.h>
|
||||
@ -141,8 +142,8 @@ ColumnPtr wrapInNullable(const ColumnPtr & src, const Block & block, const Colum
|
||||
{
|
||||
MutableColumnPtr mutable_result_null_map_column = (*std::move(result_null_map_column)).mutate();
|
||||
|
||||
NullMap & result_null_map = static_cast<ColumnUInt8 &>(*mutable_result_null_map_column).getData();
|
||||
const NullMap & src_null_map = static_cast<const ColumnUInt8 &>(*null_map_column).getData();
|
||||
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();
|
||||
|
||||
for (size_t i = 0, size = result_null_map.size(); i < size; ++i)
|
||||
if (src_null_map[i])
|
||||
@ -238,7 +239,7 @@ bool PreparedFunctionImpl::defaultImplementationForConstantArguments(Block & blo
|
||||
else
|
||||
{
|
||||
have_converted_columns = true;
|
||||
temporary_block.insert({ static_cast<const ColumnConst *>(column.column.get())->getDataColumnPtr(), column.type, column.name });
|
||||
temporary_block.insert({ assert_cast<const ColumnConst *>(column.column.get())->getDataColumnPtr(), column.type, column.name });
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,7 +585,7 @@ DataTypePtr FunctionBuilderImpl::getReturnType(const ColumnsWithTypeAndName & ar
|
||||
{
|
||||
bool is_const = arg.column && isColumnConst(*arg.column);
|
||||
if (is_const)
|
||||
arg.column = static_cast<const ColumnConst &>(*arg.column).removeLowCardinality();
|
||||
arg.column = assert_cast<const ColumnConst &>(*arg.column).removeLowCardinality();
|
||||
|
||||
if (auto * low_cardinality_type = typeid_cast<const DataTypeLowCardinality *>(arg.type.get()))
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <DataTypes/DataTypeString.h>
|
||||
#include <Functions/FunctionFactory.h>
|
||||
#include <Functions/FunctionHelpers.h>
|
||||
@ -60,7 +61,7 @@ private:
|
||||
if (!checkColumnConst<ColumnString>(column_char.get()))
|
||||
throw Exception{"Second argument of function " + getName() + " must be a constant string", ErrorCodes::ILLEGAL_COLUMN};
|
||||
|
||||
String trailing_char_str = static_cast<const ColumnConst &>(*column_char).getValue<String>();
|
||||
String trailing_char_str = assert_cast<const ColumnConst &>(*column_char).getValue<String>();
|
||||
|
||||
if (trailing_char_str.size() != 1)
|
||||
throw Exception{"Second argument of function " + getName() + " must be a one-character string", ErrorCodes::BAD_ARGUMENTS};
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Columns/ColumnFunction.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <Functions/IFunction.h>
|
||||
#include <Functions/FunctionHelpers.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
@ -146,7 +147,7 @@ public:
|
||||
if (!column_const_array)
|
||||
throw Exception("Expected array column, found " + column_array_ptr->getName(), ErrorCodes::ILLEGAL_COLUMN);
|
||||
column_array_ptr = column_const_array->convertToFullColumn();
|
||||
column_array = static_cast<const ColumnArray *>(column_array_ptr.get());
|
||||
column_array = assert_cast<const ColumnArray *>(column_array_ptr.get());
|
||||
}
|
||||
|
||||
block.getByPosition(result).column = Impl::execute(*column_array, column_array->getDataPtr());
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user