Fixed code review issues

This commit is contained in:
Maksim Kita 2021-01-31 12:59:35 +03:00
parent e5b89f24b5
commit d3f299269f
8 changed files with 21 additions and 21 deletions

View File

@ -13,7 +13,7 @@
namespace DB
{
void formatWithBlock(BlockOutputStreamPtr & out, const Block & block)
void formatBlock(BlockOutputStreamPtr & out, const Block & block)
{
out->writePrefix();
out->write(block);

View File

@ -20,7 +20,7 @@ class Context;
/// Write keys to block output stream.
void formatWithBlock(BlockOutputStreamPtr & out, const Block & block);
void formatBlock(BlockOutputStreamPtr & out, const Block & block);
/// For simple key

View File

@ -218,7 +218,7 @@ namespace
if (header)
{
for (int64_t i = static_cast<uint64_t>(block_to_add.columns() - 1); i >= 0; --i)
for (Int64 i = static_cast<Int64>(block_to_add.columns() - 1); i >= 0; --i)
header.insert(0, block_to_add.getByPosition(i).cloneEmpty());
}
@ -235,7 +235,11 @@ namespace
auto cut_block = block_to_add.cloneWithCutColumns(current_range_index, block_rows);
for (int64_t i = static_cast<uint64_t>(cut_block.columns() - 1); i >= 0; --i)
if (cut_block.rows() != block_rows)
throw Exception("Rows in block to add after cut must equal to rows in readed block",
ErrorCodes::LOGICAL_ERROR);
for (Int64 i = static_cast<Int64>(cut_block.columns() - 1); i >= 0; --i)
block.insert(0, cut_block.getByPosition(i));
current_range_index += block_rows;
@ -276,7 +280,7 @@ BlockInputStreamPtr ExecutableDictionarySource::loadIds(const std::vector<UInt64
[block, this](WriteBufferFromFile & out) mutable
{
auto output_stream = context.getOutputStream(format, out, block.cloneEmpty());
formatWithBlock(output_stream, block);
formatBlock(output_stream, block);
out.close();
});
@ -299,7 +303,7 @@ BlockInputStreamPtr ExecutableDictionarySource::loadKeys(const Columns & key_col
[block, this](WriteBufferFromFile & out) mutable
{
auto output_stream = context.getOutputStream(format, out, block.cloneEmpty());
formatWithBlock(output_stream, block);
formatBlock(output_stream, block);
out.close();
});

View File

@ -137,7 +137,7 @@ BlockInputStreamPtr HTTPDictionarySource::loadIds(const std::vector<UInt64> & id
{
WriteBufferFromOStream out_buffer(ostr);
auto output_stream = context.getOutputStream(format, out_buffer, sample_block);
formatWithBlock(output_stream, block);
formatBlock(output_stream, block);
};
Poco::URI uri(url);
@ -158,7 +158,7 @@ BlockInputStreamPtr HTTPDictionarySource::loadKeys(const Columns & key_columns,
{
WriteBufferFromOStream out_buffer(ostr);
auto output_stream = context.getOutputStream(format, out_buffer, sample_block);
formatWithBlock(output_stream, block);
formatBlock(output_stream, block);
};
Poco::URI uri(url);

View File

@ -1,8 +1,3 @@
999999 1999998 999998000001
999999 1999998 999998000001
999999 1999998 999998000001
Check implicit_key option
Value
Value
Value
Value

View File

@ -1,11 +1,3 @@
SELECT number, dictGet('executable_complex', 'a', (number, number)) AS a, dictGet('executable_complex', 'b', (number, number)) AS b FROM numbers(1000000) WHERE number = 999999;
SELECT number, dictGet('executable_complex_direct', 'a', (number, number)) AS a, dictGet('executable_complex_direct', 'b', (number, number)) AS b FROM numbers(1000000) WHERE number = 999999;
SELECT number, dictGet('executable_simple', 'a', number) AS a, dictGet('executable_simple', 'b', number) AS b FROM numbers(1000000) WHERE number = 999999;
SELECT 'Check implicit_key option';
SELECT dictGet('simple_executable_cache_dictionary_no_implicit_key', 'value', toUInt64(1));
SELECT dictGet('simple_executable_cache_dictionary_implicit_key', 'value', toUInt64(1));
SELECT dictGet('complex_executable_cache_dictionary_no_implicit_key', 'value', (toUInt64(1), 'FirstKey'));
SELECT dictGet('complex_executable_cache_dictionary_implicit_key', 'value', (toUInt64(1), 'FirstKey'));

View File

@ -0,0 +1,4 @@
Value
Value
Value
Value

View File

@ -0,0 +1,5 @@
SELECT dictGet('simple_executable_cache_dictionary_no_implicit_key', 'value', toUInt64(1));
SELECT dictGet('simple_executable_cache_dictionary_implicit_key', 'value', toUInt64(1));
SELECT dictGet('complex_executable_cache_dictionary_no_implicit_key', 'value', (toUInt64(1), 'FirstKey'));
SELECT dictGet('complex_executable_cache_dictionary_implicit_key', 'value', (toUInt64(1), 'FirstKey'));