mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Fixed tests
This commit is contained in:
parent
8bdb906acb
commit
ed74a464bd
@ -9,7 +9,6 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -21,6 +20,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
|
||||
#include <base/errnoToString.h>
|
||||
|
||||
|
||||
@ -247,9 +248,9 @@ static_assert(sizeof(raw_events_info) / sizeof(raw_events_info[0]) == NUMBER_OF_
|
||||
#undef CACHE_EVENT
|
||||
|
||||
// A map of event name -> event index, to parse event list in settings.
|
||||
static std::unordered_map<std::string, size_t> populateEventMap()
|
||||
static std::unordered_map<std::string_view, size_t> populateEventMap()
|
||||
{
|
||||
std::unordered_map<std::string, size_t> name_to_index;
|
||||
std::unordered_map<std::string_view, size_t> name_to_index;
|
||||
name_to_index.reserve(NUMBER_OF_RAW_EVENTS);
|
||||
|
||||
for (size_t i = 0; i < NUMBER_OF_RAW_EVENTS; ++i)
|
||||
@ -455,10 +456,10 @@ std::vector<size_t> PerfEventsCounters::eventIndicesFromString(const std::string
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::string> event_names;
|
||||
boost::split(event_names, events_list, [](char c) { return c == ','; });
|
||||
|
||||
std::istringstream iss(events_list); // STYLE_CHECK_ALLOW_STD_STRING_STREAM
|
||||
std::string event_name;
|
||||
while (std::getline(iss, event_name, ','))
|
||||
for (auto & event_name : event_names)
|
||||
{
|
||||
// Allow spaces at the beginning of the token, so that you can write 'a, b'.
|
||||
event_name.erase(0, event_name.find_first_not_of(' '));
|
||||
|
@ -81,7 +81,10 @@ static Block createBlockFromCollection(const Collection & collection, const Data
|
||||
size_t columns_num = types.size();
|
||||
MutableColumns columns(columns_num);
|
||||
for (size_t i = 0; i < columns_num; ++i)
|
||||
{
|
||||
columns[i] = types[i]->createColumn();
|
||||
columns[i]->reserve(collection.size());
|
||||
}
|
||||
|
||||
Row tuple_values;
|
||||
for (const auto & value : collection)
|
||||
|
@ -165,7 +165,7 @@ void Set::setHeader(const ColumnsWithTypeAndName & header)
|
||||
|
||||
bool Set::insertFromBlock(const ColumnsWithTypeAndName & columns)
|
||||
{
|
||||
std::unique_lock lock(rwlock);
|
||||
std::lock_guard<std::shared_mutex> lock(rwlock);
|
||||
|
||||
if (data.empty())
|
||||
throw Exception("Method Set::setHeader must be called before Set::insertFromBlock", ErrorCodes::LOGICAL_ERROR);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Core/Block.h>
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <DataTypes/FieldToDataType.h>
|
||||
#include <Interpreters/Context.h>
|
||||
#include <Interpreters/convertFieldToType.h>
|
||||
#include <Interpreters/ExpressionActions.h>
|
||||
@ -32,6 +33,10 @@ namespace ErrorCodes
|
||||
|
||||
std::pair<Field, std::shared_ptr<const IDataType>> evaluateConstantExpression(const ASTPtr & node, ContextPtr context)
|
||||
{
|
||||
if (ASTLiteral * literal = node->as<ASTLiteral>()) {
|
||||
return std::make_pair(literal->value, applyVisitor(FieldToDataType(), literal->value));
|
||||
}
|
||||
|
||||
NamesAndTypesList source_columns = {{ "_dummy", std::make_shared<DataTypeUInt8>() }};
|
||||
auto ast = node->clone();
|
||||
ReplaceQueryParameterVisitor param_visitor(context->getQueryParameters());
|
||||
|
Loading…
Reference in New Issue
Block a user