Merge remote-tracking branch 'upstream/master' into HEAD

This commit is contained in:
proller 2019-04-22 14:31:10 +03:00
commit 96e4e389b7
139 changed files with 1502 additions and 1492 deletions

2
contrib/lz4 vendored

@ -1 +1 @@
Subproject commit c10863b98e1503af90616ae99725ecd120265dfb
Subproject commit 780aac520b69d6369f4e3995624c37e56d75498d

View File

@ -9,8 +9,7 @@ add_library (lz4
${LIBRARY_DIR}/xxhash.h
${LIBRARY_DIR}/lz4.h
${LIBRARY_DIR}/lz4hc.h
${LIBRARY_DIR}/lz4opt.h)
${LIBRARY_DIR}/lz4hc.h)
target_compile_definitions(lz4 PUBLIC LZ4_DISABLE_DEPRECATE_WARNINGS=1)

View File

@ -1,11 +1,11 @@
# This strings autochanged from release_lib.sh:
set(VERSION_REVISION 54418)
set(VERSION_REVISION 54419)
set(VERSION_MAJOR 19)
set(VERSION_MINOR 6)
set(VERSION_MINOR 7)
set(VERSION_PATCH 1)
set(VERSION_GITHASH 30d3496c36cf3945c9828ac0b7cf7d1774a9f845)
set(VERSION_DESCRIBE v19.6.1.1-testing)
set(VERSION_STRING 19.6.1.1)
set(VERSION_GITHASH b0b369b30f04a5026d1da5c7d3fd5998d6de1fe4)
set(VERSION_DESCRIBE v19.7.1.1-testing)
set(VERSION_STRING 19.7.1.1)
# end of autochange
set(VERSION_EXTRA "" CACHE STRING "")

View File

@ -16,6 +16,7 @@
with minimum number of different symbols between replica's hostname and local hostname
(Hamming distance).
in_order - first live replica is chosen in specified order.
first_or_random - if first replica one has higher number of errors, pick a random one from replicas with minimum number of errors.
-->
<load_balancing>random</load_balancing>
</default>

View File

@ -62,6 +62,9 @@ IConnectionPool::Entry ConnectionPoolWithFailover::get(const Settings * settings
break;
case LoadBalancing::RANDOM:
break;
case LoadBalancing::FIRST_OR_RANDOM:
get_priority = [](size_t i) -> size_t { return i >= 1; };
break;
}
return Base::get(try_get_entry, get_priority);
@ -134,6 +137,9 @@ std::vector<ConnectionPoolWithFailover::TryResult> ConnectionPoolWithFailover::g
break;
case LoadBalancing::RANDOM:
break;
case LoadBalancing::FIRST_OR_RANDOM:
get_priority = [](size_t i) -> size_t { return i >= 1; };
break;
}
bool fallback_to_stale_replicas = settings ? bool(settings->fallback_to_stale_replicas_for_distributed_queries) : true;

View File

