Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into filelog-engine

This commit is contained in:
feng lv 2021-10-14 02:09:51 +00:00
commit 21f7ecbd9f
74 changed files with 673 additions and 17460 deletions

View File

@ -13,6 +13,7 @@
#include <Common/StackTrace.h>
#include <Common/getNumberOfPhysicalCPUCores.h>
#include <Core/ServerUUID.h>
#include <Common/hex.h>
#if !defined(ARCADIA_BUILD)
# include "Common/config_version.h"
@ -64,41 +65,6 @@ void setExtras()
sentry_set_extra("disk_free_space", sentry_value_new_string(formatReadableSizeWithBinarySuffix(fs::space(server_data_path).free).c_str()));
}
void sentry_logger(sentry_level_e level, const char * message, va_list args, void *)
{
auto * logger = &Poco::Logger::get("SentryWriter");
size_t size = 1024;
char buffer[size];
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-nonliteral"
#endif
if (vsnprintf(buffer, size, message, args) >= 0)
{
#ifdef __clang__
#pragma clang diagnostic pop
#endif
switch (level)
{
case SENTRY_LEVEL_DEBUG:
logger->debug(buffer);
break;
case SENTRY_LEVEL_INFO:
logger->information(buffer);
break;
case SENTRY_LEVEL_WARNING:
logger->warning(buffer);
break;
case SENTRY_LEVEL_ERROR:
logger->error(buffer);
break;
case SENTRY_LEVEL_FATAL:
logger->fatal(buffer);
break;
}
}
}
}
@ -107,13 +73,13 @@ void SentryWriter::initialize(Poco::Util::LayeredConfiguration & config)
bool enabled = false;
bool debug = config.getBool("send_crash_reports.debug", false);
auto * logger = &Poco::Logger::get("SentryWriter");
if (config.getBool("send_crash_reports.enabled", false))
{
if (debug || (strlen(VERSION_OFFICIAL) > 0)) //-V560
{
enabled = true;
}
}
if (enabled)
{
server_data_path = config.getString("path", "");
@ -126,7 +92,6 @@ void SentryWriter::initialize(Poco::Util::LayeredConfiguration & config)
sentry_options_t * options = sentry_options_new(); /// will be freed by sentry_init or sentry_shutdown
sentry_options_set_release(options, VERSION_STRING_SHORT);
sentry_options_set_logger(options, &sentry_logger, nullptr);
if (debug)
{
sentry_options_set_debug(options, 1);
@ -199,34 +164,34 @@ void SentryWriter::onFault(int sig, const std::string & error_message, const Sta
if (stack_size > 0)
{
ssize_t offset = stack_trace.getOffset();
char instruction_addr[100];
char instruction_addr[19]
{
'0', 'x',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
'\0'
};
StackTrace::Frames frames;
StackTrace::symbolize(stack_trace.getFramePointers(), offset, stack_size, frames);
for (ssize_t i = stack_size - 1; i >= offset; --i)
{
const StackTrace::Frame & current_frame = frames[i];
sentry_value_t sentry_frame = sentry_value_new_object();
UInt64 frame_ptr = reinterpret_cast<UInt64>(current_frame.virtual_addr);
if (std::snprintf(instruction_addr, sizeof(instruction_addr), "0x%" PRIx64, frame_ptr) >= 0)
{
sentry_value_set_by_key(sentry_frame, "instruction_addr", sentry_value_new_string(instruction_addr));
}
writeHexUIntLowercase(frame_ptr, instruction_addr + 2);
sentry_value_set_by_key(sentry_frame, "instruction_addr", sentry_value_new_string(instruction_addr));
if (current_frame.symbol.has_value())
{
sentry_value_set_by_key(sentry_frame, "function", sentry_value_new_string(current_frame.symbol.value().c_str()));
}
if (current_frame.file.has_value())
{
sentry_value_set_by_key(sentry_frame, "filename", sentry_value_new_string(current_frame.file.value().c_str()));
}
if (current_frame.line.has_value())
{
sentry_value_set_by_key(sentry_frame, "lineno", sentry_value_new_int32(current_frame.line.value()));
}
sentry_value_append(sentry_frames, sentry_frame);
}

View File

@ -20,35 +20,23 @@ endif ()
if (CMAKE_CROSSCOMPILING)
if (OS_DARWIN)
# FIXME: broken dependencies
set (ENABLE_PROTOBUF OFF CACHE INTERNAL "")
set (ENABLE_GRPC OFF CACHE INTERNAL "") # no protobuf -> no grpc
set (USE_SNAPPY OFF CACHE INTERNAL "")
set (ENABLE_PARQUET OFF CACHE INTERNAL "") # no snappy and protobuf -> no parquet
set (ENABLE_ORC OFF CACHE INTERNAL "") # no arrow (parquet) -> no orc
set (ENABLE_ICU OFF CACHE INTERNAL "")
set (ENABLE_FASTOPS OFF CACHE INTERNAL "")
elseif (OS_LINUX OR OS_ANDROID)
if (ARCH_AARCH64)
# FIXME: broken dependencies
set (ENABLE_PROTOBUF OFF CACHE INTERNAL "")
set (ENABLE_GRPC OFF CACHE INTERNAL "")
set (USE_SENTRY OFF CACHE INTERNAL "")
# set (ENABLE_ROCKSDB OFF CACHE INTERNAL "")
elseif (ARCH_PPC64LE)
set (ENABLE_PROTOBUF OFF CACHE INTERNAL "")
set (ENABLE_GRPC OFF CACHE INTERNAL "")
set (USE_SENTRY OFF CACHE INTERNAL "")
# set (ENABLE_ROCKSDB OFF CACHE INTERNAL "")
endif ()
elseif (OS_FREEBSD)
# FIXME: broken dependencies
set (ENABLE_PROTOBUF OFF CACHE INTERNAL "")
set (ENABLE_PARQUET OFF CACHE INTERNAL "")
set (ENABLE_ORC OFF CACHE INTERNAL "")
set (ENABLE_GRPC OFF CACHE INTERNAL "")
set (ENABLE_ORC OFF CACHE INTERNAL "") # no protobuf -> no parquet -> no orc
set (ENABLE_EMBEDDED_COMPILER OFF CACHE INTERNAL "")
else ()
message (FATAL_ERROR "Trying to cross-compile to unsupported system: ${CMAKE_SYSTEM_NAME}!")

2
contrib/boost vendored

@ -1 +1 @@
Subproject commit 311cfd498966d4f77742703d605d9c2e7b4cc6a8
Subproject commit 79358a3106aab6af464430ed67c7efafebf5cd6f

View File

@ -187,12 +187,12 @@ function(protobuf_generate_grpc)
add_custom_command(
OUTPUT ${_generated_srcs}
COMMAND $<TARGET_FILE:protobuf::protoc>
COMMAND $<TARGET_FILE: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}
DEPENDS ${_abs_file} protoc ${protobuf_generate_grpc_PLUGIN}
COMMENT "Running ${protobuf_generate_grpc_LANGUAGE} protocol buffer compiler on ${_proto}"
VERBATIM)
endforeach()

View File

@ -10,8 +10,82 @@ else ()
set(protobuf_BUILD_SHARED_LIBS ON CACHE INTERNAL "" FORCE)
endif ()
if (CMAKE_CROSSCOMPILING)
# Will build 'protoc' for host arch instead of cross-compiling
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE INTERNAL "" FORCE)
endif ()
add_subdirectory("${protobuf_SOURCE_DIR}/cmake" "${protobuf_BINARY_DIR}")
# We don't want to stop compilation on warnings in protobuf's headers.
# The following line overrides the value assigned by the command target_include_directories() in libprotobuf.cmake
# The following line overrides the value assigned by the command target_include_directories() in libprotobuf.cmake
set_property(TARGET libprotobuf PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${protobuf_SOURCE_DIR}/src")
if (CMAKE_CROSSCOMPILING)
# Build 'protoc' for host arch
set (PROTOC_BUILD_DIR "${protobuf_BINARY_DIR}/build")
if (NOT EXISTS "${PROTOC_BUILD_DIR}/protoc")
# This is quite ugly but I cannot make dependencies work propery.
execute_process(
COMMAND mkdir -p ${PROTOC_BUILD_DIR}
COMMAND_ECHO STDOUT)
execute_process(
COMMAND ${CMAKE_COMMAND}
"-G${CMAKE_GENERATOR}"
"-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
"-Dprotobuf_BUILD_TESTS=0"
"-Dprotobuf_BUILD_CONFORMANCE=0"
"-Dprotobuf_BUILD_EXAMPLES=0"
"-Dprotobuf_BUILD_PROTOC_BINARIES=1"
"${protobuf_SOURCE_DIR}/cmake"
WORKING_DIRECTORY "${PROTOC_BUILD_DIR}"
COMMAND_ECHO STDOUT)
execute_process(
COMMAND ${CMAKE_COMMAND} --build "${PROTOC_BUILD_DIR}"
COMMAND_ECHO STDOUT)
endif ()
# add_custom_command (
# OUTPUT ${PROTOC_BUILD_DIR}
# COMMAND mkdir -p ${PROTOC_BUILD_DIR})
#
# add_custom_command (
# OUTPUT "${PROTOC_BUILD_DIR}/CMakeCache.txt"
#
# COMMAND ${CMAKE_COMMAND}
# -G"${CMAKE_GENERATOR}"
# -DCMAKE_MAKE_PROGRAM="${CMAKE_MAKE_PROGRAM}"
# -DCMAKE_C_COMPILER="${CMAKE_C_COMPILER}"
# -DCMAKE_CXX_COMPILER="${CMAKE_CXX_COMPILER}"
# -Dprotobuf_BUILD_TESTS=0
# -Dprotobuf_BUILD_CONFORMANCE=0
# -Dprotobuf_BUILD_EXAMPLES=0
# -Dprotobuf_BUILD_PROTOC_BINARIES=1
# "${protobuf_SOURCE_DIR}/cmake"
#
# DEPENDS "${PROTOC_BUILD_DIR}"
# WORKING_DIRECTORY "${PROTOC_BUILD_DIR}"
# COMMENT "Configuring 'protoc' for host architecture."
# USES_TERMINAL)
#
# add_custom_command (
# OUTPUT "${PROTOC_BUILD_DIR}/protoc"
# COMMAND ${CMAKE_COMMAND} --build "${PROTOC_BUILD_DIR}"
# DEPENDS "${PROTOC_BUILD_DIR}/CMakeCache.txt"
# COMMENT "Building 'protoc' for host architecture."
# USES_TERMINAL)
#
# add_custom_target (protoc-host DEPENDS "${PROTOC_BUILD_DIR}/protoc")
add_executable(protoc IMPORTED GLOBAL)
set_target_properties (protoc PROPERTIES IMPORTED_LOCATION "${PROTOC_BUILD_DIR}/protoc")
add_dependencies(protoc "${PROTOC_BUILD_DIR}/protoc")
endif ()

View File

@ -181,9 +181,9 @@ function(protobuf_generate)
add_custom_command(
OUTPUT ${_generated_srcs}
COMMAND $<TARGET_FILE:protobuf::protoc>
COMMAND $<TARGET_FILE:protoc>
ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file}
DEPENDS ${_abs_file} protobuf::protoc
DEPENDS ${_abs_file} protoc
COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}"
VERBATIM)
endforeach()

View File

@ -262,11 +262,13 @@ function run_tests
start_server
set +e
time clickhouse-test --hung-check -j 8 --order=random \
--fast-tests-only --no-long --testname --shard --zookeeper \
-- "$FASTTEST_FOCUS" 2>&1 \
| ts '%Y-%m-%d %H:%M:%S' \
| tee "$FASTTEST_OUTPUT/test_result.txt"
set -e
}
case "$stage" in

