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
{
void formatWithBlock(BlockOutputStreamPtr & out, Block block)
void formatWithBlock(BlockOutputStreamPtr & out, const Block & block)
{
out->writePrefix();
out->write(block);
@ -23,14 +23,14 @@ void formatWithBlock(BlockOutputStreamPtr & out, Block block)
/// 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());
memcpy(column->getData().data(), ids.data(), ids.size() * sizeof(ids.front()));
Block block{{std::move(column), std::make_shared<DataTypeUInt64>(), "id"}};
std::cerr << "Block for IDs size " << ids.size() << std::endl;
Block block{{std::move(column), std::make_shared<DataTypeUInt64>(), (*dict_struct.id).name}};
return block;
}

View File

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

View File

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

View File

@ -131,7 +131,7 @@ BlockInputStreamPtr HTTPDictionarySource::loadIds(const std::vector<UInt64> & id
{
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)
{