@ -43,13 +43,13 @@ using Arenas = std::vector<ArenaPtr>;
* specifying which individual values should be destroyed and which ones should not.
* Clearly, this method would have a substantially non-zero price.
*/
class ColumnAggregateFunction final : public COWPtrHelper<IColumn, ColumnAggregateFunction>
class ColumnAggregateFunction final : public COWHelper<IColumn, ColumnAggregateFunction>
{
public:
using Container = PaddedPODArray<AggregateDataPtr>;
private:
friend class COWPtrHelper<IColumn, ColumnAggregateFunction>;
friend class COWHelper<IColumn, ColumnAggregateFunction>;
/// Memory pools. Aggregate states are allocated from them.
Arenas arenas;

View File

@ -13,10 +13,10 @@ namespace DB
* In memory, it is represented as one column of a nested type, whose size is equal to the sum of the sizes of all arrays,
* and as an array of offsets in it, which allows you to get each element.
*/
class ColumnArray final : public COWPtrHelper<IColumn, ColumnArray>
class ColumnArray final : public COWHelper<IColumn, ColumnArray>
{
private:
friend class COWPtrHelper<IColumn, ColumnArray>;
friend class COWHelper<IColumn, ColumnArray>;
/** Create an array column with specified values and offsets. */
ColumnArray(MutableColumnPtr && nested_column, MutableColumnPtr && offsets_column);
@ -30,7 +30,7 @@ public:
/** Create immutable column using immutable arguments. This arguments may be shared with other columns.
* Use IColumn::mutate in order to make mutable column and mutate shared nested columns.
*/
using Base = COWPtrHelper<IColumn, ColumnArray>;
using Base = COWHelper<IColumn, ColumnArray>;
static Ptr create(const ColumnPtr & nested_column, const ColumnPtr & offsets_column)
{

View File

@ -18,10 +18,10 @@ namespace ErrorCodes
/** ColumnConst contains another column with single element,
* but looks like a column with arbitrary amount of same elements.
*/
class ColumnConst final : public COWPtrHelper<IColumn, ColumnConst>
class ColumnConst final : public COWHelper<IColumn, ColumnConst>
{
private:
friend class COWPtrHelper<IColumn, ColumnConst>;
friend class COWHelper<IColumn, ColumnConst>;
WrappedPtr data;
size_t s;

View File

@ -55,13 +55,13 @@ private:
/// A ColumnVector for Decimals
template <typename T>
class ColumnDecimal final : public COWPtrHelper<ColumnVectorHelper, ColumnDecimal<T>>
class ColumnDecimal final : public COWHelper<ColumnVectorHelper, ColumnDecimal<T>>
{
static_assert(IsDecimalNumber<T>);
private:
using Self = ColumnDecimal;
friend class COWPtrHelper<ColumnVectorHelper, Self>;
friend class COWHelper<ColumnVectorHelper, Self>;
public:
using Container = DecimalPaddedPODArray<T>;

View File

@ -13,10 +13,10 @@ namespace DB
/** A column of values of "fixed-length string" type.
* If you insert a smaller string, it will be padded with zero bytes.
*/
class ColumnFixedString final : public COWPtrHelper<ColumnVectorHelper, ColumnFixedString>
class ColumnFixedString final : public COWHelper<ColumnVectorHelper, ColumnFixedString>
{
public:
friend class COWPtrHelper<ColumnVectorHelper, ColumnFixedString>;
friend class COWHelper<ColumnVectorHelper, ColumnFixedString>;
using Chars = PaddedPODArray<UInt8>;

View File

@ -15,10 +15,10 @@ namespace DB
/** A column containing a lambda expression.
* Behaves like a constant-column. Contains an expression, but not input or output data.
*/
class ColumnFunction final : public COWPtrHelper<IColumn, ColumnFunction>
class ColumnFunction final : public COWHelper<IColumn, ColumnFunction>
{
private:
friend class COWPtrHelper<IColumn, ColumnFunction>;
friend class COWHelper<IColumn, ColumnFunction>;
ColumnFunction(size_t size, FunctionBasePtr function, const ColumnsWithTypeAndName & columns_to_capture);

View File

@ -14,9 +14,9 @@ namespace ErrorCodes
extern const int ILLEGAL_COLUMN;
}
class ColumnLowCardinality final : public COWPtrHelper<IColumn, ColumnLowCardinality>
class ColumnLowCardinality final : public COWHelper<IColumn, ColumnLowCardinality>
{
friend class COWPtrHelper<IColumn, ColumnLowCardinality>;
friend class COWHelper<IColumn, ColumnLowCardinality>;
ColumnLowCardinality(MutableColumnPtr && column_unique, MutableColumnPtr && indexes, bool is_shared = false);
ColumnLowCardinality(const ColumnLowCardinality & other) = default;
@ -25,7 +25,7 @@ public:
/** Create immutable column using immutable arguments. This arguments may be shared with other columns.
* Use IColumn::mutate in order to make mutable column and mutate shared nested columns.
*/
using Base = COWPtrHelper<IColumn, ColumnLowCardinality>;
using Base = COWHelper<IColumn, ColumnLowCardinality>;
static Ptr create(const ColumnPtr & column_unique_, const ColumnPtr & indexes_, bool is_shared = false)
{
return ColumnLowCardinality::create(column_unique_->assumeMutable(), indexes_->assumeMutable(), is_shared);

View File

@ -6,10 +6,10 @@
namespace DB
{
class ColumnNothing final : public COWPtrHelper<IColumnDummy, ColumnNothing>
class ColumnNothing final : public COWHelper<IColumnDummy, ColumnNothing>
{
private:
friend class COWPtrHelper<IColumnDummy, ColumnNothing>;
friend class COWHelper<IColumnDummy, ColumnNothing>;
ColumnNothing(size_t s_)
{

View File

@ -20,10 +20,10 @@ using ConstNullMapPtr = const NullMap *;
/// over a bitmap because columns are usually stored on disk as compressed
/// files. In this regard, using a bitmap instead of a byte map would
/// greatly complicate the implementation with little to no benefits.
class ColumnNullable final : public COWPtrHelper<IColumn, ColumnNullable>
class ColumnNullable final : public COWHelper<IColumn, ColumnNullable>
{
private:
friend class COWPtrHelper<IColumn, ColumnNullable>;
friend class COWHelper<IColumn, ColumnNullable>;
ColumnNullable(MutableColumnPtr && nested_column_, MutableColumnPtr && null_map_);
ColumnNullable(const ColumnNullable &) = default;
@ -32,7 +32,7 @@ public:
/** Create immutable column using immutable arguments. This arguments may be shared with other columns.
* Use IColumn::mutate in order to make mutable column and mutate shared nested columns.
*/
using Base = COWPtrHelper<IColumn, ColumnNullable>;
using Base = COWHelper<IColumn, ColumnNullable>;
static Ptr create(const ColumnPtr & nested_column_, const ColumnPtr & null_map_)
{
return ColumnNullable::create(nested_column_->assumeMutable(), null_map_->assumeMutable());

View File

@ -14,10 +14,10 @@ using ConstSetPtr = std::shared_ptr<const Set>;
* Behaves like a constant-column (because the set is one, not its own for each line).
* This column has a nonstandard value, so it can not be obtained via a normal interface.
*/
class ColumnSet final : public COWPtrHelper<IColumnDummy, ColumnSet>
class ColumnSet final : public COWHelper<IColumnDummy, ColumnSet>
{
private:
friend class COWPtrHelper<IColumnDummy, ColumnSet>;
friend class COWHelper<IColumnDummy, ColumnSet>;
ColumnSet(size_t s_, const ConstSetPtr & data_) : data(data_) { s = s_; }
ColumnSet(const ColumnSet &) = default;

View File

@ -18,14 +18,14 @@ namespace DB
/** Column for String values.
*/
class ColumnString final : public COWPtrHelper<IColumn, ColumnString>
class ColumnString final : public COWHelper<IColumn, ColumnString>
{
public:
using Char = UInt8;
using Chars = PaddedPODArray<UInt8>;
private:
friend class COWPtrHelper<IColumn, ColumnString>;
friend class COWHelper<IColumn, ColumnString>;
/// Maps i'th position to offset to i+1'th element. Last offset maps to the end of all chars (is the size of all chars).
Offsets offsets;

View File

@ -12,10 +12,10 @@ namespace DB
* Mixed constant/non-constant columns is prohibited in tuple
* for implementation simplicity.
*/
class ColumnTuple final : public COWPtrHelper<IColumn, ColumnTuple>
class ColumnTuple final : public COWHelper<IColumn, ColumnTuple>
{
private:
friend class COWPtrHelper<IColumn, ColumnTuple>;
friend class COWHelper<IColumn, ColumnTuple>;
using TupleColumns = std::vector<WrappedPtr>;
TupleColumns columns;
@ -30,7 +30,7 @@ public:
/** Create immutable column using immutable arguments. This arguments may be shared with other columns.
* Use IColumn::mutate in order to make mutable column and mutate shared nested columns.
*/
using Base = COWPtrHelper<IColumn, ColumnTuple>;
using Base = COWHelper<IColumn, ColumnTuple>;
static Ptr create(const Columns & columns);
static Ptr create(const TupleColumns & columns);
static Ptr create(Columns && arg) { return create(arg); }

View File

@ -25,9 +25,9 @@ namespace ErrorCodes
}
template <typename ColumnType>
class ColumnUnique final : public COWPtrHelper<IColumnUnique, ColumnUnique<ColumnType>>
class ColumnUnique final : public COWHelper<IColumnUnique, ColumnUnique<ColumnType>>
{
friend class COWPtrHelper<IColumnUnique, ColumnUnique<ColumnType>>;
friend class COWHelper<IColumnUnique, ColumnUnique<ColumnType>>;
private:
explicit ColumnUnique(MutableColumnPtr && holder, bool is_nullable);

View File

@ -90,13 +90,13 @@ template <> struct CompareHelper<Float64> : public FloatCompareHelper<Float64> {
/** A template for columns that use a simple array to store.
*/
template <typename T>
class ColumnVector final : public COWPtrHelper<ColumnVectorHelper, ColumnVector<T>>
class ColumnVector final : public COWHelper<ColumnVectorHelper, ColumnVector<T>>
{
static_assert(!IsDecimalNumber<T>);
private:
using Self = ColumnVector;
friend class COWPtrHelper<ColumnVectorHelper, Self>;
friend class COWHelper<ColumnVectorHelper, Self>;
struct less;
struct greater;

View File

@ -1,7 +1,7 @@
#pragma once
#include <Core/Field.h>
#include <Common/COWPtr.h>
#include <Common/COW.h>
#include <Common/PODArray.h>
#include <Common/Exception.h>
#include <common/StringRef.h>
@ -24,13 +24,13 @@ class Arena;
class ColumnGathererStream;
/// Declares interface to store columns in memory.
class IColumn : public COWPtr<IColumn>
class IColumn : public COW<IColumn>
{
private:
friend class COWPtr<IColumn>;
friend class COW<IColumn>;
/// Creates the same column with the same data.
/// This is internal method to use from COWPtr.
/// This is internal method to use from COW.
/// It performs shallow copy with copy-ctor and not useful from outside.
/// If you want to copy column for modification, look at 'mutate' method.
virtual MutablePtr clone() const = 0;

View File

@ -10,10 +10,10 @@
*
* Usage:
class Column : public COWPtr<Column>
class Column : public COW<Column>
{
private:
friend class COWPtr<Column>;
friend class COW<Column>;
/// Leave all constructors in private section. They will be avaliable through 'create' method.
Column();
@ -23,7 +23,7 @@
public:
/// Correctly use const qualifiers in your interface.
virtual ~IColumn() {}
virtual ~Column() {}
};
* It will provide 'create' and 'mutate' methods.
@ -63,7 +63,7 @@
* Actually it is, if your values are small or if copying is done implicitly.
* This is the case for string implementations.
*
* In contrast, COWPtr is intended for the cases when you need to share states of large objects,
* In contrast, COW is intended for the cases when you need to share states of large objects,
* (when you usually will use std::shared_ptr) but you also want precise control over modification
* of this shared state.
*
@ -73,7 +73,7 @@
* to use std::unique_ptr for it somehow.
*/
template <typename Derived>
class COWPtr : public boost::intrusive_ref_counter<Derived>
class COW : public boost::intrusive_ref_counter<Derived>
{
private:
Derived * derived() { return static_cast<Derived *>(this); }
@ -96,8 +96,8 @@ protected:
private:
using Base = IntrusivePtr<T>;
template <typename> friend class COWPtr;
template <typename, typename> friend class COWPtrHelper;
template <typename> friend class COW;
template <typename, typename> friend class COWHelper;
explicit mutable_ptr(T * ptr) : Base(ptr) {}
@ -115,7 +115,7 @@ protected:
mutable_ptr() = default;
mutable_ptr(const std::nullptr_t *) {}
mutable_ptr(std::nullptr_t) {}
};
public:
@ -128,8 +128,8 @@ protected:
private:
using Base = IntrusivePtr<const T>;
template <typename> friend class COWPtr;
template <typename, typename> friend class COWPtrHelper;
template <typename> friend class COW;
template <typename, typename> friend class COWHelper;
explicit immutable_ptr(const T * ptr) : Base(ptr) {}
@ -159,7 +159,7 @@ protected:
immutable_ptr() = default;
immutable_ptr(const std::nullptr_t *) {}
immutable_ptr(std::nullptr_t) {}
};
public:
@ -192,7 +192,7 @@ public:
MutablePtr assumeMutable() const
{
return const_cast<COWPtr*>(this)->getPtr();
return const_cast<COW*>(this)->getPtr();
}
Derived & assumeMutableRef() const
@ -244,7 +244,7 @@ public:
*
* NOTE:
* If you override 'mutate' method in inherited classes, don't forget to make it virtual in base class or to make it call a virtual method.
* (COWPtr itself doesn't force any methods to be virtual).
* (COW itself doesn't force any methods to be virtual).
*
* See example in "cow_compositions.cpp".
*/
@ -255,22 +255,22 @@ public:
/** Helper class to support inheritance.
* Example:
*
* class IColumn : public COWPtr<IColumn>
* class IColumn : public COW<IColumn>
* {
* friend class COWPtr<IColumn>;
* friend class COW<IColumn>;
* virtual MutablePtr clone() const = 0;
* virtual ~IColumn() {}
* };
*
* class ConcreteColumn : public COWPtrHelper<IColumn, ConcreteColumn>
* class ConcreteColumn : public COWHelper<IColumn, ConcreteColumn>
* {
* friend class COWPtrHelper<IColumn, ConcreteColumn>;
* friend class COWHelper<IColumn, ConcreteColumn>;
* };
*
* Here is complete inheritance diagram:
*
* ConcreteColumn
* COWPtrHelper<IColumn, ConcreteColumn>
* COWHelper<IColumn, ConcreteColumn>
* IColumn
* CowPtr<IColumn>
* boost::intrusive_ref_counter<IColumn>
@ -278,7 +278,7 @@ public:
* See example in "cow_columns.cpp".
*/
template <typename Base, typename Derived>
class COWPtrHelper : public Base
class COWHelper : public Base
{
private:
Derived * derived() { return static_cast<Derived *>(this); }

View File

@ -1,11 +1,11 @@
#include <Common/COWPtr.h>
#include <Common/COW.h>
#include <iostream>
class IColumn : public COWPtr<IColumn>
class IColumn : public COW<IColumn>
{
private:
friend class COWPtr<IColumn>;
friend class COW<IColumn>;
virtual MutablePtr clone() const = 0;
public:
@ -22,10 +22,10 @@ public:
using ColumnPtr = IColumn::Ptr;
using MutableColumnPtr = IColumn::MutablePtr;
class ConcreteColumn : public COWPtrHelper<IColumn, ConcreteColumn>
class ConcreteColumn : public COWHelper<IColumn, ConcreteColumn>
{
private:
friend class COWPtrHelper<IColumn, ConcreteColumn>;
friend class COWHelper<IColumn, ConcreteColumn>;
int data;
ConcreteColumn(int data) : data(data) {}

View File

@ -1,11 +1,11 @@
#include <Common/COWPtr.h>
#include <Common/COW.h>
#include <iostream>
class IColumn : public COWPtr<IColumn>
class IColumn : public COW<IColumn>
{
private:
friend class COWPtr<IColumn>;
friend class COW<IColumn>;
virtual MutablePtr clone() const = 0;
virtual MutablePtr deepMutate() const { return shallowMutate(); }
@ -24,10 +24,10 @@ public:
using ColumnPtr = IColumn::Ptr;
using MutableColumnPtr = IColumn::MutablePtr;
class ConcreteColumn : public COWPtrHelper<IColumn, ConcreteColumn>
class ConcreteColumn : public COWHelper<IColumn, ConcreteColumn>
{
private:
friend class COWPtrHelper<IColumn, ConcreteColumn>;
friend class COWHelper<IColumn, ConcreteColumn>;
int data;
ConcreteColumn(int data) : data(data) {}
@ -38,10 +38,10 @@ public:
void set(int value) override { data = value; }
};
class ColumnComposition : public COWPtrHelper<IColumn, ColumnComposition>
class ColumnComposition : public COWHelper<IColumn, ColumnComposition>
{
private:
friend class COWPtrHelper<IColumn, ColumnComposition>;
friend class COWHelper<IColumn, ColumnComposition>;
ConcreteColumn::WrappedPtr wrapped;

View File

@ -247,15 +247,16 @@ LoadBalancing SettingLoadBalancing::getLoadBalancing(const String & s)
if (s == "random") return LoadBalancing::RANDOM;
if (s == "nearest_hostname") return LoadBalancing::NEAREST_HOSTNAME;
if (s == "in_order") return LoadBalancing::IN_ORDER;
if (s == "first_or_random") return LoadBalancing::FIRST_OR_RANDOM;
throw Exception("Unknown load balancing mode: '" + s + "', must be one of 'random', 'nearest_hostname', 'in_order'",
throw Exception("Unknown load balancing mode: '" + s + "', must be one of 'random', 'nearest_hostname', 'in_order', 'first_or_random'",
ErrorCodes::UNKNOWN_LOAD_BALANCING);
}
String SettingLoadBalancing::toString() const
{
const char * strings[] = {"random", "nearest_hostname", "in_order"};
if (value < LoadBalancing::RANDOM || value > LoadBalancing::IN_ORDER)
const char * strings[] = {"random", "nearest_hostname", "in_order", "first_or_random"};
if (value < LoadBalancing::RANDOM || value > LoadBalancing::FIRST_OR_RANDOM)
throw Exception("Unknown load balancing mode", ErrorCodes::UNKNOWN_LOAD_BALANCING);
return strings[static_cast<size_t>(value)];
}

View File

@ -167,6 +167,9 @@ enum class LoadBalancing
NEAREST_HOSTNAME,
/// replicas are walked through strictly in order; the number of errors does not matter
IN_ORDER,
/// if first replica one has higher number of errors,
/// pick a random one from replicas with minimum number of errors
FIRST_OR_RANDOM,
};
struct SettingLoadBalancing

View File

@ -12,7 +12,7 @@
#include <Interpreters/ExpressionAnalyzer.h>
#include <Parsers/IAST.h>
#include <Storages/IStorage.h>
#include <Common/COWPtr.h>
#include <Common/COW.h>
#include <Common/FieldVisitors.h>
namespace DB

View File

@ -1,7 +1,7 @@
#pragma once
#include <memory>
#include <Common/COWPtr.h>
#include <Common/COW.h>
#include <boost/noncopyable.hpp>
#include <Core/Field.h>
@ -17,8 +17,8 @@ class IDataType;
struct FormatSettings;
class IColumn;
using ColumnPtr = COWPtr<IColumn>::Ptr;
using MutableColumnPtr = COWPtr<IColumn>::MutablePtr;
using ColumnPtr = COW<IColumn>::Ptr;
using MutableColumnPtr = COW<IColumn>::MutablePtr;
using DataTypePtr = std::shared_ptr<const IDataType>;
using DataTypes = std::vector<DataTypePtr>;

View File

@ -43,7 +43,7 @@ namespace
void unknownFormat()
{
throw Exception("Protobuf messages are corrupted or doesn't match the provided schema", ErrorCodes::UNKNOWN_PROTOBUF_FORMAT);
throw Exception("Protobuf messages are corrupted or don't match the provided schema. Please note that Protobuf stream is length-delimited: every message is prefixed by its length in varint.", ErrorCodes::UNKNOWN_PROTOBUF_FORMAT);
}
}

View File

@ -136,6 +136,9 @@ void fillIndexGranularityImpl(
if (index_granularity_for_block == 0) /// very rare case when index granularity bytes less then single row
index_granularity_for_block = 1;
/// We should be less or equal than fixed index granularity
index_granularity_for_block = std::min(fixed_index_granularity_rows, index_granularity_for_block);
for (size_t current_row = index_offset; current_row < rows_in_block; current_row += index_granularity_for_block)
index_granularity.appendMark(index_granularity_for_block);

View File

@ -55,7 +55,7 @@ TEST(AdaptiveIndexGranularity, FillGranularityToyTests)
{ /// Blocks with granule size
MergeTreeIndexGranularity index_granularity;
fillIndexGranularityImpl(block1, 1, 1, true, 0, index_granularity);
fillIndexGranularityImpl(block1, 1, 100, true, 0, index_granularity);
EXPECT_EQ(index_granularity.getMarksCount(), 1);
for (size_t i = 0; i < index_granularity.getMarksCount(); ++i)
EXPECT_EQ(index_granularity.getMarkRows(i), block1.rows());
@ -79,7 +79,7 @@ TEST(AdaptiveIndexGranularity, FillGranularitySequenceOfBlocks)
auto block3 = getBlockWithSize(65536, 8);
MergeTreeIndexGranularity index_granularity;
for (const auto & block : {block1, block2, block3})
fillIndexGranularityImpl(block, 1024, 0, false, 0, index_granularity);
fillIndexGranularityImpl(block, 1024, 8192, false, 0, index_granularity);
EXPECT_EQ(index_granularity.getMarksCount(), 192); /// granules
for (size_t i = 0; i < index_granularity.getMarksCount(); ++i)
@ -92,7 +92,7 @@ TEST(AdaptiveIndexGranularity, FillGranularitySequenceOfBlocks)
EXPECT_EQ(block1.rows() + block2.rows() + block3.rows(), 3136);
MergeTreeIndexGranularity index_granularity;
for (const auto & block : {block1, block2, block3})
fillIndexGranularityImpl(block, 1024, 0, false, 0, index_granularity);
fillIndexGranularityImpl(block, 1024, 8192, false, 0, index_granularity);
EXPECT_EQ(index_granularity.getMarksCount(), 98); /// granules
for (size_t i = 0; i < index_granularity.getMarksCount(); ++i)
@ -110,7 +110,7 @@ TEST(AdaptiveIndexGranularity, FillGranularitySequenceOfBlocks)
size_t index_offset = 0;
for (const auto & block : {block1, block2, block3})
{
fillIndexGranularityImpl(block, 16384, 0, false, index_offset, index_granularity);
fillIndexGranularityImpl(block, 16384, 8192, false, index_offset, index_granularity);
index_offset = index_granularity.getLastMarkRows() - block.rows();
}
EXPECT_EQ(index_granularity.getMarksCount(), 1); /// granules

View File

@ -36,9 +36,9 @@ def remove_control_characters(s):
if int(s, base) < 0x10000:
return unichr(int(s, base))
return default
s = re.sub(ur"&#(\d+);?", lambda c: str_to_int(c.group(1), c.group(0)), s)
s = re.sub(ur"&#[xX]([0-9a-fA-F]+);?", lambda c: str_to_int(c.group(1), c.group(0), base=16), s)
s = re.sub(ur"[\x00-\x08\x0b\x0e-\x1f\x7f]", "", s)
s = re.sub(r"&#(\d+);?", lambda c: str_to_int(c.group(1), c.group(0)), s)
s = re.sub(r"&#[xX]([0-9a-fA-F]+);?", lambda c: str_to_int(c.group(1), c.group(0), base=16), s)
s = re.sub(r"[\x00-\x08\x0b\x0e-\x1f\x7f]", "", s)
return s
def run_single_test(args, ext, server_logs_level, case_file, stdout_file, stderr_file):
@ -214,6 +214,9 @@ def main(args):
if 'stateless' in suite and args.no_stateless:
print("Won't run stateless tests because they were manually disabled.")
continue
if 'stateful' in suite and args.no_stateful:
print("Won't run stateful tests because they were manually disabled.")
continue
# Reverse sort order: we want run newest test first.
# And not reverse subtests
@ -258,8 +261,9 @@ def main(args):
report_testcase = et.Element("testcase", attrib = {"name": name})
try:
print "{0:72}".format(name + ": "),
sys.stdout.flush()
sys.stdout.write("{0:72}".format(name + ": "))
if run_total == 1:
sys.stdout.flush()
if args.skip and any(s in name for s in args.skip):
report_testcase.append(et.Element("skipped", attrib = {"message": "skip"}))
@ -466,6 +470,7 @@ if __name__ == '__main__':
parser.add_argument('--parallel', default='1/1', help='Parralel test run number/total')
parser.add_argument('--no-stateless', action='store_true', help='Disable all stateless tests')
parser.add_argument('--no-stateful', action='store_true', help='Disable all stateful tests')
parser.add_argument('--skip', nargs='+', help="Skip these tests")
parser.add_argument('--no-long', action='store_false', dest='no_long', help='Do not run long tests')
group=parser.add_mutually_exclusive_group(required=False)

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS big_array;
CREATE TABLE big_array (x Array(UInt8)) ENGINE=TinyLog;
SET min_insert_block_size_rows = 0, min_insert_block_size_bytes = 0;

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS empty_summing;
CREATE TABLE empty_summing (d Date, k UInt64, v Int8) ENGINE=SummingMergeTree(d, k, 8192);

View File

@ -1,107 +1,107 @@
DROP TABLE IF EXISTS replicated_alter1;
DROP TABLE IF EXISTS replicated_alter2;
CREATE TABLE replicated_alter1 (d Date, k UInt64, i32 Int32) ENGINE=ReplicatedMergeTree('/clickhouse/tables/test/alter', 'r1', d, k, 8192);
CREATE TABLE replicated_alter2 (d Date, k UInt64, i32 Int32) ENGINE=ReplicatedMergeTree('/clickhouse/tables/test/alter', 'r2', d, k, 8192);
DROP TABLE IF EXISTS test.replicated_alter1;
DROP TABLE IF EXISTS test.replicated_alter2;
CREATE TABLE test.replicated_alter1 (d Date, k UInt64, i32 Int32) ENGINE=ReplicatedMergeTree('/clickhouse/tables/test/alter', 'r1', d, k, 8192);
CREATE TABLE test.replicated_alter2 (d Date, k UInt64, i32 Int32) ENGINE=ReplicatedMergeTree('/clickhouse/tables/test/alter', 'r2', d, k, 8192);
INSERT INTO replicated_alter1 VALUES ('2015-01-01', 10, 42);
INSERT INTO test.replicated_alter1 VALUES ('2015-01-01', 10, 42);
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 ADD COLUMN dt DateTime;
INSERT INTO replicated_alter1 VALUES ('2015-01-01', 9, 41, '1992-01-01 08:00:00');
ALTER TABLE test.replicated_alter1 ADD COLUMN dt DateTime;
INSERT INTO test.replicated_alter1 VALUES ('2015-01-01', 9, 41, '1992-01-01 08:00:00');
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 ADD COLUMN n Nested(ui8 UInt8, s String);
INSERT INTO replicated_alter1 VALUES ('2015-01-01', 8, 40, '2012-12-12 12:12:12', [1,2,3], ['12','13','14']);
ALTER TABLE test.replicated_alter1 ADD COLUMN n Nested(ui8 UInt8, s String);
INSERT INTO test.replicated_alter1 VALUES ('2015-01-01', 8, 40, '2012-12-12 12:12:12', [1,2,3], ['12','13','14']);
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 ADD COLUMN `n.d` Array(Date);
INSERT INTO replicated_alter1 VALUES ('2015-01-01', 7, 39, '2014-07-14 13:26:50', [10,20,30], ['120','130','140'],['2000-01-01','2000-01-01','2000-01-03']);
ALTER TABLE test.replicated_alter1 ADD COLUMN `n.d` Array(Date);
INSERT INTO test.replicated_alter1 VALUES ('2015-01-01', 7, 39, '2014-07-14 13:26:50', [10,20,30], ['120','130','140'],['2000-01-01','2000-01-01','2000-01-03']);
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 ADD COLUMN s String DEFAULT '0';
INSERT INTO replicated_alter1 VALUES ('2015-01-01', 6,38,'2014-07-15 13:26:50',[10,20,30],['asd','qwe','qwe'],['2000-01-01','2000-01-01','2000-01-03'],'100500');
ALTER TABLE test.replicated_alter1 ADD COLUMN s String DEFAULT '0';
INSERT INTO test.replicated_alter1 VALUES ('2015-01-01', 6,38,'2014-07-15 13:26:50',[10,20,30],['asd','qwe','qwe'],['2000-01-01','2000-01-01','2000-01-03'],'100500');
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 DROP COLUMN `n.d`, MODIFY COLUMN s Int64;
ALTER TABLE test.replicated_alter1 DROP COLUMN `n.d`, MODIFY COLUMN s Int64;
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 ADD COLUMN `n.d` Array(Date), MODIFY COLUMN s UInt32;
ALTER TABLE test.replicated_alter1 ADD COLUMN `n.d` Array(Date), MODIFY COLUMN s UInt32;
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 DROP COLUMN n.ui8, DROP COLUMN n.d;
ALTER TABLE test.replicated_alter1 DROP COLUMN n.ui8, DROP COLUMN n.d;
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 DROP COLUMN n.s;
ALTER TABLE test.replicated_alter1 DROP COLUMN n.s;
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 ADD COLUMN n.s Array(String), ADD COLUMN n.d Array(Date);
ALTER TABLE test.replicated_alter1 ADD COLUMN n.s Array(String), ADD COLUMN n.d Array(Date);
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 DROP COLUMN n;
ALTER TABLE test.replicated_alter1 DROP COLUMN n;
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
ALTER TABLE replicated_alter1 MODIFY COLUMN dt Date, MODIFY COLUMN s DateTime;
ALTER TABLE test.replicated_alter1 MODIFY COLUMN dt Date, MODIFY COLUMN s DateTime;
DESC TABLE replicated_alter1;
SHOW CREATE TABLE replicated_alter1;
DESC TABLE replicated_alter2;
SHOW CREATE TABLE replicated_alter2;
SELECT * FROM replicated_alter1 ORDER BY k;
DESC TABLE test.replicated_alter1;
SHOW CREATE TABLE test.replicated_alter1;
DESC TABLE test.replicated_alter2;
SHOW CREATE TABLE test.replicated_alter2;
SELECT * FROM test.replicated_alter1 ORDER BY k;
DROP TABLE replicated_alter1;
DROP TABLE replicated_alter2;
DROP TABLE test.replicated_alter1;
DROP TABLE test.replicated_alter2;

View File

@ -2,8 +2,8 @@ SET max_rows_to_group_by = 100000;
SET max_block_size = 100001;
SET group_by_overflow_mode = 'any';
DROP TABLE IF EXISTS numbers500k;
CREATE VIEW numbers500k AS SELECT number FROM system.numbers LIMIT 500000;
DROP TABLE IF EXISTS test.numbers500k;
CREATE VIEW test.numbers500k AS SELECT number FROM system.numbers LIMIT 500000;
SET totals_mode = 'after_having_auto';
SELECT intDiv(number, 2) AS k, count(), argMax(toString(number), number) FROM remote('127.0.0.{2,3}', test, numbers500k) GROUP BY k WITH TOTALS ORDER BY k LIMIT 10;
@ -17,4 +17,4 @@ SELECT intDiv(number, 2) AS k, count(), argMax(toString(number), number) FROM re
SET totals_mode = 'before_having';
SELECT intDiv(number, 2) AS k, count(), argMax(toString(number), number) FROM remote('127.0.0.{2,3}', test, numbers500k) GROUP BY k WITH TOTALS ORDER BY k LIMIT 10;
DROP TABLE numbers500k;
DROP TABLE test.numbers500k;

View File

@ -1,9 +1,9 @@
SET max_memory_usage = 100000000;
SET max_bytes_before_external_sort = 20000000;
DROP TABLE IF EXISTS numbers10m;
CREATE VIEW numbers10m AS SELECT number FROM system.numbers LIMIT 10000000;
DROP TABLE IF EXISTS test.numbers10m;
CREATE VIEW test.numbers10m AS SELECT number FROM system.numbers LIMIT 10000000;
SELECT number FROM remote('127.0.0.{2,3}', test, numbers10m) ORDER BY number * 1234567890123456789 LIMIT 19999980, 20;
DROP TABLE numbers10m;
DROP TABLE test.numbers10m;

View File

@ -1,62 +1,62 @@
DROP TABLE IF EXISTS test.buffer;
DROP TABLE IF EXISTS test.null_sink;
DROP TABLE IF EXISTS test.buffer_00126;
DROP TABLE IF EXISTS test.null_sink_00126;
CREATE TABLE test.null_sink (a UInt8, b String, c Array(UInt32)) ENGINE = Null;
CREATE TABLE test.buffer (a UInt8, b String, c Array(UInt32)) ENGINE = Buffer(test, null_sink, 1, 1000, 1000, 1000, 1000, 1000000, 1000000);
CREATE TABLE test.null_sink_00126 (a UInt8, b String, c Array(UInt32)) ENGINE = Null;
CREATE TABLE test.buffer_00126 (a UInt8, b String, c Array(UInt32)) ENGINE = Buffer(test, null_sink_00126, 1, 1000, 1000, 1000, 1000, 1000000, 1000000);
INSERT INTO test.buffer VALUES (1, '2', [3]);
INSERT INTO test.buffer_00126 VALUES (1, '2', [3]);
SELECT a, b, c FROM test.buffer ORDER BY a, b, c;
SELECT b, c, a FROM test.buffer ORDER BY a, b, c;
SELECT c, a, b FROM test.buffer ORDER BY a, b, c;
SELECT a, c, b FROM test.buffer ORDER BY a, b, c;
SELECT b, a, c FROM test.buffer ORDER BY a, b, c;
SELECT c, b, a FROM test.buffer ORDER BY a, b, c;
SELECT a, b FROM test.buffer ORDER BY a, b, c;
SELECT b, c FROM test.buffer ORDER BY a, b, c;
SELECT c, a FROM test.buffer ORDER BY a, b, c;
SELECT a, c FROM test.buffer ORDER BY a, b, c;
SELECT b, a FROM test.buffer ORDER BY a, b, c;
SELECT c, b FROM test.buffer ORDER BY a, b, c;
SELECT a FROM test.buffer ORDER BY a, b, c;
SELECT b FROM test.buffer ORDER BY a, b, c;
SELECT c FROM test.buffer ORDER BY a, b, c;
SELECT a, b, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, c, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, a, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a, c, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, a, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, b, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c FROM test.buffer_00126 ORDER BY a, b, c;
INSERT INTO test.buffer (c, b, a) VALUES ([7], '8', 9);
INSERT INTO test.buffer_00126 (c, b, a) VALUES ([7], '8', 9);
SELECT a, b, c FROM test.buffer ORDER BY a, b, c;
SELECT b, c, a FROM test.buffer ORDER BY a, b, c;
SELECT c, a, b FROM test.buffer ORDER BY a, b, c;
SELECT a, c, b FROM test.buffer ORDER BY a, b, c;
SELECT b, a, c FROM test.buffer ORDER BY a, b, c;
SELECT c, b, a FROM test.buffer ORDER BY a, b, c;
SELECT a, b FROM test.buffer ORDER BY a, b, c;
SELECT b, c FROM test.buffer ORDER BY a, b, c;
SELECT c, a FROM test.buffer ORDER BY a, b, c;
SELECT a, c FROM test.buffer ORDER BY a, b, c;
SELECT b, a FROM test.buffer ORDER BY a, b, c;
SELECT c, b FROM test.buffer ORDER BY a, b, c;
SELECT a FROM test.buffer ORDER BY a, b, c;
SELECT b FROM test.buffer ORDER BY a, b, c;
SELECT c FROM test.buffer ORDER BY a, b, c;
SELECT a, b, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, c, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, a, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a, c, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, a, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, b, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c FROM test.buffer_00126 ORDER BY a, b, c;
INSERT INTO test.buffer (a, c) VALUES (11, [33]);
INSERT INTO test.buffer_00126 (a, c) VALUES (11, [33]);
SELECT a, b, c FROM test.buffer ORDER BY a, b, c;
SELECT b, c, a FROM test.buffer ORDER BY a, b, c;
SELECT c, a, b FROM test.buffer ORDER BY a, b, c;
SELECT a, c, b FROM test.buffer ORDER BY a, b, c;
SELECT b, a, c FROM test.buffer ORDER BY a, b, c;
SELECT c, b, a FROM test.buffer ORDER BY a, b, c;
SELECT a, b FROM test.buffer ORDER BY a, b, c;
SELECT b, c FROM test.buffer ORDER BY a, b, c;
SELECT c, a FROM test.buffer ORDER BY a, b, c;
SELECT a, c FROM test.buffer ORDER BY a, b, c;
SELECT b, a FROM test.buffer ORDER BY a, b, c;
SELECT c, b FROM test.buffer ORDER BY a, b, c;
SELECT a FROM test.buffer ORDER BY a, b, c;
SELECT b FROM test.buffer ORDER BY a, b, c;
SELECT c FROM test.buffer ORDER BY a, b, c;
SELECT a, b, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, c, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, a, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a, c, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, a, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, b, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a, c FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b, a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c, b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT a FROM test.buffer_00126 ORDER BY a, b, c;
SELECT b FROM test.buffer_00126 ORDER BY a, b, c;
SELECT c FROM test.buffer_00126 ORDER BY a, b, c;
DROP TABLE test.buffer;
DROP TABLE test.null_sink;
DROP TABLE test.buffer_00126;
DROP TABLE test.null_sink_00126;

View File

@ -1,23 +1,23 @@
DROP TABLE IF EXISTS test.mt;
DROP TABLE IF EXISTS test.merge;
DROP TABLE IF EXISTS test.mt_00160;
DROP TABLE IF EXISTS test.merge_00160;
CREATE TABLE test.mt (d Date DEFAULT toDate('2015-05-01'), x UInt64) ENGINE = MergeTree(d, x, 1);
CREATE TABLE test.merge (d Date, x UInt64) ENGINE = Merge(test, '^mt$');
CREATE TABLE test.mt_00160 (d Date DEFAULT toDate('2015-05-01'), x UInt64) ENGINE = MergeTree(d, x, 1);
CREATE TABLE test.merge_00160 (d Date, x UInt64) ENGINE = Merge(test, '^mt_00160$');
SET min_insert_block_size_rows = 0, min_insert_block_size_bytes = 0;
SET max_block_size = 1000000;
INSERT INTO test.mt (x) SELECT number AS x FROM system.numbers LIMIT 100000;
INSERT INTO test.mt_00160 (x) SELECT number AS x FROM system.numbers LIMIT 100000;
SELECT *, b FROM test.mt WHERE x IN (12345, 67890) AND NOT ignore(blockSize() < 10 AS b) ORDER BY x;
SELECT *, b FROM test.merge WHERE x IN (12345, 67890) AND NOT ignore(blockSize() < 10 AS b) ORDER BY x;
SELECT *, b FROM test.mt_00160 WHERE x IN (12345, 67890) AND NOT ignore(blockSize() < 10 AS b) ORDER BY x;
SELECT *, b FROM test.merge_00160 WHERE x IN (12345, 67890) AND NOT ignore(blockSize() < 10 AS b) ORDER BY x;
DROP TABLE test.merge;
DROP TABLE test.mt;
DROP TABLE test.merge_00160;
DROP TABLE test.mt_00160;
CREATE TABLE test.mt (d Date DEFAULT toDate('2015-05-01'), x UInt64, y UInt64, z UInt64) ENGINE = MergeTree(d, (x, z), 1);
CREATE TABLE test.mt_00160 (d Date DEFAULT toDate('2015-05-01'), x UInt64, y UInt64, z UInt64) ENGINE = MergeTree(d, (x, z), 1);
INSERT INTO test.mt (x, y, z) SELECT number AS x, number + 10 AS y, number / 2 AS z FROM system.numbers LIMIT 100000;
INSERT INTO test.mt_00160 (x, y, z) SELECT number AS x, number + 10 AS y, number / 2 AS z FROM system.numbers LIMIT 100000;
SELECT *, b FROM test.mt WHERE (z, y, x) IN ((617, 1244, 1234), (2839, 5688, 5678), (1,1,1)) AND NOT ignore(blockSize() < 10 AS b) ORDER BY (x, y, z);
SELECT *, b FROM test.mt_00160 WHERE (z, y, x) IN ((617, 1244, 1234), (2839, 5688, 5678), (1,1,1)) AND NOT ignore(blockSize() < 10 AS b) ORDER BY (x, y, z);
DROP TABLE test.mt;
DROP TABLE test.mt_00160;

View File

@ -1,12 +1,12 @@
DROP TABLE IF EXISTS test.mt;
DROP TABLE IF EXISTS test.mt_buffer;
CREATE TABLE test.mt (EventDate Date, UTCEventTime DateTime, MoscowEventDate Date DEFAULT toDate(UTCEventTime)) ENGINE = MergeTree(EventDate, UTCEventTime, 8192);
CREATE TABLE test.mt_buffer AS test.mt ENGINE = Buffer(test, mt, 16, 10, 100, 10000, 1000000, 10000000, 100000000);
DESC TABLE test.mt;
DESC TABLE test.mt_buffer;
INSERT INTO test.mt (EventDate, UTCEventTime) VALUES ('2015-06-09', '2015-06-09 01:02:03');
SELECT * FROM test.mt_buffer;
INSERT INTO test.mt_buffer (EventDate, UTCEventTime) VALUES ('2015-06-09', '2015-06-09 01:02:03');
SELECT * FROM test.mt_buffer;
DROP TABLE test.mt_buffer;
DROP TABLE test.mt;
DROP TABLE IF EXISTS test.mt_00168;
DROP TABLE IF EXISTS test.mt_00168_buffer;
CREATE TABLE test.mt_00168 (EventDate Date, UTCEventTime DateTime, MoscowEventDate Date DEFAULT toDate(UTCEventTime)) ENGINE = MergeTree(EventDate, UTCEventTime, 8192);
CREATE TABLE test.mt_00168_buffer AS test.mt_00168 ENGINE = Buffer(test, mt_00168, 16, 10, 100, 10000, 1000000, 10000000, 100000000);
DESC TABLE test.mt_00168;
DESC TABLE test.mt_00168_buffer;
INSERT INTO test.mt_00168 (EventDate, UTCEventTime) VALUES ('2015-06-09', '2015-06-09 01:02:03');
SELECT * FROM test.mt_00168_buffer;
INSERT INTO test.mt_00168_buffer (EventDate, UTCEventTime) VALUES ('2015-06-09', '2015-06-09 01:02:03');
SELECT * FROM test.mt_00168_buffer;
DROP TABLE test.mt_00168_buffer;
DROP TABLE test.mt_00168;

View File

@ -1,12 +1,12 @@
DROP TABLE IF EXISTS t;
DROP TABLE IF EXISTS mv;
DROP TABLE IF EXISTS `.inner.mv`;
DROP TABLE IF EXISTS t_00180;
DROP TABLE IF EXISTS mv_00180;
DROP TABLE IF EXISTS `.inner.mv_00180`;
CREATE TABLE t (x UInt8) ENGINE = Null;
CREATE MATERIALIZED VIEW mv ENGINE = Null AS SELECT * FROM t;
CREATE TABLE t_00180 (x UInt8) ENGINE = Null;
CREATE MATERIALIZED VIEW mv_00180 ENGINE = Null AS SELECT * FROM t_00180;
DETACH TABLE mv;
ATTACH MATERIALIZED VIEW mv ENGINE = Null AS SELECT * FROM t;
DETACH TABLE mv_00180;
ATTACH MATERIALIZED VIEW mv_00180 ENGINE = Null AS SELECT * FROM t_00180;
DROP TABLE t;
DROP TABLE mv;
DROP TABLE t_00180;
DROP TABLE mv_00180;

View File

@ -1,131 +1,131 @@
SET max_block_size = 1000;
DROP TABLE IF EXISTS test.numbers_10;
CREATE TABLE test.numbers_10 ENGINE = Log AS SELECT * FROM system.numbers LIMIT 10000;
DROP TABLE IF EXISTS test.numbers_10_00223;
CREATE TABLE test.numbers_10_00223 ENGINE = Log AS SELECT * FROM system.numbers LIMIT 10000;
SET distributed_aggregation_memory_efficient = 0;
SET group_by_two_level_threshold = 1000;
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SET distributed_aggregation_memory_efficient = 0;
SET group_by_two_level_threshold = 7;
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SET distributed_aggregation_memory_efficient = 1;
SET group_by_two_level_threshold = 1000;
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SET distributed_aggregation_memory_efficient = 1;
SET group_by_two_level_threshold = 7;
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SET distributed_aggregation_memory_efficient = 1;
SET group_by_two_level_threshold = 1;
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10) FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY number);
SET distributed_aggregation_memory_efficient = 1;
SET group_by_two_level_threshold = 1000;
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SET distributed_aggregation_memory_efficient = 1;
SET group_by_two_level_threshold = 1;
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SELECT sum(c = 1) IN (0, 10), sum(c = 2) IN (0, 5), sum(c) = 10 FROM (SELECT number, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) AND number >= (randConstant() % 2 ? 0 : 5) GROUP BY number);
SET distributed_aggregation_memory_efficient = 1;
SET group_by_two_level_threshold = 7;
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 1) IN (0, 5), sum(c = 2) IN (5, 10), sum(c) IN (10, 15, 20) FROM (SELECT number AS k1, number + 1 AS k2, count() AS c FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 5 : 10) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
SELECT sum(c = 20) IN (5, 10), sum(c = 10) IN (0, 5), sum(u != 10) = 0 FROM (SELECT intDiv(number, 10) AS k1, k1 + 1 AS k2, count() AS c, uniq(number) AS u FROM remote('127.0.0.{2,3}', test.numbers_10_00223) WHERE number < (randConstant() % 2 ? 50 : 100) GROUP BY k1, k2 HAVING count() > 0 ORDER BY k1, k2);
DROP TABLE test.numbers_10;
DROP TABLE test.numbers_10_00223;
SELECT count() FROM remote('127.0.0.{2,3}', system.one);

View File

@ -1,13 +1,13 @@
DROP TABLE IF EXISTS view1;
DROP TABLE IF EXISTS view2;
DROP TABLE IF EXISTS merge_view;
DROP TABLE IF EXISTS test.view1;
DROP TABLE IF EXISTS test.view2;
DROP TABLE IF EXISTS test.merge_view;
CREATE VIEW view1 AS SELECT number FROM system.numbers LIMIT 10;
CREATE VIEW view2 AS SELECT number FROM system.numbers LIMIT 10;
CREATE TABLE merge_view (number UInt64) ENGINE = Merge(test, '^view');
CREATE VIEW test.view1 AS SELECT number FROM system.numbers LIMIT 10;
CREATE VIEW test.view2 AS SELECT number FROM system.numbers LIMIT 10;
CREATE TABLE test.merge_view (number UInt64) ENGINE = Merge(test, '^view');
SELECT 'Hello, world!' FROM merge_view LIMIT 5;
SELECT 'Hello, world!' FROM test.merge_view LIMIT 5;
DROP TABLE view1;
DROP TABLE view2;
DROP TABLE merge_view;
DROP TABLE test.view1;
DROP TABLE test.view2;
DROP TABLE test.merge_view;

View File

@ -1,17 +1,17 @@
DROP TABLE IF EXISTS test.numbers_10;
DROP TABLE IF EXISTS test.numbers_10_00290;
SET max_block_size = 1000;
CREATE TABLE test.numbers_10 ENGINE = Log AS SELECT * FROM system.numbers LIMIT 10000;
CREATE TABLE test.numbers_10_00290 ENGINE = Log AS SELECT * FROM system.numbers LIMIT 10000;
SET distributed_aggregation_memory_efficient = 1, group_by_two_level_threshold = 5000;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
SELECT concat(toString(number), arrayStringConcat(arrayMap(x -> '.', range(number % 10)))) AS k FROM remote('127.0.0.{2,3}', test.numbers_10_00290) WHERE number < (randConstant() % 2 ? 4999 : 10000) GROUP BY k ORDER BY k LIMIT 10;
DROP TABLE test.numbers_10;
DROP TABLE test.numbers_10_00290;

View File

@ -1,20 +1,20 @@
DROP TABLE IF EXISTS sample1;
DROP TABLE IF EXISTS sample2;
DROP TABLE IF EXISTS sample_merge;
DROP TABLE IF EXISTS test.sample_00314_1;
DROP TABLE IF EXISTS test.sample_00314_2;
DROP TABLE IF EXISTS test.sample_merge_00314;
CREATE TABLE sample1 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
CREATE TABLE sample2 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
CREATE TABLE test.sample_00314_1 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
CREATE TABLE test.sample_00314_2 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
SET min_insert_block_size_rows = 0, min_insert_block_size_bytes = 0;
INSERT INTO sample1 (x) SELECT number AS x FROM system.numbers LIMIT 1000000;
INSERT INTO sample2 (x) SELECT number AS x FROM system.numbers LIMIT 2000000;
INSERT INTO test.sample_00314_1 (x) SELECT number AS x FROM system.numbers LIMIT 1000000;
INSERT INTO test.sample_00314_2 (x) SELECT number AS x FROM system.numbers LIMIT 2000000;
CREATE TABLE sample_merge AS sample1 ENGINE = Merge(test, '^sample\\d$');
CREATE TABLE test.sample_merge_00314 AS test.sample_00314_1 ENGINE = Merge(test, '^sample_00314_\\d$');
SELECT abs(sum(_sample_factor) - 3000000) / 3000000 < 0.001 FROM sample_merge SAMPLE 100000;
SELECT abs(sum(_sample_factor) - 3000000) / 3000000 < 0.001 FROM merge(test, '^sample\\d$') SAMPLE 100000;
SELECT abs(sum(_sample_factor) - 3000000) / 3000000 < 0.001 FROM test.sample_merge_00314 SAMPLE 100000;
SELECT abs(sum(_sample_factor) - 3000000) / 3000000 < 0.001 FROM merge(test, '^sample_00314_\\d$') SAMPLE 100000;
DROP TABLE sample1;
DROP TABLE sample2;
DROP TABLE sample_merge;
DROP TABLE test.sample_00314_1;
DROP TABLE test.sample_00314_2;
DROP TABLE test.sample_merge_00314;

View File

@ -18,17 +18,17 @@ $CLICKHOUSE_CLIENT -n --query="SELECT 1; SELECT 2"
$CLICKHOUSE_CLIENT -n --query="SELECT 1; SELECT 2;"
$CLICKHOUSE_CLIENT -n --query="SELECT 1; SELECT 2; SELECT" 2>&1 | grep -o 'Syntax error'
$CLICKHOUSE_CLIENT -n --query="DROP TABLE IF EXISTS t; CREATE TABLE t (x UInt64) ENGINE = TinyLog;"
$CLICKHOUSE_CLIENT -n --query="DROP TABLE IF EXISTS t_00366; CREATE TABLE t_00366 (x UInt64) ENGINE = TinyLog;"
$CLICKHOUSE_CLIENT --query="INSERT INTO t VALUES (1),(2),(3);"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t"
$CLICKHOUSE_CLIENT --query="INSERT INTO t VALUES" <<< "(4),(5),(6)"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t"
$CLICKHOUSE_CLIENT --query="INSERT INTO t_00366 VALUES (1),(2),(3);"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t_00366"
$CLICKHOUSE_CLIENT --query="INSERT INTO t_00366 VALUES" <<< "(4),(5),(6)"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t_00366"
$CLICKHOUSE_CLIENT -n --query="INSERT INTO t VALUES (1),(2),(3);"
$CLICKHOUSE_CLIENT -n --query="SELECT * FROM t"
$CLICKHOUSE_CLIENT -n --query="INSERT INTO t VALUES" <<< "(4),(5),(6)"
$CLICKHOUSE_CLIENT -n --query="SELECT * FROM t"
$CLICKHOUSE_CLIENT -n --query="INSERT INTO t_00366 VALUES (1),(2),(3);"
$CLICKHOUSE_CLIENT -n --query="SELECT * FROM t_00366"
$CLICKHOUSE_CLIENT -n --query="INSERT INTO t_00366 VALUES" <<< "(4),(5),(6)"
$CLICKHOUSE_CLIENT -n --query="SELECT * FROM t_00366"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}" -d "SELECT 1"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}" -d "SELECT 1;"
@ -40,11 +40,11 @@ ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}" -d "SELECT 1; SELECT 2" 2>&1 |
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}" -d "SELECT 1; SELECT 2;" 2>&1 | grep -o 'Syntax error'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}" -d "SELECT 1; SELECT 2; SELECT" 2>&1 | grep -o 'Syntax error'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}" -d "INSERT INTO t VALUES (1),(2),(3);"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}&query=INSERT" -d "INTO t VALUES (4),(5),(6);"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}&query=INSERT+INTO+t+VALUES" -d "(7),(8),(9)"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}" -d "INSERT INTO t_00366 VALUES (1),(2),(3);"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t_00366"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}&query=INSERT" -d "INTO t_00366 VALUES (4),(5),(6);"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t_00366"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL_PARAMS}&query=INSERT+INTO+t_00366+VALUES" -d "(7),(8),(9)"
$CLICKHOUSE_CLIENT --query="SELECT * FROM t_00366"
$CLICKHOUSE_CLIENT -n --query="DROP TABLE t;"
$CLICKHOUSE_CLIENT -n --query="DROP TABLE t_00366;"

View File

@ -1,10 +1,10 @@
#!/usr/bin/env python
def gen_queries():
create_template = 'create table tab (a Int8, b String, c Tuple(Int8), d Tuple(Tuple(Int8)), e Tuple(Int8, String), f Tuple(Tuple(Int8, String))) engine = MergeTree order by ({}) partition by {}'
drop_query = 'drop table if exists tab'
create_template = 'create table tab_00386 (a Int8, b String, c Tuple(Int8), d Tuple(Tuple(Int8)), e Tuple(Int8, String), f Tuple(Tuple(Int8, String))) engine = MergeTree order by ({}) partition by {}'
drop_query = 'drop table if exists tab_00386'
values = ('1', "'a'", 'tuple(1)', 'tuple(tuple(1))', "(1, 'a')", "tuple((1, 'a'))")
insert_query = "insert into tab values (1, 'a', tuple(1), tuple(tuple(1)), (1, 'a'), tuple((1, 'a')))"
insert_query = "insert into tab_00386 values (1, 'a', tuple(1), tuple(tuple(1)), (1, 'a'), tuple((1, 'a')))"
columns = tuple('a b c d'.split())
order_by_columns = tuple('a b c'.split())
partition_by_columns = tuple(' tuple() a'.split())
@ -17,30 +17,30 @@ def gen_queries():
yield q
for column, value in zip(columns, values):
yield 'select {} in {} from tab'.format(column, value)
yield 'select {} in tuple({}) from tab'.format(column, value)
yield 'select {} in (select {} from tab) from tab'.format(column, column)
yield 'select {} in {} from tab_00386'.format(column, value)
yield 'select {} in tuple({}) from tab_00386'.format(column, value)
yield 'select {} in (select {} from tab_00386) from tab_00386'.format(column, column)
for i in range(len(columns)):
for j in range(i, len(columns)):
yield 'select ({}, {}) in tuple({}, {}) from tab'.format(columns[i], columns[j], values[i], values[j])
yield 'select ({}, {}) in (select {}, {} from tab) from tab'.format(columns[i], columns[j], columns[i], columns[j])
yield 'select ({}, {}) in (select ({}, {}) from tab) from tab'.format(columns[i], columns[j], columns[i], columns[j])
yield 'select ({}, {}) in tuple({}, {}) from tab_00386'.format(columns[i], columns[j], values[i], values[j])
yield 'select ({}, {}) in (select {}, {} from tab_00386) from tab_00386'.format(columns[i], columns[j], columns[i], columns[j])
yield 'select ({}, {}) in (select ({}, {}) from tab_00386) from tab_00386'.format(columns[i], columns[j], columns[i], columns[j])
yield "select e in (1, 'a') from tab"
yield "select f in tuple((1, 'a')) from tab"
yield "select f in tuple(tuple((1, 'a'))) from tab"
yield "select e in (1, 'a') from tab_00386"
yield "select f in tuple((1, 'a')) from tab_00386"
yield "select f in tuple(tuple((1, 'a'))) from tab_00386"
yield 'select e in (select a, b from tab) from tab'
yield 'select e in (select (a, b) from tab) from tab'
yield 'select f in (select tuple((a, b)) from tab) from tab'
yield 'select tuple(f) in (select tuple(tuple((a, b))) from tab) from tab'
yield 'select e in (select a, b from tab_00386) from tab_00386'
yield 'select e in (select (a, b) from tab_00386) from tab_00386'
yield 'select f in (select tuple((a, b)) from tab_00386) from tab_00386'
yield 'select tuple(f) in (select tuple(tuple((a, b))) from tab_00386) from tab_00386'
import requests
import os
def main():
url = os.environ['CLICKHOUSE_URL']
url = os.environ['CLICKHOUSE_URL_PARAMS']
for q in gen_queries():
resp = requests.post(url, data=q)

View File

@ -1,48 +1,48 @@
DROP TABLE IF EXISTS stripe1;
DROP TABLE IF EXISTS stripe2;
DROP TABLE IF EXISTS stripe3;
DROP TABLE IF EXISTS stripe4;
DROP TABLE IF EXISTS stripe5;
DROP TABLE IF EXISTS stripe6;
DROP TABLE IF EXISTS stripe7;
DROP TABLE IF EXISTS stripe8;
DROP TABLE IF EXISTS stripe9;
DROP TABLE IF EXISTS stripe10;
DROP TABLE IF EXISTS merge;
DROP TABLE IF EXISTS test.stripe1;
DROP TABLE IF EXISTS test.stripe2;
DROP TABLE IF EXISTS test.stripe3;
DROP TABLE IF EXISTS test.stripe4;
DROP TABLE IF EXISTS test.stripe5;
DROP TABLE IF EXISTS test.stripe6;
DROP TABLE IF EXISTS test.stripe7;
DROP TABLE IF EXISTS test.stripe8;
DROP TABLE IF EXISTS test.stripe9;
DROP TABLE IF EXISTS test.stripe10;
DROP TABLE IF EXISTS test.merge;
CREATE TABLE stripe1 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE stripe2 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE stripe3 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE stripe4 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE stripe5 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE stripe6 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE stripe7 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE stripe8 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE stripe9 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE stripe10 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe1 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe2 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe3 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe4 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe5 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe6 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe7 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe8 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe9 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE test.stripe10 ENGINE = StripeLog AS SELECT number AS x FROM system.numbers LIMIT 10;
CREATE TABLE merge AS stripe1 ENGINE = Merge(test, '^stripe\\d+');
CREATE TABLE test.merge AS test.stripe1 ENGINE = Merge(test, '^stripe\\d+');
SELECT x, count() FROM merge GROUP BY x ORDER BY x;
SELECT x, count() FROM test.merge GROUP BY x ORDER BY x;
SET max_threads = 1;
SELECT x, count() FROM merge GROUP BY x ORDER BY x;
SELECT x, count() FROM test.merge GROUP BY x ORDER BY x;
SET max_threads = 2;
SELECT x, count() FROM merge GROUP BY x ORDER BY x;
SELECT x, count() FROM test.merge GROUP BY x ORDER BY x;
SET max_threads = 5;
SELECT x, count() FROM merge GROUP BY x ORDER BY x;
SELECT x, count() FROM test.merge GROUP BY x ORDER BY x;
SET max_threads = 10;
SELECT x, count() FROM merge GROUP BY x ORDER BY x;
SELECT x, count() FROM test.merge GROUP BY x ORDER BY x;
SET max_threads = 20;
SELECT x, count() FROM merge GROUP BY x ORDER BY x;
SELECT x, count() FROM test.merge GROUP BY x ORDER BY x;
DROP TABLE IF EXISTS stripe1;
DROP TABLE IF EXISTS stripe2;
DROP TABLE IF EXISTS stripe3;
DROP TABLE IF EXISTS stripe4;
DROP TABLE IF EXISTS stripe5;
DROP TABLE IF EXISTS stripe6;
DROP TABLE IF EXISTS stripe7;
DROP TABLE IF EXISTS stripe8;
DROP TABLE IF EXISTS stripe9;
DROP TABLE IF EXISTS stripe10;
DROP TABLE IF EXISTS merge;
DROP TABLE IF EXISTS test.stripe1;
DROP TABLE IF EXISTS test.stripe2;
DROP TABLE IF EXISTS test.stripe3;
DROP TABLE IF EXISTS test.stripe4;
DROP TABLE IF EXISTS test.stripe5;
DROP TABLE IF EXISTS test.stripe6;
DROP TABLE IF EXISTS test.stripe7;
DROP TABLE IF EXISTS test.stripe8;
DROP TABLE IF EXISTS test.stripe9;
DROP TABLE IF EXISTS test.stripe10;
DROP TABLE IF EXISTS test.merge;

View File

@ -89,9 +89,9 @@ check_cli_and_http
function cmp_http_compression() {
$CLICKHOUSE_CLIENT -q "`query $1`" > ${CLICKHOUSE_TMP}/res0
ch_url 'compress=1' $1 | clickhouse-compressor --decompress > ${CLICKHOUSE_TMP}/res1
ch_url "compress=1&buffer_size=$2&wait_end_of_query=0" $1 | clickhouse-compressor --decompress > ${CLICKHOUSE_TMP}/res2
ch_url "compress=1&buffer_size=$2&wait_end_of_query=1" $1 | clickhouse-compressor --decompress > ${CLICKHOUSE_TMP}/res3
ch_url 'compress=1' $1 | ${CLICKHOUSE_BINARY}-compressor --decompress > ${CLICKHOUSE_TMP}/res1
ch_url "compress=1&buffer_size=$2&wait_end_of_query=0" $1 | ${CLICKHOUSE_BINARY}-compressor --decompress > ${CLICKHOUSE_TMP}/res2
ch_url "compress=1&buffer_size=$2&wait_end_of_query=1" $1 | ${CLICKHOUSE_BINARY}-compressor --decompress > ${CLICKHOUSE_TMP}/res3
cmp ${CLICKHOUSE_TMP}/res0 ${CLICKHOUSE_TMP}/res1
cmp ${CLICKHOUSE_TMP}/res1 ${CLICKHOUSE_TMP}/res2
cmp ${CLICKHOUSE_TMP}/res1 ${CLICKHOUSE_TMP}/res3

View File

@ -2,21 +2,21 @@
* - constant, true
* - constant, false
* - constant, NULL
* - non constant, non nullable
* - non constant, nullable
* - non constant, non nullable_00431
* - non constant, nullable_00431
*
* Then and else could be:
* - constant, not NULL
* - constant, NULL
* - non constant, non nullable
* - non constant, nullable
* - non constant, non nullable_00431
* - non constant, nullable_00431
*
* Thus we have 5 * 4 * 4 = 80 combinations.
*/
DROP TABLE IF EXISTS nullable;
DROP TABLE IF EXISTS nullable_00431;
CREATE VIEW nullable
CREATE VIEW nullable_00431
AS SELECT
1 AS constant_true,
0 AS constant_false,
@ -32,109 +32,109 @@ AS SELECT
FROM system.numbers LIMIT 10;
SELECT constant_true ? then_constant : else_constant AS res FROM nullable;
SELECT constant_true ? then_constant : constant_null AS res FROM nullable;
SELECT constant_true ? then_constant : else_non_constant AS res FROM nullable;
SELECT constant_true ? then_constant : else_non_constant_nullable AS res FROM nullable;
SELECT constant_true ? then_constant : else_constant AS res FROM nullable_00431;
SELECT constant_true ? then_constant : constant_null AS res FROM nullable_00431;
SELECT constant_true ? then_constant : else_non_constant AS res FROM nullable_00431;
SELECT constant_true ? then_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_true ? constant_null : else_constant AS res FROM nullable;
SELECT constant_true ? constant_null : constant_null AS res FROM nullable;
SELECT constant_true ? constant_null : else_non_constant AS res FROM nullable;
SELECT constant_true ? constant_null : else_non_constant_nullable AS res FROM nullable;
SELECT constant_true ? constant_null : else_constant AS res FROM nullable_00431;
SELECT constant_true ? constant_null : constant_null AS res FROM nullable_00431;
SELECT constant_true ? constant_null : else_non_constant AS res FROM nullable_00431;
SELECT constant_true ? constant_null : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_true ? then_non_constant : else_constant AS res FROM nullable;
SELECT constant_true ? then_non_constant : constant_null AS res FROM nullable;
SELECT constant_true ? then_non_constant : else_non_constant AS res FROM nullable;
SELECT constant_true ? then_non_constant : else_non_constant_nullable AS res FROM nullable;
SELECT constant_true ? then_non_constant : else_constant AS res FROM nullable_00431;
SELECT constant_true ? then_non_constant : constant_null AS res FROM nullable_00431;
SELECT constant_true ? then_non_constant : else_non_constant AS res FROM nullable_00431;
SELECT constant_true ? then_non_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_true ? then_non_constant_nullable : else_constant AS res FROM nullable;
SELECT constant_true ? then_non_constant_nullable : constant_null AS res FROM nullable;
SELECT constant_true ? then_non_constant_nullable : else_non_constant AS res FROM nullable;
SELECT constant_true ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable;
SELECT constant_true ? then_non_constant_nullable : else_constant AS res FROM nullable_00431;
SELECT constant_true ? then_non_constant_nullable : constant_null AS res FROM nullable_00431;
SELECT constant_true ? then_non_constant_nullable : else_non_constant AS res FROM nullable_00431;
SELECT constant_true ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_false ? then_constant : else_constant AS res FROM nullable;
SELECT constant_false ? then_constant : constant_null AS res FROM nullable;
SELECT constant_false ? then_constant : else_non_constant AS res FROM nullable;
SELECT constant_false ? then_constant : else_non_constant_nullable AS res FROM nullable;
SELECT constant_false ? then_constant : else_constant AS res FROM nullable_00431;
SELECT constant_false ? then_constant : constant_null AS res FROM nullable_00431;
SELECT constant_false ? then_constant : else_non_constant AS res FROM nullable_00431;
SELECT constant_false ? then_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_false ? constant_null : else_constant AS res FROM nullable;
SELECT constant_false ? constant_null : constant_null AS res FROM nullable;
SELECT constant_false ? constant_null : else_non_constant AS res FROM nullable;
SELECT constant_false ? constant_null : else_non_constant_nullable AS res FROM nullable;
SELECT constant_false ? constant_null : else_constant AS res FROM nullable_00431;
SELECT constant_false ? constant_null : constant_null AS res FROM nullable_00431;
SELECT constant_false ? constant_null : else_non_constant AS res FROM nullable_00431;
SELECT constant_false ? constant_null : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_false ? then_non_constant : else_constant AS res FROM nullable;
SELECT constant_false ? then_non_constant : constant_null AS res FROM nullable;
SELECT constant_false ? then_non_constant : else_non_constant AS res FROM nullable;
SELECT constant_false ? then_non_constant : else_non_constant_nullable AS res FROM nullable;
SELECT constant_false ? then_non_constant : else_constant AS res FROM nullable_00431;
SELECT constant_false ? then_non_constant : constant_null AS res FROM nullable_00431;
SELECT constant_false ? then_non_constant : else_non_constant AS res FROM nullable_00431;
SELECT constant_false ? then_non_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_false ? then_non_constant_nullable : else_constant AS res FROM nullable;
SELECT constant_false ? then_non_constant_nullable : constant_null AS res FROM nullable;
SELECT constant_false ? then_non_constant_nullable : else_non_constant AS res FROM nullable;
SELECT constant_false ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable;
SELECT constant_false ? then_non_constant_nullable : else_constant AS res FROM nullable_00431;
SELECT constant_false ? then_non_constant_nullable : constant_null AS res FROM nullable_00431;
SELECT constant_false ? then_non_constant_nullable : else_non_constant AS res FROM nullable_00431;
SELECT constant_false ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_null ? then_constant : else_constant AS res FROM nullable;
SELECT constant_null ? then_constant : constant_null AS res FROM nullable;
SELECT constant_null ? then_constant : else_non_constant AS res FROM nullable;
SELECT constant_null ? then_constant : else_non_constant_nullable AS res FROM nullable;
SELECT constant_null ? then_constant : else_constant AS res FROM nullable_00431;
SELECT constant_null ? then_constant : constant_null AS res FROM nullable_00431;
SELECT constant_null ? then_constant : else_non_constant AS res FROM nullable_00431;
SELECT constant_null ? then_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_null ? constant_null : else_constant AS res FROM nullable;
SELECT constant_null ? constant_null : constant_null AS res FROM nullable;
SELECT constant_null ? constant_null : else_non_constant AS res FROM nullable;
SELECT constant_null ? constant_null : else_non_constant_nullable AS res FROM nullable;
SELECT constant_null ? constant_null : else_constant AS res FROM nullable_00431;
SELECT constant_null ? constant_null : constant_null AS res FROM nullable_00431;
SELECT constant_null ? constant_null : else_non_constant AS res FROM nullable_00431;
SELECT constant_null ? constant_null : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_null ? then_non_constant : else_constant AS res FROM nullable;
SELECT constant_null ? then_non_constant : constant_null AS res FROM nullable;
SELECT constant_null ? then_non_constant : else_non_constant AS res FROM nullable;
SELECT constant_null ? then_non_constant : else_non_constant_nullable AS res FROM nullable;
SELECT constant_null ? then_non_constant : else_constant AS res FROM nullable_00431;
SELECT constant_null ? then_non_constant : constant_null AS res FROM nullable_00431;
SELECT constant_null ? then_non_constant : else_non_constant AS res FROM nullable_00431;
SELECT constant_null ? then_non_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT constant_null ? then_non_constant_nullable : else_constant AS res FROM nullable;
SELECT constant_null ? then_non_constant_nullable : constant_null AS res FROM nullable;
SELECT constant_null ? then_non_constant_nullable : else_non_constant AS res FROM nullable;
SELECT constant_null ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable;
SELECT constant_null ? then_non_constant_nullable : else_constant AS res FROM nullable_00431;
SELECT constant_null ? then_non_constant_nullable : constant_null AS res FROM nullable_00431;
SELECT constant_null ? then_non_constant_nullable : else_non_constant AS res FROM nullable_00431;
SELECT constant_null ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable_00431;
SELECT cond_non_constant ? then_constant : else_constant AS res FROM nullable;
SELECT cond_non_constant ? then_constant : constant_null AS res FROM nullable;
SELECT cond_non_constant ? then_constant : else_non_constant AS res FROM nullable;
SELECT cond_non_constant ? then_constant : else_non_constant_nullable AS res FROM nullable;
SELECT cond_non_constant ? then_constant : else_constant AS res FROM nullable_00431;
SELECT cond_non_constant ? then_constant : constant_null AS res FROM nullable_00431;
SELECT cond_non_constant ? then_constant : else_non_constant AS res FROM nullable_00431;
SELECT cond_non_constant ? then_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT cond_non_constant ? constant_null : else_constant AS res FROM nullable;
SELECT cond_non_constant ? constant_null : constant_null AS res FROM nullable;
SELECT cond_non_constant ? constant_null : else_non_constant AS res FROM nullable;
SELECT cond_non_constant ? constant_null : else_non_constant_nullable AS res FROM nullable;
SELECT cond_non_constant ? constant_null : else_constant AS res FROM nullable_00431;
SELECT cond_non_constant ? constant_null : constant_null AS res FROM nullable_00431;
SELECT cond_non_constant ? constant_null : else_non_constant AS res FROM nullable_00431;
SELECT cond_non_constant ? constant_null : else_non_constant_nullable AS res FROM nullable_00431;
SELECT cond_non_constant ? then_non_constant : else_constant AS res FROM nullable;
SELECT cond_non_constant ? then_non_constant : constant_null AS res FROM nullable;
SELECT cond_non_constant ? then_non_constant : else_non_constant AS res FROM nullable;
SELECT cond_non_constant ? then_non_constant : else_non_constant_nullable AS res FROM nullable;
SELECT cond_non_constant ? then_non_constant : else_constant AS res FROM nullable_00431;
SELECT cond_non_constant ? then_non_constant : constant_null AS res FROM nullable_00431;
SELECT cond_non_constant ? then_non_constant : else_non_constant AS res FROM nullable_00431;
SELECT cond_non_constant ? then_non_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT cond_non_constant ? then_non_constant_nullable : else_constant AS res FROM nullable;
SELECT cond_non_constant ? then_non_constant_nullable : constant_null AS res FROM nullable;
SELECT cond_non_constant ? then_non_constant_nullable : else_non_constant AS res FROM nullable;
SELECT cond_non_constant ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable;
SELECT cond_non_constant ? then_non_constant_nullable : else_constant AS res FROM nullable_00431;
SELECT cond_non_constant ? then_non_constant_nullable : constant_null AS res FROM nullable_00431;
SELECT cond_non_constant ? then_non_constant_nullable : else_non_constant AS res FROM nullable_00431;
SELECT cond_non_constant ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_constant : else_constant AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_constant : constant_null AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_constant : else_non_constant AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_constant : else_non_constant_nullable AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_constant : else_constant AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_constant : constant_null AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_constant : else_non_constant AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? constant_null : else_constant AS res FROM nullable;
SELECT cond_non_constant_nullable ? constant_null : constant_null AS res FROM nullable;
SELECT cond_non_constant_nullable ? constant_null : else_non_constant AS res FROM nullable;
SELECT cond_non_constant_nullable ? constant_null : else_non_constant_nullable AS res FROM nullable;
SELECT cond_non_constant_nullable ? constant_null : else_constant AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? constant_null : constant_null AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? constant_null : else_non_constant AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? constant_null : else_non_constant_nullable AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_non_constant : else_constant AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_non_constant : constant_null AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_non_constant : else_non_constant AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_non_constant : else_non_constant_nullable AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_non_constant : else_constant AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_non_constant : constant_null AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_non_constant : else_non_constant AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_non_constant : else_non_constant_nullable AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_non_constant_nullable : else_constant AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_non_constant_nullable : constant_null AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_non_constant_nullable : else_non_constant AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable;
SELECT cond_non_constant_nullable ? then_non_constant_nullable : else_constant AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_non_constant_nullable : constant_null AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_non_constant_nullable : else_non_constant AS res FROM nullable_00431;
SELECT cond_non_constant_nullable ? then_non_constant_nullable : else_non_constant_nullable AS res FROM nullable_00431;
DROP TABLE nullable;
DROP TABLE nullable_00431;

View File

@ -1,40 +1,40 @@
DROP TABLE IF EXISTS nullable;
DROP TABLE IF EXISTS nullable_00457;
CREATE TABLE nullable (s String, ns Nullable(String), narr Array(Nullable(UInt64))) ENGINE = Log;
CREATE TABLE nullable_00457 (s String, ns Nullable(String), narr Array(Nullable(UInt64))) ENGINE = Log;
INSERT INTO nullable SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10;
SELECT * FROM nullable ORDER BY s;
SELECT s FROM nullable ORDER BY s;
SELECT ns FROM nullable ORDER BY s;
SELECT narr FROM nullable ORDER BY s;
SELECT s, narr FROM nullable ORDER BY s;
INSERT INTO nullable_00457 SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10;
SELECT * FROM nullable_00457 ORDER BY s;
SELECT s FROM nullable_00457 ORDER BY s;
SELECT ns FROM nullable_00457 ORDER BY s;
SELECT narr FROM nullable_00457 ORDER BY s;
SELECT s, narr FROM nullable_00457 ORDER BY s;
INSERT INTO nullable SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10, 10;
INSERT INTO nullable_00457 SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10, 10;
DROP TABLE IF EXISTS nullable;
DROP TABLE IF EXISTS nullable_00457;
CREATE TABLE nullable (s String, ns Nullable(String), narr Array(Nullable(UInt64))) ENGINE = TinyLog;
CREATE TABLE nullable_00457 (s String, ns Nullable(String), narr Array(Nullable(UInt64))) ENGINE = TinyLog;
INSERT INTO nullable SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10;
SELECT * FROM nullable ORDER BY s;
SELECT s FROM nullable ORDER BY s;
SELECT ns FROM nullable ORDER BY s;
SELECT narr FROM nullable ORDER BY s;
SELECT s, narr FROM nullable ORDER BY s;
INSERT INTO nullable_00457 SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10;
SELECT * FROM nullable_00457 ORDER BY s;
SELECT s FROM nullable_00457 ORDER BY s;
SELECT ns FROM nullable_00457 ORDER BY s;
SELECT narr FROM nullable_00457 ORDER BY s;
SELECT s, narr FROM nullable_00457 ORDER BY s;
INSERT INTO nullable SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10, 10;
INSERT INTO nullable_00457 SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10, 10;
DROP TABLE IF EXISTS nullable;
DROP TABLE IF EXISTS nullable_00457;
CREATE TABLE nullable (s String, ns Nullable(String), narr Array(Nullable(UInt64))) ENGINE = StripeLog;
CREATE TABLE nullable_00457 (s String, ns Nullable(String), narr Array(Nullable(UInt64))) ENGINE = StripeLog;
INSERT INTO nullable SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10;
SELECT * FROM nullable ORDER BY s;
SELECT s FROM nullable ORDER BY s;
SELECT ns FROM nullable ORDER BY s;
SELECT narr FROM nullable ORDER BY s;
SELECT s, narr FROM nullable ORDER BY s;
INSERT INTO nullable_00457 SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10;
SELECT * FROM nullable_00457 ORDER BY s;
SELECT s FROM nullable_00457 ORDER BY s;
SELECT ns FROM nullable_00457 ORDER BY s;
SELECT narr FROM nullable_00457 ORDER BY s;
SELECT s, narr FROM nullable_00457 ORDER BY s;
INSERT INTO nullable SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10, 10;
INSERT INTO nullable_00457 SELECT toString(number), number % 3 = 1 ? toString(number) : NULL, arrayMap(x -> x % 2 = 1 ? x : NULL, range(number)) FROM system.numbers LIMIT 10, 10;
DROP TABLE nullable;
DROP TABLE nullable_00457;

View File

@ -1,5 +1,5 @@
DROP TABLE IF EXISTS nullable;
CREATE TABLE nullable (id Nullable(UInt32), cat String) ENGINE = Log;
INSERT INTO nullable (cat) VALUES ('test');
SELECT * FROM nullable;
DROP TABLE nullable;
DROP TABLE IF EXISTS nullable_00465;
CREATE TABLE nullable_00465 (id Nullable(UInt32), cat String) ENGINE = Log;
INSERT INTO nullable_00465 (cat) VALUES ('test');
SELECT * FROM nullable_00465;
DROP TABLE nullable_00465;

View File

@ -1,9 +1,9 @@
DROP TABLE IF EXISTS t;
DROP TABLE IF EXISTS mv;
DROP TABLE IF EXISTS `.inner.mv`;
DROP TABLE IF EXISTS t_00472;
DROP TABLE IF EXISTS mv_00472;
DROP TABLE IF EXISTS `.inner.mv_00472`;
CREATE TABLE t (x UInt8) ENGINE = Null;
CREATE VIEW IF NOT EXISTS mv AS SELECT * FROM t;
CREATE TABLE t_00472 (x UInt8) ENGINE = Null;
CREATE VIEW IF NOT EXISTS mv_00472 AS SELECT * FROM t_00472;
DROP TABLE t;
DROP TABLE mv;
DROP TABLE t_00472;
DROP TABLE mv_00472;

View File

@ -1,7 +1,7 @@
DROP TABLE IF EXISTS tab;
CREATE TABLE tab (date Date, value UInt64, s String, m FixedString(16)) ENGINE = MergeTree(date, (date, value), 8);
INSERT INTO tab SELECT today() as date, number as value, '' as s, toFixedString('', 16) as m from system.numbers limit 42;
DROP TABLE IF EXISTS tab_00481;
CREATE TABLE tab_00481 (date Date, value UInt64, s String, m FixedString(16)) ENGINE = MergeTree(date, (date, value), 8);
INSERT INTO tab_00481 SELECT today() as date, number as value, '' as s, toFixedString('', 16) as m from system.numbers limit 42;
SET preferred_max_column_in_block_size_bytes = 32;
SELECT blockSize(), * from tab format Null;
SELECT blockSize(), * from tab_00481 format Null;
SELECT 0;

View File

@ -1,34 +1,34 @@
drop table if exists tab;
create table tab (date Date, x UInt64, s FixedString(128)) engine = MergeTree(date, (date, x), 8192);
insert into tab select today(), number, toFixedString('', 128) from system.numbers limit 8192;
drop table if exists tab_00484;
create table tab_00484 (date Date, x UInt64, s FixedString(128)) engine = MergeTree(date, (date, x), 8192);
insert into tab_00484 select today(), number, toFixedString('', 128) from system.numbers limit 8192;
set preferred_block_size_bytes = 2000000;
set preferred_max_column_in_block_size_bytes = 0;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab_00484;
set preferred_max_column_in_block_size_bytes = 128;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab_00484;
set preferred_max_column_in_block_size_bytes = 256;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab_00484;
set preferred_max_column_in_block_size_bytes = 2097152;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab_00484;
set preferred_max_column_in_block_size_bytes = 4194304;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab;
select max(blockSize()), min(blockSize()), any(ignore(*)) from tab_00484;
drop table if exists tab;
create table tab (date Date, x UInt64, s FixedString(128)) engine = MergeTree(date, (date, x), 32);
insert into tab select today(), number, toFixedString('', 128) from system.numbers limit 47;
drop table if exists tab_00484;
create table tab_00484 (date Date, x UInt64, s FixedString(128)) engine = MergeTree(date, (date, x), 32);
insert into tab_00484 select today(), number, toFixedString('', 128) from system.numbers limit 47;
set preferred_max_column_in_block_size_bytes = 1152;
select blockSize(), * from tab where x = 1 or x > 36 format Null;
select blockSize(), * from tab_00484 where x = 1 or x > 36 format Null;
drop table if exists tab;
create table tab (date Date, x UInt64, s FixedString(128)) engine = MergeTree(date, (date, x), 8192);
insert into tab select today(), number, toFixedString('', 128) from system.numbers limit 10;
drop table if exists tab_00484;
create table tab_00484 (date Date, x UInt64, s FixedString(128)) engine = MergeTree(date, (date, x), 8192);
insert into tab_00484 select today(), number, toFixedString('', 128) from system.numbers limit 10;
set preferred_max_column_in_block_size_bytes = 128;
select s from tab where s == '' format Null;
select s from tab_00484 where s == '' format Null;
drop table if exists tab;
create table tab (date Date, x UInt64, s String) engine = MergeTree(date, (date, x), 8192);
insert into tab select today(), number, 'abc' from system.numbers limit 81920;
drop table if exists tab_00484;
create table tab_00484 (date Date, x UInt64, s String) engine = MergeTree(date, (date, x), 8192);
insert into tab_00484 select today(), number, 'abc' from system.numbers limit 81920;
set preferred_block_size_bytes = 0;
select count(*) from tab prewhere s != 'abc' format Null;
select count(*) from tab prewhere s = 'abc' format Null;
select count(*) from tab_00484 prewhere s != 'abc' format Null;
select count(*) from tab_00484 prewhere s = 'abc' format Null;

View File

@ -1,6 +1,5 @@
SET send_logs_level = 'none';
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS sum_map;
CREATE TABLE sum_map(date Date, timeslot DateTime, statusMap Nested(status UInt16, requests UInt64)) ENGINE = Log;

View File

@ -1,4 +1,3 @@
create database if not exists test;
drop table if exists test_ins_arr;
create table test_ins_arr (date Date, val Array(UInt64)) engine = MergeTree(date, (date), 8192);

View File

@ -1,32 +1,32 @@
DROP TABLE IF EXISTS test.src;
DROP TABLE IF EXISTS test.dst;
DROP TABLE IF EXISTS test.mv;
DROP TABLE IF EXISTS test.mv_00508;
CREATE TABLE test.src (x UInt8) ENGINE = Null;
CREATE TABLE test.dst (x UInt8) ENGINE = Memory;
USE test;
CREATE MATERIALIZED VIEW mv TO dst AS SELECT * FROM src;
CREATE MATERIALIZED VIEW test.mv_00508 TO dst AS SELECT * FROM src;
INSERT INTO src VALUES (1), (2);
SELECT * FROM mv ORDER BY x;
SELECT * FROM test.mv_00508 ORDER BY x;
-- Detach MV and see if the data is still readable
DETACH TABLE mv;
DETACH TABLE test.mv_00508;
SELECT * FROM dst ORDER BY x;
USE default;
-- Reattach MV (shortcut)
ATTACH TABLE test.mv;
ATTACH TABLE test.mv_00508;
INSERT INTO test.src VALUES (3);
SELECT * FROM test.mv ORDER BY x;
SELECT * FROM test.mv_00508 ORDER BY x;
-- Drop the MV and see if the data is still readable
DROP TABLE test.mv;
DROP TABLE test.mv_00508;
SELECT * FROM test.dst ORDER BY x;
DROP TABLE test.src;

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash
[ -z "$CLICKHOUSE_CLIENT" ] && CLICKHOUSE_CLIENT="clickhouse-client"
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
SETTINGS="--compile=1 --min_count_to_compile=0 --max_threads=1 --max_memory_usage=8000000 --server_logs_file=/dev/null"
output=$($CLICKHOUSE_CLIENT -q "SELECT length(groupArray(number)) FROM (SELECT * FROM system.numbers LIMIT 1000000)" $SETTINGS 2>&1)

View File

@ -1,13 +1,13 @@
DROP TABLE IF EXISTS nullable;
CREATE TABLE nullable (x String) ENGINE = MergeTree ORDER BY x;
INSERT INTO nullable VALUES ('hello'), ('world');
SELECT * FROM nullable;
ALTER TABLE nullable ADD COLUMN n Nullable(UInt64);
SELECT * FROM nullable;
ALTER TABLE nullable DROP COLUMN n;
ALTER TABLE nullable ADD COLUMN n Nullable(UInt64) DEFAULT NULL;
SELECT * FROM nullable;
ALTER TABLE nullable DROP COLUMN n;
ALTER TABLE nullable ADD COLUMN n Nullable(UInt64) DEFAULT 0;
SELECT * FROM nullable;
DROP TABLE nullable;
DROP TABLE IF EXISTS nullable_00571;
CREATE TABLE nullable_00571 (x String) ENGINE = MergeTree ORDER BY x;
INSERT INTO nullable_00571 VALUES ('hello'), ('world');
SELECT * FROM nullable_00571;
ALTER TABLE nullable_00571 ADD COLUMN n Nullable(UInt64);
SELECT * FROM nullable_00571;
ALTER TABLE nullable_00571 DROP COLUMN n;
ALTER TABLE nullable_00571 ADD COLUMN n Nullable(UInt64) DEFAULT NULL;
SELECT * FROM nullable_00571;
ALTER TABLE nullable_00571 DROP COLUMN n;
ALTER TABLE nullable_00571 ADD COLUMN n Nullable(UInt64) DEFAULT 0;
SELECT * FROM nullable_00571;
DROP TABLE nullable_00571;

View File

@ -1,9 +1,9 @@
DROP TABLE IF EXISTS t;
DROP TABLE IF EXISTS t_00575;
create table t(d Date) engine MergeTree(d, d, 8192);
create table t_00575(d Date) engine MergeTree(d, d, 8192);
insert into t values ('2018-02-20');
insert into t_00575 values ('2018-02-20');
select count() from t where toDayOfWeek(d) in (2);
select count() from t_00575 where toDayOfWeek(d) in (2);
DROP TABLE t;
DROP TABLE t_00575;

View File

@ -1,8 +1,8 @@
drop table if exists tab;
create table tab (date Date, version UInt64, val UInt64) engine = ReplacingMergeTree(version) partition by date order by date settings enable_vertical_merge_algorithm = 1, vertical_merge_algorithm_min_rows_to_activate = 1, vertical_merge_algorithm_min_columns_to_activate = 0;
insert into tab values ('2018-01-01', 2, 2), ('2018-01-01', 1, 1);
insert into tab values ('2018-01-01', 0, 0);
select * from tab order by version;
OPTIMIZE TABLE tab;
select * from tab;
drop table if exists tab_00577;
create table tab_00577 (date Date, version UInt64, val UInt64) engine = ReplacingMergeTree(version) partition by date order by date settings enable_vertical_merge_algorithm = 1, vertical_merge_algorithm_min_rows_to_activate = 1, vertical_merge_algorithm_min_columns_to_activate = 0;
insert into tab_00577 values ('2018-01-01', 2, 2), ('2018-01-01', 1, 1);
insert into tab_00577 values ('2018-01-01', 0, 0);
select * from tab_00577 order by version;
OPTIMIZE TABLE tab_00577;
select * from tab_00577;

View File

@ -1,18 +1,18 @@
DROP TABLE IF EXISTS test.sample1;
DROP TABLE IF EXISTS test.sample2;
DROP TABLE IF EXISTS test.sample_merge;
DROP TABLE IF EXISTS test.sample_00579_1;
DROP TABLE IF EXISTS test.sample_00579_2;
DROP TABLE IF EXISTS test.sample_merge_00579;
CREATE TABLE test.sample1 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
CREATE TABLE test.sample2 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
CREATE TABLE test.sample_00579_1 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
CREATE TABLE test.sample_00579_2 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
INSERT INTO test.sample1 (x) SELECT number AS x FROM system.numbers LIMIT 1000;
INSERT INTO test.sample2 (x) SELECT number AS x FROM system.numbers LIMIT 2000;
INSERT INTO test.sample_00579_1 (x) SELECT number AS x FROM system.numbers LIMIT 1000;
INSERT INTO test.sample_00579_2 (x) SELECT number AS x FROM system.numbers LIMIT 2000;
CREATE TABLE test.sample_merge AS test.sample1 ENGINE = Merge(test, '^sample\\d$');
CREATE TABLE test.sample_merge_00579 AS test.sample_00579_1 ENGINE = Merge(test, '^sample_00579_\\d$');
SET max_threads = 1;
SELECT _sample_factor FROM merge(test, '^sample\\d$');
SELECT _sample_factor FROM merge(test, '^sample_00579_\\d$');
DROP TABLE test.sample1;
DROP TABLE test.sample2;
DROP TABLE test.sample_merge;
DROP TABLE test.sample_00579_1;
DROP TABLE test.sample_00579_2;
DROP TABLE test.sample_merge_00579;

View File

@ -1,7 +1,7 @@
DROP TABLE IF EXISTS alias_local10;
DROP TABLE IF EXISTS alias10;
DROP TABLE IF EXISTS test.alias_local10;
DROP TABLE IF EXISTS test.alias10;
CREATE TABLE alias_local10 (
CREATE TABLE test.alias_local10 (
Id Int8,
EventDate Date DEFAULT '2000-01-01',
field1 Int8,
@ -9,29 +9,29 @@ CREATE TABLE alias_local10 (
field3 ALIAS CASE WHEN field1 = 1 THEN field2 ELSE '0' END
) ENGINE = MergeTree(EventDate, (Id, EventDate), 8192);
CREATE TABLE alias10 AS alias_local10 ENGINE = Distributed(test_shard_localhost, test, alias_local10, cityHash64(Id));
CREATE TABLE test.alias10 AS test.alias_local10 ENGINE = Distributed(test_shard_localhost, test, alias_local10, cityHash64(Id));
INSERT INTO alias_local10 (Id, EventDate, field1, field2) VALUES (1, '2000-01-01', 1, '12345'), (2, '2000-01-01', 2, '54321'), (3, '2000-01-01', 0, '');
INSERT INTO test.alias_local10 (Id, EventDate, field1, field2) VALUES (1, '2000-01-01', 1, '12345'), (2, '2000-01-01', 2, '54321'), (3, '2000-01-01', 0, '');
SELECT field1, field2, field3 FROM alias_local10;
SELECT field1, field2, field3 FROM alias_local10 WHERE EventDate='2000-01-01';
SELECT field1, field2 FROM alias_local10 WHERE EventDate='2000-01-01';
SELECT field1, field2, field3 FROM test.alias_local10;
SELECT field1, field2, field3 FROM test.alias_local10 WHERE EventDate='2000-01-01';
SELECT field1, field2 FROM test.alias_local10 WHERE EventDate='2000-01-01';
SELECT field1, field2, field3 FROM alias10;
SELECT field1, field2, field3 FROM alias10 WHERE EventDate='2000-01-01';
SELECT field1, field2 FROM alias10 WHERE EventDate='2000-01-01';
SELECT field1, field2, field3 FROM test.alias10;
SELECT field1, field2, field3 FROM test.alias10 WHERE EventDate='2000-01-01';
SELECT field1, field2 FROM test.alias10 WHERE EventDate='2000-01-01';
SELECT field2, field3 FROM alias10 WHERE EventDate='2000-01-01';
SELECT field3 FROM alias10 WHERE EventDate='2000-01-01';
SELECT field2, field3 FROM alias10;
SELECT field3 FROM alias10;
SELECT field2, field3 FROM test.alias10 WHERE EventDate='2000-01-01';
SELECT field3 FROM test.alias10 WHERE EventDate='2000-01-01';
SELECT field2, field3 FROM test.alias10;
SELECT field3 FROM test.alias10;
SELECT field1 FROM alias10 WHERE field3 = '12345';
SELECT field2 FROM alias10 WHERE field3 = '12345';
SELECT field3 FROM alias10 WHERE field3 = '12345';
SELECT field1 FROM test.alias10 WHERE field3 = '12345';
SELECT field2 FROM test.alias10 WHERE field3 = '12345';
SELECT field3 FROM test.alias10 WHERE field3 = '12345';
DROP TABLE alias10;
CREATE TABLE alias10 (
DROP TABLE test.alias10;
CREATE TABLE test.alias10 (
Id Int8,
EventDate Date,
field1 Int8,
@ -39,22 +39,22 @@ CREATE TABLE alias10 (
field3 String
) ENGINE = Distributed(test_shard_localhost, test, alias_local10);
SELECT field1, field2, field3 FROM alias_local10;
SELECT field1, field2, field3 FROM alias_local10 WHERE EventDate='2000-01-01';
SELECT field1, field2 FROM alias_local10 WHERE EventDate='2000-01-01';
SELECT field1, field2, field3 FROM test.alias_local10;
SELECT field1, field2, field3 FROM test.alias_local10 WHERE EventDate='2000-01-01';
SELECT field1, field2 FROM test.alias_local10 WHERE EventDate='2000-01-01';
SELECT field1, field2, field3 FROM alias10;
SELECT field1, field2, field3 FROM alias10 WHERE EventDate='2000-01-01';
SELECT field1, field2 FROM alias10 WHERE EventDate='2000-01-01';
SELECT field1, field2, field3 FROM test.alias10;
SELECT field1, field2, field3 FROM test.alias10 WHERE EventDate='2000-01-01';
SELECT field1, field2 FROM test.alias10 WHERE EventDate='2000-01-01';
SELECT field2, field3 FROM alias10 WHERE EventDate='2000-01-01';
SELECT field3 FROM alias10 WHERE EventDate='2000-01-01';
SELECT field2, field3 FROM alias10;
SELECT field3 FROM alias10;
SELECT field2, field3 FROM test.alias10 WHERE EventDate='2000-01-01';
SELECT field3 FROM test.alias10 WHERE EventDate='2000-01-01';
SELECT field2, field3 FROM test.alias10;
SELECT field3 FROM test.alias10;
SELECT field1 FROM alias10 WHERE field3 = '12345';
SELECT field2 FROM alias10 WHERE field3 = '12345';
SELECT field3 FROM alias10 WHERE field3 = '12345';
SELECT field1 FROM test.alias10 WHERE field3 = '12345';
SELECT field2 FROM test.alias10 WHERE field3 = '12345';
SELECT field3 FROM test.alias10 WHERE field3 = '12345';
DROP TABLE alias_local10;
DROP TABLE alias10;
DROP TABLE test.alias_local10;
DROP TABLE test.alias10;

View File

@ -1,18 +1,18 @@
DROP TABLE IF EXISTS tab;
DROP TABLE IF EXISTS mv;
DROP TABLE IF EXISTS tab_00610;
DROP TABLE IF EXISTS mv_00610;
CREATE TABLE tab(d Date, x UInt32) ENGINE MergeTree(d, x, 8192);
CREATE MATERIALIZED VIEW mv(d Date, y UInt64) ENGINE MergeTree(d, y, 8192) AS SELECT d, x + 1 AS y FROM tab;
CREATE TABLE tab_00610(d Date, x UInt32) ENGINE MergeTree(d, x, 8192);
CREATE MATERIALIZED VIEW mv_00610(d Date, y UInt64) ENGINE MergeTree(d, y, 8192) AS SELECT d, x + 1 AS y FROM tab_00610;
INSERT INTO tab VALUES ('2018-01-01', 1), ('2018-01-01', 2), ('2018-02-01', 3);
INSERT INTO tab_00610 VALUES ('2018-01-01', 1), ('2018-01-01', 2), ('2018-02-01', 3);
SELECT '-- Before DROP PARTITION --';
SELECT * FROM mv ORDER BY y;
SELECT * FROM mv_00610 ORDER BY y;
ALTER TABLE mv DROP PARTITION 201801;
ALTER TABLE mv_00610 DROP PARTITION 201801;
SELECT '-- After DROP PARTITION --';
SELECT * FROM mv ORDER BY y;
SELECT * FROM mv_00610 ORDER BY y;
DROP TABLE tab;
DROP TABLE mv;
DROP TABLE tab_00610;
DROP TABLE mv_00610;

View File

@ -11,11 +11,11 @@ echo "select '1'" | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL}/?max_query_size=10
echo -
echo "select '11'" | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL}/?max_query_size=10 -d @- 2>&1 | grep -o "Max query size exceeded"
echo 'drop table if exists tab' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
echo 'create table tab (key UInt64, val UInt64) engine = MergeTree order by key' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
echo 'into tab values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5)' | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL}/?max_query_size=30&query=insert" -d @-
echo 'select val from tab order by val' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
echo 'drop table tab' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
echo 'drop table if exists tab_00612_1' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL_PARAMS} -d @-
echo 'create table tab_00612_1 (key UInt64, val UInt64) engine = MergeTree order by key' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL_PARAMS} -d @-
echo 'into tab_00612_1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5)' | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL_PARAMS}&max_query_size=30&query=insert" -d @-
echo 'select val from tab_00612_1 order by val' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL_PARAMS} -d @-
echo 'drop table tab_00612_1' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL_PARAMS} -d @-
echo "
import requests

View File

@ -24,14 +24,14 @@ key, arrayJoin(n.x) in ((1, 1), (2, 2))
(key, left array join n.x) in ((1, 1), (2, 2))
1
2
max(key) from tab where (key, left array join n.x) in (1, 1)
max(key) from tab_00612 where (key, left array join n.x) in (1, 1)
1
1
max(key) from tab where (key, left array join n.x) in ((1, 1), (2, 2))
max(key) from tab_00612 where (key, left array join n.x) in ((1, 1), (2, 2))
2
2
max(key) from tab any left join (select key, arrayJoin(n.x) as val from tab) using key where (key, val) in (1, 1)
max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in (1, 1)
1
max(key) from tab any left join (select key, arrayJoin(n.x) as val from tab) using key where (key, val) in ((1, 1), (2, 2))
max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in ((1, 1), (2, 2))
2
1

View File

@ -1,45 +1,44 @@
create database if not exists test;
drop table if exists tab;
create table tab (key UInt64, arr Array(UInt64)) Engine = MergeTree order by key;
insert into tab values (1, [1]);
insert into tab values (2, [2]);
drop table if exists tab_00612;
create table tab_00612 (key UInt64, arr Array(UInt64)) Engine = MergeTree order by key;
insert into tab_00612 values (1, [1]);
insert into tab_00612 values (2, [2]);
select 'all';
select * from tab order by key;
select * from tab_00612 order by key;
select 'key, arrayJoin(arr) in (1, 1)';
select key, arrayJoin(arr) as val from tab where (key, val) in (1, 1);
select key, arrayJoin(arr) as val from tab_00612 where (key, val) in (1, 1);
select 'key, arrayJoin(arr) in ((1, 1), (2, 2))';
select key, arrayJoin(arr) as val from tab where (key, val) in ((1, 1), (2, 2)) order by key;
select key, arrayJoin(arr) as val from tab_00612 where (key, val) in ((1, 1), (2, 2)) order by key;
select '(key, left array join arr) in (1, 1)';
select key from tab left array join arr as val where (key, val) in (1, 1);
select key from tab_00612 left array join arr as val where (key, val) in (1, 1);
select '(key, left array join arr) in ((1, 1), (2, 2))';
select key from tab left array join arr as val where (key, val) in ((1, 1), (2, 2)) order by key;
select key from tab_00612 left array join arr as val where (key, val) in ((1, 1), (2, 2)) order by key;
drop table if exists tab;
create table tab (key UInt64, n Nested(x UInt64)) Engine = MergeTree order by key;
insert into tab values (1, [1]);
insert into tab values (2, [2]);
drop table if exists tab_00612;
create table tab_00612 (key UInt64, n Nested(x UInt64)) Engine = MergeTree order by key;
insert into tab_00612 values (1, [1]);
insert into tab_00612 values (2, [2]);
select 'all';
select * from tab order by key;
select * from tab_00612 order by key;
select 'key, arrayJoin(n.x) in (1, 1)';
select key, arrayJoin(n.x) as val from tab where (key, val) in (1, 1);
select key, arrayJoin(n.x) as val from tab_00612 where (key, val) in (1, 1);
select 'key, arrayJoin(n.x) in ((1, 1), (2, 2))';
select key, arrayJoin(n.x) as val from tab where (key, val) in ((1, 1), (2, 2)) order by key;
select key, arrayJoin(n.x) as val from tab_00612 where (key, val) in ((1, 1), (2, 2)) order by key;
select '(key, left array join n.x) in (1, 1)';
select key from tab left array join n.x as val where (key, val) in (1, 1);
select key from tab_00612 left array join n.x as val where (key, val) in (1, 1);
select '(key, left array join n.x) in ((1, 1), (2, 2))';
select key from tab left array join n.x as val where (key, val) in ((1, 1), (2, 2)) order by key;
select 'max(key) from tab where (key, left array join n.x) in (1, 1)';
select max(key) from tab left array join `n.x` as val where (key, val) in ((1, 1));
select max(key) from tab left array join n as val where (key, val.x) in (1, 1);
select 'max(key) from tab where (key, left array join n.x) in ((1, 1), (2, 2))';
select max(key) from tab left array join `n.x` as val where (key, val) in ((1, 1), (2, 2));
select max(key) from tab left array join n as val where (key, val.x) in ((1, 1), (2, 2));
select 'max(key) from tab any left join (select key, arrayJoin(n.x) as val from tab) using key where (key, val) in (1, 1)';
select max(key) from tab any left join (select key, arrayJoin(n.x) as val from tab) using key where (key, val) in (1, 1);
select 'max(key) from tab any left join (select key, arrayJoin(n.x) as val from tab) using key where (key, val) in ((1, 1), (2, 2))';
select max(key) from tab any left join (select key, arrayJoin(n.x) as val from tab) using key where (key, val) in ((1, 1), (2, 2));
select key from tab_00612 left array join n.x as val where (key, val) in ((1, 1), (2, 2)) order by key;
select 'max(key) from tab_00612 where (key, left array join n.x) in (1, 1)';
select max(key) from tab_00612 left array join `n.x` as val where (key, val) in ((1, 1));
select max(key) from tab_00612 left array join n as val where (key, val.x) in (1, 1);
select 'max(key) from tab_00612 where (key, left array join n.x) in ((1, 1), (2, 2))';
select max(key) from tab_00612 left array join `n.x` as val where (key, val) in ((1, 1), (2, 2));
select max(key) from tab_00612 left array join n as val where (key, val.x) in ((1, 1), (2, 2));
select 'max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in (1, 1)';
select max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in (1, 1);
select 'max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in ((1, 1), (2, 2))';
select max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in ((1, 1), (2, 2));
drop table if exists tab;
CREATE TABLE tab (key1 Int32, id1 Int64, c1 Int64) ENGINE = MergeTree PARTITION BY id1 ORDER BY (key1) ;
insert into tab values ( -1, 1, 0 );
SELECT count(*) FROM tab PREWHERE id1 IN (1);
drop table if exists tab_00612;
CREATE TABLE tab_00612 (key1 Int32, id1 Int64, c1 Int64) ENGINE = MergeTree PARTITION BY id1 ORDER BY (key1) ;
insert into tab_00612 values ( -1, 1, 0 );
SELECT count(*) FROM tab_00612 PREWHERE id1 IN (1);

View File

@ -1,6 +1,6 @@
DROP TABLE IF EXISTS tab ;
DROP TABLE IF EXISTS tab_00625;
CREATE TABLE tab
CREATE TABLE tab_00625
(
date Date,
key UInt32,
@ -10,7 +10,7 @@ CREATE TABLE tab
)
ENGINE = SummingMergeTree(date, (date, key), 1);
INSERT INTO tab SELECT
INSERT INTO tab_00625 SELECT
today(),
number,
[toUInt16(number)],
@ -18,7 +18,7 @@ INSERT INTO tab SELECT
FROM system.numbers
LIMIT 8190;
INSERT INTO tab SELECT
INSERT INTO tab_00625 SELECT
today(),
number + 8190,
[toUInt16(number)],
@ -26,4 +26,4 @@ INSERT INTO tab SELECT
FROM system.numbers
LIMIT 10;
OPTIMIZE TABLE tab;
OPTIMIZE TABLE tab_00625;

View File

@ -17,8 +17,8 @@ SELECT cast(1, 'Enum8(\'hello\' = 1,\n\t\'world\' = 2)');
SELECT toTimeZone(CAST(1 AS TIMESTAMP), 'UTC');
DROP TABLE IF EXISTS cast;
CREATE TABLE cast
DROP TABLE IF EXISTS test.cast;
CREATE TABLE test.cast
(
x UInt8,
e Enum8
@ -39,10 +39,10 @@ CREATE TABLE cast
)
) ENGINE = MergeTree ORDER BY e;
SHOW CREATE TABLE cast FORMAT TSVRaw;
DESC TABLE cast;
SHOW CREATE TABLE test.cast FORMAT TSVRaw;
DESC TABLE test.cast;
INSERT INTO cast (x) VALUES (1);
SELECT * FROM cast;
INSERT INTO test.cast (x) VALUES (1);
SELECT * FROM test.cast;
DROP TABLE cast;
DROP TABLE test.cast;

View File

@ -1,7 +1,7 @@
DROP TABLE IF EXISTS cast1;
DROP TABLE IF EXISTS cast2;
DROP TABLE IF EXISTS test.cast1;
DROP TABLE IF EXISTS test.cast2;
CREATE TABLE cast1
CREATE TABLE test.cast1
(
x UInt8,
e Enum8
@ -22,17 +22,17 @@ CREATE TABLE cast1
)
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_cast', 'r1') ORDER BY e;
SHOW CREATE TABLE cast1 FORMAT TSVRaw;
DESC TABLE cast1;
SHOW CREATE TABLE test.cast1 FORMAT TSVRaw;
DESC TABLE test.cast1;
INSERT INTO cast1 (x) VALUES (1);
SELECT * FROM cast1;
INSERT INTO test.cast1 (x) VALUES (1);
SELECT * FROM test.cast1;
CREATE TABLE cast2 AS cast1 ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_cast', 'r2') ORDER BY e;
CREATE TABLE test.cast2 AS test.cast1 ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_cast', 'r2') ORDER BY e;
SYSTEM SYNC REPLICA cast2;
SYSTEM SYNC REPLICA test.cast2;
SELECT * FROM cast2;
SELECT * FROM test.cast2;
DROP TABLE cast1;
DROP TABLE cast2;
DROP TABLE test.cast1;
DROP TABLE test.cast2;

View File

@ -1,21 +1,21 @@
drop table if exists tab;
create table tab (val UInt32, n Nested(x UInt8, y String)) engine = Memory;
insert into tab values (1, [1, 2, 1, 1, 2, 1], ['a', 'a', 'b', 'a', 'b', 'b']);
select arrayEnumerateUniq(n.x) from tab;
select arrayEnumerateUniq(n.y) from tab;
select arrayEnumerateUniq(n.x, n.y) from tab;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y)) from tab;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y), n.x) from tab;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y), arrayMap((a, b) -> (b, a), n.x, n.y)) from tab;
drop table if exists tab_00650;
create table tab_00650 (val UInt32, n Nested(x UInt8, y String)) engine = Memory;
insert into tab_00650 values (1, [1, 2, 1, 1, 2, 1], ['a', 'a', 'b', 'a', 'b', 'b']);
select arrayEnumerateUniq(n.x) from tab_00650;
select arrayEnumerateUniq(n.y) from tab_00650;
select arrayEnumerateUniq(n.x, n.y) from tab_00650;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y)) from tab_00650;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y), n.x) from tab_00650;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y), arrayMap((a, b) -> (b, a), n.x, n.y)) from tab_00650;
drop table tab;
create table tab (val UInt32, n Nested(x Nullable(UInt8), y String)) engine = Memory;
insert into tab values (1, [1, Null, 2, 1, 1, 2, 1, Null, Null], ['a', 'a', 'a', 'b', 'a', 'b', 'b', 'b', 'a']);
select arrayEnumerateUniq(n.x) from tab;
select arrayEnumerateUniq(n.y) from tab;
select arrayEnumerateUniq(n.x, n.y) from tab;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y)) from tab;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y), n.x) from tab;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y), arrayMap((a, b) -> (b, a), n.x, n.y)) from tab;
drop table tab_00650;
create table tab_00650 (val UInt32, n Nested(x Nullable(UInt8), y String)) engine = Memory;
insert into tab_00650 values (1, [1, Null, 2, 1, 1, 2, 1, Null, Null], ['a', 'a', 'a', 'b', 'a', 'b', 'b', 'b', 'a']);
select arrayEnumerateUniq(n.x) from tab_00650;
select arrayEnumerateUniq(n.y) from tab_00650;
select arrayEnumerateUniq(n.x, n.y) from tab_00650;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y)) from tab_00650;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y), n.x) from tab_00650;
select arrayEnumerateUniq(arrayMap((a, b) -> (a, b), n.x, n.y), arrayMap((a, b) -> (b, a), n.x, n.y)) from tab_00650;
drop table tab;
drop table tab_00650;

