Merge remote-tracking branch 'origin' into improvements_in_replication_without_zookeeper

This commit is contained in:
alesapin 2019-03-14 19:35:33 +03:00
commit ef223fbca8
6 changed files with 88 additions and 20 deletions

View File

@ -293,7 +293,7 @@
### New features:
* `DEFAULT` expressions are evaluated for missing fields when loading data in semi-structured input formats (`JSONEachRow`, `TSKV`). [#3555](https://github.com/yandex/ClickHouse/pull/3555)
* `DEFAULT` expressions are evaluated for missing fields when loading data in semi-structured input formats (`JSONEachRow`, `TSKV`). The feature is enabled with the `insert_sample_with_metadata` setting. [#3555](https://github.com/yandex/ClickHouse/pull/3555)
* The `ALTER TABLE` query now has the `MODIFY ORDER BY` action for changing the sorting key when adding or removing a table column. This is useful for tables in the `MergeTree` family that perform additional tasks when merging based on this sorting key, such as `SummingMergeTree`, `AggregatingMergeTree`, and so on. [#3581](https://github.com/yandex/ClickHouse/pull/3581) [#3755](https://github.com/yandex/ClickHouse/pull/3755)
* For tables in the `MergeTree` family, now you can specify a different sorting key (`ORDER BY`) and index (`PRIMARY KEY`). The sorting key can be longer than the index. [#3581](https://github.com/yandex/ClickHouse/pull/3581)
* Added the `hdfs` table function and the `HDFS` table engine for importing and exporting data to HDFS. [chenxing-xc](https://github.com/yandex/ClickHouse/pull/3617)

View File

@ -302,7 +302,7 @@
### Новые возможности:
* Вычисление `DEFAULT` выражений для отсутствующих полей при загрузке данных в полуструктурированных форматах (`JSONEachRow`, `TSKV`). [#3555](https://github.com/yandex/ClickHouse/pull/3555)
* Вычисление `DEFAULT` выражений для отсутствующих полей при загрузке данных в полуструктурированных форматах (`JSONEachRow`, `TSKV`) (требуется включить настройку запроса `insert_sample_with_metadata`). [#3555](https://github.com/yandex/ClickHouse/pull/3555)
* Для запроса `ALTER TABLE` добавлено действие `MODIFY ORDER BY` для изменения ключа сортировки при одновременном добавлении или удалении столбца таблицы. Это полезно для таблиц семейства `MergeTree`, выполняющих дополнительную работу при слияниях, согласно этому ключу сортировки, как например, `SummingMergeTree`, `AggregatingMergeTree` и т. п. [#3581](https://github.com/yandex/ClickHouse/pull/3581) [#3755](https://github.com/yandex/ClickHouse/pull/3755)
* Для таблиц семейства `MergeTree` появилась возможность указать различный ключ сортировки (`ORDER BY`) и индекс (`PRIMARY KEY`). Ключ сортировки может быть длиннее, чем индекс. [#3581](https://github.com/yandex/ClickHouse/pull/3581)
* Добавлена табличная функция `hdfs` и движок таблиц `HDFS` для импорта и экспорта данных в HDFS. [chenxing-xc](https://github.com/yandex/ClickHouse/pull/3617)

View File

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

View File

@ -0,0 +1,83 @@
USE test;
DROP TABLE IF EXISTS t_local;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t_local (dummy UInt8) ENGINE = Memory;
CREATE TABLE t1 (dummy UInt8) ENGINE = Distributed(test_shard_localhost, 'test', 't_local');
CREATE TABLE t2 (dummy UInt8) ENGINE = Distributed(test_shard_localhost, 'test', 't_local');
INSERT INTO t_local VALUES (1);
SET asterisk_left_columns_only = 1;
SELECT * FROM t1
GLOBAL INNER JOIN
(
SELECT *
FROM ( SELECT * FROM t2 )
INNER JOIN ( SELECT * FROM t1 )
USING dummy
) USING dummy;
DROP TABLE t_local;
DROP TABLE t1;
DROP TABLE t2;
SELECT * FROM remote('127.0.0.2', system.one)
GLOBAL INNER JOIN
(
SELECT *
FROM ( SELECT dummy FROM remote('127.0.0.2', system.one) ) t1
GLOBAL INNER JOIN ( SELECT dummy FROM remote('127.0.0.3', system.one) ) t2
USING dummy
) USING dummy;
-- SET asterisk_left_columns_only = 0;
--
-- SELECT * FROM remote('127.0.0.2', system.one)
-- GLOBAL INNER JOIN
-- (
-- SELECT *, dummy
-- FROM ( SELECT dummy FROM remote('127.0.0.2', system.one) ) t1
-- GLOBAL INNER JOIN ( SELECT dummy FROM remote('127.0.0.3', system.one) ) t2
-- USING dummy
-- ) USING dummy;
--
-- SELECT * FROM remote('127.0.0.2', system.one)
-- GLOBAL INNER JOIN
-- (
-- SELECT *, t1.*, t2.*
-- FROM ( SELECT toUInt8(1) AS dummy ) t1
-- INNER JOIN ( SELECT toUInt8(1) AS dummy ) t2
-- USING dummy
-- ) USING dummy;
--
-- SELECT * FROM remote('127.0.0.2', system.one)
-- GLOBAL INNER JOIN
-- (
-- SELECT *, dummy
-- FROM ( SELECT toUInt8(1) AS dummy ) t1
-- INNER JOIN ( SELECT toUInt8(1) AS dummy ) t2
-- USING dummy
-- ) USING dummy;
--
-- SELECT * FROM remote('127.0.0.2', system.one)
-- GLOBAL INNER JOIN
-- (
-- SELECT *
-- FROM ( SELECT dummy FROM remote('127.0.0.3', system.one) ) t1
-- GLOBAL INNER JOIN ( SELECT toUInt8(1) AS dummy ) t2
-- USING dummy
-- ) USING dummy;
--
-- SELECT * FROM remote('127.0.0.2', system.one)
-- GLOBAL INNER JOIN
-- (
-- SELECT *
-- FROM ( SELECT toUInt8(1) AS dummy ) t1
-- GLOBAL INNER JOIN ( SELECT dummy FROM remote('127.0.0.3', system.one) ) t2
-- USING dummy
-- ) USING dummy;

View File

@ -13,23 +13,7 @@ from (
select a.ANIMAL a, 'CAT' b, c.ANIMAL c, d.ANIMAL d
from ANIMAL a join ANIMAL b on a.ANIMAL = b.ANIMAL
left outer join ANIMAL c on (b.ANIMAL = c.ANIMAL)
right outer join (select * from ANIMAL union all select * from ANIMAL
union all select * from ANIMAL) d on (a.ANIMAL = d.ANIMAL)
where d.ANIMAL <> 'CAT' and c.ANIMAL <>'DOG' and b.ANIMAL <> 'FISH') as x
where x.b >= 'CAT'
group by x.b
having ANIMAL >= 0) ANIMAL
where ANIMAL.ANIMAL >= 0;
set enable_optimize_predicate_expression = 1;
select * from (
select x.b x, count(distinct x.c) ANIMAL
from (
select a.ANIMAL a, 'CAT' b, c.ANIMAL c, d.ANIMAL d
from ANIMAL a join ANIMAL b on a.ANIMAL = b.ANIMAL
left outer join ANIMAL c on (b.ANIMAL = c.ANIMAL)
right outer join (select * from ANIMAL union all select * from ANIMAL
right outer join (select * from ANIMAL union all select * from ANIMAL
union all select * from ANIMAL) d on (a.ANIMAL = d.ANIMAL)
where d.ANIMAL <> 'CAT' and c.ANIMAL <>'DOG' and b.ANIMAL <> 'FISH') as x
where x.b >= 'CAT'