mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-22 01:30:51 +00:00
* Fixing clang errors
* Fixing LIVE VIEW tests
This commit is contained in:
parent
137f5127ac
commit
87b58e4150
@ -86,7 +86,7 @@ void PushingToViewsBlockOutputStream::write(const Block & block)
|
||||
|
||||
if (auto * live_view = dynamic_cast<StorageLiveView *>(storage.get()))
|
||||
{
|
||||
BlockOutputStreamPtr output = std::make_shared<LiveViewBlockOutputStream>(*live_view);
|
||||
output = std::make_shared<LiveViewBlockOutputStream>(*live_view);
|
||||
StorageLiveView::writeIntoLiveView(*live_view, block, context, output);
|
||||
}
|
||||
else
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
/// The name of the table.
|
||||
virtual std::string getTableName() const = 0;
|
||||
virtual std::string getDatabaseName() const { return {}; } // FIXME: should be an abstract method!
|
||||
virtual std::string getDatabaseName() const { return {}; }
|
||||
|
||||
/// Returns true if the storage receives data from a remote server or servers.
|
||||
virtual bool isRemote() const { return false; }
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
~StorageLiveView() override;
|
||||
String getName() const override { return "LiveView"; }
|
||||
String getTableName() const override { return table_name; }
|
||||
String getDatabaseName() const { return database_name; }
|
||||
String getDatabaseName() const override { return database_name; }
|
||||
String getSelectDatabaseName() const { return select_database_name; }
|
||||
String getSelectTableName() const { return select_table_name; }
|
||||
|
||||
@ -55,7 +55,7 @@ public:
|
||||
bool hasColumn(const String & column_name) const override;
|
||||
|
||||
// const NamesAndTypesList & getColumnsListImpl() const override { return *columns; }
|
||||
ASTPtr getInnerQuery() const { return inner_query->clone(); };
|
||||
ASTPtr getInnerQuery() const { return inner_query->clone(); }
|
||||
|
||||
/// It is passed inside the query and solved at its level.
|
||||
bool supportsSampling() const override { return true; }
|
||||
@ -218,10 +218,10 @@ public:
|
||||
mergeable_blocks->push_back(new_mergeable_blocks);
|
||||
|
||||
/// Create from blocks streams
|
||||
for (auto & blocks : *mergeable_blocks)
|
||||
for (auto & blocks_ : *mergeable_blocks)
|
||||
{
|
||||
auto sample_block = mergeable_blocks->front()->front().cloneEmpty();
|
||||
BlockInputStreamPtr stream = std::make_shared<BlocksBlockInputStream>(std::make_shared<BlocksPtr>(blocks), sample_block);
|
||||
BlockInputStreamPtr stream = std::make_shared<BlocksBlockInputStream>(std::make_shared<BlocksPtr>(blocks_), sample_block);
|
||||
from.push_back(std::move(stream));
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ client1.send('CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt')
|
||||
client1.expect(prompt)
|
||||
|
||||
client2 = client('client2>', ['bash', '--noediting'])
|
||||
client2.expect('\$ ')
|
||||
client2.expect('[\$#] ')
|
||||
client2.send('wget -O- -q "http://localhost:8123/?query=WATCH test.lv EVENTS"')
|
||||
client2.expect('.*1\tc9d39b11cce79112219a73aaa319b475\r\n')
|
||||
|
||||
|
@ -34,7 +34,7 @@ client1.send('CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt')
|
||||
client1.expect(prompt)
|
||||
|
||||
client2 = client('client2>', ['bash', '--noediting'])
|
||||
client2.expect('\$ ')
|
||||
client2.expect('[\$#] ')
|
||||
client2.send('wget -O- -q "http://localhost:8123/?query=WATCH test.lv"')
|
||||
client2.expect('.*0\t1\r\n')
|
||||
|
||||
|
@ -34,7 +34,7 @@ client1.send('CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt')
|
||||
client1.expect(prompt)
|
||||
|
||||
client2 = client('client2>', ['bash', '--noediting'])
|
||||
client2.expect('\$ ')
|
||||
client2.expect('[\$#] ')
|
||||
client2.send('wget -O- -q "http://localhost:8123/?live_view_heartbeat_interval=1&query=WATCH test.lv EVENTS FORMAT JSONEachRowWithProgress"')
|
||||
client2.expect('{"progress":{"read_rows":"1","read_bytes":"49","written_rows":"0","written_bytes":"0","total_rows_to_read":"0"}}\r\n', escape=True)
|
||||
client2.expect('{"row":{"version":"1","hash":"c9d39b11cce79112219a73aaa319b475"}}', escape=True)
|
||||
@ -47,7 +47,6 @@ client1.expect(prompt)
|
||||
|
||||
client2.expect('{"row":{"version":"2","hash":"4cd0592103888d4682de9a32a23602e3"}}\r\n', escape=True)
|
||||
|
||||
client2.expect('.*2\t.*\r\n')
|
||||
## send Ctrl-C
|
||||
os.kill(client2.process.pid,signal.SIGINT)
|
||||
|
||||
|
@ -34,7 +34,7 @@ client1.send('CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt')
|
||||
client1.expect(prompt)
|
||||
|
||||
client2 = client('client2>', ['bash', '--noediting'])
|
||||
client2.expect('\$ ')
|
||||
client2.expect('[\$#] ')
|
||||
client2.send('wget -O- -q "http://localhost:8123/?live_view_heartbeat_interval=1&query=WATCH test.lv FORMAT JSONEachRowWithProgress"')
|
||||
client2.expect('"progress".*',)
|
||||
client2.expect('{"row":{"sum(a)":"0","_version":"1"}}\r\n', escape=True)
|
||||
|
@ -37,8 +37,8 @@ class ExpectTimeoutError(Exception):
|
||||
def __str__(self):
|
||||
return ('Timeout %.3fs ' % float(self.timeout) +
|
||||
'for %s ' % repr(self.pattern.pattern) +
|
||||
'buffer ends with %s ' % repr(self.buffer[-80:]) +
|
||||
'or \'%s\'' % ','.join(['%x' % ord(c) for c in self.buffer[-80:]]))
|
||||
'buffer %s ' % repr(self.buffer[:]) +
|
||||
'or \'%s\'' % ','.join(['%x' % ord(c) for c in self.buffer[:]]))
|
||||
|
||||
class IO(object):
|
||||
class EOF(object):
|
||||
@ -111,10 +111,11 @@ class IO(object):
|
||||
pattern = re.compile(pattern)
|
||||
if timeout is None:
|
||||
timeout = self._timeout
|
||||
while timeout >= 0:
|
||||
timeleft = timeout
|
||||
while timeleft >= 0:
|
||||
start_time = time.time()
|
||||
try:
|
||||
data = self.read(timeout=timeout, raise_exception=True)
|
||||
data = self.read(timeout=timeleft, raise_exception=True)
|
||||
except TimeoutError:
|
||||
if self._logger:
|
||||
self._logger.write(self.buffer + '\n')
|
||||
@ -122,7 +123,7 @@ class IO(object):
|
||||
exception = ExpectTimeoutError(pattern, timeout, self.buffer)
|
||||
self.buffer = None
|
||||
raise exception
|
||||
timeout -= (time.time() - start_time)
|
||||
timeleft -= (time.time() - start_time)
|
||||
if data:
|
||||
self.buffer = self.buffer + data if self.buffer else data
|
||||
self.match = pattern.search(self.buffer, 0)
|
||||
@ -134,23 +135,31 @@ class IO(object):
|
||||
if self._logger:
|
||||
self._logger.write((self.before or '') + (self.after or ''))
|
||||
self._logger.flush()
|
||||
if self.match is None:
|
||||
exception = ExpectTimeoutError(pattern, timeout, self.buffer)
|
||||
self.buffer = None
|
||||
raise exception
|
||||
return self.match
|
||||
|
||||
def read(self, timeout=0, raise_exception=False):
|
||||
data = ''
|
||||
timeleft = timeout
|
||||
try:
|
||||
while timeout >= 0 :
|
||||
while timeleft >= 0 :
|
||||
start_time = time.time()
|
||||
data += self.queue.get(timeout=timeout)
|
||||
data += self.queue.get(timeout=timeleft)
|
||||
if data:
|
||||
break
|
||||
timeout -= (time.time() - start_time)
|
||||
timeleft -= (time.time() - start_time)
|
||||
except Empty:
|
||||
if data:
|
||||
return data
|
||||
if raise_exception:
|
||||
raise TimeoutError(timeout)
|
||||
pass
|
||||
if not data and raise_exception:
|
||||
raise TimeoutError(timeout)
|
||||
|
||||
return data
|
||||
|
||||
def spawn(command):
|
||||
|
Loading…
Reference in New Issue
Block a user