View File

@ -3,4 +3,4 @@
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
${CLICKHOUSE_CLIENT} --ignore-error --multiquery --query "DROP TABLE IF EXISTS tab; CREATE TABLE tab (val UInt64) engine = Memory; SHOW CREATE TABLE tab format abcd; DESC tab; DROP TABLE tab;" ||: 2> /dev/null
${CLICKHOUSE_CLIENT} --ignore-error --multiquery --query "DROP TABLE IF EXISTS tab_00651; CREATE TABLE tab_00651 (val UInt64) engine = Memory; SHOW CREATE TABLE tab_00651 format abcd; DESC tab_00651; DROP TABLE tab_00651;" ||: 2> /dev/null

View File

@ -1,12 +1,12 @@
DROP TABLE IF EXISTS mergetree;
DROP TABLE IF EXISTS mergetree_00673;
CREATE TABLE mergetree (x UInt64) ENGINE = MergeTree ORDER BY x;
INSERT INTO mergetree VALUES (1);
CREATE TABLE mergetree_00673 (x UInt64) ENGINE = MergeTree ORDER BY x;
INSERT INTO mergetree_00673 VALUES (1);
SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM mergetree WHERE x IN (SELECT * FROM numbers(10000000))))))))))));
SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM mergetree_00673 WHERE x IN (SELECT * FROM numbers(10000000))))))))))));
SET force_primary_key = 1;
SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM mergetree WHERE x IN (SELECT * FROM numbers(10000000))))))))))));
SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM mergetree_00673 WHERE x IN (SELECT * FROM numbers(10000000))))))))))));
DROP TABLE mergetree;
DROP TABLE mergetree_00673;

