Merge branch 'master' of github.com:yandex/ClickHouse

This commit is contained in:
Alexey Milovidov 2017-01-31 21:36:56 +03:00
commit a5a85c97a3
6 changed files with 58 additions and 33 deletions

View File

@ -1,6 +1,7 @@
#include <DB/Dictionaries/DictionaryStructure.h>
#include <DB/Common/StringUtils.h>
#include <unordered_set>
namespace DB
{
@ -231,6 +232,20 @@ std::size_t DictionaryStructure::getKeySize() const
}
static void CheckAttributeKeys(const Poco::Util::AbstractConfiguration::Keys & keys)
{
static const std::unordered_set<std::string> valid_keys =
{ "name", "type", "expression", "null_value", "hierarchical", "injective" };
for (const auto & key : keys)
{
if (valid_keys.find(key) == valid_keys.end())
throw Exception{
"Unknown key '" + key + "' inside attribute section",
ErrorCodes::BAD_ARGUMENTS};
}
}
std::vector<DictionaryAttribute> DictionaryStructure::getAttributes(
const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix,
const bool hierarchy_allowed, const bool allow_null_values)
@ -247,6 +262,10 @@ std::vector<DictionaryAttribute> DictionaryStructure::getAttributes(
continue;
const auto prefix = config_prefix + '.' + key + '.';
Poco::Util::AbstractConfiguration::Keys attribute_keys;
config.keys(config_prefix + '.' + key, attribute_keys);
CheckAttributeKeys(attribute_keys);
const auto name = config.getString(prefix + "name");
const auto type_string = config.getString(prefix + "type");

View File

@ -40,10 +40,12 @@ BlockInputStreams StorageSystemBuildOptions::read(
ColumnWithTypeAndName col_name{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName col_value{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "value"};
for (const auto & option : auto_config_build)
{
col_name.column->insert(String(option.first));
col_value.column->insert(String(option.second));
for (auto it = auto_config_build.begin(); it != auto_config_build.end(); ++it) {
col_name.column->insert(String(*it));
++it;
if (it == auto_config_build.end())
break;
col_value.column->insert(String(*it));
}
Block block{

View File

@ -1,6 +1,6 @@
set (CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/include/common/config_version.h)
set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/include/common/config_common.h)
set (CONFIG_BUILD ${CMAKE_CURRENT_BINARY_DIR}/include/common/config_build.h)
set (CONFIG_BUILD ${CMAKE_CURRENT_BINARY_DIR}/src/config_build.cpp)
include_directories (include)
include_directories (BEFORE ${CMAKE_SOURCE_DIR}/contrib/libcctz/include)
@ -23,8 +23,8 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/common/config_version.h.in $
get_property (BUILD_COMPILE_DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
get_property (BUILD_INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
string (TIMESTAMP BUILD_DATE UTC)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/common/config_build.h.in ${CONFIG_BUILD})
string (TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/config_build.cpp.in ${CONFIG_BUILD})
if (APPLE)
add_library (apple_rt
@ -55,6 +55,7 @@ add_library (common
include/common/singleton.h
include/common/strong_typedef.h
include/common/JSON.h
include/common/config_build.h
include/ext/bit_cast.hpp
include/ext/collection_cast.hpp
@ -69,6 +70,7 @@ add_library (common
${CONFIG_VERSION}
${CONFIG_COMMON}
${CONFIG_BUILD}
)
# When testing for memory leaks, dont link tcmalloc or jemalloc.

View File

@ -0,0 +1,4 @@
#pragma once
#include <vector>
extern const std::vector<const char *> auto_config_build;

View File

@ -1,26 +0,0 @@
#pragma once
// .h autogenerated by cmake !
#include <utility>
#include <array>
const std::array<const std::pair<const char *, const char *>, 17> auto_config_build { {
{"VERSION_FULL", "@VERSION_FULL@"},
{"VERSION_DESCRIBE", "@VERSION_DESCRIBE@"},
{"BUILD_DATE", "@BUILD_DATE@"},
{"BUILD_TYPE", "@CMAKE_BUILD_TYPE@"},
{"SYSTEM", "@CMAKE_SYSTEM@"},
{"SYSTEM_PROCESSOR", "@CMAKE_SYSTEM_PROCESSOR@"},
{"LIBRARY_ARCHITECTURE", "@CMAKE_LIBRARY_ARCHITECTURE@"},
{"CMAKE_VERSION", "@CMAKE_VERSION@"},
{"C_COMPILER", "@CMAKE_C_COMPILER@"},
{"C_COMPILER_VERSION", "@CMAKE_C_COMPILER_VERSION@"},
{"CXX_COMPILER", "@CMAKE_CXX_COMPILER@"},
{"CXX_COMPILER_VERSION", "@CMAKE_CXX_COMPILER_VERSION@"},
{"C_FLAGS", "@FULL_C_FLAGS@"},
{"CXX_FLAGS", "@FULL_CXX_FLAGS@"},
{"LINK_FLAGS", "@CMAKE_EXE_LINKER_FLAGS@"},
{"BUILD_COMPILE_DEFINITIONS", "@BUILD_COMPILE_DEFINITIONS@"},
{"BUILD_INCLUDE_DIRECTORIES", "@BUILD_INCLUDE_DIRECTORIES@"},
} };

View File

@ -0,0 +1,24 @@
// .cpp autogenerated by cmake !
#include <common/config_build.h>
const std::vector<const char *> auto_config_build {
"VERSION_FULL", "@VERSION_FULL@",
"VERSION_DESCRIBE", "@VERSION_DESCRIBE@",
"BUILD_DATE", "@BUILD_DATE@",
"BUILD_TYPE", "@CMAKE_BUILD_TYPE@",
"SYSTEM", "@CMAKE_SYSTEM@",
"SYSTEM_PROCESSOR", "@CMAKE_SYSTEM_PROCESSOR@",
"LIBRARY_ARCHITECTURE", "@CMAKE_LIBRARY_ARCHITECTURE@",
"CMAKE_VERSION", "@CMAKE_VERSION@",
"C_COMPILER", "@CMAKE_C_COMPILER@",
"C_COMPILER_VERSION", "@CMAKE_C_COMPILER_VERSION@",
"CXX_COMPILER", "@CMAKE_CXX_COMPILER@",
"CXX_COMPILER_VERSION", "@CMAKE_CXX_COMPILER_VERSION@",
"C_FLAGS", "@FULL_C_FLAGS@",
"CXX_FLAGS", "@FULL_CXX_FLAGS@",
"LINK_FLAGS", "@CMAKE_EXE_LINKER_FLAGS@",
"BUILD_COMPILE_DEFINITIONS", "@BUILD_COMPILE_DEFINITIONS@",
"BUILD_INCLUDE_DIRECTORIES", "@BUILD_INCLUDE_DIRECTORIES@",
};