View File

@ -108,8 +108,10 @@ function run_tests()
ADDITIONAL_OPTIONS+=('--replicated-database')
fi
set +e
clickhouse-test --testname --shard --zookeeper --no-stateless --hung-check --print-time "${ADDITIONAL_OPTIONS[@]}" \
"$SKIP_TESTS_OPTION" 2>&1 | ts '%Y-%m-%d %H:%M:%S' | tee test_output/test_result.txt
set -e
}
export -f run_tests

View File

@ -96,10 +96,12 @@ function run_tests()
ADDITIONAL_OPTIONS+=('8')
fi
set +e
clickhouse-test --testname --shard --zookeeper --hung-check --print-time \
--test-runs "$NUM_TRIES" "${ADDITIONAL_OPTIONS[@]}" 2>&1 \
| ts '%Y-%m-%d %H:%M:%S' \
| tee -a test_output/test_result.txt
set -e
}
export -f run_tests
@ -114,12 +116,6 @@ grep -Fa "Fatal" /var/log/clickhouse-server/clickhouse-server.log ||:
pigz < /var/log/clickhouse-server/clickhouse-server.log > /test_output/clickhouse-server.log.gz &
clickhouse-client -q "select * from system.query_log format TSVWithNamesAndTypes" | pigz > /test_output/query-log.tsv.gz &
clickhouse-client -q "select * from system.query_thread_log format TSVWithNamesAndTypes" | pigz > /test_output/query-thread-log.tsv.gz &
clickhouse-client --allow_introspection_functions=1 -q "
WITH
arrayMap(x -> concat(demangle(addressToSymbol(x)), ':', addressToLine(x)), trace) AS trace_array,
arrayStringConcat(trace_array, '\n') AS trace_string
SELECT * EXCEPT(trace), trace_string FROM system.trace_log FORMAT TSVWithNamesAndTypes
" | pigz > /test_output/trace-log.tsv.gz &
# Also export trace log in flamegraph-friendly format.
for trace_type in CPU Memory Real
@ -146,6 +142,7 @@ fi
tar -chf /test_output/text_log_dump.tar /var/lib/clickhouse/data/system/text_log ||:
tar -chf /test_output/query_log_dump.tar /var/lib/clickhouse/data/system/query_log ||:
tar -chf /test_output/zookeeper_log_dump.tar /var/lib/clickhouse/data/system/zookeeper_log ||:
tar -chf /test_output/trace_log_dump.tar /var/lib/clickhouse/data/system/trace_log ||:
tar -chf /test_output/coordination.tar /var/lib/clickhouse/coordination ||:
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then

View File

@ -28,6 +28,7 @@ def process_test_log(log_path):
test_results = []
with open(log_path, 'r') as test_file:
for line in test_file:
original_line = line
line = line.strip()
if any(s in line for s in NO_TASK_TIMEOUT_SIGNS):
task_timeout = False
@ -49,19 +50,24 @@ def process_test_log(log_path):
total += 1
if TIMEOUT_SIGN in line:
failed += 1
test_results.append((test_name, "Timeout", test_time))
test_results.append((test_name, "Timeout", test_time, []))
elif FAIL_SIGN in line:
failed += 1
test_results.append((test_name, "FAIL", test_time))
test_results.append((test_name, "FAIL", test_time, []))
elif UNKNOWN_SIGN in line:
unknown += 1
test_results.append((test_name, "FAIL", test_time))
test_results.append((test_name, "FAIL", test_time, []))
elif SKIPPED_SIGN in line:
skipped += 1
test_results.append((test_name, "SKIPPED", test_time))
test_results.append((test_name, "SKIPPED", test_time, []))
else:
success += int(OK_SIGN in line)
test_results.append((test_name, "OK", test_time))
test_results.append((test_name, "OK", test_time, []))
elif len(test_results) > 0 and test_results[-1][1] == "FAIL":
test_results[-1][3].append(original_line)
test_results = [(test[0], test[1], test[2], ''.join(test[3])) for test in test_results]
return total, skipped, unknown, failed, success, hung, task_timeout, retries, test_results
def process_result(result_path):
@ -89,14 +95,14 @@ def process_result(result_path):
if hung:
description = "Some queries hung, "
state = "failure"
test_results.append(("Some queries hung", "FAIL", "0"))
test_results.append(("Some queries hung", "FAIL", "0", ""))
elif task_timeout:
description = "Timeout, "
state = "failure"
test_results.append(("Timeout", "FAIL", "0"))
test_results.append(("Timeout", "FAIL", "0", ""))
elif retries:
description = "Some tests restarted, "
test_results.append(("Some tests restarted", "SKIPPED", "0"))
test_results.append(("Some tests restarted", "SKIPPED", "0", ""))
else:
description = ""

View File

@ -0,0 +1,59 @@
#!/bin/sh -e
OS=$(uname -s)
ARCH=$(uname -m)
DIR=
if [ "${OS}" = "Linux" ]
then
if [ "${ARCH}" = "x86_64" ]
then
DIR="amd64"
elif [ "${ARCH}" = "aarch64" ]
then
DIR="aarch64"
elif [ "${ARCH}" = "powerpc64le" ]
then
DIR="powerpc64le"
fi
elif [ "${OS}" = "FreeBSD" ]
then
if [ "${ARCH}" = "x86_64" ]
then
DIR="freebsd"
elif [ "${ARCH}" = "aarch64" ]
then
DIR="freebsd-aarch64"
elif [ "${ARCH}" = "powerpc64le" ]
then
DIR="freebsd-powerpc64le"
fi
elif [ "${OS}" = "Darwin" ]
then
if [ "${ARCH}" = "x86_64" ]
then
DIR="macos"
elif [ "${ARCH}" = "aarch64" ]
then
DIR="macos-aarch64"
fi
fi
if [ -z "${DIR}" ]
then
echo "The '${OS}' operating system with the '${ARCH}' architecture is not supported."
exit 1
fi
URL="https://builds.clickhouse.com/master/${DIR}/clickhouse"
echo "Will download ${URL}"
curl -O "${URL}" && chmod a+x clickhouse &&
echo "Successfully downloaded the ClickHouse binary, you can run it as:
./clickhouse"
if [ "${OS}" = "Linux" ]
then
echo "You can also install it:
sudo ./clickhouse install"
fi

View File