View File

@ -1,10 +1,10 @@
drop table if exists lc;
create table lc (str StringWithDictionary, val UInt8WithDictionary) engine = MergeTree order by tuple();
insert into lc values ('a', 1), ('b', 2);
select str, str in ('a', 'd') from lc;
select val, val in (1, 3) from lc;
select str, str in (select arrayJoin(['a', 'd'])) from lc;
select val, val in (select arrayJoin([1, 3])) from lc;
select str, str in (select str from lc) from lc;
select val, val in (select val from lc) from lc;
drop table if exists lc;
drop table if exists lc_00688;
create table lc_00688 (str StringWithDictionary, val UInt8WithDictionary) engine = MergeTree order by tuple();
insert into lc_00688 values ('a', 1), ('b', 2);
select str, str in ('a', 'd') from lc_00688;
select val, val in (1, 3) from lc_00688;
select str, str in (select arrayJoin(['a', 'd'])) from lc_00688;
select val, val in (select arrayJoin([1, 3])) from lc_00688;
select str, str in (select str from lc_00688) from lc_00688;
select val, val in (select val from lc_00688) from lc_00688;
drop table if exists lc_00688;

View File

@ -2,7 +2,7 @@
1
1
1
t Memory 1 0000-00-00 00:00:00 [] [] Memory
t_00693 Memory 1 0000-00-00 00:00:00 [] [] Memory
1
1
1

