mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-28 12:40:49 +00:00
Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into trivial_count_seq_consistency
This commit is contained in:
commit
1f85114325
1
.gitmodules
vendored
1
.gitmodules
vendored
@ -107,7 +107,6 @@
|
|||||||
[submodule "contrib/grpc"]
|
[submodule "contrib/grpc"]
|
||||||
path = contrib/grpc
|
path = contrib/grpc
|
||||||
url = https://github.com/ClickHouse-Extras/grpc.git
|
url = https://github.com/ClickHouse-Extras/grpc.git
|
||||||
branch = v1.25.0
|
|
||||||
[submodule "contrib/aws"]
|
[submodule "contrib/aws"]
|
||||||
path = contrib/aws
|
path = contrib/aws
|
||||||
url = https://github.com/ClickHouse-Extras/aws-sdk-cpp.git
|
url = https://github.com/ClickHouse-Extras/aws-sdk-cpp.git
|
||||||
|
@ -513,7 +513,13 @@ endif ()
|
|||||||
macro (add_executable target)
|
macro (add_executable target)
|
||||||
# invoke built-in add_executable
|
# invoke built-in add_executable
|
||||||
# explicitly acquire and interpose malloc symbols by clickhouse_malloc
|
# explicitly acquire and interpose malloc symbols by clickhouse_malloc
|
||||||
_add_executable (${ARGV} $<TARGET_OBJECTS:clickhouse_malloc>)
|
# if GLIBC_COMPATIBILITY is ON and not sanitizer build, provide memcpy symbol explicitly to neutrialize thinlto's libcall generation.
|
||||||
|
if (GLIBC_COMPATIBILITY AND NOT SANITIZE)
|
||||||
|
_add_executable (${ARGV} $<TARGET_OBJECTS:clickhouse_malloc> $<TARGET_OBJECTS:clickhouse_memcpy>)
|
||||||
|
else ()
|
||||||
|
_add_executable (${ARGV} $<TARGET_OBJECTS:clickhouse_malloc>)
|
||||||
|
endif ()
|
||||||
|
|
||||||
get_target_property (type ${target} TYPE)
|
get_target_property (type ${target} TYPE)
|
||||||
if (${type} STREQUAL EXECUTABLE)
|
if (${type} STREQUAL EXECUTABLE)
|
||||||
# operator::new/delete for executables (MemoryTracker stuff)
|
# operator::new/delete for executables (MemoryTracker stuff)
|
||||||
|
@ -27,6 +27,10 @@ if (GLIBC_COMPATIBILITY)
|
|||||||
list(APPEND glibc_compatibility_sources musl/getentropy.c)
|
list(APPEND glibc_compatibility_sources musl/getentropy.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_library (clickhouse_memcpy OBJECT
|
||||||
|
${ClickHouse_SOURCE_DIR}/contrib/FastMemcpy/memcpy_wrapper.c
|
||||||
|
)
|
||||||
|
|
||||||
# Need to omit frame pointers to match the performance of glibc
|
# Need to omit frame pointers to match the performance of glibc
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer")
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer")
|
||||||
|
|
||||||
|
330
cmake/Modules/FindgRPC.cmake
Normal file
330
cmake/Modules/FindgRPC.cmake
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
#[[
|
||||||
|
Defines the following variables:
|
||||||
|
``gRPC_FOUND``
|
||||||
|
Whether the gRPC framework is found
|
||||||
|
``gRPC_INCLUDE_DIRS``
|
||||||
|
The include directories of the gRPC framework, including the include directories of the C++ wrapper.
|
||||||
|
``gRPC_LIBRARIES``
|
||||||
|
The libraries of the gRPC framework.
|
||||||
|
``gRPC_UNSECURE_LIBRARIES``
|
||||||
|
The libraries of the gRPC framework without SSL.
|
||||||
|
``_gRPC_CPP_PLUGIN``
|
||||||
|
The plugin for generating gRPC client and server C++ stubs from `.proto` files
|
||||||
|
``_gRPC_PYTHON_PLUGIN``
|
||||||
|
The plugin for generating gRPC client and server Python stubs from `.proto` files
|
||||||
|
|
||||||
|
The following :prop_tgt:`IMPORTED` targets are also defined:
|
||||||
|
``grpc++``
|
||||||
|
``grpc++_unsecure``
|
||||||
|
``grpc_cpp_plugin``
|
||||||
|
``grpc_python_plugin``
|
||||||
|
|
||||||
|
Add custom commands to process ``.proto`` files to C++::
|
||||||
|
protobuf_generate_grpc_cpp(<SRCS> <HDRS>
|
||||||
|
[DESCRIPTORS <DESC>] [EXPORT_MACRO <MACRO>] [<ARGN>...])
|
||||||
|
|
||||||
|
``SRCS``
|
||||||
|
Variable to define with autogenerated source files
|
||||||
|
``HDRS``
|
||||||
|
Variable to define with autogenerated header files
|
||||||
|
``DESCRIPTORS``
|
||||||
|
Variable to define with autogenerated descriptor files, if requested.
|
||||||
|
``EXPORT_MACRO``
|
||||||
|
is a macro which should expand to ``__declspec(dllexport)`` or
|
||||||
|
``__declspec(dllimport)`` depending on what is being compiled.
|
||||||
|
``ARGN``
|
||||||
|
``.proto`` files
|
||||||
|
#]]
|
||||||
|
|
||||||
|
# Function to generate C++ files from .proto files.
|
||||||
|
# This function is a modified version of the function PROTOBUF_GENERATE_CPP() copied from https://github.com/Kitware/CMake/blob/master/Modules/FindProtobuf.cmake.
|
||||||
|
function(PROTOBUF_GENERATE_GRPC_CPP SRCS HDRS)
|
||||||
|
cmake_parse_arguments(protobuf_generate_grpc_cpp "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN})
|
||||||
|
|
||||||
|
set(_proto_files "${protobuf_generate_grpc_cpp_UNPARSED_ARGUMENTS}")
|
||||||
|
if(NOT _proto_files)
|
||||||
|
message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PROTOBUF_GENERATE_GRPC_CPP_APPEND_PATH)
|
||||||
|
set(_append_arg APPEND_PATH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_cpp_DESCRIPTORS)
|
||||||
|
set(_descriptors DESCRIPTORS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
|
||||||
|
set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED Protobuf_IMPORT_DIRS)
|
||||||
|
set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_outvar)
|
||||||
|
protobuf_generate_grpc(${_append_arg} ${_descriptors} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files})
|
||||||
|
|
||||||
|
set(${SRCS})
|
||||||
|
set(${HDRS})
|
||||||
|
if(protobuf_generate_grpc_cpp_DESCRIPTORS)
|
||||||
|
set(${protobuf_generate_grpc_cpp_DESCRIPTORS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(_file ${_outvar})
|
||||||
|
if(_file MATCHES "cc$")
|
||||||
|
list(APPEND ${SRCS} ${_file})
|
||||||
|
elseif(_file MATCHES "desc$")
|
||||||
|
list(APPEND ${protobuf_generate_grpc_cpp_DESCRIPTORS} ${_file})
|
||||||
|
else()
|
||||||
|
list(APPEND ${HDRS} ${_file})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
|
||||||
|
set(${HDRS} ${${HDRS}} PARENT_SCOPE)
|
||||||
|
if(protobuf_generate_grpc_cpp_DESCRIPTORS)
|
||||||
|
set(${protobuf_generate_grpc_cpp_DESCRIPTORS} "${${protobuf_generate_grpc_cpp_DESCRIPTORS}}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Helper function.
|
||||||
|
# This function is a modified version of the function protobuf_generate() copied from https://github.com/Kitware/CMake/blob/master/Modules/FindProtobuf.cmake.
|
||||||
|
function(protobuf_generate_grpc)
|
||||||
|
set(_options APPEND_PATH DESCRIPTORS)
|
||||||
|
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR)
|
||||||
|
if(COMMAND target_sources)
|
||||||
|
list(APPEND _singleargs TARGET)
|
||||||
|
endif()
|
||||||
|
set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS)
|
||||||
|
|
||||||
|
cmake_parse_arguments(protobuf_generate_grpc "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}")
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_PROTOS AND NOT protobuf_generate_grpc_TARGET)
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc called without any targets or source files")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_OUT_VAR AND NOT protobuf_generate_grpc_TARGET)
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc called without a target or output variable")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_LANGUAGE)
|
||||||
|
set(protobuf_generate_grpc_LANGUAGE cpp)
|
||||||
|
endif()
|
||||||
|
string(TOLOWER ${protobuf_generate_grpc_LANGUAGE} protobuf_generate_grpc_LANGUAGE)
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_PROTOC_OUT_DIR)
|
||||||
|
set(protobuf_generate_grpc_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_EXPORT_MACRO AND protobuf_generate_grpc_LANGUAGE STREQUAL cpp)
|
||||||
|
set(_dll_export_decl "dllexport_decl=${protobuf_generate_grpc_EXPORT_MACRO}:")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_GENERATE_EXTENSIONS)
|
||||||
|
if(protobuf_generate_grpc_LANGUAGE STREQUAL cpp)
|
||||||
|
set(protobuf_generate_grpc_GENERATE_EXTENSIONS .pb.h .pb.cc .grpc.pb.h .grpc.pb.cc)
|
||||||
|
elseif(protobuf_generate_grpc_LANGUAGE STREQUAL python)
|
||||||
|
set(protobuf_generate_grpc_GENERATE_EXTENSIONS _pb2.py)
|
||||||
|
else()
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_PLUGIN)
|
||||||
|
if(protobuf_generate_grpc_LANGUAGE STREQUAL cpp)
|
||||||
|
set(protobuf_generate_grpc_PLUGIN "grpc_cpp_plugin")
|
||||||
|
elseif(protobuf_generate_grpc_LANGUAGE STREQUAL python)
|
||||||
|
set(protobuf_generate_grpc_PLUGIN "grpc_python_plugin")
|
||||||
|
else()
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc given unknown Language ${LANGUAGE}, please provide a value for PLUGIN")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_TARGET)
|
||||||
|
get_target_property(_source_list ${protobuf_generate_grpc_TARGET} SOURCES)
|
||||||
|
foreach(_file ${_source_list})
|
||||||
|
if(_file MATCHES "proto$")
|
||||||
|
list(APPEND protobuf_generate_grpc_PROTOS ${_file})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_PROTOS)
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc could not find any .proto files")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_APPEND_PATH)
|
||||||
|
# Create an include path for each file specified
|
||||||
|
foreach(_file ${protobuf_generate_grpc_PROTOS})
|
||||||
|
get_filename_component(_abs_file ${_file} ABSOLUTE)
|
||||||
|
get_filename_component(_abs_path ${_abs_file} PATH)
|
||||||
|
list(FIND _protobuf_include_path ${_abs_path} _contains_already)
|
||||||
|
if(${_contains_already} EQUAL -1)
|
||||||
|
list(APPEND _protobuf_include_path -I ${_abs_path})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(DIR ${protobuf_generate_grpc_IMPORT_DIRS})
|
||||||
|
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
|
||||||
|
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
|
||||||
|
if(${_contains_already} EQUAL -1)
|
||||||
|
list(APPEND _protobuf_include_path -I ${ABS_PATH})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(_generated_srcs_all)
|
||||||
|
foreach(_proto ${protobuf_generate_grpc_PROTOS})
|
||||||
|
get_filename_component(_abs_file ${_proto} ABSOLUTE)
|
||||||
|
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
||||||
|
get_filename_component(_basename ${_proto} NAME_WE)
|
||||||
|
file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
|
||||||
|
|
||||||
|
set(_possible_rel_dir)
|
||||||
|
if(NOT protobuf_generate_grpc_APPEND_PATH)
|
||||||
|
set(_possible_rel_dir ${_rel_dir}/)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_generated_srcs)
|
||||||
|
foreach(_ext ${protobuf_generate_grpc_GENERATE_EXTENSIONS})
|
||||||
|
list(APPEND _generated_srcs "${protobuf_generate_grpc_PROTOC_OUT_DIR}/${_possible_rel_dir}${_basename}${_ext}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_DESCRIPTORS AND protobuf_generate_grpc_LANGUAGE STREQUAL cpp)
|
||||||
|
set(_descriptor_file "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.desc")
|
||||||
|
set(_dll_desc_out "--descriptor_set_out=${_descriptor_file}")
|
||||||
|
list(APPEND _generated_srcs ${_descriptor_file})
|
||||||
|
endif()
|
||||||
|
list(APPEND _generated_srcs_all ${_generated_srcs})
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${_generated_srcs}
|
||||||
|
COMMAND protobuf::protoc
|
||||||
|
ARGS --${protobuf_generate_grpc_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_grpc_PROTOC_OUT_DIR}
|
||||||
|
--grpc_out ${_dll_export_decl}${protobuf_generate_grpc_PROTOC_OUT_DIR}
|
||||||
|
--plugin=protoc-gen-grpc=$<TARGET_FILE:${protobuf_generate_grpc_PLUGIN}>
|
||||||
|
${_dll_desc_out} ${_protobuf_include_path} ${_abs_file}
|
||||||
|
DEPENDS ${_abs_file} protobuf::protoc ${protobuf_generate_grpc_PLUGIN}
|
||||||
|
COMMENT "Running ${protobuf_generate_grpc_LANGUAGE} protocol buffer compiler on ${_proto}"
|
||||||
|
VERBATIM)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE)
|
||||||
|
if(protobuf_generate_grpc_OUT_VAR)
|
||||||
|
set(${protobuf_generate_grpc_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
if(protobuf_generate_grpc_TARGET)
|
||||||
|
target_sources(${protobuf_generate_grpc_TARGET} PRIVATE ${_generated_srcs_all})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Find the libraries.
|
||||||
|
if(gRPC_USE_STATIC_LIBS)
|
||||||
|
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
|
||||||
|
set(_gRPC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
if(WIN32)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
else()
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(gRPC_LIBRARY NAMES grpc)
|
||||||
|
find_library(gRPC_CPP_LIBRARY NAMES grpc++)
|
||||||
|
find_library(gRPC_UNSECURE_LIBRARY NAMES grpc_unsecure)
|
||||||
|
find_library(gRPC_CPP_UNSECURE_LIBRARY NAMES grpc++_unsecure)
|
||||||
|
|
||||||
|
set(gRPC_LIBRARIES)
|
||||||
|
if(gRPC_USE_UNSECURE_LIBRARIES)
|
||||||
|
if(gRPC_UNSECURE_LIBRARY)
|
||||||
|
set(gRPC_LIBRARIES ${gRPC_LIBRARIES} ${gRPC_UNSECURE_LIBRARY})
|
||||||
|
endif()
|
||||||
|
if(gRPC_CPP_UNSECURE_LIBRARY)
|
||||||
|
set(gRPC_LIBRARIES ${gRPC_LIBRARIES} ${gRPC_CPP_UNSECURE_LIBRARY})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(gRPC_LIBRARY)
|
||||||
|
set(gRPC_LIBRARIES ${gRPC_LIBRARIES} ${gRPC_LIBRARY})
|
||||||
|
endif()
|
||||||
|
if(gRPC_CPP_UNSECURE_LIBRARY)
|
||||||
|
set(gRPC_LIBRARIES ${gRPC_LIBRARIES} ${gRPC_CPP_LIBRARY})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Restore the original find library ordering.
|
||||||
|
if(gRPC_USE_STATIC_LIBS)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_gRPC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the include directories.
|
||||||
|
find_path(gRPC_INCLUDE_DIR grpc/grpc.h)
|
||||||
|
find_path(gRPC_CPP_INCLUDE_DIR grpc++/grpc++.h)
|
||||||
|
|
||||||
|
if(gRPC_INCLUDE_DIR AND gRPC_CPP_INCLUDE_DIR AND NOT(gRPC_INCLUDE_DIR STREQUAL gRPC_CPP_INCLUDE_DIR))
|
||||||
|
set(gRPC_INCLUDE_DIRS ${gRPC_INCLUDE_DIR} ${gRPC_CPP_INCLUDE_DIR})
|
||||||
|
elseif(gRPC_INCLUDE_DIR)
|
||||||
|
set(gRPC_INCLUDE_DIRS ${gRPC_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
|
set(gRPC_INCLUDE_DIRS ${gRPC_CPP_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Get full path to plugin.
|
||||||
|
find_program(_gRPC_CPP_PLUGIN
|
||||||
|
NAMES grpc_cpp_plugin
|
||||||
|
DOC "The plugin for generating gRPC client and server C++ stubs from `.proto` files")
|
||||||
|
|
||||||
|
find_program(_gRPC_PYTHON_PLUGIN
|
||||||
|
NAMES grpc_python_plugin
|
||||||
|
DOC "The plugin for generating gRPC client and server Python stubs from `.proto` files")
|
||||||
|
|
||||||
|
# Add imported targets.
|
||||||
|
if(gRPC_CPP_LIBRARY AND NOT TARGET grpc++)
|
||||||
|
add_library(grpc++ UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(grpc++ PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${gRPC_CPP_LIBRARY}")
|
||||||
|
set_target_properties(grpc++ PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${gRPC_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(gRPC_CPP_UNSECURE_LIBRARY AND NOT TARGET grpc++_unsecure)
|
||||||
|
add_library(grpc++_unsecure UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(grpc++_unsecure PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${gRPC_CPP_UNSECURE_LIBRARY}")
|
||||||
|
set_target_properties(grpc++_unsecure PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${gRPC_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(gRPC_CPP_PLUGIN AND NOT TARGET grpc_cpp_plugin)
|
||||||
|
add_executable(grpc_cpp_plugin IMPORTED)
|
||||||
|
set_target_properties(grpc_cpp_plugin PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${gRPC_CPP_PLUGIN}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(gRPC_PYTHON_PLUGIN AND NOT TARGET grpc_python_plugin)
|
||||||
|
add_executable(grpc_python_plugin IMPORTED)
|
||||||
|
set_target_properties(grpc_python_plugin PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${gRPC_PYTHON_PLUGIN}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#include(FindPackageHandleStandardArgs.cmake)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(gRPC
|
||||||
|
REQUIRED_VARS gRPC_LIBRARY gRPC_CPP_LIBRARY gRPC_UNSECURE_LIBRARY gRPC_CPP_UNSECURE_LIBRARY
|
||||||
|
gRPC_INCLUDE_DIR gRPC_CPP_INCLUDE_DIR _gRPC_CPP_PLUGIN _gRPC_PYTHON_PLUGIN)
|
||||||
|
|
||||||
|
if(gRPC_FOUND)
|
||||||
|
if(gRPC_DEBUG)
|
||||||
|
message(STATUS "gRPC: INCLUDE_DIRS=${gRPC_INCLUDE_DIRS}")
|
||||||
|
message(STATUS "gRPC: LIBRARIES=${gRPC_LIBRARIES}")
|
||||||
|
message(STATUS "gRPC: CPP_PLUGIN=${_gRPC_CPP_PLUGIN}")
|
||||||
|
message(STATUS "gRPC: PYTHON_PLUGIN=${_gRPC_PYTHON_PLUGIN}")
|
||||||
|
endif()
|
||||||
|
endif()
|
@ -1,45 +1,65 @@
|
|||||||
option (ENABLE_GRPC "Use gRPC" ${ENABLE_LIBRARIES})
|
option(ENABLE_GRPC "Use gRPC" ${ENABLE_LIBRARIES})
|
||||||
|
|
||||||
if (NOT ENABLE_GRPC)
|
if(NOT ENABLE_GRPC)
|
||||||
if (USE_INTERNAL_GRPC_LIBRARY)
|
if(USE_INTERNAL_GRPC_LIBRARY)
|
||||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal gRPC library with ENABLE_GRPC=OFF")
|
message(${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal gRPC library with ENABLE_GRPC=OFF")
|
||||||
endif()
|
endif()
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option (USE_INTERNAL_GRPC_LIBRARY
|
if(NOT USE_PROTOBUF)
|
||||||
"Set to FALSE to use system gRPC library instead of bundled. (Experimental. Set to OFF on your own risk)"
|
message(WARNING "Cannot use gRPC library without protobuf")
|
||||||
${NOT_UNBUNDLED})
|
|
||||||
|
|
||||||
if (NOT USE_INTERNAL_GRPC_LIBRARY)
|
|
||||||
find_package(grpc)
|
|
||||||
if (NOT GRPC_FOUND)
|
|
||||||
find_path(GRPC_INCLUDE_DIR grpcpp/grpcpp.h)
|
|
||||||
find_library(GRPC_LIBRARY grpc++)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (GRPC_INCLUDE_DIR AND GRPC_LIBRARY)
|
|
||||||
set (USE_GRPC ON)
|
|
||||||
else()
|
|
||||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system gRPC")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT USE_GRPC)
|
# Normally we use the internal gRPC framework.
|
||||||
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/grpc/include/grpc++/grpc++.h")
|
# You can set USE_INTERNAL_GRPC_LIBRARY to OFF to force using the external gRPC framework, which should be installed in the system in this case.
|
||||||
message (WARNING "submodule contrib/grpc is missing. To fix try run: \n git submodule update --init --recursive")
|
# The external gRPC framework can be installed in the system by running
|
||||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal gRPC")
|
# sudo apt-get install libgrpc++-dev protobuf-compiler-grpc
|
||||||
set (USE_INTERNAL_GRPC_LIBRARY OFF)
|
option(USE_INTERNAL_GRPC_LIBRARY "Set to FALSE to use system gRPC library instead of bundled. (Experimental. Set to OFF on your own risk)" ${NOT_UNBUNDLED})
|
||||||
elseif (NOT USE_PROTOBUF)
|
|
||||||
message (WARNING "gRPC requires protobuf which is disabled")
|
if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/grpc/CMakeLists.txt")
|
||||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Will not use internal gRPC without protobuf")
|
if(USE_INTERNAL_GRPC_LIBRARY)
|
||||||
set (USE_INTERNAL_GRPC_LIBRARY OFF)
|
message(WARNING "submodule contrib/grpc is missing. to fix try run: \n git submodule update --init --recursive")
|
||||||
else()
|
message(${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal grpc")
|
||||||
set (GRPC_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/grpc/include")
|
set(USE_INTERNAL_GRPC_LIBRARY 0)
|
||||||
set (GRPC_LIBRARY "libgrpc++")
|
endif()
|
||||||
set (USE_GRPC ON)
|
set(MISSING_INTERNAL_GRPC_LIBRARY 1)
|
||||||
set (USE_INTERNAL_GRPC_LIBRARY ON)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message (STATUS "Using gRPC=${USE_GRPC}: ${GRPC_INCLUDE_DIR} : ${GRPC_LIBRARY}")
|
if(USE_SSL)
|
||||||
|
set(gRPC_USE_UNSECURE_LIBRARIES FALSE)
|
||||||
|
else()
|
||||||
|
set(gRPC_USE_UNSECURE_LIBRARIES TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT USE_INTERNAL_GRPC_LIBRARY)
|
||||||
|
find_package(gRPC)
|
||||||
|
if(NOT gRPC_INCLUDE_DIRS OR NOT gRPC_LIBRARIES)
|
||||||
|
message(${RECONFIGURE_MESSAGE_LEVEL} "Can't find system gRPC library")
|
||||||
|
set(EXTERNAL_GRPC_LIBRARY_FOUND 0)
|
||||||
|
elseif(NOT _gRPC_CPP_PLUGIN)
|
||||||
|
message(${RECONFIGURE_MESSAGE_LEVEL} "Can't find system grcp_cpp_plugin")
|
||||||
|
set(EXTERNAL_GRPC_LIBRARY_FOUND 0)
|
||||||
|
else()
|
||||||
|
set(EXTERNAL_GRPC_LIBRARY_FOUND 1)
|
||||||
|
set(USE_GRPC 1)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT EXTERNAL_GRPC_LIBRARY_FOUND AND NOT MISSING_INTERNAL_GRPC_LIBRARY)
|
||||||
|
set(gRPC_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/grpc/include")
|
||||||
|
if(gRPC_USE_UNSECURE_LIBRARIES)
|
||||||
|
set(gRPC_LIBRARIES grpc_unsecure grpc++_unsecure)
|
||||||
|
else()
|
||||||
|
set(gRPC_LIBRARIES grpc grpc++)
|
||||||
|
endif()
|
||||||
|
set(_gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin>)
|
||||||
|
set(_gRPC_PROTOC_EXECUTABLE $<TARGET_FILE:protobuf::protoc>)
|
||||||
|
|
||||||
|
include("${ClickHouse_SOURCE_DIR}/contrib/grpc-cmake/protobuf_generate_grpc.cmake")
|
||||||
|
|
||||||
|
set(USE_INTERNAL_GRPC_LIBRARY 1)
|
||||||
|
set(USE_GRPC 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Using gRPC=${USE_GRPC}: ${gRPC_INCLUDE_DIRS} : ${gRPC_LIBRARIES} : ${_gRPC_CPP_PLUGIN}")
|
||||||
|
@ -26,7 +26,7 @@ endif ()
|
|||||||
if (NOT USE_INTERNAL_LLVM_LIBRARY)
|
if (NOT USE_INTERNAL_LLVM_LIBRARY)
|
||||||
set (LLVM_PATHS "/usr/local/lib/llvm")
|
set (LLVM_PATHS "/usr/local/lib/llvm")
|
||||||
|
|
||||||
foreach(llvm_v 9 8)
|
foreach(llvm_v 10 9 8)
|
||||||
if (NOT LLVM_FOUND)
|
if (NOT LLVM_FOUND)
|
||||||
find_package (LLVM ${llvm_v} CONFIG PATHS ${LLVM_PATHS})
|
find_package (LLVM ${llvm_v} CONFIG PATHS ${LLVM_PATHS})
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <FastMemcpy.h>
|
#include "FastMemcpy.h"
|
||||||
|
|
||||||
void * memcpy(void * __restrict destination, const void * __restrict source, size_t size)
|
void * memcpy(void * __restrict destination, const void * __restrict source, size_t size)
|
||||||
{
|
{
|
||||||
|
2
contrib/grpc
vendored
2
contrib/grpc
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 8aea4e168e78f3eb9828080740fc8cb73d53bf79
|
Subproject commit a6570b863cf76c9699580ba51c7827d5bffaac43
|
File diff suppressed because it is too large
Load Diff
207
contrib/grpc-cmake/protobuf_generate_grpc.cmake
Normal file
207
contrib/grpc-cmake/protobuf_generate_grpc.cmake
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
#[[
|
||||||
|
Add custom commands to process ``.proto`` files to C++::
|
||||||
|
protobuf_generate_grpc_cpp(<SRCS> <HDRS>
|
||||||
|
[DESCRIPTORS <DESC>] [EXPORT_MACRO <MACRO>] [<ARGN>...])
|
||||||
|
|
||||||
|
``SRCS``
|
||||||
|
Variable to define with autogenerated source files
|
||||||
|
``HDRS``
|
||||||
|
Variable to define with autogenerated header files
|
||||||
|
``DESCRIPTORS``
|
||||||
|
Variable to define with autogenerated descriptor files, if requested.
|
||||||
|
``EXPORT_MACRO``
|
||||||
|
is a macro which should expand to ``__declspec(dllexport)`` or
|
||||||
|
``__declspec(dllimport)`` depending on what is being compiled.
|
||||||
|
``ARGN``
|
||||||
|
``.proto`` files
|
||||||
|
#]]
|
||||||
|
|
||||||
|
# Function to generate C++ files from .proto files.
|
||||||
|
# This function is a modified version of the function PROTOBUF_GENERATE_CPP() copied from https://github.com/Kitware/CMake/blob/master/Modules/FindProtobuf.cmake.
|
||||||
|
function(PROTOBUF_GENERATE_GRPC_CPP SRCS HDRS)
|
||||||
|
cmake_parse_arguments(protobuf_generate_grpc_cpp "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN})
|
||||||
|
|
||||||
|
set(_proto_files "${protobuf_generate_grpc_cpp_UNPARSED_ARGUMENTS}")
|
||||||
|
if(NOT _proto_files)
|
||||||
|
message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PROTOBUF_GENERATE_GRPC_CPP_APPEND_PATH)
|
||||||
|
set(_append_arg APPEND_PATH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_cpp_DESCRIPTORS)
|
||||||
|
set(_descriptors DESCRIPTORS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
|
||||||
|
set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED Protobuf_IMPORT_DIRS)
|
||||||
|
set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_outvar)
|
||||||
|
protobuf_generate_grpc(${_append_arg} ${_descriptors} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files})
|
||||||
|
|
||||||
|
set(${SRCS})
|
||||||
|
set(${HDRS})
|
||||||
|
if(protobuf_generate_grpc_cpp_DESCRIPTORS)
|
||||||
|
set(${protobuf_generate_grpc_cpp_DESCRIPTORS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(_file ${_outvar})
|
||||||
|
if(_file MATCHES "cc$")
|
||||||
|
list(APPEND ${SRCS} ${_file})
|
||||||
|
elseif(_file MATCHES "desc$")
|
||||||
|
list(APPEND ${protobuf_generate_grpc_cpp_DESCRIPTORS} ${_file})
|
||||||
|
else()
|
||||||
|
list(APPEND ${HDRS} ${_file})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
|
||||||
|
set(${HDRS} ${${HDRS}} PARENT_SCOPE)
|
||||||
|
if(protobuf_generate_grpc_cpp_DESCRIPTORS)
|
||||||
|
set(${protobuf_generate_grpc_cpp_DESCRIPTORS} "${${protobuf_generate_grpc_cpp_DESCRIPTORS}}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Helper function.
|
||||||
|
# This function is a modified version of the function protobuf_generate() copied from https://github.com/Kitware/CMake/blob/master/Modules/FindProtobuf.cmake.
|
||||||
|
function(protobuf_generate_grpc)
|
||||||
|
set(_options APPEND_PATH DESCRIPTORS)
|
||||||
|
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR)
|
||||||
|
if(COMMAND target_sources)
|
||||||
|
list(APPEND _singleargs TARGET)
|
||||||
|
endif()
|
||||||
|
set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS)
|
||||||
|
|
||||||
|
cmake_parse_arguments(protobuf_generate_grpc "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}")
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_PROTOS AND NOT protobuf_generate_grpc_TARGET)
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc called without any targets or source files")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_OUT_VAR AND NOT protobuf_generate_grpc_TARGET)
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc called without a target or output variable")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_LANGUAGE)
|
||||||
|
set(protobuf_generate_grpc_LANGUAGE cpp)
|
||||||
|
endif()
|
||||||
|
string(TOLOWER ${protobuf_generate_grpc_LANGUAGE} protobuf_generate_grpc_LANGUAGE)
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_PROTOC_OUT_DIR)
|
||||||
|
set(protobuf_generate_grpc_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_EXPORT_MACRO AND protobuf_generate_grpc_LANGUAGE STREQUAL cpp)
|
||||||
|
set(_dll_export_decl "dllexport_decl=${protobuf_generate_grpc_EXPORT_MACRO}:")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_GENERATE_EXTENSIONS)
|
||||||
|
if(protobuf_generate_grpc_LANGUAGE STREQUAL cpp)
|
||||||
|
set(protobuf_generate_grpc_GENERATE_EXTENSIONS .pb.h .pb.cc .grpc.pb.h .grpc.pb.cc)
|
||||||
|
elseif(protobuf_generate_grpc_LANGUAGE STREQUAL python)
|
||||||
|
set(protobuf_generate_grpc_GENERATE_EXTENSIONS _pb2.py)
|
||||||
|
else()
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_PLUGIN)
|
||||||
|
if(protobuf_generate_grpc_LANGUAGE STREQUAL cpp)
|
||||||
|
set(protobuf_generate_grpc_PLUGIN "grpc_cpp_plugin")
|
||||||
|
elseif(protobuf_generate_grpc_LANGUAGE STREQUAL python)
|
||||||
|
set(protobuf_generate_grpc_PLUGIN "grpc_python_plugin")
|
||||||
|
else()
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc given unknown Language ${LANGUAGE}, please provide a value for PLUGIN")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_TARGET)
|
||||||
|
get_target_property(_source_list ${protobuf_generate_grpc_TARGET} SOURCES)
|
||||||
|
foreach(_file ${_source_list})
|
||||||
|
if(_file MATCHES "proto$")
|
||||||
|
list(APPEND protobuf_generate_grpc_PROTOS ${_file})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT protobuf_generate_grpc_PROTOS)
|
||||||
|
message(SEND_ERROR "Error: protobuf_generate_grpc could not find any .proto files")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_APPEND_PATH)
|
||||||
|
# Create an include path for each file specified
|
||||||
|
foreach(_file ${protobuf_generate_grpc_PROTOS})
|
||||||
|
get_filename_component(_abs_file ${_file} ABSOLUTE)
|
||||||
|
get_filename_component(_abs_path ${_abs_file} PATH)
|
||||||
|
list(FIND _protobuf_include_path ${_abs_path} _contains_already)
|
||||||
|
if(${_contains_already} EQUAL -1)
|
||||||
|
list(APPEND _protobuf_include_path -I ${_abs_path})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(DIR ${protobuf_generate_grpc_IMPORT_DIRS})
|
||||||
|
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
|
||||||
|
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
|
||||||
|
if(${_contains_already} EQUAL -1)
|
||||||
|
list(APPEND _protobuf_include_path -I ${ABS_PATH})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(_generated_srcs_all)
|
||||||
|
foreach(_proto ${protobuf_generate_grpc_PROTOS})
|
||||||
|
get_filename_component(_abs_file ${_proto} ABSOLUTE)
|
||||||
|
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
||||||
|
get_filename_component(_basename ${_proto} NAME_WE)
|
||||||
|
file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
|
||||||
|
|
||||||
|
set(_possible_rel_dir)
|
||||||
|
if(NOT protobuf_generate_grpc_APPEND_PATH)
|
||||||
|
set(_possible_rel_dir ${_rel_dir}/)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_generated_srcs)
|
||||||
|
foreach(_ext ${protobuf_generate_grpc_GENERATE_EXTENSIONS})
|
||||||
|
list(APPEND _generated_srcs "${protobuf_generate_grpc_PROTOC_OUT_DIR}/${_possible_rel_dir}${_basename}${_ext}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(protobuf_generate_grpc_DESCRIPTORS AND protobuf_generate_grpc_LANGUAGE STREQUAL cpp)
|
||||||
|
set(_descriptor_file "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.desc")
|
||||||
|
set(_dll_desc_out "--descriptor_set_out=${_descriptor_file}")
|
||||||
|
list(APPEND _generated_srcs ${_descriptor_file})
|
||||||
|
endif()
|
||||||
|
list(APPEND _generated_srcs_all ${_generated_srcs})
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${_generated_srcs}
|
||||||
|
COMMAND protobuf::protoc
|
||||||
|
ARGS --${protobuf_generate_grpc_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_grpc_PROTOC_OUT_DIR}
|
||||||
|
--grpc_out ${_dll_export_decl}${protobuf_generate_grpc_PROTOC_OUT_DIR}
|
||||||
|
--plugin=protoc-gen-grpc=$<TARGET_FILE:${protobuf_generate_grpc_PLUGIN}>
|
||||||
|
${_dll_desc_out} ${_protobuf_include_path} ${_abs_file}
|
||||||
|
DEPENDS ${_abs_file} protobuf::protoc ${protobuf_generate_grpc_PLUGIN}
|
||||||
|
COMMENT "Running ${protobuf_generate_grpc_LANGUAGE} protocol buffer compiler on ${_proto}"
|
||||||
|
VERBATIM)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE)
|
||||||
|
if(protobuf_generate_grpc_OUT_VAR)
|
||||||
|
set(${protobuf_generate_grpc_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
if(protobuf_generate_grpc_TARGET)
|
||||||
|
target_sources(${protobuf_generate_grpc_TARGET} PRIVATE ${_generated_srcs_all})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -1,7 +1,7 @@
|
|||||||
# docker build -t yandex/clickhouse-binary-builder .
|
# docker build -t yandex/clickhouse-binary-builder .
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=10
|
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=11
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \
|
&& apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \
|
||||||
@ -11,7 +11,7 @@ RUN apt-get update \
|
|||||||
&& echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c \
|
&& echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c \
|
||||||
&& apt-key add /tmp/llvm-snapshot.gpg.key \
|
&& apt-key add /tmp/llvm-snapshot.gpg.key \
|
||||||
&& export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \
|
&& export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \
|
||||||
&& echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-11 main" >> \
|
&& echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \
|
||||||
/etc/apt/sources.list
|
/etc/apt/sources.list
|
||||||
|
|
||||||
# initial packages
|
# initial packages
|
||||||
@ -32,10 +32,11 @@ RUN apt-get update \
|
|||||||
curl \
|
curl \
|
||||||
gcc-9 \
|
gcc-9 \
|
||||||
g++-9 \
|
g++-9 \
|
||||||
llvm-${LLVM_VERSION} \
|
clang-10 \
|
||||||
clang-${LLVM_VERSION} \
|
clang-tidy-10 \
|
||||||
lld-${LLVM_VERSION} \
|
lld-10 \
|
||||||
clang-tidy-${LLVM_VERSION} \
|
llvm-10 \
|
||||||
|
llvm-10-dev \
|
||||||
clang-11 \
|
clang-11 \
|
||||||
clang-tidy-11 \
|
clang-tidy-11 \
|
||||||
lld-11 \
|
lld-11 \
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# docker build -t yandex/clickhouse-deb-builder .
|
# docker build -t yandex/clickhouse-deb-builder .
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=10
|
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=11
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \
|
&& apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \
|
||||||
@ -11,7 +11,7 @@ RUN apt-get update \
|
|||||||
&& echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c \
|
&& echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c \
|
||||||
&& apt-key add /tmp/llvm-snapshot.gpg.key \
|
&& apt-key add /tmp/llvm-snapshot.gpg.key \
|
||||||
&& export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \
|
&& export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \
|
||||||
&& echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-11 main" >> \
|
&& echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \
|
||||||
/etc/apt/sources.list
|
/etc/apt/sources.list
|
||||||
|
|
||||||
# initial packages
|
# initial packages
|
||||||
@ -49,15 +49,11 @@ RUN apt-get update \
|
|||||||
lld-11 \
|
lld-11 \
|
||||||
llvm-11 \
|
llvm-11 \
|
||||||
llvm-11-dev \
|
llvm-11-dev \
|
||||||
clang-${LLVM_VERSION} \
|
clang-10 \
|
||||||
clang-tidy-${LLVM_VERSION} \
|
clang-tidy-10 \
|
||||||
lld-${LLVM_VERSION} \
|
lld-10 \
|
||||||
llvm-${LLVM_VERSION} \
|
llvm-10 \
|
||||||
llvm-${LLVM_VERSION}-dev \
|
llvm-10-dev \
|
||||||
llvm-9-dev \
|
|
||||||
lld-9 \
|
|
||||||
clang-9 \
|
|
||||||
clang-tidy-9 \
|
|
||||||
ninja-build \
|
ninja-build \
|
||||||
perl \
|
perl \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
|
@ -4,7 +4,8 @@ set -x -e
|
|||||||
|
|
||||||
ccache --show-stats ||:
|
ccache --show-stats ||:
|
||||||
ccache --zero-stats ||:
|
ccache --zero-stats ||:
|
||||||
build/release --no-pbuilder "$ALIEN_PKGS" | ts '%Y-%m-%d %H:%M:%S'
|
read -ra ALIEN_PKGS <<< "${ALIEN_PKGS:-}"
|
||||||
|
build/release --no-pbuilder "${ALIEN_PKGS[@]}" | ts '%Y-%m-%d %H:%M:%S'
|
||||||
mv /*.deb /output
|
mv /*.deb /output
|
||||||
mv -- *.changes /output
|
mv -- *.changes /output
|
||||||
mv -- *.buildinfo /output
|
mv -- *.buildinfo /output
|
||||||
|
@ -51,6 +51,7 @@ RUN apt-get update \
|
|||||||
protobuf-compiler \
|
protobuf-compiler \
|
||||||
libprotoc-dev \
|
libprotoc-dev \
|
||||||
libgrpc++-dev \
|
libgrpc++-dev \
|
||||||
|
protobuf-compiler-grpc \
|
||||||
rapidjson-dev \
|
rapidjson-dev \
|
||||||
libsnappy-dev \
|
libsnappy-dev \
|
||||||
libparquet-dev \
|
libparquet-dev \
|
||||||
|
@ -4,7 +4,8 @@ set -x -e
|
|||||||
|
|
||||||
ccache --show-stats ||:
|
ccache --show-stats ||:
|
||||||
ccache --zero-stats ||:
|
ccache --zero-stats ||:
|
||||||
build/release --no-pbuilder "$ALIEN_PKGS" | ts '%Y-%m-%d %H:%M:%S'
|
read -ra ALIEN_PKGS <<< "${ALIEN_PKGS:-}"
|
||||||
|
build/release --no-pbuilder "${ALIEN_PKGS[@]}" | ts '%Y-%m-%d %H:%M:%S'
|
||||||
mv /*.deb /output
|
mv /*.deb /output
|
||||||
mv -- *.changes /output
|
mv -- *.changes /output
|
||||||
mv -- *.buildinfo /output
|
mv -- *.buildinfo /output
|
||||||
|
@ -3,25 +3,27 @@ toc_priority: 42
|
|||||||
toc_title: Decimal
|
toc_title: Decimal
|
||||||
---
|
---
|
||||||
|
|
||||||
# Decimal(P, S), Decimal32(S), Decimal64(S), Decimal128(S) {#decimalp-s-decimal32s-decimal64s-decimal128s}
|
# Decimal(P, S), Decimal32(S), Decimal64(S), Decimal128(S), Decimal256(S) {#decimalp-s-decimal32s-decimal64s-decimal128s}
|
||||||
|
|
||||||
Signed fixed-point numbers that keep precision during add, subtract and multiply operations. For division least significant digits are discarded (not rounded).
|
Signed fixed-point numbers that keep precision during add, subtract and multiply operations. For division least significant digits are discarded (not rounded).
|
||||||
|
|
||||||
## Parameters {#parameters}
|
## Parameters {#parameters}
|
||||||
|
|
||||||
- P - precision. Valid range: \[ 1 : 38 \]. Determines how many decimal digits number can have (including fraction).
|
- P - precision. Valid range: \[ 1 : 76 \]. Determines how many decimal digits number can have (including fraction).
|
||||||
- S - scale. Valid range: \[ 0 : P \]. Determines how many decimal digits fraction can have.
|
- S - scale. Valid range: \[ 0 : P \]. Determines how many decimal digits fraction can have.
|
||||||
|
|
||||||
Depending on P parameter value Decimal(P, S) is a synonym for:
|
Depending on P parameter value Decimal(P, S) is a synonym for:
|
||||||
- P from \[ 1 : 9 \] - for Decimal32(S)
|
- P from \[ 1 : 9 \] - for Decimal32(S)
|
||||||
- P from \[ 10 : 18 \] - for Decimal64(S)
|
- P from \[ 10 : 18 \] - for Decimal64(S)
|
||||||
- P from \[ 19 : 38 \] - for Decimal128(S)
|
- P from \[ 19 : 38 \] - for Decimal128(S)
|
||||||
|
- P from \[ 39 : 76 \] - for Decimal256(S)
|
||||||
|
|
||||||
## Decimal Value Ranges {#decimal-value-ranges}
|
## Decimal Value Ranges {#decimal-value-ranges}
|
||||||
|
|
||||||
- Decimal32(S) - ( -1 \* 10^(9 - S), 1 \* 10^(9 - S) )
|
- Decimal32(S) - ( -1 \* 10^(9 - S), 1 \* 10^(9 - S) )
|
||||||
- Decimal64(S) - ( -1 \* 10^(18 - S), 1 \* 10^(18 - S) )
|
- Decimal64(S) - ( -1 \* 10^(18 - S), 1 \* 10^(18 - S) )
|
||||||
- Decimal128(S) - ( -1 \* 10^(38 - S), 1 \* 10^(38 - S) )
|
- Decimal128(S) - ( -1 \* 10^(38 - S), 1 \* 10^(38 - S) )
|
||||||
|
- Decimal256(S) - ( -1 \* 10^(76 - S), 1 \* 10^(76 - S) )
|
||||||
|
|
||||||
For example, Decimal32(4) can contain numbers from -99999.9999 to 99999.9999 with 0.0001 step.
|
For example, Decimal32(4) can contain numbers from -99999.9999 to 99999.9999 with 0.0001 step.
|
||||||
|
|
||||||
@ -38,6 +40,7 @@ Binary operations on Decimal result in wider result type (with any order of argu
|
|||||||
- `Decimal64(S1) <op> Decimal32(S2) -> Decimal64(S)`
|
- `Decimal64(S1) <op> Decimal32(S2) -> Decimal64(S)`
|
||||||
- `Decimal128(S1) <op> Decimal32(S2) -> Decimal128(S)`
|
- `Decimal128(S1) <op> Decimal32(S2) -> Decimal128(S)`
|
||||||
- `Decimal128(S1) <op> Decimal64(S2) -> Decimal128(S)`
|
- `Decimal128(S1) <op> Decimal64(S2) -> Decimal128(S)`
|
||||||
|
- `Decimal256(S1) <op> Decimal<32|64|128>(S2) -> Decimal256(S)`
|
||||||
|
|
||||||
Rules for scale:
|
Rules for scale:
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
toc_priority: 40
|
toc_priority: 40
|
||||||
toc_title: UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64
|
toc_title: UInt8, UInt16, UInt32, UInt64, UInt256, Int8, Int16, Int32, Int64, Int128, Int256
|
||||||
---
|
---
|
||||||
|
|
||||||
# UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64 {#uint8-uint16-uint32-uint64-int8-int16-int32-int64}
|
# UInt8, UInt16, UInt32, UInt64, UInt256, Int8, Int16, Int32, Int64, Int128, Int256 {#uint8-uint16-uint32-uint64-int8-int16-int32-int64}
|
||||||
|
|
||||||
Fixed-length integers, with or without a sign.
|
Fixed-length integers, with or without a sign.
|
||||||
|
|
||||||
@ -13,6 +13,8 @@ Fixed-length integers, with or without a sign.
|
|||||||
- Int16 - \[-32768 : 32767\]
|
- Int16 - \[-32768 : 32767\]
|
||||||
- Int32 - \[-2147483648 : 2147483647\]
|
- Int32 - \[-2147483648 : 2147483647\]
|
||||||
- Int64 - \[-9223372036854775808 : 9223372036854775807\]
|
- Int64 - \[-9223372036854775808 : 9223372036854775807\]
|
||||||
|
- Int128 - \[-170141183460469231731687303715884105728 : 170141183460469231731687303715884105727\]
|
||||||
|
- Int256 - \[-57896044618658097711785492504343953926634992332820282019728792003956564819968 : 57896044618658097711785492504343953926634992332820282019728792003956564819967\]
|
||||||
|
|
||||||
## Uint Ranges {#uint-ranges}
|
## Uint Ranges {#uint-ranges}
|
||||||
|
|
||||||
@ -20,5 +22,8 @@ Fixed-length integers, with or without a sign.
|
|||||||
- UInt16 - \[0 : 65535\]
|
- UInt16 - \[0 : 65535\]
|
||||||
- UInt32 - \[0 : 4294967295\]
|
- UInt32 - \[0 : 4294967295\]
|
||||||
- UInt64 - \[0 : 18446744073709551615\]
|
- UInt64 - \[0 : 18446744073709551615\]
|
||||||
|
- UInt256 - \[0 : 115792089237316195423570985008687907853269984665640564039457584007913129639935\]
|
||||||
|
|
||||||
|
UInt128 is not supported yet.
|
||||||
|
|
||||||
[Original article](https://clickhouse.tech/docs/en/data_types/int_uint/) <!--hide-->
|
[Original article](https://clickhouse.tech/docs/en/data_types/int_uint/) <!--hide-->
|
||||||
|
@ -11,7 +11,7 @@ When you convert a value from one to another data type, you should remember that
|
|||||||
|
|
||||||
ClickHouse has the [same behavior as C++ programs](https://en.cppreference.com/w/cpp/language/implicit_conversion).
|
ClickHouse has the [same behavior as C++ programs](https://en.cppreference.com/w/cpp/language/implicit_conversion).
|
||||||
|
|
||||||
## toInt(8\|16\|32\|64) {#toint8163264}
|
## toInt(8\|16\|32\|64\|128\|256) {#toint8163264}
|
||||||
|
|
||||||
Converts an input value to the [Int](../../sql-reference/data-types/int-uint.md) data type. This function family includes:
|
Converts an input value to the [Int](../../sql-reference/data-types/int-uint.md) data type. This function family includes:
|
||||||
|
|
||||||
@ -19,6 +19,8 @@ Converts an input value to the [Int](../../sql-reference/data-types/int-uint.md)
|
|||||||
- `toInt16(expr)` — Results in the `Int16` data type.
|
- `toInt16(expr)` — Results in the `Int16` data type.
|
||||||
- `toInt32(expr)` — Results in the `Int32` data type.
|
- `toInt32(expr)` — Results in the `Int32` data type.
|
||||||
- `toInt64(expr)` — Results in the `Int64` data type.
|
- `toInt64(expr)` — Results in the `Int64` data type.
|
||||||
|
- `toInt128(expr)` — Results in the `Int128` data type.
|
||||||
|
- `toInt256(expr)` — Results in the `Int256` data type.
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
@ -26,7 +28,7 @@ Converts an input value to the [Int](../../sql-reference/data-types/int-uint.md)
|
|||||||
|
|
||||||
**Returned value**
|
**Returned value**
|
||||||
|
|
||||||
Integer value in the `Int8`, `Int16`, `Int32`, or `Int64` data type.
|
Integer value in the `Int8`, `Int16`, `Int32`, `Int64`, `Int128` or `Int256` data type.
|
||||||
|
|
||||||
Functions use [rounding towards zero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), meaning they truncate fractional digits of numbers.
|
Functions use [rounding towards zero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), meaning they truncate fractional digits of numbers.
|
||||||
|
|
||||||
@ -44,9 +46,9 @@ SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8)
|
|||||||
└──────────────────────┴─────────────┴───────────────┴─────────────┘
|
└──────────────────────┴─────────────┴───────────────┴─────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toInt(8\|16\|32\|64)OrZero {#toint8163264orzero}
|
## toInt(8\|16\|32\|64\|128\|256)OrZero {#toint8163264orzero}
|
||||||
|
|
||||||
It takes an argument of type String and tries to parse it into Int (8 \| 16 \| 32 \| 64). If failed, returns 0.
|
It takes an argument of type String and tries to parse it into Int (8 \| 16 \| 32 \| 64 \| 128 \| 256). If failed, returns 0.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
@ -60,9 +62,9 @@ select toInt64OrZero('123123'), toInt8OrZero('123qwe123')
|
|||||||
└─────────────────────────┴───────────────────────────┘
|
└─────────────────────────┴───────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toInt(8\|16\|32\|64)OrNull {#toint8163264ornull}
|
## toInt(8\|16\|32\|64\|128\|256)OrNull {#toint8163264ornull}
|
||||||
|
|
||||||
It takes an argument of type String and tries to parse it into Int (8 \| 16 \| 32 \| 64). If failed, returns NULL.
|
It takes an argument of type String and tries to parse it into Int (8 \| 16 \| 32 \| 64 \| 128 \| 256). If failed, returns NULL.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
@ -76,7 +78,7 @@ select toInt64OrNull('123123'), toInt8OrNull('123qwe123')
|
|||||||
└─────────────────────────┴───────────────────────────┘
|
└─────────────────────────┴───────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toUInt(8\|16\|32\|64) {#touint8163264}
|
## toUInt(8\|16\|32\|64\|256) {#touint8163264}
|
||||||
|
|
||||||
Converts an input value to the [UInt](../../sql-reference/data-types/int-uint.md) data type. This function family includes:
|
Converts an input value to the [UInt](../../sql-reference/data-types/int-uint.md) data type. This function family includes:
|
||||||
|
|
||||||
@ -84,6 +86,7 @@ Converts an input value to the [UInt](../../sql-reference/data-types/int-uint.md
|
|||||||
- `toUInt16(expr)` — Results in the `UInt16` data type.
|
- `toUInt16(expr)` — Results in the `UInt16` data type.
|
||||||
- `toUInt32(expr)` — Results in the `UInt32` data type.
|
- `toUInt32(expr)` — Results in the `UInt32` data type.
|
||||||
- `toUInt64(expr)` — Results in the `UInt64` data type.
|
- `toUInt64(expr)` — Results in the `UInt64` data type.
|
||||||
|
- `toUInt256(expr)` — Results in the `UInt256` data type.
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
@ -91,7 +94,7 @@ Converts an input value to the [UInt](../../sql-reference/data-types/int-uint.md
|
|||||||
|
|
||||||
**Returned value**
|
**Returned value**
|
||||||
|
|
||||||
Integer value in the `UInt8`, `UInt16`, `UInt32`, or `UInt64` data type.
|
Integer value in the `UInt8`, `UInt16`, `UInt32`, `UInt64` or `UInt256` data type.
|
||||||
|
|
||||||
Functions use [rounding towards zero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), meaning they truncate fractional digits of numbers.
|
Functions use [rounding towards zero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), meaning they truncate fractional digits of numbers.
|
||||||
|
|
||||||
@ -109,9 +112,9 @@ SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8)
|
|||||||
└─────────────────────┴───────────────┴────────────────┴──────────────┘
|
└─────────────────────┴───────────────┴────────────────┴──────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toUInt(8\|16\|32\|64)OrZero {#touint8163264orzero}
|
## toUInt(8\|16\|32\|64\|256)OrZero {#touint8163264orzero}
|
||||||
|
|
||||||
## toUInt(8\|16\|32\|64)OrNull {#touint8163264ornull}
|
## toUInt(8\|16\|32\|64\|256)OrNull {#touint8163264ornull}
|
||||||
|
|
||||||
## toFloat(32\|64) {#tofloat3264}
|
## toFloat(32\|64) {#tofloat3264}
|
||||||
|
|
||||||
@ -131,21 +134,23 @@ SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8)
|
|||||||
|
|
||||||
## toDateTimeOrNull {#todatetimeornull}
|
## toDateTimeOrNull {#todatetimeornull}
|
||||||
|
|
||||||
## toDecimal(32\|64\|128) {#todecimal3264128}
|
## toDecimal(32\|64\|128\|256) {#todecimal3264128}
|
||||||
|
|
||||||
Converts `value` to the [Decimal](../../sql-reference/data-types/decimal.md) data type with precision of `S`. The `value` can be a number or a string. The `S` (scale) parameter specifies the number of decimal places.
|
Converts `value` to the [Decimal](../../sql-reference/data-types/decimal.md) data type with precision of `S`. The `value` can be a number or a string. The `S` (scale) parameter specifies the number of decimal places.
|
||||||
|
|
||||||
- `toDecimal32(value, S)`
|
- `toDecimal32(value, S)`
|
||||||
- `toDecimal64(value, S)`
|
- `toDecimal64(value, S)`
|
||||||
- `toDecimal128(value, S)`
|
- `toDecimal128(value, S)`
|
||||||
|
- `toDecimal256(value, S)`
|
||||||
|
|
||||||
## toDecimal(32\|64\|128)OrNull {#todecimal3264128ornull}
|
## toDecimal(32\|64\|128\|256)OrNull {#todecimal3264128ornull}
|
||||||
|
|
||||||
Converts an input string to a [Nullable(Decimal(P,S))](../../sql-reference/data-types/decimal.md) data type value. This family of functions include:
|
Converts an input string to a [Nullable(Decimal(P,S))](../../sql-reference/data-types/decimal.md) data type value. This family of functions include:
|
||||||
|
|
||||||
- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` data type.
|
- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` data type.
|
||||||
- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` data type.
|
- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` data type.
|
||||||
- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` data type.
|
- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` data type.
|
||||||
|
- `toDecimal256OrNull(expr, S)` — Results in `Nullable(Decimal256(S))` data type.
|
||||||
|
|
||||||
These functions should be used instead of `toDecimal*()` functions, if you prefer to get a `NULL` value instead of an exception in the event of an input value parsing error.
|
These functions should be used instead of `toDecimal*()` functions, if you prefer to get a `NULL` value instead of an exception in the event of an input value parsing error.
|
||||||
|
|
||||||
@ -183,13 +188,14 @@ SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val)
|
|||||||
└──────┴────────────────────────────────────────────────────┘
|
└──────┴────────────────────────────────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toDecimal(32\|64\|128)OrZero {#todecimal3264128orzero}
|
## toDecimal(32\|64\|128\|256)OrZero {#todecimal3264128orzero}
|
||||||
|
|
||||||
Converts an input value to the [Decimal(P,S)](../../sql-reference/data-types/decimal.md) data type. This family of functions include:
|
Converts an input value to the [Decimal(P,S)](../../sql-reference/data-types/decimal.md) data type. This family of functions include:
|
||||||
|
|
||||||
- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` data type.
|
- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` data type.
|
||||||
- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` data type.
|
- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` data type.
|
||||||
- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` data type.
|
- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` data type.
|
||||||
|
- `toDecimal256OrZero( expr, S)` — Results in `Decimal256(S)` data type.
|
||||||
|
|
||||||
These functions should be used instead of `toDecimal*()` functions, if you prefer to get a `0` value instead of an exception in the event of an input value parsing error.
|
These functions should be used instead of `toDecimal*()` functions, if you prefer to get a `0` value instead of an exception in the event of an input value parsing error.
|
||||||
|
|
||||||
|
@ -1,22 +1,24 @@
|
|||||||
# Decimal(P, S), Decimal32(S), Decimal64(S), Decimal128(S) {#decimalp-s-decimal32s-decimal64s-decimal128s}
|
# Decimal(P, S), Decimal32(S), Decimal64(S), Decimal128(S), Decimal256(S) {#decimalp-s-decimal32s-decimal64s-decimal128s}
|
||||||
|
|
||||||
Знаковые дробные числа с сохранением точности операций сложения, умножения и вычитания. Для деления осуществляется отбрасывание (не округление) знаков, не попадающих в младший десятичный разряд.
|
Знаковые дробные числа с сохранением точности операций сложения, умножения и вычитания. Для деления осуществляется отбрасывание (не округление) знаков, не попадающих в младший десятичный разряд.
|
||||||
|
|
||||||
## Параметры {#parametry}
|
## Параметры {#parametry}
|
||||||
|
|
||||||
- P - precision. Значение из диапазона \[ 1 : 38 \]. Определяет, сколько десятичных знаков (с учетом дробной части) может содержать число.
|
- P - precision. Значение из диапазона \[ 1 : 76 \]. Определяет, сколько десятичных знаков (с учетом дробной части) может содержать число.
|
||||||
- S - scale. Значение из диапазона \[ 0 : P \]. Определяет, сколько десятичных знаков содержится в дробной части числа.
|
- S - scale. Значение из диапазона \[ 0 : P \]. Определяет, сколько десятичных знаков содержится в дробной части числа.
|
||||||
|
|
||||||
В зависимости от параметра P Decimal(P, S) является синонимом:
|
В зависимости от параметра P Decimal(P, S) является синонимом:
|
||||||
- P из \[ 1 : 9 \] - для Decimal32(S)
|
- P из \[ 1 : 9 \] - для Decimal32(S)
|
||||||
- P из \[ 10 : 18 \] - для Decimal64(S)
|
- P из \[ 10 : 18 \] - для Decimal64(S)
|
||||||
- P из \[ 19 : 38 \] - для Decimal128(S)
|
- P из \[ 19 : 38 \] - для Decimal128(S)
|
||||||
|
- P из \[ 39 : 76 \] - для Decimal256(S)
|
||||||
|
|
||||||
## Диапазоны Decimal {#diapazony-decimal}
|
## Диапазоны Decimal {#diapazony-decimal}
|
||||||
|
|
||||||
- Decimal32(S) - ( -1 \* 10^(9 - S), 1 \* 10^(9 - S) )
|
- Decimal32(S) - ( -1 \* 10^(9 - S), 1 \* 10^(9 - S) )
|
||||||
- Decimal64(S) - ( -1 \* 10^(18 - S), 1 \* 10^(18 - S) )
|
- Decimal64(S) - ( -1 \* 10^(18 - S), 1 \* 10^(18 - S) )
|
||||||
- Decimal128(S) - ( -1 \* 10^(38 - S), 1 \* 10^(38 - S) )
|
- Decimal128(S) - ( -1 \* 10^(38 - S), 1 \* 10^(38 - S) )
|
||||||
|
- Decimal256(S) - ( -1 \* 10^(76 - S), 1 \* 10^(76 - S) )
|
||||||
|
|
||||||
Например, Decimal32(4) содержит числа от -99999.9999 до 99999.9999 c шагом 0.0001.
|
Например, Decimal32(4) содержит числа от -99999.9999 до 99999.9999 c шагом 0.0001.
|
||||||
|
|
||||||
@ -32,6 +34,7 @@
|
|||||||
- `Decimal64(S1) <op> Decimal32(S2) -> Decimal64(S)`
|
- `Decimal64(S1) <op> Decimal32(S2) -> Decimal64(S)`
|
||||||
- `Decimal128(S1) <op> Decimal32(S2) -> Decimal128(S)`
|
- `Decimal128(S1) <op> Decimal32(S2) -> Decimal128(S)`
|
||||||
- `Decimal128(S1) <op> Decimal64(S2) -> Decimal128(S)`
|
- `Decimal128(S1) <op> Decimal64(S2) -> Decimal128(S)`
|
||||||
|
- `Decimal256(S1) <op> Decimal<32|64|128>(S2) -> Decimal256(S)`
|
||||||
|
|
||||||
Для размера дробной части (scale) результата действуют следующие правила:
|
Для размера дробной части (scale) результата действуют следующие правила:
|
||||||
|
|
||||||
|
@ -1,19 +1,24 @@
|
|||||||
# UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64 {#uint8-uint16-uint32-uint64-int8-int16-int32-int64}
|
# UInt8, UInt16, UInt32, UInt64, UInt256, Int8, Int16, Int32, Int64, Int128, Int256 {#uint8-uint16-uint32-uint64-int8-int16-int32-int64}
|
||||||
|
|
||||||
Целые числа фиксированной длины, без знака или со знаком.
|
Целые числа фиксированной длины, без знака или со знаком.
|
||||||
|
|
||||||
## Диапазоны Int {#int-ranges}
|
## Диапазоны Int {#int-ranges}
|
||||||
|
|
||||||
- Int8 - \[ -128 : 127 \]
|
- Int8 - \[-128 : 127\]
|
||||||
- Int16 - \[ -32768 : 32767 \]
|
- Int16 - \[-32768 : 32767\]
|
||||||
- Int32 - \[ -2147483648 : 2147483647 \]
|
- Int32 - \[-2147483648 : 2147483647\]
|
||||||
- Int64 - \[ -9223372036854775808 : 9223372036854775807 \]
|
- Int64 - \[-9223372036854775808 : 9223372036854775807\]
|
||||||
|
- Int128 - \[-170141183460469231731687303715884105728 : 170141183460469231731687303715884105727\]
|
||||||
|
- Int256 - \[-57896044618658097711785492504343953926634992332820282019728792003956564819968 : 57896044618658097711785492504343953926634992332820282019728792003956564819967\]
|
||||||
|
|
||||||
## Диапазоны Uint {#uint-ranges}
|
## Диапазоны Uint {#uint-ranges}
|
||||||
|
|
||||||
- UInt8 - \[ 0 : 255 \]
|
- UInt8 - \[0 : 255\]
|
||||||
- UInt16 - \[ 0 : 65535 \]
|
- UInt16 - \[0 : 65535\]
|
||||||
- UInt32 - \[ 0 : 4294967295 \]
|
- UInt32 - \[0 : 4294967295\]
|
||||||
- UInt64 - \[ 0 : 18446744073709551615 \]
|
- UInt64 - \[0 : 18446744073709551615\]
|
||||||
|
- UInt256 - \[0 : 115792089237316195423570985008687907853269984665640564039457584007913129639935\]
|
||||||
|
|
||||||
|
UInt128 пока не реализован.
|
||||||
|
|
||||||
[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/int_uint/) <!--hide-->
|
[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/int_uint/) <!--hide-->
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
Поведение ClickHouse при конвертировании похоже на [поведение C++ программ](https://en.cppreference.com/w/cpp/language/implicit_conversion).
|
Поведение ClickHouse при конвертировании похоже на [поведение C++ программ](https://en.cppreference.com/w/cpp/language/implicit_conversion).
|
||||||
|
|
||||||
## toInt(8\|16\|32\|64) {#toint8163264}
|
## toInt(8\|16\|32\|64\|128\|256) {#toint8163264}
|
||||||
|
|
||||||
Преобразует входное значение к типу [Int](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает:
|
Преобразует входное значение к типу [Int](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает:
|
||||||
|
|
||||||
@ -14,6 +14,8 @@
|
|||||||
- `toInt16(expr)` — возвращает значение типа `Int16`.
|
- `toInt16(expr)` — возвращает значение типа `Int16`.
|
||||||
- `toInt32(expr)` — возвращает значение типа `Int32`.
|
- `toInt32(expr)` — возвращает значение типа `Int32`.
|
||||||
- `toInt64(expr)` — возвращает значение типа `Int64`.
|
- `toInt64(expr)` — возвращает значение типа `Int64`.
|
||||||
|
- `toInt128(expr)` — возвращает значение типа `Int128`.
|
||||||
|
- `toInt256(expr)` — возвращает значение типа `Int256`.
|
||||||
|
|
||||||
**Параметры**
|
**Параметры**
|
||||||
|
|
||||||
@ -21,7 +23,7 @@
|
|||||||
|
|
||||||
**Возвращаемое значение**
|
**Возвращаемое значение**
|
||||||
|
|
||||||
Целое число типа `Int8`, `Int16`, `Int32` или `Int64`.
|
Целое число типа `Int8`, `Int16`, `Int32`, `Int64`, `Int128` или `Int256`.
|
||||||
|
|
||||||
Функции используют [округление к нулю](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), т.е. обрезают дробную часть числа.
|
Функции используют [округление к нулю](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), т.е. обрезают дробную часть числа.
|
||||||
|
|
||||||
@ -39,9 +41,9 @@ SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8)
|
|||||||
└──────────────────────┴─────────────┴───────────────┴─────────────┘
|
└──────────────────────┴─────────────┴───────────────┴─────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toInt(8\|16\|32\|64)OrZero {#toint8163264orzero}
|
## toInt(8\|16\|32\|64\|128\|256)OrZero {#toint8163264orzero}
|
||||||
|
|
||||||
Принимает аргумент типа String и пытается его распарсить в Int(8\|16\|32\|64). Если не удалось - возвращает 0.
|
Принимает аргумент типа String и пытается его распарсить в Int(8\|16\|32\|64\|128\|256). Если не удалось - возвращает 0.
|
||||||
|
|
||||||
**Пример**
|
**Пример**
|
||||||
|
|
||||||
@ -55,9 +57,9 @@ select toInt64OrZero('123123'), toInt8OrZero('123qwe123')
|
|||||||
└─────────────────────────┴───────────────────────────┘
|
└─────────────────────────┴───────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toInt(8\|16\|32\|64)OrNull {#toint8163264ornull}
|
## toInt(8\|16\|32\|64\|128\|256)OrNull {#toint8163264ornull}
|
||||||
|
|
||||||
Принимает аргумент типа String и пытается его распарсить в Int(8\|16\|32\|64). Если не удалось - возвращает NULL.
|
Принимает аргумент типа String и пытается его распарсить в Int(8\|16\|32\|64\|128\|256). Если не удалось - возвращает NULL.
|
||||||
|
|
||||||
**Пример**
|
**Пример**
|
||||||
|
|
||||||
@ -71,7 +73,7 @@ select toInt64OrNull('123123'), toInt8OrNull('123qwe123')
|
|||||||
└─────────────────────────┴───────────────────────────┘
|
└─────────────────────────┴───────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toUInt(8\|16\|32\|64) {#touint8163264}
|
## toUInt(8\|16\|32\|64\|256) {#touint8163264}
|
||||||
|
|
||||||
Преобраует входное значение к типу [UInt](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает:
|
Преобраует входное значение к типу [UInt](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает:
|
||||||
|
|
||||||
@ -79,6 +81,7 @@ select toInt64OrNull('123123'), toInt8OrNull('123qwe123')
|
|||||||
- `toUInt16(expr)` — возвращает значение типа `UInt16`.
|
- `toUInt16(expr)` — возвращает значение типа `UInt16`.
|
||||||
- `toUInt32(expr)` — возвращает значение типа `UInt32`.
|
- `toUInt32(expr)` — возвращает значение типа `UInt32`.
|
||||||
- `toUInt64(expr)` — возвращает значение типа `UInt64`.
|
- `toUInt64(expr)` — возвращает значение типа `UInt64`.
|
||||||
|
- `toUInt256(expr)` — возвращает значение типа `UInt256`.
|
||||||
|
|
||||||
**Параметры**
|
**Параметры**
|
||||||
|
|
||||||
@ -86,7 +89,7 @@ select toInt64OrNull('123123'), toInt8OrNull('123qwe123')
|
|||||||
|
|
||||||
**Возвращаемое значение**
|
**Возвращаемое значение**
|
||||||
|
|
||||||
Целое число типа `UInt8`, `UInt16`, `UInt32` или `UInt64`.
|
Целое число типа `UInt8`, `UInt16`, `UInt32`, `UInt64` или `UInt256`.
|
||||||
|
|
||||||
Функции используют [округление к нулю](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), т.е. обрезают дробную часть числа.
|
Функции используют [округление к нулю](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), т.е. обрезают дробную часть числа.
|
||||||
|
|
||||||
@ -104,9 +107,9 @@ SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8)
|
|||||||
└─────────────────────┴───────────────┴────────────────┴──────────────┘
|
└─────────────────────┴───────────────┴────────────────┴──────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toUInt(8\|16\|32\|64)OrZero {#touint8163264orzero}
|
## toUInt(8\|16\|32\|64\|256)OrZero {#touint8163264orzero}
|
||||||
|
|
||||||
## toUInt(8\|16\|32\|64)OrNull {#touint8163264ornull}
|
## toUInt(8\|16\|32\|64\|256)OrNull {#touint8163264ornull}
|
||||||
|
|
||||||
## toFloat(32\|64) {#tofloat3264}
|
## toFloat(32\|64) {#tofloat3264}
|
||||||
|
|
||||||
@ -126,21 +129,23 @@ SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8)
|
|||||||
|
|
||||||
## toDateTimeOrNull {#todatetimeornull}
|
## toDateTimeOrNull {#todatetimeornull}
|
||||||
|
|
||||||
## toDecimal(32\|64\|128) {#todecimal3264128}
|
## toDecimal(32\|64\|128\|256) {#todecimal3264128}
|
||||||
|
|
||||||
Преобразует `value` к типу данных [Decimal](../../sql-reference/functions/type-conversion-functions.md) с точностью `S`. `value` может быть числом или строкой. Параметр `S` (scale) задаёт число десятичных знаков.
|
Преобразует `value` к типу данных [Decimal](../../sql-reference/functions/type-conversion-functions.md) с точностью `S`. `value` может быть числом или строкой. Параметр `S` (scale) задаёт число десятичных знаков.
|
||||||
|
|
||||||
- `toDecimal32(value, S)`
|
- `toDecimal32(value, S)`
|
||||||
- `toDecimal64(value, S)`
|
- `toDecimal64(value, S)`
|
||||||
- `toDecimal128(value, S)`
|
- `toDecimal128(value, S)`
|
||||||
|
- `toDecimal256(value, S)`
|
||||||
|
|
||||||
## toDecimal(32\|64\|128)OrNull {#todecimal3264128ornull}
|
## toDecimal(32\|64\|128\|256)OrNull {#todecimal3264128ornull}
|
||||||
|
|
||||||
Преобразует входную строку в значение с типом данных [Nullable (Decimal (P, S))](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает в себя:
|
Преобразует входную строку в значение с типом данных [Nullable (Decimal (P, S))](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает в себя:
|
||||||
|
|
||||||
- `toDecimal32OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal32(S))`.
|
- `toDecimal32OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal32(S))`.
|
||||||
- `toDecimal64OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal64(S))`.
|
- `toDecimal64OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal64(S))`.
|
||||||
- `toDecimal128OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal128(S))`.
|
- `toDecimal128OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal128(S))`.
|
||||||
|
- `toDecimal256OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal256(S))`.
|
||||||
|
|
||||||
Эти функции следует использовать вместо функций `toDecimal*()`, если при ошибке обработки входного значения вы хотите получать `NULL` вместо исключения.
|
Эти функции следует использовать вместо функций `toDecimal*()`, если при ошибке обработки входного значения вы хотите получать `NULL` вместо исключения.
|
||||||
|
|
||||||
@ -178,13 +183,14 @@ SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val)
|
|||||||
└──────┴────────────────────────────────────────────────────┘
|
└──────┴────────────────────────────────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## toDecimal(32\|64\|128)OrZero {#todecimal3264128orzero}
|
## toDecimal(32\|64\|128\|256)OrZero {#todecimal3264128orzero}
|
||||||
|
|
||||||
Преобразует тип входного значения в [Decimal (P, S)](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает в себя:
|
Преобразует тип входного значения в [Decimal (P, S)](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает в себя:
|
||||||
|
|
||||||
- `toDecimal32OrZero( expr, S)` — возвращает значение типа `Decimal32(S)`.
|
- `toDecimal32OrZero( expr, S)` — возвращает значение типа `Decimal32(S)`.
|
||||||
- `toDecimal64OrZero( expr, S)` — возвращает значение типа `Decimal64(S)`.
|
- `toDecimal64OrZero( expr, S)` — возвращает значение типа `Decimal64(S)`.
|
||||||
- `toDecimal128OrZero( expr, S)` — возвращает значение типа `Decimal128(S)`.
|
- `toDecimal128OrZero( expr, S)` — возвращает значение типа `Decimal128(S)`.
|
||||||
|
- `toDecimal256OrZero( expr, S)` — возвращает значение типа `Decimal256(S)`.
|
||||||
|
|
||||||
Эти функции следует использовать вместо функций `toDecimal*()`, если при ошибке обработки входного значения вы хотите получать `0` вместо исключения.
|
Эти функции следует использовать вместо функций `toDecimal*()`, если при ошибке обработки входного значения вы хотите получать `0` вместо исключения.
|
||||||
|
|
||||||
|
@ -565,14 +565,14 @@ void ActionsMatcher::visit(const ASTIdentifier & identifier, const ASTPtr & ast,
|
|||||||
/// The requested column is not in the block.
|
/// The requested column is not in the block.
|
||||||
/// If such a column exists in the table, then the user probably forgot to surround it with an aggregate function or add it to GROUP BY.
|
/// If such a column exists in the table, then the user probably forgot to surround it with an aggregate function or add it to GROUP BY.
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
for (const auto & column_name_type : data.source_columns)
|
for (const auto & column_name_type : data.source_columns)
|
||||||
|
{
|
||||||
if (column_name_type.name == column_name.get(ast))
|
if (column_name_type.name == column_name.get(ast))
|
||||||
found = true;
|
{
|
||||||
|
throw Exception("Column " + backQuote(column_name.get(ast)) + " is not under aggregate function and not in GROUP BY",
|
||||||
if (found)
|
|
||||||
throw Exception("Column " + backQuote(column_name.get(ast)) + " is not under aggregate function and not in GROUP BY",
|
|
||||||
ErrorCodes::NOT_AN_AGGREGATE);
|
ErrorCodes::NOT_AN_AGGREGATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Special check for WITH statement alias. Add alias action to be able to use this alias.
|
/// Special check for WITH statement alias. Add alias action to be able to use this alias.
|
||||||
if (identifier.prefer_alias_to_column_name && !identifier.alias.empty())
|
if (identifier.prefer_alias_to_column_name && !identifier.alias.empty())
|
||||||
|
@ -21,28 +21,6 @@
|
|||||||
#include <Interpreters/ExpressionAnalyzer.h>
|
#include <Interpreters/ExpressionAnalyzer.h>
|
||||||
#include <Interpreters/Context.h>
|
#include <Interpreters/Context.h>
|
||||||
|
|
||||||
/// Allow to use __uint128_t as a template parameter for boost::rational.
|
|
||||||
// https://stackoverflow.com/questions/41198673/uint128-t-not-working-with-clang-and-libstdc
|
|
||||||
#if 0
|
|
||||||
#if !defined(__GLIBCXX_BITSIZE_INT_N_0) && defined(__SIZEOF_INT128__)
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
template <>
|
|
||||||
struct numeric_limits<__uint128_t>
|
|
||||||
{
|
|
||||||
static constexpr bool is_specialized = true;
|
|
||||||
static constexpr bool is_signed = false;
|
|
||||||
static constexpr bool is_integer = true;
|
|
||||||
static constexpr int radix = 2;
|
|
||||||
static constexpr int digits = 128;
|
|
||||||
static constexpr int digits10 = 38;
|
|
||||||
static constexpr __uint128_t min () { return 0; } // used in boost 1.65.1+
|
|
||||||
static constexpr __uint128_t max () { return __uint128_t(0) - 1; } // used in boost 1.68.0+
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <DataTypes/DataTypeDate.h>
|
#include <DataTypes/DataTypeDate.h>
|
||||||
#include <DataTypes/DataTypeEnum.h>
|
#include <DataTypes/DataTypeEnum.h>
|
||||||
#include <DataTypes/DataTypesNumber.h>
|
#include <DataTypes/DataTypesNumber.h>
|
||||||
|
@ -446,7 +446,7 @@ static StoragePtr create(const StorageFactory::Arguments & args)
|
|||||||
"No replica name in config" + getMergeTreeVerboseHelp(is_extended_storage_def), ErrorCodes::NO_REPLICA_NAME_GIVEN);
|
"No replica name in config" + getMergeTreeVerboseHelp(is_extended_storage_def), ErrorCodes::NO_REPLICA_NAME_GIVEN);
|
||||||
++arg_num;
|
++arg_num;
|
||||||
}
|
}
|
||||||
else if (is_extended_storage_def && !has_arguments)
|
else if (is_extended_storage_def && arg_cnt == 0)
|
||||||
{
|
{
|
||||||
/// Try use default values if arguments are not specified.
|
/// Try use default values if arguments are not specified.
|
||||||
/// Note: {uuid} macro works for ON CLUSTER queries when database engine is Atomic.
|
/// Note: {uuid} macro works for ON CLUSTER queries when database engine is Atomic.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build_config": [
|
"build_config": [
|
||||||
{
|
{
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"build-type": "",
|
"build-type": "",
|
||||||
"sanitizer": "",
|
"sanitizer": "",
|
||||||
"package-type": "deb",
|
"package-type": "deb",
|
||||||
@ -12,7 +12,7 @@
|
|||||||
"with_coverage": false
|
"with_coverage": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"build-type": "",
|
"build-type": "",
|
||||||
"sanitizer": "",
|
"sanitizer": "",
|
||||||
"package-type": "performance",
|
"package-type": "performance",
|
||||||
@ -227,7 +227,7 @@
|
|||||||
},
|
},
|
||||||
"Functional stateful tests (release)": {
|
"Functional stateful tests (release)": {
|
||||||
"required_build_properties": {
|
"required_build_properties": {
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"package_type": "deb",
|
"package_type": "deb",
|
||||||
"build_type": "relwithdebuginfo",
|
"build_type": "relwithdebuginfo",
|
||||||
"sanitizer": "none",
|
"sanitizer": "none",
|
||||||
@ -239,7 +239,7 @@
|
|||||||
},
|
},
|
||||||
"Functional stateful tests (release, DatabaseOrdinary)": {
|
"Functional stateful tests (release, DatabaseOrdinary)": {
|
||||||
"required_build_properties": {
|
"required_build_properties": {
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"package_type": "deb",
|
"package_type": "deb",
|
||||||
"build_type": "relwithdebuginfo",
|
"build_type": "relwithdebuginfo",
|
||||||
"sanitizer": "none",
|
"sanitizer": "none",
|
||||||
@ -311,7 +311,7 @@
|
|||||||
},
|
},
|
||||||
"Functional stateless tests (release)": {
|
"Functional stateless tests (release)": {
|
||||||
"required_build_properties": {
|
"required_build_properties": {
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"package_type": "deb",
|
"package_type": "deb",
|
||||||
"build_type": "relwithdebuginfo",
|
"build_type": "relwithdebuginfo",
|
||||||
"sanitizer": "none",
|
"sanitizer": "none",
|
||||||
@ -335,7 +335,7 @@
|
|||||||
},
|
},
|
||||||
"Functional stateless tests (release, polymorphic parts enabled)": {
|
"Functional stateless tests (release, polymorphic parts enabled)": {
|
||||||
"required_build_properties": {
|
"required_build_properties": {
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"package_type": "deb",
|
"package_type": "deb",
|
||||||
"build_type": "relwithdebuginfo",
|
"build_type": "relwithdebuginfo",
|
||||||
"sanitizer": "none",
|
"sanitizer": "none",
|
||||||
@ -347,7 +347,7 @@
|
|||||||
},
|
},
|
||||||
"Functional stateless tests (release, DatabaseOrdinary)": {
|
"Functional stateless tests (release, DatabaseOrdinary)": {
|
||||||
"required_build_properties": {
|
"required_build_properties": {
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"package_type": "deb",
|
"package_type": "deb",
|
||||||
"build_type": "relwithdebuginfo",
|
"build_type": "relwithdebuginfo",
|
||||||
"sanitizer": "none",
|
"sanitizer": "none",
|
||||||
@ -431,7 +431,7 @@
|
|||||||
},
|
},
|
||||||
"Integration tests (release)": {
|
"Integration tests (release)": {
|
||||||
"required_build_properties": {
|
"required_build_properties": {
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"package_type": "deb",
|
"package_type": "deb",
|
||||||
"build_type": "relwithdebuginfo",
|
"build_type": "relwithdebuginfo",
|
||||||
"sanitizer": "none",
|
"sanitizer": "none",
|
||||||
@ -455,7 +455,7 @@
|
|||||||
},
|
},
|
||||||
"Compatibility check": {
|
"Compatibility check": {
|
||||||
"required_build_properties": {
|
"required_build_properties": {
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"package_type": "deb",
|
"package_type": "deb",
|
||||||
"build_type": "relwithdebuginfo",
|
"build_type": "relwithdebuginfo",
|
||||||
"sanitizer": "none",
|
"sanitizer": "none",
|
||||||
@ -479,7 +479,7 @@
|
|||||||
},
|
},
|
||||||
"Testflows check": {
|
"Testflows check": {
|
||||||
"required_build_properties": {
|
"required_build_properties": {
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"package_type": "deb",
|
"package_type": "deb",
|
||||||
"build_type": "relwithdebuginfo",
|
"build_type": "relwithdebuginfo",
|
||||||
"sanitizer": "none",
|
"sanitizer": "none",
|
||||||
@ -575,7 +575,7 @@
|
|||||||
},
|
},
|
||||||
"Release": {
|
"Release": {
|
||||||
"required_build_properties": {
|
"required_build_properties": {
|
||||||
"compiler": "gcc-10",
|
"compiler": "clang-11",
|
||||||
"package_type": "deb",
|
"package_type": "deb",
|
||||||
"build_type": "relwithdebuginfo",
|
"build_type": "relwithdebuginfo",
|
||||||
"sanitizer": "none",
|
"sanitizer": "none",
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
CREATE TABLE mt (v UInt8) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_01497/mt')
|
||||||
|
ORDER BY tuple() -- { serverError 36 }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user