@ -15,6 +15,7 @@ toc_title: Adopters
| <a href="http://www.adscribe.tv/" class="favicon">AdScribe</a> | Ads | TV Analytics | — | — | [A quote from CTO](https://altinity.com/24x7-support/) |
| <a href="https://ahrefs.com/" class="favicon">Ahrefs</a> | SEO | Analytics | — | — | [Job listing](https://ahrefs.com/jobs/data-scientist-search) |
| <a href="https://cn.aliyun.com/" class="favicon">Alibaba Cloud</a> | Cloud | Managed Service | — | — | [Official Website](https://help.aliyun.com/product/144466.html) |
| <a href="https://cn.aliyun.com/" class="favicon">Alibaba Cloud</a> | Cloud | E-MapReduce | — | — | [Official Website](https://help.aliyun.com/document_detail/212195.html) |
| <a href="https://alohabrowser.com/" class="favicon">Aloha Browser</a> | Mobile App | Browser backend | — | — | [Slides in Russian, May 2019](https://presentations.clickhouse.com/meetup22/aloha.pdf) |
| <a href="https://altinity.com/" class="favicon">Altinity</a> | Cloud, SaaS | Main product | — | — | [Official Website](https://altinity.com/) |
| <a href="https://amadeus.com/" class="favicon">Amadeus</a> | Travel | Analytics | — | — | [Press Release, April 2018](https://www.altinity.com/blog/2018/4/5/amadeus-technologies-launches-investment-and-insights-tool-based-on-machine-learning-and-strategy-algorithms) |
@ -31,6 +32,7 @@ toc_title: Adopters
| <a href="https://cardsmobile.ru/" class="favicon">CardsMobile</a> | Finance | Analytics | — | — | [VC.ru](https://vc.ru/s/cardsmobile/143449-rukovoditel-gruppy-analiza-dannyh) |
| <a href="https://carto.com/" class="favicon">CARTO</a> | Business Intelligence | Geo analytics | — | — | [Geospatial processing with ClickHouse](https://carto.com/blog/geospatial-processing-with-clickhouse/) |
| <a href="http://public.web.cern.ch/public/" class="favicon">CERN</a> | Research | Experiment | — | — | [Press release, April 2012](https://www.yandex.com/company/press_center/press_releases/2012/2012-04-10/) |
| <a href="https://www.checklyhq.com/" class="favicon">Checkly</a> | Software Development | Analytics | — | — | [Tweet, October 2021](https://twitter.com/tim_nolet/status/1445810665743081474?s=20) |
| <a href="http://cisco.com/" class="favicon">Cisco</a> | Networking | Traffic analysis | — | — | [Lightning talk, October 2019](https://youtu.be/-hI1vDR2oPY?t=5057) |
| <a href="https://www.citadelsecurities.com/" class="favicon">Citadel Securities</a> | Finance | — | — | — | [Contribution, March 2019](https://github.com/ClickHouse/ClickHouse/pull/4774) |
| <a href="https://city-mobil.ru" class="favicon">Citymobil</a> | Taxi | Analytics | — | — | [Blog Post in Russian, March 2020](https://habr.com/en/company/citymobil/blog/490660/) |
@ -115,6 +117,7 @@ toc_title: Adopters
| <a href="https://seo.do/" class="favicon">seo.do</a> | Analytics | Main product | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/CH%20Presentation-%20Metehan%20Çetinkaya.pdf) |
| <a href="http://www.sgk.gov.tr/wps/portal/sgk/tr" class="favicon">SGK</a> | Government Social Security | Analytics | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/ClickHouse%20Meetup-Ramazan%20POLAT.pdf) |
| <a href="http://english.sina.com/index.html" class="favicon">Sina</a> | News | — | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/6.%20ClickHouse最佳实践%20高鹏_新浪.pdf) |
| <a href="https://www.sipfront.com/" class="favicon">Sipfront</a> | Software Development | Analytics | — | — | [Tweet, October 2021](https://twitter.com/andreasgranig/status/1446404332337913895?s=20) |
| <a href="https://smi2.ru/" class="favicon">SMI2</a> | News | Analytics | — | — | [Blog Post in Russian, November 2017](https://habr.com/ru/company/smi2/blog/314558/) |
| <a href="https://www.spark.co.nz/" class="favicon">Spark New Zealand</a> | Telecommunications | Security Operations | — | — | [Blog Post, Feb 2020](https://blog.n0p.me/2020/02/2020-02-05-dnsmonster/) |
| <a href="https://splitbee.io" class="favicon">Splitbee</a> | Analytics | Main Product | — | — | [Blog Post, Mai 2021](https://splitbee.io/blog/new-pricing) |

View File

@ -39,9 +39,9 @@ In ClickHouse, data can reside on different shards. Each shard can be a group of
ClickHouse supports a [declarative query language based on SQL](../sql-reference/index.md) that is identical to the ANSI SQL standard in [many cases](../sql-reference/ansi.md).
Supported queries include [GROUP BY](../sql-reference/statements/select/group-by.md), [ORDER BY](../sql-reference/statements/select/order-by.md), subqueries in [FROM](../sql-reference/statements/select/from.md), [JOIN](../sql-reference/statements/select/join.md) clause, [IN](../sql-reference/operators/in.md) operator, and scalar subqueries.
Supported queries include [GROUP BY](../sql-reference/statements/select/group-by.md), [ORDER BY](../sql-reference/statements/select/order-by.md), subqueries in [FROM](../sql-reference/statements/select/from.md), [JOIN](../sql-reference/statements/select/join.md) clause, [IN](../sql-reference/operators/in.md) operator, [window functions](../sql-reference/window-functions/index.md) and scalar subqueries.
Correlated (dependent) subqueries and window functions are not supported at the time of writing but might become available in the future.
Correlated (dependent) subqueries are not supported at the time of writing but might become available in the future.
## Vector Computation Engine {#vector-engine}

View File

@ -1,4 +1,3 @@
---
toc_priority: 58
toc_title: Usage Recommendations
---
@ -60,7 +59,7 @@ $ echo 4096 | sudo tee /sys/block/md2/md/stripe_cache_size
Calculate the exact number from the number of devices and the block size, using the formula: `2 * num_devices * chunk_size_in_bytes / 4096`.
A block size of 1024 KB is sufficient for all RAID configurations.
A block size of 64 KB is sufficient for most RAID configurations. The average clickhouse-server write size is approximately 1 MB (1024 KB), and thus the recommended stripe size is also 1 MB. The block size can be optimized if needed when set to 1 MB divided by the number of non-parity disks in the RAID array, such that each write is parallelized across all available non-parity disks.
Never set the block size too small or too large.
You can use RAID-0 on SSD.

View File

@ -40,7 +40,7 @@ Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT h3IsValid(630814730351855103) as h3IsValid;
SELECT h3IsValid(630814730351855103) AS h3IsValid;
```
Result:
@ -77,7 +77,7 @@ Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT h3GetResolution(639821929606596015) as resolution;
SELECT h3GetResolution(639821929606596015) AS resolution;
```
Result:
@ -111,7 +111,7 @@ h3EdgeAngle(resolution)
Query:
``` sql
SELECT h3EdgeAngle(10) as edgeAngle;
SELECT h3EdgeAngle(10) AS edgeAngle;
```
Result:
@ -145,7 +145,7 @@ h3EdgeLengthM(resolution)
Query:
``` sql
SELECT h3EdgeLengthM(15) as edgeLengthM;
SELECT h3EdgeLengthM(15) AS edgeLengthM;
```
Result:
@ -184,7 +184,7 @@ Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index;
SELECT geoToH3(37.79506683, 55.71290588, 15) AS h3Index;
```
Result:
@ -333,7 +333,7 @@ Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT h3GetBaseCell(612916788725809151) as basecell;
SELECT h3GetBaseCell(612916788725809151) AS basecell;
```
Result:
@ -369,7 +369,7 @@ Type: [Float64](../../../sql-reference/data-types/float.md).
Query:
``` sql
SELECT h3HexAreaM2(13) as area;
SELECT h3HexAreaM2(13) AS area;
```
Result:
@ -481,7 +481,7 @@ Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT h3ToParent(599405990164561919, 3) as parent;
SELECT h3ToParent(599405990164561919, 3) AS parent;
```
Result:
@ -515,7 +515,7 @@ Type: [String](../../../sql-reference/data-types/string.md).
Query:
``` sql
SELECT h3ToString(617420388352917503) as h3_string;
SELECT h3ToString(617420388352917503) AS h3_string;
```
Result:
@ -549,7 +549,7 @@ stringToH3(index_str)
Query:
``` sql
SELECT stringToH3('89184926cc3ffff') as index;
SELECT stringToH3('89184926cc3ffff') AS index;
```
Result:
@ -583,7 +583,7 @@ h3GetResolution(index)
Query:
``` sql
SELECT h3GetResolution(617420388352917503) as res;
SELECT h3GetResolution(617420388352917503) AS res;
```
Result:
@ -620,7 +620,7 @@ Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT h3IsResClassIII(617420388352917503) as res;
SELECT h3IsResClassIII(617420388352917503) AS res;
```
Result:
@ -631,7 +631,7 @@ Result:
└─────┘
```
## h3IsPentagon {#h3ispentagon }
## h3IsPentagon {#h3ispentagon}
Returns whether this [H3](#h3index) index represents a pentagonal cell.
@ -657,7 +657,7 @@ Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT SELECT h3IsPentagon(644721767722457330) as pentagon;
SELECT h3IsPentagon(644721767722457330) AS pentagon;
```
Result:
@ -693,7 +693,7 @@ Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-
Query:
``` sql
SELECT SELECT h3GetFaces(599686042433355775) as faces;
SELECT h3GetFaces(599686042433355775) AS faces;
```
Result:

View File

@ -12,21 +12,21 @@ toc_title: "Анонимизированные данные Яндекс.Мет
**Скачивание и импортирование партиций hits:**
``` bash
$ curl -O https://datasets.clickhouse.com/hits/partitions/hits_v1.tar
$ tar xvf hits_v1.tar -C /var/lib/clickhouse # путь к папке с данными ClickHouse
$ # убедитесь, что установлены корректные права доступа на файлы
$ sudo service clickhouse-server restart
$ clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1"
curl -O https://datasets.clickhouse.com/hits/partitions/hits_v1.tar
tar xvf hits_v1.tar -C /var/lib/clickhouse # путь к папке с данными ClickHouse
# убедитесь, что установлены корректные права доступа на файлы
sudo service clickhouse-server restart
clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1"
```
**Скачивание и импортирование партиций visits:**
``` bash
$ curl -O https://datasets.clickhouse.com/visits/partitions/visits_v1.tar
$ tar xvf visits_v1.tar -C /var/lib/clickhouse # путь к папке с данными ClickHouse
$ # убедитесь, что установлены корректные права доступа на файлы
$ sudo service clickhouse-server restart
$ clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1"
curl -O https://datasets.clickhouse.com/visits/partitions/visits_v1.tar
tar xvf visits_v1.tar -C /var/lib/clickhouse # путь к папке с данными ClickHouse
# убедитесь, что установлены корректные права доступа на файлы
sudo service clickhouse-server restart
clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1"
```
## Получение таблиц из сжатых tsv-файлов {#poluchenie-tablits-iz-szhatykh-tsv-failov}
@ -34,29 +34,32 @@ $ clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1"
**Скачивание и импортирование hits из сжатого tsv-файла**
``` bash
$ curl https://datasets.clickhouse.com/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv
$ # теперь создадим таблицу
$ clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets"
$ clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192"
$ # импортируем данные
$ cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000
$ # опционально можно оптимизировать таблицу
$ clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL"
$ clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1"
curl https://datasets.clickhouse.com/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv
# создадим таблицу hits_v1
clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets"
clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192"
# создадим таблицу hits_100m_obfuscated
clickhouse-client --query="CREATE TABLE hits_100m_obfuscated (WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, Refresh UInt8, RefererCategoryID UInt16, RefererRegionID UInt32, URLCategoryID UInt16, URLRegionID UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, OriginalURL String, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), LocalEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, RemoteIP UInt32, WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming UInt32, DNSTiming UInt32, ConnectTiming UInt32, ResponseStartTiming UInt32, ResponseEndTiming UInt32, FetchTiming UInt32, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192"
# импортируем данные
cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000
# опционально можно оптимизировать таблицу
clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL"
clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1"
```
**Скачивание и импортирование visits из сжатого tsv-файла**
``` bash
$ curl https://datasets.clickhouse.com/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv
$ # теперь создадим таблицу
$ clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets"
$ clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192"
$ # импортируем данные
$ cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000
$ # опционально можно оптимизировать таблицу
$ clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL"
$ clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1"
curl https://datasets.clickhouse.com/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv
# теперь создадим таблицу
clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets"
clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192"
# импортируем данные
cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000
# опционально можно оптимизировать таблицу
clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL"
clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1"
```
## Запросы {#zaprosy}

View File

@ -6,7 +6,7 @@ toc_title: "Функции для работы с индексами H3"
[H3](https://eng.uber.com/h3/) — это система геокодирования, которая делит поверхность Земли на равные шестигранные ячейки. Система поддерживает иерархию (вложенность) ячеек, т.е. каждый "родительский" шестигранник может быть поделен на семь одинаковых вложенных "дочерних" шестигранников, и так далее.
Уровень вложенности назвается `разрешением` и может принимать значение от `0` до `15`, где `0` соответствует `базовым` ячейкам самого верхнего уровня (наиболее крупным).
Уровень вложенности называется "разрешением" и может принимать значение от `0` до `15`, где `0` соответствует "базовым" ячейкам самого верхнего уровня (наиболее крупным).
Для каждой точки, имеющей широту и долготу, можно получить 64-битный индекс H3, соответствующий номеру шестигранной ячейки, где эта точка находится.
@ -38,7 +38,7 @@ h3IsValid(h3index)
Запрос:
``` sql
SELECT h3IsValid(630814730351855103) as h3IsValid;
SELECT h3IsValid(630814730351855103) AS h3IsValid;
```
Результат:
@ -75,7 +75,7 @@ h3GetResolution(h3index)
Запрос:
``` sql
SELECT h3GetResolution(639821929606596015) as resolution;
SELECT h3GetResolution(639821929606596015) AS resolution;
```
Результат:
@ -109,7 +109,7 @@ h3EdgeAngle(resolution)
Запрос:
``` sql
SELECT h3EdgeAngle(10) as edgeAngle;
SELECT h3EdgeAngle(10) AS edgeAngle;
```
Результат:
@ -143,7 +143,7 @@ h3EdgeLengthM(resolution)
Запрос:
``` sql
SELECT h3EdgeLengthM(15) as edgeLengthM;
SELECT h3EdgeLengthM(15) AS edgeLengthM;
```
Результат:
@ -182,7 +182,7 @@ geoToH3(lon, lat, resolution)
Запрос:
``` sql
SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index;
SELECT geoToH3(37.79506683, 55.71290588, 15) AS h3Index;
```
Результат:
@ -295,7 +295,7 @@ h3GetBaseCell(index)
Запрос:
``` sql
SELECT h3GetBaseCell(612916788725809151) as basecell;
SELECT h3GetBaseCell(612916788725809151) AS basecell;
```
Результат:
@ -329,7 +329,7 @@ h3HexAreaM2(resolution)
Запрос:
``` sql
SELECT h3HexAreaM2(13) as area;
SELECT h3HexAreaM2(13) AS area;
```
Результат:
@ -441,7 +441,7 @@ h3ToParent(index, resolution)
Запрос:
``` sql
SELECT h3ToParent(599405990164561919, 3) as parent;
SELECT h3ToParent(599405990164561919, 3) AS parent;
```
Результат:
@ -475,7 +475,7 @@ h3ToString(index)
Запрос:
``` sql
SELECT h3ToString(617420388352917503) as h3_string;
SELECT h3ToString(617420388352917503) AS h3_string;
```
Результат:
@ -512,7 +512,7 @@ stringToH3(index_str)
Запрос:
``` sql
SELECT stringToH3('89184926cc3ffff') as index;
SELECT stringToH3('89184926cc3ffff') AS index;
```
Результат:
@ -548,7 +548,7 @@ h3GetResolution(index)
Запрос:
``` sql
SELECT h3GetResolution(617420388352917503) as res;
SELECT h3GetResolution(617420388352917503) AS res;
```
Результат:
@ -559,3 +559,114 @@ SELECT h3GetResolution(617420388352917503) as res;
└─────┘
```
## h3IsResClassIII {#h3isresclassIII}
Проверяет, имеет ли индекс [H3](#h3index) разрешение с ориентацией Class III.
**Синтаксис**
``` sql
h3IsResClassIII(index)
```
**Параметр**
- `index` — порядковый номер шестигранника. Тип: [UInt64](../../../sql-reference/data-types/int-uint.md).
**Возвращаемые значения**
- `1` — индекс имеет разрешение с ориентацией Class III.
- `0` — индекс не имеет разрешения с ориентацией Class III.
Тип: [UInt8](../../../sql-reference/data-types/int-uint.md).
**Пример**
Запрос:
``` sql
SELECT h3IsResClassIII(617420388352917503) AS res;
```
Результат:
``` text
┌─res─┐
│ 1 │
└─────┘
```
## h3IsPentagon {#h3ispentagon}
Проверяет, является ли указанный индекс [H3](#h3index) пятиугольной ячейкой.
**Синтаксис**
``` sql
h3IsPentagon(index)
```
**Параметр**
- `index` — порядковый номер шестигранника. Тип: [UInt64](../../../sql-reference/data-types/int-uint.md).
**Возвращаемые значения**
- `1` — индекс представляет собой пятиугольную ячейку.
- `0` — индекс не является пятиугольной ячейкой.
Тип: [UInt8](../../../sql-reference/data-types/int-uint.md).
**Пример**
Запрос:
``` sql
SELECT h3IsPentagon(644721767722457330) AS pentagon;
```
Результат:
``` text
┌─pentagon─┐
│ 0 │
└──────────┘
```
## h3GetFaces {#h3getfaces}
Возвращает все грани многоугольника (икосаэдра), пересекаемые заданным [H3](#h3index) индексом.
**Синтаксис**
``` sql
h3GetFaces(index)
```
**Параметр**
- `index` — индекс шестиугольной ячейки. Тип: [UInt64](../../../sql-reference/data-types/int-uint.md).
**Возвращаемое значение**
- Массив, содержащий грани многоугольника (икосаэдра), пересекаемые заданным H3 индексом.
Тип: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-reference/data-types/int-uint.md)).
**Пример**
Запрос:
``` sql
SELECT h3GetFaces(599686042433355775) AS faces;
```
Результат:
``` text
┌─faces─┐
│ [7] │
└───────┘
```
[Оригинальная статья](https://clickhouse.com/docs/ru/sql-reference/functions/geo/h3) <!--hide-->

View File

@ -68,8 +68,8 @@ CREATE MATERIALIZED VIEW [IF NOT EXISTS] [db.]table_name [ON CLUSTER] [TO[db.]na
## LIVE-представления [экспериментальный функционал] {#live-view}
!!! important "Важно"
Представления `LIVE VIEW` являются экспериментальной возможностью. Их использование может повлечь потерю совместимости в будущих версиях.
Чтобы использовать `LIVE VIEW` и запросы `WATCH`, включите настройку [allow_experimental_live_view](../../../operations/settings/settings.md#allow-experimental-live-view).
Представления `LIVE VIEW` являются экспериментальной возможностью. Их использование может повлечь потерю совместимости в будущих версиях.
Чтобы использовать `LIVE VIEW` и запросы `WATCH`, включите настройку [allow_experimental_live_view](../../../operations/settings/settings.md#allow-experimental-live-view).
```sql
CREATE LIVE VIEW [IF NOT EXISTS] [db.]table_name [WITH [TIMEOUT [value_in_sec] [AND]] [REFRESH [value_in_sec]]] AS SELECT ...

View File

@ -160,7 +160,10 @@ def generate_cmake_flags_files() -> None:
"docs/ru/development/cmake-in-clickhouse.md"]
for lang in other_languages:
os.symlink(output_file_name, os.path.join(root_path, lang))
other_file_name = os.path.join(root_path, lang)
if os.path.exists(other_file_name):
os.unlink(other_file_name)
os.symlink(output_file_name, other_file_name)
if __name__ == '__main__':
generate_cmake_flags_files()

View File

@ -14,6 +14,7 @@ module.exports = {
entry: [
path.resolve(scssPath, 'bootstrap.scss'),
path.resolve(scssPath, 'greenhouse.scss'),
path.resolve(scssPath, 'main.scss'),
path.resolve(jsPath, 'main.js'),
],

View File

@ -156,6 +156,11 @@ def build_website(args):
os.path.join(args.src_dir, 'utils', 'list-versions', 'version_date.tsv'),
os.path.join(args.output_dir, 'data', 'version_date.tsv'))
# This file can be requested to install ClickHouse.
shutil.copy2(
os.path.join(args.src_dir, 'docs', '_includes', 'install', 'universal.sh'),
os.path.join(args.output_dir, 'data', 'install.sh'))
for root, _, filenames in os.walk(args.output_dir):
for filename in filenames:
if filename == 'main.html':
@ -218,7 +223,7 @@ def minify_file(path, css_digest, js_digest):
# TODO: restore cssmin
# elif path.endswith('.css'):
# content = cssmin.cssmin(content)
# TODO: restore jsmin
# TODO: restore jsmin
# elif path.endswith('.js'):
# content = jsmin.jsmin(content)
with open(path, 'wb') as f:
@ -226,6 +231,12 @@ def minify_file(path, css_digest, js_digest):
def minify_website(args):
# Output greenhouse css separately from main bundle to be included via the greenhouse iframe
command = f"cat '{args.website_dir}/css/greenhouse.css' > '{args.output_dir}/css/greenhouse.css'"
logging.info(command)
output = subprocess.check_output(command, shell=True)
logging.debug(output)
css_in = ' '.join(get_css_in(args))
css_out = f'{args.output_dir}/css/base.css'
if args.minify:

View File

@ -11,6 +11,8 @@ toc_title: "ClickHouse用户"
| 公司简介 | 行业 | 用例 | 群集大小 | (Un)压缩数据大小<abbr title="of single replica"><sup>\*</sup></abbr> | 参考资料 |
|-----------------------------------------------------------------|------------------|----------------|---------------------------------------------------|----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [2gis](https://2gis.ru) | 地图 | 监测 | — | — | [俄文2019年7月](https://youtu.be/58sPkXfq6nw) |
| [阿里云](https://cn.aliyun.com/) | 公有云 | 全托管服务 | — | — | [官方网站](https://help.aliyun.com/product/144466.html) |
| [阿里云](https://cn.aliyun.com/) | 公有云 | E-MapReduce | — | — | [官方网站](https://help.aliyun.com/document_detail/212195.html) |
| [Aloha 浏览器](https://alohabrowser.com/) | 移动应用程序 | 浏览器后端 | — | — | [俄文幻灯片2019年5月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup22/aloha.pdf) |
| [阿玛迪斯](https://amadeus.com/) | 旅行 | 分析 | — | — | [新闻稿,四月2018](https://www.altinity.com/blog/2018/4/5/amadeus-technologies-launches-investment-and-insights-tool-based-on-machine-learning-and-strategy-algorithms) |
| [Appsflyer](https://www.appsflyer.com) | 移动分析 | 主要产品 | — | — | [俄文2019年7月](https://www.youtube.com/watch?v=M3wbRlcpBbY) |

View File

@ -73,8 +73,8 @@ IConnectionPool::Entry ConnectionPoolWithFailover::get(const ConnectionTimeouts
++last_used;
/* Consider nested_pools.size() equals to 5
* last_used = 1 -> get_priority: 0 1 2 3 4
* last_used = 2 -> get_priority: 5 0 1 2 3
* last_used = 3 -> get_priority: 5 4 0 1 2
* last_used = 2 -> get_priority: 4 0 1 2 3
* last_used = 3 -> get_priority: 4 3 0 1 2
* ...
* */
get_priority = [&](size_t i) { ++i; return i < last_used ? nested_pools.size() - i : i - last_used; };

View File

@ -481,7 +481,7 @@ public:
MultiCallback callback) = 0;
/// Expire session and finish all pending requests
virtual void finalize() = 0;
virtual void finalize(const String & reason) = 0;
};
}

View File

@ -493,7 +493,7 @@ TestKeeper::~TestKeeper()
{
try
{
finalize();
finalize(__PRETTY_FUNCTION__);
if (processing_thread.joinable())
processing_thread.join();
}
@ -556,12 +556,12 @@ void TestKeeper::processingThread()
catch (...)
{
tryLogCurrentException(__PRETTY_FUNCTION__);
finalize();
finalize(__PRETTY_FUNCTION__);
}
}
void TestKeeper::finalize()
void TestKeeper::finalize(const String &)
{
{
std::lock_guard lock(push_request_mutex);
@ -661,7 +661,7 @@ void TestKeeper::pushRequest(RequestInfo && request)
}
catch (...)
{
finalize();
finalize(__PRETTY_FUNCTION__);
throw;
}
}

View File

@ -83,7 +83,7 @@ public:
const Requests & requests,
MultiCallback callback) override;
void finalize() override;
void finalize(const String & reason) override;
struct Node
{

View File

@ -269,7 +269,7 @@ Coordination::Error ZooKeeper::getChildrenImpl(const std::string & path, Strings
if (future_result.wait_for(std::chrono::milliseconds(operation_timeout_ms)) != std::future_status::ready)
{
impl->finalize();
impl->finalize(fmt::format("Operation timeout on {} {}", toString(Coordination::OpNum::List), path));
return Coordination::Error::ZOPERATIONTIMEOUT;
}
else
@ -330,7 +330,7 @@ Coordination::Error ZooKeeper::createImpl(const std::string & path, const std::s
if (future_result.wait_for(std::chrono::milliseconds(operation_timeout_ms)) != std::future_status::ready)
{
impl->finalize();
impl->finalize(fmt::format("Operation timeout on {} {}", toString(Coordination::OpNum::Create), path));
return Coordination::Error::ZOPERATIONTIMEOUT;
}
else
@ -400,7 +400,7 @@ Coordination::Error ZooKeeper::removeImpl(const std::string & path, int32_t vers
if (future_result.wait_for(std::chrono::milliseconds(operation_timeout_ms)) != std::future_status::ready)
{
impl->finalize();
impl->finalize(fmt::format("Operation timeout on {} {}", toString(Coordination::OpNum::Remove), path));
return Coordination::Error::ZOPERATIONTIMEOUT;
}
else
@ -432,7 +432,7 @@ Coordination::Error ZooKeeper::existsImpl(const std::string & path, Coordination
if (future_result.wait_for(std::chrono::milliseconds(operation_timeout_ms)) != std::future_status::ready)
{
impl->finalize();
impl->finalize(fmt::format("Operation timeout on {} {}", toString(Coordination::OpNum::Exists), path));
return Coordination::Error::ZOPERATIONTIMEOUT;
}
else
@ -466,7 +466,7 @@ Coordination::Error ZooKeeper::getImpl(const std::string & path, std::string & r
if (future_result.wait_for(std::chrono::milliseconds(operation_timeout_ms)) != std::future_status::ready)
{
impl->finalize();
impl->finalize(fmt::format("Operation timeout on {} {}", toString(Coordination::OpNum::Get), path));
return Coordination::Error::ZOPERATIONTIMEOUT;
}
else
@ -539,7 +539,7 @@ Coordination::Error ZooKeeper::setImpl(const std::string & path, const std::stri
if (future_result.wait_for(std::chrono::milliseconds(operation_timeout_ms)) != std::future_status::ready)
{
impl->finalize();
impl->finalize(fmt::format("Operation timeout on {} {}", toString(Coordination::OpNum::Set), path));
return Coordination::Error::ZOPERATIONTIMEOUT;
}
else
@ -591,7 +591,7 @@ Coordination::Error ZooKeeper::multiImpl(const Coordination::Requests & requests
if (future_result.wait_for(std::chrono::milliseconds(operation_timeout_ms)) != std::future_status::ready)
{
impl->finalize();
impl->finalize(fmt::format("Operation timeout on {} {}", toString(Coordination::OpNum::Multi), requests[0]->getPath()));
return Coordination::Error::ZOPERATIONTIMEOUT;
}
else
@ -1038,9 +1038,9 @@ Coordination::Error ZooKeeper::tryMultiNoThrow(const Coordination::Requests & re
}
}
void ZooKeeper::finalize()
void ZooKeeper::finalize(const String & reason)
{
impl->finalize();
impl->finalize(reason);
}
void ZooKeeper::setZooKeeperLog(std::shared_ptr<DB::ZooKeeperLog> zk_log_)

View File

@ -274,7 +274,7 @@ public:
/// * The node doesn't exist
FutureGet asyncTryGet(const std::string & path);
void finalize();
void finalize(const String & reason);
void setZooKeeperLog(std::shared_ptr<DB::ZooKeeperLog> zk_log_);

View File

@ -289,7 +289,7 @@ ZooKeeper::~ZooKeeper()
{
try
{
finalize(false, false, "destructor called");
finalize(false, false, "Destructor called");
if (send_thread.joinable())
send_thread.join();
@ -610,7 +610,7 @@ void ZooKeeper::sendThread()
catch (...)
{
tryLogCurrentException(log);
finalize(true, false, "exception in sendThread");
finalize(true, false, "Exception in sendThread");
}
}
@ -669,7 +669,7 @@ void ZooKeeper::receiveThread()
catch (...)
{
tryLogCurrentException(log);
finalize(false, true, "exception in receiveThread");
finalize(false, true, "Exception in receiveThread");
}
}

View File

@ -187,7 +187,7 @@ public:
/// it will do read in another session, that read may not see the
/// already performed write.
void finalize() override { finalize(false, false, "unknown"); }
void finalize(const String & reason) override { finalize(false, false, reason); }
void setZooKeeperLog(std::shared_ptr<DB::ZooKeeperLog> zk_log_);

View File

@ -523,6 +523,8 @@ class IColumn;
M(Int64, remote_fs_read_backoff_threshold, 10000, "Max wait time when trying to read data for remote disk", 0) \
M(Int64, remote_fs_read_backoff_max_tries, 5, "Max attempts to read with backoff", 0) \
\
M(Bool, force_remove_data_recursively_on_drop, false, "Recursively remove data on DROP query. Avoids 'Directory not empty' error, but may silently remove detached data", 0) \
\
/** Experimental functions */ \
M(Bool, allow_experimental_funnel_functions, false, "Enable experimental functions for funnel analysis.", 0) \
M(Bool, allow_experimental_nlp_functions, false, "Enable experimental functions for natural language processing.", 0) \

View File

@ -71,6 +71,7 @@ DatabasePtr DatabaseFactory::get(const ASTCreateQuery & create, const String & m
/// Before 20.7 it's possible that .sql metadata file does not exist for some old database.
/// In this case Ordinary database is created on server startup if the corresponding metadata directory exists.
/// So we should remove metadata directory if database creation failed.
/// TODO remove this code
created = fs::create_directory(metadata_path);
DatabasePtr impl = getImpl(create, metadata_path, context);

View File

@ -39,6 +39,7 @@ namespace ErrorCodes
extern const int SYNTAX_ERROR;
extern const int TABLE_ALREADY_EXISTS;
extern const int EMPTY_LIST_OF_COLUMNS_PASSED;
extern const int DATABASE_NOT_EMPTY;
}
@ -544,8 +545,28 @@ ASTPtr DatabaseOnDisk::getCreateDatabaseQuery() const
void DatabaseOnDisk::drop(ContextPtr local_context)
{
assert(tables.empty());
fs::remove(local_context->getPath() + getDataPath());
fs::remove(getMetadataPath());
if (local_context->getSettingsRef().force_remove_data_recursively_on_drop)
{
fs::remove_all(local_context->getPath() + getDataPath());
fs::remove_all(getMetadataPath());
}
else
{
try
{
fs::remove(local_context->getPath() + getDataPath());
fs::remove(getMetadataPath());
}
catch (const fs::filesystem_error & e)
{
if (e.code() != std::errc::directory_not_empty)
throw Exception(Exception::CreateFromSTDTag{}, e);
throw Exception(ErrorCodes::DATABASE_NOT_EMPTY, "Cannot drop: {}. "
"Probably database contain some detached tables or metadata leftovers from Ordinary engine. "
"If you want to remove all data anyway, try to attach database back and drop it again "
"with enabled force_remove_data_recursively_on_drop setting", e.what());
}
}
}
String DatabaseOnDisk::getObjectMetadataPath(const String & object_name) const

View File

@ -166,15 +166,14 @@ void PocoHTTPClient::makeRequestInternal(
for (unsigned int attempt = 0; attempt <= s3_max_redirects; ++attempt)
{
Poco::URI target_uri(uri);
/// Reverse proxy can replace host header with resolved ip address instead of host name.
/// This can lead to request signature difference on S3 side.
auto session = makeHTTPSession(target_uri, timeouts, false);
HTTPSessionPtr session;
auto request_configuration = per_request_configuration(request);
if (!request_configuration.proxyHost.empty())
{
/// Reverse proxy can replace host header with resolved ip address instead of host name.
/// This can lead to request signature difference on S3 side.
session = makeHTTPSession(target_uri, timeouts, /* resolve_host = */ false);
bool use_tunnel = request_configuration.proxyScheme == Aws::Http::Scheme::HTTP && target_uri.getScheme() == "https";
session->setProxy(
@ -184,6 +183,11 @@ void PocoHTTPClient::makeRequestInternal(
use_tunnel
);
}
else
{
session = makeHTTPSession(target_uri, timeouts, /* resolve_host = */ true);
}
Poco::Net::HTTPRequest poco_request(Poco::Net::HTTPRequest::HTTP_1_1);

View File

@ -1853,7 +1853,7 @@ static void reloadZooKeeperIfChangedImpl(const ConfigurationPtr & config, const
if (!zk || zk->configChanged(*config, config_name))
{
if (zk)
zk->finalize();
zk->finalize("Config changed");
zk = std::make_shared<zkutil::ZooKeeper>(*config, config_name, std::move(zk_log));
}

View File

@ -329,7 +329,7 @@ void DatabaseCatalog::attachDatabase(const String & database_name, const Databas
}
DatabasePtr DatabaseCatalog::detachDatabase(const String & database_name, bool drop, bool check_empty)
DatabasePtr DatabaseCatalog::detachDatabase(ContextPtr local_context, const String & database_name, bool drop, bool check_empty)
{
if (database_name == TEMPORARY_DATABASE)
throw Exception("Cannot detach database with temporary tables.", ErrorCodes::DATABASE_ACCESS_DENIED);
@ -365,12 +365,14 @@ DatabasePtr DatabaseCatalog::detachDatabase(const String & database_name, bool d
if (drop)
{
/// Delete the database.
db->drop(getContext());
db->drop(local_context);
/// Old ClickHouse versions did not store database.sql files
/// Remove metadata dir (if exists) to avoid recreation of .sql file on server startup
fs::path database_metadata_dir = fs::path(getContext()->getPath()) / "metadata" / escapeForFileName(database_name);
fs::remove(database_metadata_dir);
fs::path database_metadata_file = fs::path(getContext()->getPath()) / "metadata" / (escapeForFileName(database_name) + ".sql");
if (fs::exists(database_metadata_file))
fs::remove(database_metadata_file);
fs::remove(database_metadata_file);
}
return db;

View File

@ -147,7 +147,7 @@ public:
DatabasePtr getSystemDatabase() const;
void attachDatabase(const String & database_name, const DatabasePtr & database);
DatabasePtr detachDatabase(const String & database_name, bool drop = false, bool check_empty = true);
DatabasePtr detachDatabase(ContextPtr local_context, const String & database_name, bool drop = false, bool check_empty = true);
void updateDatabaseName(const String & old_name, const String & new_name);
/// database_name must be not empty

View File

@ -295,7 +295,7 @@ BlockIO InterpreterCreateQuery::createDatabase(ASTCreateQuery & create)
assert(removed);
}
if (added)
DatabaseCatalog::instance().detachDatabase(database_name, false, false);
DatabaseCatalog::instance().detachDatabase(getContext(), database_name, false, false);
throw;
}
@ -999,7 +999,7 @@ bool InterpreterCreateQuery::doCreateTable(ASTCreateQuery & create,
}
else
throw Exception(storage_already_exists_error_code,
"{} {}.{} already exists.", storage_name, backQuoteIfNeed(create.database), backQuoteIfNeed(create.table));
"{} {}.{} already exists", storage_name, backQuoteIfNeed(create.database), backQuoteIfNeed(create.table));
}
data_path = database->getTableDataPath(create);

View File

@ -369,7 +369,7 @@ BlockIO InterpreterDropQuery::executeToDatabaseImpl(const ASTDropQuery & query,
database->assertCanBeDetached(true);
/// DETACH or DROP database itself
DatabaseCatalog::instance().detachDatabase(database_name, drop, database->shouldBeEmptyOnDetach());
DatabaseCatalog::instance().detachDatabase(getContext(), database_name, drop, database->shouldBeEmptyOnDetach());
}
}

View File

@ -72,6 +72,7 @@ static void loadDatabase(
}
else if (fs::exists(fs::path(database_path)))
{
/// TODO Remove this code (it's required for compatibility with versions older than 20.7)
/// Database exists, but .sql file is absent. It's old-style Ordinary database (e.g. system or default)
database_attach_query = "ATTACH DATABASE " + backQuoteIfNeed(database) + " ENGINE = Ordinary";
}

View File

@ -1447,6 +1447,11 @@ void StorageMergeTree::replacePartitionFrom(const StoragePtr & source_table, con
void StorageMergeTree::movePartitionToTable(const StoragePtr & dest_table, const ASTPtr & partition, ContextPtr local_context)
{
/// MOVE PARTITION cannot be run in parallel with merges/mutations,
/// since otherwise there can be some merge/mutation in progress,
/// that will be created in the source table after MOVE PARTITION.
std::unique_lock background_lock(currently_processing_in_background_mutex);
auto lock1 = lockForShare(local_context->getCurrentQueryId(), local_context->getSettingsRef().lock_acquire_timeout);
auto lock2 = dest_table->lockForShare(local_context->getCurrentQueryId(), local_context->getSettingsRef().lock_acquire_timeout);
@ -1509,7 +1514,6 @@ void StorageMergeTree::movePartitionToTable(const StoragePtr & dest_table, const
transaction.commit(&lock);
}
clearOldMutations(true);
clearOldPartsFromFilesystem();
PartLog::addNewParts(getContext(), dst_parts, watch.elapsed());

View File

@ -0,0 +1,22 @@
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance('node', stay_alive=True)
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_drop_memory_database(start_cluster):
node.query("CREATE DATABASE test ENGINE Memory")
node.query("CREATE TABLE test.test_table(a String) ENGINE Memory")
node.query("DROP DATABASE test")
node.restart_clickhouse(kill=True)
assert node.query("SHOW DATABASES LIKE 'test'").strip() == ""

View File

@ -131,7 +131,7 @@ SELECT 'And detach permanently again to check how database drop will behave';
DETACH table test1601_detach_permanently_ordinary.test_name_reuse PERMANENTLY;
SELECT 'DROP database - Directory not empty error, but database detached';
DROP DATABASE test1601_detach_permanently_ordinary; -- { serverError 1001 }
DROP DATABASE test1601_detach_permanently_ordinary; -- { serverError 219 }
ATTACH DATABASE test1601_detach_permanently_ordinary;
@ -205,7 +205,7 @@ SELECT 'And detach permanently again to check how database drop will behave';
DETACH table test1601_detach_permanently_lazy.test_name_reuse PERMANENTLY;
SELECT 'DROP database - Directory not empty error, but database deteched';
DROP DATABASE test1601_detach_permanently_lazy; -- { serverError 1001 }
DROP DATABASE test1601_detach_permanently_lazy; -- { serverError 219 }
ATTACH DATABASE test1601_detach_permanently_lazy;

View File

@ -0,0 +1,4 @@
0
2
2

View File

@ -0,0 +1,2 @@
select sum(number) from remote('127.0.0.{2,3}', numbers(2)) where number global in (select sum(number) from numbers(2) group by number with totals) group by number with totals

View File

@ -0,0 +1,26 @@
{% set prefetch_items = [
('/docs/en/', 'document')
] %}
{% extends "templates/base.html" %}
{% block extra_meta %}
{% include "templates/common_fonts.html" %}
{% endblock %}
{% block nav %}
{% include "templates/global/nav.html" %}
{% endblock %}
{% block content %}
{% include "templates/careers/hero.html" %}
{% include "templates/careers/overview.html" %}
{% include "templates/careers/greenhouse.html" %}
{% include "templates/global/newsletter.html" %}
{% include "templates/global/github_stars.html" %}
{% endblock %}

16035
website/css/bootstrap.css vendored

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
#main{padding-bottom:0;padding-top:0}#wrapper{max-width:1078px;padding:0}body>#wrapper>#main>#wrapper>#content,body>#wrapper>#main>#wrapper>#logo,body>#wrapper>#main>#wrapper>h1{display:none}body>#wrapper>#main>#wrapper>#board_title{margin-top:0}body>#wrapper>#main>#logo{margin-top:80px}body>#wrapper>#main>:last-child{margin-bottom:120px}

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1,158 +1 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({
/***/ "../../website/src/js/components/case-study-card.js":
/*!**************************************************************************************!*\
!*** /Users/cody/Sites/tech.clickhouse/website/src/js/components/case-study-card.js ***!
\**************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar CaseStudyCard = /*#__PURE__*/function () {\n function CaseStudyCard($el) {\n _classCallCheck(this, CaseStudyCard);\n\n this.onOpen = this.onOpen.bind(this);\n this.onToggle = this.onToggle.bind(this);\n this.$el = $el;\n this.$el.addEventListener('click', this.onOpen);\n this.$el.querySelector('.case-study-card-toggle').addEventListener('click', this.onToggle);\n this.open = false;\n }\n\n _createClass(CaseStudyCard, [{\n key: \"onOpen\",\n value: function onOpen() {\n this.open = true;\n this.$el.classList.toggle('is-open', this.open);\n this.$el.classList.toggle('is-closing', !this.open);\n this.closeOthers();\n }\n }, {\n key: \"onToggle\",\n value: function onToggle(event) {\n event.stopPropagation();\n this.open = !this.$el.classList.contains('is-open');\n this.$el.classList.toggle('is-open', this.open);\n this.$el.classList.toggle('is-closing', !this.open);\n this.closeOthers();\n }\n }, {\n key: \"closeOthers\",\n value: function closeOthers() {\n var _this = this;\n\n if (this.open) {\n document.querySelectorAll('.case-study-card').forEach(function ($el) {\n if (!$el.isSameNode(_this.$el)) {\n $el.classList.toggle('is-closing', $el.classList.contains('is-open'));\n $el.classList.toggle('is-open', false);\n }\n });\n }\n }\n }]);\n\n return CaseStudyCard;\n}();\n\ndocument.querySelectorAll('.case-study-card').forEach(function ($el) {\n return new CaseStudyCard($el);\n});\n\n//# sourceURL=webpack:////Users/cody/Sites/tech.clickhouse/website/src/js/components/case-study-card.js?");
/***/ }),
/***/ "../../website/src/js/main.js":
/*!****************************************************************!*\
!*** /Users/cody/Sites/tech.clickhouse/website/src/js/main.js ***!
\****************************************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_case_study_card__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/case-study-card */ \"../../website/src/js/components/case-study-card.js\");\n/* harmony import */ var _components_case_study_card__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_case_study_card__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utilities_equalize_heights__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utilities/equalize-heights */ \"../../website/src/js/utilities/equalize-heights.js\");\n/* harmony import */ var _utilities_equalize_heights__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_utilities_equalize_heights__WEBPACK_IMPORTED_MODULE_1__);\n\n\n\n//# sourceURL=webpack:////Users/cody/Sites/tech.clickhouse/website/src/js/main.js?");
/***/ }),
/***/ "../../website/src/js/utilities/equalize-heights.js":
/*!**************************************************************************************!*\
!*** /Users/cody/Sites/tech.clickhouse/website/src/js/utilities/equalize-heights.js ***!
\**************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar $allElements = document.querySelectorAll('[equalize-heights]');\nvar groupedElements = {};\n$allElements.forEach(function ($el) {\n var group = $el.getAttribute('equalize-heights');\n groupedElements[group] = groupedElements[group] || [];\n groupedElements[group].push($el);\n});\n\nfunction resizeElements() {\n Object.entries(groupedElements).forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n group = _ref2[0],\n $elements = _ref2[1];\n\n $elements.forEach(function ($el) {\n var styles = window.getComputedStyle($el);\n\n if ('none' === styles.getPropertyValue('display')) {\n $el.style.display = 'block';\n }\n\n $el.style.minHeight = 'auto';\n });\n var minHeight = $elements.reduce(function (max, $el) {\n if ($el.offsetHeight > max) {\n max = $el.offsetHeight;\n }\n\n return max;\n }, 0);\n $elements.forEach(function ($el) {\n $el.style.display = null;\n $el.style.minHeight = \"\".concat(minHeight, \"px\");\n });\n });\n}\n\nwindow.addEventListener('resize', resizeElements);\nwindow.addEventListener('orientationchange', resizeElements);\nresizeElements();\n\n//# sourceURL=webpack:////Users/cody/Sites/tech.clickhouse/website/src/js/utilities/equalize-heights.js?");
/***/ }),
/***/ "../../website/src/scss/bootstrap.scss":
/*!*************************************************************************!*\
!*** /Users/cody/Sites/tech.clickhouse/website/src/scss/bootstrap.scss ***!
\*************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */ __webpack_exports__[\"default\"] = (__webpack_require__.p + \"./css//bootstrap.css\");\n\n//# sourceURL=webpack:////Users/cody/Sites/tech.clickhouse/website/src/scss/bootstrap.scss?");
/***/ }),
/***/ "../../website/src/scss/main.scss":
/*!********************************************************************!*\
!*** /Users/cody/Sites/tech.clickhouse/website/src/scss/main.scss ***!
\********************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */ __webpack_exports__[\"default\"] = (__webpack_require__.p + \"./css//main.css\");\n\n//# sourceURL=webpack:////Users/cody/Sites/tech.clickhouse/website/src/scss/main.scss?");
/***/ }),
/***/ 0:
/*!*****************************************************************************************************************************************************************************************************!*\
!*** multi /Users/cody/Sites/tech.clickhouse/website/src/scss/bootstrap.scss /Users/cody/Sites/tech.clickhouse/website/src/scss/main.scss /Users/cody/Sites/tech.clickhouse/website/src/js/main.js ***!
\*****************************************************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("__webpack_require__(/*! /Users/cody/Sites/tech.clickhouse/website/src/scss/bootstrap.scss */\"../../website/src/scss/bootstrap.scss\");\n__webpack_require__(/*! /Users/cody/Sites/tech.clickhouse/website/src/scss/main.scss */\"../../website/src/scss/main.scss\");\nmodule.exports = __webpack_require__(/*! /Users/cody/Sites/tech.clickhouse/website/src/js/main.js */\"../../website/src/js/main.js\");\n\n\n//# sourceURL=webpack:///multi_/Users/cody/Sites/tech.clickhouse/website/src/scss/bootstrap.scss_/Users/cody/Sites/tech.clickhouse/website/src/scss/main.scss_/Users/cody/Sites/tech.clickhouse/website/src/js/main.js?");
/***/ })
/******/ });
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){n(1),n(2),n(3),t.exports=n(4)},function(t,e,n){"use strict";n.r(e),e.default=n.p+"./css//bootstrap.css"},function(t,e,n){"use strict";n.r(e),e.default=n.p+"./css//greenhouse.css"},function(t,e,n){"use strict";n.r(e),e.default=n.p+"./css//main.css"},function(t,e,n){"use strict";n.r(e);n(5),n(6),n(7)},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.onOpen=this.onOpen.bind(this),this.onToggle=this.onToggle.bind(this),this.$el=e,this.$el.addEventListener("click",this.onOpen),this.$el.querySelector(".case-study-card-toggle").addEventListener("click",this.onToggle),this.open=!1}var e,o,r;return e=t,(o=[{key:"onOpen",value:function(){this.open=!0,this.$el.classList.toggle("is-open",this.open),this.$el.classList.toggle("is-closing",!this.open),this.closeOthers()}},{key:"onToggle",value:function(t){t.stopPropagation(),this.open=!this.$el.classList.contains("is-open"),this.$el.classList.toggle("is-open",this.open),this.$el.classList.toggle("is-closing",!this.open),this.closeOthers()}},{key:"closeOthers",value:function(){var t=this;this.open&&document.querySelectorAll(".case-study-card").forEach((function(e){e.isSameNode(t.$el)||(e.classList.toggle("is-closing",e.classList.contains("is-open")),e.classList.toggle("is-open",!1))}))}}])&&n(e.prototype,o),r&&n(e,r),t}();document.querySelectorAll(".case-study-card").forEach((function(t){return new o(t)}))},function(t,e){function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var o,r,i=[],s=!0,l=!1;try{for(n=n.call(t);!(s=(o=n.next()).done)&&(i.push(o.value),!e||i.length!==e);s=!0);}catch(t){l=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(l)throw r}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var r=document.querySelectorAll("[equalize-heights]"),i={};function s(){Object.entries(i).forEach((function(t){var e=n(t,2),o=(e[0],e[1]);o.forEach((function(t){"none"===window.getComputedStyle(t).getPropertyValue("display")&&(t.style.display="block"),t.style.minHeight="auto"}));var r=o.reduce((function(t,e){return e.offsetHeight>t&&(t=e.offsetHeight),t}),0);o.forEach((function(t){t.style.display=null,t.style.minHeight="".concat(r,"px")}))}))}r.forEach((function(t){var e=t.getAttribute("equalize-heights");i[e]=i[e]||[],i[e].push(t)})),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),s()},function(t,e){window.addEventListener("load",(function(){if(-1!==window.location.search.indexOf("gh_jid=")){var t=window.scrollY,e=document.querySelector("#jobs").getBoundingClientRect().top;window.scrollTo({left:0,top:t+e}),window.setTimeout((function(){window.scrollTo({left:0,top:t+e-40})}),50)}}))}]);

View File

@ -1,2 +1,3 @@
import './components/case-study-card'
import './utilities/equalize-heights'
import './utilities/greenhouse'

View File

@ -0,0 +1,16 @@
window.addEventListener('load', () => {
if (-1 !== window.location.search.indexOf('gh_jid=')) {
const scrollY = window.scrollY
const offsetTop = document.querySelector('#jobs').getBoundingClientRect().top
window.scrollTo({
left: 0,
top: scrollY + offsetTop,
})
window.setTimeout(() => {
window.scrollTo({
left: 0,
top: scrollY + offsetTop - 40,
})
}, 50)
}
})

View File

@ -28,3 +28,31 @@
margin-bottom: -160px;
padding-bottom: 160px;
}
.base-hero {
height:22.5vw;
max-height:324px;
min-height:280px;
}
.index-hero {
background-image:url('/images/backgrounds/bg-hero-home.svg');
height:68vw;
max-height:980px;
max-width:2448px;
width:170vw;
}
.other-hero {
background-image: url('/images/backgrounds/bg-hero.svg');
max-width: 2448px;
width: 170vw;
}
.bg-footer-cta {
background-image:url('/images/backgrounds/bg-footer-cta.svg');
width:2448px;
}
.quickstart-bg {
background-image:url('/images/backgrounds/bg-quick-start.svg');
height:40vw;
top:220px;
width:170vw;
}

View File

@ -1,11 +1,13 @@
.navbar {
.navbar-clickhouse {
border-bottom: 4px solid $gray-100;
height: 142px;
> .container {
flex-wrap: wrap;
}
}
.navbar {
&-super {
flex-shrink: 0;
width: 100%;
@ -38,8 +40,8 @@
}
}
&-brand {
background: no-repeat url(#{"../images/logo.svg"});
&-brand-clickhouse {
background: no-repeat url(#{"../images/logo-clickhouse.svg"});
background-size: contain;
flex-shrink: 0;
height: 28px;

View File

@ -0,0 +1,27 @@
#main {
padding-bottom: 0;
padding-top: 0;
}
#wrapper {
max-width: 1078px;
padding: 0;
}
body > #wrapper > #main > #wrapper > #logo,
body > #wrapper > #main > #wrapper > h1,
body > #wrapper > #main > #wrapper > #content {
display: none;
}
body > #wrapper > #main > #wrapper > #board_title {
margin-top: 0;
}
body > #wrapper > #main > #logo {
margin-top: 80px;
}
body > #wrapper > #main > :last-child {
margin-bottom: 120px;
}

View File

@ -0,0 +1,8 @@
<div id="jobs" class="section bg-white pb-10 pb-lg-15 pt-10 pt-lg-15">
<div class="container">
<div id="grnhse_app"></div>
<script src="https://boards.greenhouse.io/embed/job_board/js?for=clickhouse"></script>
</div>
</div>

View File

@ -0,0 +1,10 @@
<div class="hero bg-primary-light d-flex align-items-center base-hero">
<div class="hero-bg other-hero"></div>
<div class="container pt-8 pt-lg-10 pt-xl-15 pb-8 pb-lg-10 pb-xl-15">
<h1 class="display-1 mb-0">
{{ _('Careers') }}
</h1>
</div>
</div>

View File

@ -0,0 +1,11 @@
<div class="section bg-white pt-10">
<div class="container">
<p class="lead text-dark mb-6">
ClickHouse is searching  for individuals who are not just knowledgeable about what they do, but want to learn more. Our ideal candidates are thinkers and doers who are not afraid to take on various roles and responsibilities as they grow with the company. If you are looking for a place to build something new, be an agent of change, and have an opportunity to have a significant impact on the companys success, this is the place for you.
</p>
<hr class="is-yellow">
</div>
</div>

View File

@ -71,6 +71,19 @@
{{ _('Senior Director, Business Technology') }}
</p>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<a href="https://www.linkedin.com/in/mihir-g-3a8010b8/" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
<img src="/images/photos/mihir-gokhale.jpg">
</a>
<h3 class="display-4">
{{ _('Mihir Gokhale') }}
</h3>
<p class="font-lg text-muted mb-0 mx-auto w-75">
{{ _('Associate, Business Strategy & Ops') }}
</p>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
@ -85,21 +98,19 @@
</p>
</div>
{% if false %}
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<div class="photo-frame mx-auto">
<a href="https://www.linkedin.com/in/brianjohnhunter/" target="_blank" class="photo-frame mx-auto">
<img src="/images/photos/brian-hunter.jpg">
</div>
</a>
<h3 class="display-4">
{{ _('Brian Hunter') }}
</h3>
<p class="font-lg text-muted mb-0 mx-auto w-75">
{{ _('Account Executive') }}
{{ _('Account Executive, AMER') }}
</p>
</div>
{% endif %}
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<a href="https://github.com/kitaisreal/" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
@ -126,12 +137,11 @@
</p>
</div>
{% if false %}
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<div class="photo-frame mx-auto">
<img src="/images/photos/placeholder.png">
</div>
<a href="https://www.linkedin.com/in/anne-krechmer-3790162b/" target="_blank" class="photo-frame mx-auto">
<img src="/images/photos/anne-krechmer.jpg">
</a>
<h3 class="display-4">
{{ _('Anne Krechmer') }}
</h3>
@ -140,7 +150,6 @@
</p>
</div>
{% endif %}
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<a href="https://github.com/Avogar" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
@ -154,21 +163,32 @@
</p>
</div>
{% if false %}
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<div class="photo-frame mx-auto">
<img src="/images/photos/placeholder.png">
</div>
<a href="https://www.linkedin.com/in/claire-g-lucas/" target="_blank" class="photo-frame mx-auto">
<img src="/images/photos/claire-lucas.jpg">
</a>
<h3 class="display-4">
{{ _('Claire Lucas') }}
</h3>
<p class="font-lg text-muted mb-0 mx-auto w-75">
{{ _('Director, Global Business Strategy &amp; Operations') }}
{{ _('Director, Business Strategy &amp; Ops') }}
</p>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<a href="https://www.linkedin.com/in/shavoyne-mccowan-668674221/" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
<img src="/images/photos/shavoyne-mccowan.jpg">
</a>
<h3 class="display-4">
{{ _('Shavoyne McCowan') }}
</h3>
<p class="font-lg text-muted mb-0 mx-auto w-75">
{{ _('Executive Assistant') }}
</p>
</div>
{% endif %}
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<a href="https://github.com/nikitamikhaylov" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
@ -224,10 +244,10 @@
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<a href="https://www.linkedin.com/in/richraposa/" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
<img src="/images/photos/richard-raposa.jpg">
<img src="/images/photos/rich-raposa.jpg">
</a>
<h3 class="display-4">
{{ _('Richard Raposa') }}
{{ _('Rich Raposa') }}
</h3>
<p class="font-lg text-muted mb-0 mx-auto w-75">
{{ _('Director, Global Learning') }}
@ -260,7 +280,7 @@
</p>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 mb-xl-0 text-center">
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<a href="https://www.linkedin.com/in/dorota-szeremeta-a849b7/" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
<img src="/images/photos/dorota-szeremeta.jpg">
@ -273,7 +293,7 @@
</p>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 mb-xl-0 text-center">
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<a href="https://github.com/tavplubix" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
<img src="/images/photos/alexander-tokmakov.jpg">
@ -286,7 +306,7 @@
</p>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 mb-0 text-center">
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-8 text-center">
<a href="https://www.linkedin.com/in/arnovandriel" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
<img src="/images/photos/arno-van-driel.jpg">
@ -299,7 +319,7 @@
</p>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 mb-3 mb-md-0 text-center">
<div class="col-xl-3 col-lg-4 col-md-6 text-center">
<a href="https://www.linkedin.com/in/%D1%8F%D1%86%D0%B8%D1%88%D0%B8%D0%BD-%D0%B8%D0%BB%D1%8C%D1%8F-9495b535/" target="_blank" class="photo-frame mx-auto" rel="external nofollow">
<img src="/images/photos/ilya-yatsishin.jpg">
@ -322,7 +342,7 @@
</h3>
<div class="btns">
<a href="mailto:careers@clickhouse.com" class="btn btn-outline-secondary" role="button">
<a href="/careers/" class="btn btn-outline-secondary" role="button">
{{ _('Apply Now') }}
</a>
</div>

View File

@ -47,6 +47,9 @@
<li class="nav-item">
<a class="nav-link" href="/company/">Company</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/careers/">Careers</a>
</li>
<li class="nav-item">
<a class="btn btn-outline-tertiary" href="/company/#contact">Contact Us</a>
</li>

View File

@ -25,7 +25,7 @@
<div class="embed-responsive embed-responsive-1by1" style="overflow: visible;">
<div class="embed-responsive-item d-flex align-items-stretch">
<a href="https://github.com/ClickHouse/ClickHouse/issues/new/choose" rel="external nofollow noreferrer" target="_blank" class="card d-flex align-items-stretch text-decoration-none">
<a href="https://github.com/ClickHouse/ClickHouse" rel="external nofollow noreferrer" target="_blank" class="card d-flex align-items-stretch text-decoration-none">
<div class="card-body d-flex align-items-center justify-content-center">
<img data-src="/images/icons/icon-github.svg" alt="ClickHouse GitHub" title="ClickHouse GitHub" class="icon mx-auto mb-0">

View File

@ -1,41 +1,43 @@
<div class="hero bg-white">
<div class="hero-bg index-hero"></div>
<div class="container pt-8 pt-lg-10 pt-xl-15 pb-8 pb-lg-10">
<div class="container pt-5 pt-lg-7 pt-xl-15 pb-5 pb-lg-7">
<h1 class="display-1 mb-3 mx-auto text-center">
<h1 class="display-1 mb-2 mb-xl-3 mx-auto text-center">
ClickHouse, Inc <span class="text-orange">Has Arrived</span>
</h1>
<p class="lead mb-7 mx-auto text-muted text-center" style="max-width:780px;">
<p class="lead mb-3 mb-lg-5 mb-xl-7 mx-auto text-muted text-center" style="max-width:780px;">
{{ _('ClickHouse® is an open-source, high performance columnar OLAP database management system for real-time analytics using SQL.') }}
</p>
<div class="btns mb-5" role="group">
<div class="btns mb-3 mb-xl-5" role="group">
<a href="/company/" class="btn btn-lg btn-primary" role="button">Learn More</a>
<a href="https://play.clickhouse.com/?file=welcome" class="btn btn-lg btn-outline-primary" role="button">Online Demo</a>
</div>
<p class="d-flex justify-content-center">
<p class="d-flex justify-content-center mb-0">
<a href="/blog/en/2021/clickhouse-inc/" class="trailing-link">Read the Blog Post</a>
</p>
</div>
</div>
{% if false %}
<div class="section">
<div class="container">
<div class="card is-large has-highlight">
<div class="card-body">
<h5 class="text-blue text-center text-upper">Introducing ClickHouse inc.!</h5>
<h4 class="text-blue text-center text-upper">ClickHouse v21.10 Release Webinar</h4>
<p class="font-lg text-muted text-center mb-6 mx-auto">ClickHouse, Inc. Announces Incorporation, Along With $50M In Series A Funding. New financing will allow the open source success to build a world-class, commercial-grade cloud solution thats secure, compliant, and convenient for any customer to use.</p>
<p class="font-lg text-muted text-center mb-6 mx-auto">
21 October 2021<br>
EMEA, Americas<br>
4:00pm UTC / 9:00am PST
</p>
<div class="btns" role="group">
<a href="#" class="btn btn-secondary" role="button">Read the Press Release</a>
<a href="#" class="btn btn-outline-secondary" role="button">Read the Blog Post</a>
<a href="https://calendar.google.com/calendar/render?action=TEMPLATE&dates=20211021T160000Z%2F20211021T170000Z&details=Connect%20with%20ClickHouse%20experts%20and%20test%20out%20the%20newest%20features%20and%20performance%20gains%20in%20the%20v21.10%20release.%C2%A0%0A%0ATopic%3A%20ClickHouse%20v21.10%20Release%20Webinar%0A%0AJoin%20Zoom%20Meeting%0Ahttps%3A%2F%2Fzoom.us%2Fj%2F96049287426%0A%0AProvide%20Us%20Your%20Feedback%0Ahttps%3A%2F%2Fforms.gle%2Ff1dCMWYxgp9ixDvy8%0A%0AMeeting%20ID%3A%20960%204928%207426%0AOne%20tap%20mobile%0A%2B12532158782%2C%2C96049287426%23%20US%20%28Tacoma%29%0A%2B13462487799%2C%2C96049287426%23%20US%20%28Houston%29%0A%0ADial%20by%20your%20location%0A%20%20%20%20%20%20%20%20%2B31%20707%20006%20526%20%28Netherlands%29%0A%20%20%20%20%20%20%20%20%2B1%20646%20558%208656%20US%20%28New%20York%29%0A%20%20%20%20%20%20%20%20%2B7%20812%20426%208988%20%28Russia%29%0A%20%20%20%20%20%20%20%20%2B44%20330%20088%205830%20%28UK%29%0A%0AMeeting%20ID%3A%20960%204928%207426%0AFind%20your%20local%20number%3A%20https%3A%2F%2Fzoom.us%2Fu%2FadxB9OsSnr&location=https%3A%2F%2Fzoom.us%2Fj%2F96049287426&text=ClickHouse%20v21.10%20Release%20Webinar" class="btn btn-secondary" role="button" rel="external nofollow" target="_blank">Add to Calendar</a>
</div>
</div>
@ -43,4 +45,3 @@
</div>
</div>
{% endif %}

View File

@ -13,7 +13,7 @@
<div class="card-body case-study-card-body case-study-card-body">
<img class="d-block mb-3" src="/images/logos/logo-yandex.png" height="40" width="108" title="Yandex" style="aspect-ratio: 108 / 40;height: auto;object-fit:contain;object-position:left center;">
<img class="d-block mb-3" src="/images/logos/logo-yandex.png" height="53" width="220" title="Yandex" style="aspect-ratio: 220 / 53;height: auto;object-fit:contain;object-position:left center;max-width: 140px;">
<div class="row flex-lg-nowrap mx-n2" equalize-heights="case-study-card-row">
<div class="px-2 d-none d-lg-flex flex-column" style="width: 104px;">

View File

@ -1,8 +1,6 @@
<div class="section">
<div class="section pt-10 pt-lg-15">
<div class="container">
<hr class="mb-10 mx-auto" style="max-width: 600px;">
<h2 class="display-2 text-center mb-3">
Why ClickHouse
</h2>