View File

@ -3,8 +3,8 @@ SELECT avg(blockSize()) <= 10 FROM system.tables LIMIT 10 SETTINGS max_block_siz
SELECT (SELECT count() FROM system.tables SETTINGS max_block_size = 10) = (SELECT count() FROM system.tables SETTINGS max_block_size = 9);
SELECT (SELECT count() FROM system.tables SETTINGS max_block_size = 100) = (SELECT count() FROM system.tables SETTINGS max_block_size = 1000);
CREATE TEMPORARY TABLE t (x UInt8);
SELECT * FROM system.tables WHERE is_temporary;
CREATE TEMPORARY TABLE t_00693 (x UInt8);
SELECT * FROM system.tables WHERE is_temporary AND name='t_00693';
SELECT avg(blockSize()) <= 10000 FROM system.columns SETTINGS max_block_size = 10;
SELECT avg(blockSize()) <= 10000 FROM system.columns LIMIT 10 SETTINGS max_block_size = 10;

View File

@ -1,12 +1,12 @@
SET send_logs_level = 'none';
DROP TABLE IF EXISTS mergetree;
CREATE TABLE mergetree (k UInt32, `n.x` Array(UInt64), `n.y` Array(UInt64)) ENGINE = MergeTree ORDER BY k;
DROP TABLE IF EXISTS mergetree_00698;
CREATE TABLE mergetree_00698 (k UInt32, `n.x` Array(UInt64), `n.y` Array(UInt64)) ENGINE = MergeTree ORDER BY k;
INSERT INTO mergetree VALUES (3, [], [1, 2, 3]), (1, [111], []), (2, [], []); -- { serverError 190 }
SELECT * FROM mergetree;
INSERT INTO mergetree_00698 VALUES (3, [], [1, 2, 3]), (1, [111], []), (2, [], []); -- { serverError 190 }
SELECT * FROM mergetree_00698;
INSERT INTO mergetree VALUES (3, [4, 5, 6], [1, 2, 3]), (1, [111], [222]), (2, [], []);
SELECT * FROM mergetree;
INSERT INTO mergetree_00698 VALUES (3, [4, 5, 6], [1, 2, 3]), (1, [111], [222]), (2, [], []);
SELECT * FROM mergetree_00698;
DROP TABLE mergetree;
DROP TABLE mergetree_00698;

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal;
CREATE TABLE decimal

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal;
CREATE TABLE IF NOT EXISTS decimal

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal;
CREATE TABLE IF NOT EXISTS decimal (x DECIMAL(10, -2)) ENGINE = Memory; -- { serverError 69 }

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal;
CREATE TABLE IF NOT EXISTS decimal

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal;
CREATE TABLE decimal

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal;
CREATE TABLE IF NOT EXISTS decimal

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal;
CREATE TABLE IF NOT EXISTS decimal

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal;
CREATE TABLE IF NOT EXISTS decimal

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal;
CREATE TABLE IF NOT EXISTS decimal

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS a1;
DROP TABLE IF EXISTS a2;

