fix debug assert in table asynchronous_inserts

This commit is contained in:
Anton Popov 2021-09-04 04:11:37 +03:00
parent 275118b0e8
commit 66173d2cc0
2 changed files with 6 additions and 8 deletions

View File

@ -52,12 +52,14 @@ void StorageSystemAsynchronousInserts::fillData(MutableColumns & res_columns, Co
auto time_in_microseconds = [](const time_point<steady_clock> & timestamp) auto time_in_microseconds = [](const time_point<steady_clock> & timestamp)
{ {
auto time_diff = duration_cast<microseconds>(steady_clock::now() - timestamp); auto time_diff = duration_cast<microseconds>(steady_clock::now() - timestamp);
return (system_clock::now() - time_diff).time_since_epoch().count(); auto time_us = (system_clock::now() - time_diff).time_since_epoch().count();
DecimalUtils::DecimalComponents<DateTime64> components{time_us / 1'000'000, time_us % 1'000'000};
return DecimalField(DecimalUtils::decimalFromComponents<DateTime64>(components, TIME_SCALE), TIME_SCALE);
}; };
size_t i = 0;
const auto & insert_query = key.query->as<const ASTInsertQuery &>(); const auto & insert_query = key.query->as<const ASTInsertQuery &>();
size_t i = 0;
res_columns[i++]->insert(queryToString(insert_query)); res_columns[i++]->insert(queryToString(insert_query));
res_columns[i++]->insert(insert_query.table_id.getDatabaseName()); res_columns[i++]->insert(insert_query.table_id.getDatabaseName());
@ -78,8 +80,7 @@ void StorageSystemAsynchronousInserts::fillData(MutableColumns & res_columns, Co
arr_bytes.push_back(entry->bytes.size()); arr_bytes.push_back(entry->bytes.size());
arr_finished.push_back(entry->isFinished()); arr_finished.push_back(entry->isFinished());
auto exception = entry->getException(); if (auto exception = entry->getException())
if (exception)
{ {
try try
{ {

View File

@ -1,6 +1,3 @@
async_inserts CSV 23 2
async_inserts CSVWithNames 44 2
async_inserts JSONEachRow 78 2
1 a 1 a
2 b 2 b
3 c 3 c