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

This commit is contained in:
alesapin 2018-09-06 16:04:10 +03:00
commit b32e0c48af
8 changed files with 23 additions and 12 deletions

View File

@ -2,10 +2,10 @@
set(VERSION_REVISION 54407 CACHE STRING "")
set(VERSION_MAJOR 18 CACHE STRING "")
set(VERSION_MINOR 12 CACHE STRING "")
set(VERSION_PATCH 5 CACHE STRING "")
set(VERSION_GITHASH d8c528ea3973dbcfb68227fc0eff0feffa399d3d CACHE STRING "")
set(VERSION_DESCRIBE v18.12.5-testing CACHE STRING "")
set(VERSION_STRING 18.12.5 CACHE STRING "")
set(VERSION_PATCH 6 CACHE STRING "")
set(VERSION_GITHASH 79f33db9cc0f1cc6fde22be2cc88f43a4b167e18 CACHE STRING "")
set(VERSION_DESCRIBE v18.12.6-testing CACHE STRING "")
set(VERSION_STRING 18.12.6 CACHE STRING "")
# end of autochange
set(VERSION_EXTRA "" CACHE STRING "")

View File

@ -46,6 +46,7 @@
#include <Columns/Collator.h>
#include <Common/typeid_cast.h>
#include <Parsers/queryToString.h>
#include <ext/map.h>
namespace DB
@ -679,6 +680,7 @@ void InterpreterSelectQuery::executeFetchColumns(
/// Columns which we will get after prewhere execution.
auto source_columns = storage->getColumns().getAllPhysical();
auto physical_columns = ext::map<NameSet>(source_columns, [] (const auto & it) { return it.name; });
for (const auto & column : required_columns)
{
@ -723,14 +725,17 @@ void InterpreterSelectQuery::executeFetchColumns(
prewhere_info->remove_prewhere_column = false;
/// Remove columns which will be added by prewhere.
size_t next_req_column_pos = 0;
for (size_t i = 0; i < required_columns.size(); ++i)
{
if (!storage->getColumns().hasPhysical(required_columns[i]))
if (physical_columns.count(required_columns[i]))
{
std::swap(required_columns[i], required_columns.back());
required_columns.pop_back();
if (next_req_column_pos < i)
std::swap(required_columns[i], required_columns[next_req_column_pos]);
++next_req_column_pos;
}
}
required_columns.resize(next_req_column_pos);
if (prewhere_info)
{

View File

@ -0,0 +1,5 @@
drop table if exists test.prewhere_alias;
create table test.prewhere_alias (a Int32, b Int32, c alias a + b) engine = MergeTree order by b;
insert into test.prewhere_alias values(1, 1);
select a, c + toInt32(1), (c + toInt32(1)) * 2 from test.prewhere_alias prewhere (c + toInt32(1)) * 2 = 6;
drop table test.prewhere_alias;

4
debian/changelog vendored
View File

@ -1,5 +1,5 @@
clickhouse (18.12.5) unstable; urgency=low
clickhouse (18.12.6) unstable; urgency=low
* Modified source code
-- <root@yandex-team.ru> Thu, 06 Sep 2018 07:25:55 +0300
-- <root@yandex-team.ru> Thu, 06 Sep 2018 15:16:36 +0300

View File

@ -1,7 +1,7 @@
FROM ubuntu:18.04
ARG repository="deb http://repo.yandex.ru/clickhouse/deb/stable/ main/"
ARG version=18.12.5
ARG version=18.12.6
RUN apt-get update && \
apt-get install -y apt-transport-https dirmngr && \

View File

@ -1,7 +1,7 @@
FROM ubuntu:18.04
ARG repository="deb http://repo.yandex.ru/clickhouse/deb/stable/ main/"
ARG version=18.12.5
ARG version=18.12.6
RUN apt-get update && \
apt-get install -y apt-transport-https dirmngr && \

View File

@ -1,7 +1,7 @@
FROM ubuntu:18.04
ARG repository="deb http://repo.yandex.ru/clickhouse/deb/stable/ main/"
ARG version=18.12.5
ARG version=18.12.6
RUN apt-get update && \
apt-get install -y apt-transport-https dirmngr && \