View File

@ -1,5 +1,5 @@
drop table if exists tab;
create table tab (a UInt32, b UInt32 alias a + 1, c UInt32) engine = MergeTree order by tuple();
insert into tab values (1, 2);
select ignore(_part) from tab prewhere b = 2;
drop table if exists tab_00712_1;
create table tab_00712_1 (a UInt32, b UInt32 alias a + 1, c UInt32) engine = MergeTree order by tuple();
insert into tab_00712_1 values (1, 2);
select ignore(_part) from tab_00712_1 prewhere b = 2;

View File

@ -1,14 +1,14 @@
DROP TABLE IF EXISTS mergetree;
CREATE TABLE mergetree (x UInt8, s String) ENGINE = MergeTree ORDER BY tuple();
DROP TABLE IF EXISTS mergetree_00712;
CREATE TABLE mergetree_00712 (x UInt8, s String) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO mergetree VALUES (1, 'Hello, world!');
SELECT * FROM mergetree;
INSERT INTO mergetree_00712 VALUES (1, 'Hello, world!');
SELECT * FROM mergetree_00712;
ALTER TABLE mergetree ADD COLUMN y UInt8 DEFAULT 0;
INSERT INTO mergetree VALUES (2, 'Goodbye.', 3);
SELECT * FROM mergetree ORDER BY x;
ALTER TABLE mergetree_00712 ADD COLUMN y UInt8 DEFAULT 0;
INSERT INTO mergetree_00712 VALUES (2, 'Goodbye.', 3);
SELECT * FROM mergetree_00712 ORDER BY x;
SELECT s FROM mergetree PREWHERE x AND y ORDER BY s;
SELECT s, y FROM mergetree PREWHERE x AND y ORDER BY s;
SELECT s FROM mergetree_00712 PREWHERE x AND y ORDER BY s;
SELECT s, y FROM mergetree_00712 PREWHERE x AND y ORDER BY s;
DROP TABLE mergetree;
DROP TABLE mergetree_00712;

