Fixed tests

This commit is contained in:
Maksim Kita 2021-01-27 16:23:02 +03:00
parent dafb0ef4e9
commit d194294d0b
5 changed files with 13 additions and 11 deletions

View File

@ -13,7 +13,7 @@
namespace DB namespace DB
{ {
void formatWithBlock(BlockOutputStreamPtr & out, Block block) void formatWithBlock(BlockOutputStreamPtr & out, const Block & block)
{ {
out->writePrefix(); out->writePrefix();
out->write(block); out->write(block);
@ -23,14 +23,14 @@ void formatWithBlock(BlockOutputStreamPtr & out, Block block)
/// For simple key /// For simple key
Block blockForIds(const std::vector<UInt64> & ids) Block blockForIds(
const DictionaryStructure & dict_struct,
const std::vector<UInt64> & ids)
{ {
auto column = ColumnUInt64::create(ids.size()); auto column = ColumnUInt64::create(ids.size());
memcpy(column->getData().data(), ids.data(), ids.size() * sizeof(ids.front())); memcpy(column->getData().data(), ids.data(), ids.size() * sizeof(ids.front()));
Block block{{std::move(column), std::make_shared<DataTypeUInt64>(), "id"}}; Block block{{std::move(column), std::make_shared<DataTypeUInt64>(), (*dict_struct.id).name}};
std::cerr << "Block for IDs size " << ids.size() << std::endl;
return block; return block;
} }

View File

@ -20,11 +20,13 @@ class Context;
/// Write keys to block output stream. /// Write keys to block output stream.
void formatWithBlock(BlockOutputStreamPtr & out, Block block); void formatWithBlock(BlockOutputStreamPtr & out, const Block & block);
/// For simple key /// For simple key
Block blockForIds(const std::vector<UInt64> & ids); Block blockForIds(
const DictionaryStructure & dict_struct,
const std::vector<UInt64> & ids);
/// For composite key /// For composite key

View File

@ -267,7 +267,7 @@ BlockInputStreamPtr ExecutableDictionarySource::loadIds(const std::vector<UInt64
{ {
LOG_TRACE(log, "loadIds {} size = {}", toString(), ids.size()); LOG_TRACE(log, "loadIds {} size = {}", toString(), ids.size());
auto block = blockForIds(ids); auto block = blockForIds(dict_struct, ids);
auto stream = std::make_unique<BlockInputStreamWithBackgroundThread>( auto stream = std::make_unique<BlockInputStreamWithBackgroundThread>(
context, format, sample_block, command, log, context, format, sample_block, command, log,

View File

@ -130,8 +130,8 @@ BlockInputStreamPtr HTTPDictionarySource::loadUpdatedAll()
BlockInputStreamPtr HTTPDictionarySource::loadIds(const std::vector<UInt64> & ids) BlockInputStreamPtr HTTPDictionarySource::loadIds(const std::vector<UInt64> & ids)
{ {
LOG_TRACE(log, "loadIds {} size = {}", toString(), ids.size()); LOG_TRACE(log, "loadIds {} size = {}", toString(), ids.size());
auto block = blockForIds(ids); auto block = blockForIds(dict_struct, ids);
ReadWriteBufferFromHTTP::OutStreamCallback out_stream_callback = [block, this](std::ostream & ostr) ReadWriteBufferFromHTTP::OutStreamCallback out_stream_callback = [block, this](std::ostream & ostr)
{ {

View File

@ -5,4 +5,4 @@ Check implicit_key option
Value Value
Value Value
Value Value
Value Value