mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
CastTypeBlockInputStream: hotfix: sometimes columns in sample blocks and stream blocks does not match
This commit is contained in:
parent
9a937591e5
commit
1474de179c
@ -41,10 +41,17 @@ Block CastTypeBlockInputStream::readImpl()
|
||||
if (!block || cast_types.empty())
|
||||
return block;
|
||||
|
||||
Block res;
|
||||
size_t s = block.columns();
|
||||
size_t block_size = block.columns();
|
||||
|
||||
for (size_t i = 0; i < s; ++i)
|
||||
if (block_size != cast_types.size())
|
||||
{
|
||||
LOG_ERROR(log, "Number of columns do not match, skipping cast");
|
||||
return block;
|
||||
}
|
||||
|
||||
Block res;
|
||||
|
||||
for (size_t i = 0; i < block_size; ++i)
|
||||
{
|
||||
const auto & elem = block.getByPosition(i);
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <DataStreams/IProfilingBlockInputStream.h>
|
||||
|
||||
#include <common/logger_useful.h>
|
||||
#include <experimental/optional>
|
||||
#include <vector>
|
||||
|
||||
@ -34,6 +35,7 @@ private:
|
||||
const Context & context;
|
||||
std::vector<std::experimental::optional<NameAndTypePair>> cast_types;
|
||||
std::vector<std::shared_ptr<IFunction>> cast_functions; /// Used to perform type conversions.
|
||||
Logger * log = &Logger::get("CastTypeBlockInputStream");
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
-- Not found column date in block. There are only columns: x.
|
||||
drop table if exists test.partition_428;
|
||||
create table test.partition_428 (date MATERIALIZED toDate(0), x UInt64, sample_key MATERIALIZED intHash64(x)) ENGINE=MergeTree(date,sample_key,(date,x,sample_key),8192);
|
||||
insert into test.partition_428 ( x ) VALUES ( now() );
|
||||
insert into test.partition_428 ( x ) VALUES ( now()+1 );
|
||||
|
Loading…
Reference in New Issue
Block a user