View File

@ -1,13 +1,12 @@
create database if not exists test;
drop table if exists t;
create table t (a Int32, b Int32) engine = MergeTree partition by (a,b) order by (a);
drop table if exists t_00712_1;
create table t_00712_1 (a Int32, b Int32) engine = MergeTree partition by (a,b) order by (a);
insert into t values (1, 1);
alter table t add column c Int32;
insert into t_00712_1 values (1, 1);
alter table t_00712_1 add column c Int32;
select b from t prewhere a < 1000;
select c from t where a < 1000;
select c from t prewhere a < 1000;
select b from t_00712_1 prewhere a < 1000;
select c from t_00712_1 where a < 1000;
select c from t_00712_1 prewhere a < 1000;
drop table t;
drop table t_00712_1;

View File

@ -1,8 +1,8 @@
drop table if exists tab;
create table tab (a UInt32, b UInt32) engine = MergeTree order by b % 2 sample by b % 2;
insert into tab values (1, 2), (1, 4);
select a from tab sample 1 / 2 prewhere b = 2;
drop table if exists tab;
drop table if exists tab_00712_2;
create table tab_00712_2 (a UInt32, b UInt32) engine = MergeTree order by b % 2 sample by b % 2;
insert into tab_00712_2 values (1, 2), (1, 4);
select a from tab_00712_2 sample 1 / 2 prewhere b = 2;
drop table if exists tab_00712_2;
DROP TABLE IF EXISTS sample_prewhere;
CREATE TABLE sample_prewhere (CounterID UInt32, UserID UInt64) ENGINE = MergeTree ORDER BY UserID SAMPLE BY UserID;

