提交 1474de17 编写于 作者: P proller

CastTypeBlockInputStream: hotfix: sometimes columns in sample blocks and...

CastTypeBlockInputStream: hotfix: sometimes columns in sample blocks and stream blocks does not match
上级 9a937591
......@@ -41,10 +41,17 @@ Block CastTypeBlockInputStream::readImpl()
if (!block || cast_types.empty())
return block;
size_t block_size = block.columns();
if (block_size != cast_types.size())
{
LOG_ERROR(log, "Number of columns do not match, skipping cast");
return block;
}
Block res;
size_t s = block.columns();
for (size_t i = 0; i < s; ++i)
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");
};
}
-- 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 );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册