* Fixing a bug in StorageLiveView.cpp in the getHeader() method

when header block would not match blocks in the stream
  when Const column is present.
* Updating 00963_temporary_live_view_watch_live_timeout.py
  and removed timeout=5 after WATCH query is aborted with Ctrl-C
  so that the default timeout of 20sec is used
* Small style fixes in tests
This commit is contained in:
Vitaliy Zakaznikov 2019-06-14 10:06:15 -04:00
parent 6cca6d359d
commit 13978c03f3
7 changed files with 26 additions and 13 deletions

View File

@ -159,12 +159,25 @@ Block StorageLiveView::getHeader() const
{
if (!sample_block)
{
auto storage = global_context.getTable(select_database_name, select_table_name);
sample_block = InterpreterSelectQuery(inner_query, global_context, storage).getSampleBlock();
sample_block.insert({DataTypeUInt64().createColumnConst(
sample_block.rows(), 0)->convertToFullColumnIfConst(),
std::make_shared<DataTypeUInt64>(),
"_version"});
if (!(*blocks_ptr) || (*blocks_ptr)->empty())
{
auto storage = global_context.getTable(select_database_name, select_table_name);
sample_block = InterpreterSelectQuery(inner_query, global_context, storage, SelectQueryOptions(QueryProcessingStage::Complete)).getSampleBlock();
sample_block.insert({DataTypeUInt64().createColumnConst(
sample_block.rows(), 0)->convertToFullColumnIfConst(),
std::make_shared<DataTypeUInt64>(),
"_version"});
/// convert all columns to full columns
/// in case some of them are constant
for (size_t i = 0; i < sample_block.columns(); ++i)
{
sample_block.safeGetByPosition(i).column = sample_block.safeGetByPosition(i).column->convertToFullColumnIfConst();
}
}
else
{
sample_block = (*blocks_ptr)->front().cloneEmpty();
}
}
return sample_block;

View File

@ -31,7 +31,7 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
client2.send('INSERT INTO test.mt VALUES (4),(5),(6)')
client1.expect(r'21.*3' + end_of_block)
# send Ctrl-C
os.kill(client1.process.pid,signal.SIGINT)
os.kill(client1.process.pid, signal.SIGINT)
client1.expect(prompt)
client1.send('DROP TABLE test.lv')
client1.expect(prompt)

View File

@ -31,7 +31,7 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
client2.send('INSERT INTO test.mt VALUES (4),(5),(6)')
client1.expect('3.*2186dbea325ee4c56b67e9b792e993a3' + end_of_block)
# send Ctrl-C
os.kill(client1.process.pid,signal.SIGINT)
os.kill(client1.process.pid, signal.SIGINT)
client1.expect(prompt)
client1.send('DROP TABLE test.lv')
client1.expect(prompt)

View File

@ -31,7 +31,7 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
client2.send('INSERT INTO test.mt VALUES (4),(5),(6)')
client1.expect(r'21.*3' + end_of_block)
# send Ctrl-C
os.kill(client1.process.pid,signal.SIGINT)
os.kill(client1.process.pid, signal.SIGINT)
client1.expect(prompt)
client1.send('DROP TABLE test.lv')
client1.expect(prompt)

View File

@ -35,8 +35,8 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
client2.expect(prompt)
client1.expect(r'21.*3' + end_of_block)
# send Ctrl-C
os.kill(client1.process.pid,signal.SIGINT)
client1.expect(prompt, timeout=5)
os.kill(client1.process.pid, signal.SIGINT)
client1.expect(prompt)
client1.send('SELECT sleep(1)')
client1.expect(prompt)
client1.send('DROP TABLE test.lv')

View File

@ -33,7 +33,7 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
# wait for heartbeat
client1.expect('Progress: 2.00 rows.*\)')
# send Ctrl-C
os.kill(client1.process.pid,signal.SIGINT)
os.kill(client1.process.pid, signal.SIGINT)
client1.expect(prompt)
client1.send('DROP TABLE test.lv')
client1.expect(prompt)

View File

@ -34,7 +34,7 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
# wait for heartbeat
client1.expect('Progress: 2.00 rows.*\)')
# send Ctrl-C
os.kill(client1.process.pid,signal.SIGINT)
os.kill(client1.process.pid, signal.SIGINT)
client1.expect(prompt)
client1.send('DROP TABLE test.lv')
client1.expect(prompt)