View File

@ -1,6 +1,6 @@
drop table if exists t;
create table t (date Date, counter UInt64, sampler UInt64, alias_col alias date + 1) engine = MergeTree(date, intHash32(sampler), (counter, date, intHash32(sampler)), 8192);
insert into t values ('2018-01-01', 1, 1);
select alias_col from t sample 1 / 2 where date = '2018-01-01' and counter = 1 and sampler = 1;
drop table if exists t;
drop table if exists t_00712_2;
create table t_00712_2 (date Date, counter UInt64, sampler UInt64, alias_col alias date + 1) engine = MergeTree(date, intHash32(sampler), (counter, date, intHash32(sampler)), 8192);
insert into t_00712_2 values ('2018-01-01', 1, 1);
select alias_col from t_00712_2 sample 1 / 2 where date = '2018-01-01' and counter = 1 and sampler = 1;
drop table if exists t_00712_2;

View File

@ -1,22 +1,21 @@
drop table if exists tab;
create table tab (a String, b StringWithDictionary) engine = MergeTree order by a;
insert into tab values ('a_1', 'b_1'), ('a_2', 'b_2');
select count() from tab;
select a from tab group by a order by a;
select b from tab group by b order by b;
select length(b) as l from tab group by l;
select sum(length(a)), b from tab group by b order by b;
select sum(length(b)), a from tab group by a order by a;
select a, b from tab group by a, b order by a, b;
select sum(length(a)) from tab group by b, b || '_';
select length(b) as l from tab group by l;
select length(b) as l from tab group by l, l + 1;
select length(b) as l from tab group by l, l + 1, l + 2;
select length(b) as l from tab group by l, l + 1, l + 2, l + 3;
select length(b) as l from tab group by l, l + 1, l + 2, l + 3, l + 4;
select length(b) as l from tab group by l, l + 1, l + 2, l + 3, l + 4, l + 5;
select a, length(b) as l from tab group by a, l, l + 1 order by a;
select b, length(b) as l from tab group by b, l, l + 1 order by b;
select a, b, length(b) as l from tab group by a, b, l, l + 1 order by a, b;
drop table if exists tab;
drop table if exists tab_00717;
create table tab_00717 (a String, b StringWithDictionary) engine = MergeTree order by a;
insert into tab_00717 values ('a_1', 'b_1'), ('a_2', 'b_2');
select count() from tab_00717;
select a from tab_00717 group by a order by a;
select b from tab_00717 group by b order by b;
select length(b) as l from tab_00717 group by l;
select sum(length(a)), b from tab_00717 group by b order by b;
select sum(length(b)), a from tab_00717 group by a order by a;
select a, b from tab_00717 group by a, b order by a, b;
select sum(length(a)) from tab_00717 group by b, b || '_';
select length(b) as l from tab_00717 group by l;
select length(b) as l from tab_00717 group by l, l + 1;
select length(b) as l from tab_00717 group by l, l + 1, l + 2;
select length(b) as l from tab_00717 group by l, l + 1, l + 2, l + 3;
select length(b) as l from tab_00717 group by l, l + 1, l + 2, l + 3, l + 4;
select length(b) as l from tab_00717 group by l, l + 1, l + 2, l + 3, l + 4, l + 5;
select a, length(b) as l from tab_00717 group by a, l, l + 1 order by a;
select b, length(b) as l from tab_00717 group by b, l, l + 1 order by b;
select a, b, length(b) as l from tab_00717 group by a, b, l, l + 1 order by a, b;
drop table if exists tab_00717;

View File

@ -1,17 +1,17 @@
create table tab (a String, b LowCardinality(UInt32)) engine = MergeTree order by a;
insert into tab values ('a', 1);
select *, toTypeName(b) from tab;
alter table tab modify column b UInt32;
select *, toTypeName(b) from tab;
alter table tab modify column b LowCardinality(UInt32);
select *, toTypeName(b) from tab;
alter table tab modify column b StringWithDictionary;
select *, toTypeName(b) from tab;
alter table tab modify column b LowCardinality(UInt32);
select *, toTypeName(b) from tab;
alter table tab modify column b String;
select *, toTypeName(b) from tab;
alter table tab modify column b LowCardinality(UInt32);
select *, toTypeName(b) from tab;
drop table if exists tab;
drop table if exists tab_00718;
create table tab_00718 (a String, b LowCardinality(UInt32)) engine = MergeTree order by a;
insert into tab_00718 values ('a', 1);
select *, toTypeName(b) from tab_00718;
alter table tab_00718 modify column b UInt32;
select *, toTypeName(b) from tab_00718;
alter table tab_00718 modify column b LowCardinality(UInt32);
select *, toTypeName(b) from tab_00718;
alter table tab_00718 modify column b StringWithDictionary;
select *, toTypeName(b) from tab_00718;
alter table tab_00718 modify column b LowCardinality(UInt32);
select *, toTypeName(b) from tab_00718;
alter table tab_00718 modify column b String;
select *, toTypeName(b) from tab_00718;
alter table tab_00718 modify column b LowCardinality(UInt32);
select *, toTypeName(b) from tab_00718;
drop table if exists tab_00718;

View File

@ -1,23 +1,23 @@
drop table if exists t;
drop table if exists s;
drop table if exists t_00725_2;
drop table if exists s_00725_2;
create table t(a Int64, b Int64) engine = TinyLog;
insert into t values(1,1);
insert into t values(2,2);
create table s(a Int64, b Int64) engine = TinyLog;
insert into s values(1,1);
create table t_00725_2(a Int64, b Int64) engine = TinyLog;
insert into t_00725_2 values(1,1);
insert into t_00725_2 values(2,2);
create table s_00725_2(a Int64, b Int64) engine = TinyLog;
insert into s_00725_2 values(1,1);
select a, b, s_a, s_b from t all left join (select a,b,a s_a, b s_b from s) using (a,b);
select a, b, s_a, s_b from t_00725_2 all left join (select a,b,a s_a, b s_b from s_00725_2) using (a,b);
select '-';
select t.*, s.* from t all left join s using (a,b);
select t_00725_2.*, s_00725_2.* from t_00725_2 all left join s_00725_2 using (a,b);
select '-';
select a,b,s_a,s_b from t all left join (select a, b, a s_a, b s_b from s) s on (s.a = t.a and s.b = t.b);
select a,b,s_a,s_b from t_00725_2 all left join (select a, b, a s_a, b s_b from s_00725_2) s_00725_2 on (s_00725_2.a = t_00725_2.a and s_00725_2.b = t_00725_2.b);
select '-';
select * from t all left join (select a s_a, b s_b from s) on (s_a = t.a and s_b = t.b);
select * from t_00725_2 all left join (select a s_a, b s_b from s_00725_2) on (s_a = t_00725_2.a and s_b = t_00725_2.b);
select '-';
select a,b,s_a,s_b from t all left join (select a,b, a s_a, b s_b from s) on (s_a = t.a and s_b = t.b);
select a,b,s_a,s_b from t_00725_2 all left join (select a,b, a s_a, b s_b from s_00725_2) on (s_a = t_00725_2.a and s_b = t_00725_2.b);
select '-';
select t.*, s.* from t all left join s on (s.a = t.a and s.b = t.b);
select t_00725_2.*, s_00725_2.* from t_00725_2 all left join s_00725_2 on (s_00725_2.a = t_00725_2.a and s_00725_2.b = t_00725_2.b);
drop table if exists t;
drop table if exists s;
drop table if exists t_00725_2;
drop table if exists s_00725_2;

View File

@ -1,14 +1,14 @@
drop table if exists t;
drop table if exists z;
drop table if exists t_00725_3;
drop table if exists z_00725_3;
create table t(a Int64, b Int64) engine = TinyLog;
insert into t values(1,1);
insert into t values(2,2);
create table z(c Int64, d Int64, e Int64) engine = TinyLog;
insert into z values(1,1,1);
create table t_00725_3(a Int64, b Int64) engine = TinyLog;
insert into t_00725_3 values(1,1);
insert into t_00725_3 values(2,2);
create table z_00725_3(c Int64, d Int64, e Int64) engine = TinyLog;
insert into z_00725_3 values(1,1,1);
select * from t all left join z on (z.c = t.a and z.d = t.b);
select * from t_00725_3 all left join z_00725_3 on (z_00725_3.c = t_00725_3.a and z_00725_3.d = t_00725_3.b);
drop table if exists t;
drop table if exists z;
drop table if exists t_00725_3;
drop table if exists z_00725_3;

View File

@ -1,13 +1,13 @@
drop table if exists t;
drop table if exists s;
drop table if exists t_00725_4;
drop table if exists s_00725_4;
create table t(a Int64, b Int64, c String) engine = TinyLog;
insert into t values(1,1,'a'),(2,2,'b');
create table s(a Int64, b Int64, c String) engine = TinyLog;
insert into s values(1,1,'a');
create table t_00725_4(a Int64, b Int64, c String) engine = TinyLog;
insert into t_00725_4 values(1,1,'a'),(2,2,'b');
create table s_00725_4(a Int64, b Int64, c String) engine = TinyLog;
insert into s_00725_4 values(1,1,'a');
select t.* from t all left join s on (s.a = t.a and s.b = t.b) where s.a = 0 and s.b = 0;
select t_00725_4.* from t_00725_4 all left join s_00725_4 on (s_00725_4.a = t_00725_4.a and s_00725_4.b = t_00725_4.b) where s_00725_4.a = 0 and s_00725_4.b = 0;
drop table if exists t;
drop table if exists s;
drop table if exists t_00725_4;
drop table if exists s_00725_4;

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS unicode;
CREATE TABLE unicode(c1 String, c2 String) ENGINE = Memory;

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS decimal_sum;
CREATE TABLE decimal_sum
(

View File

@ -1,4 +1,3 @@
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS or_expr_bug;
CREATE TABLE or_expr_bug (a UInt64, b UInt64) ENGINE = Memory;

Some files were not shown because too many files have changed in this diff Show More