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

This commit is contained in:
proller 2017-10-30 16:19:19 +03:00
commit 8b3d3cf56f
5 changed files with 11 additions and 13 deletions

View File

@ -35,7 +35,7 @@ String getTableDefinitionFromCreateQuery(const ASTPtr & query)
create.select = nullptr;
/// For "MATERIALIZED VIEW x TO y" it's necessary to save destination table
if (!(create.is_materialized_view && !create.storage))
if (!create.is_materialized_view || create.storage)
{
create.as_database.clear();
create.as_table.clear();

View File

@ -364,6 +364,8 @@ bool ParserCreateQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
to_table = true;
/// FIXME: as_table is ambiguous, it is set in AS clause also
if (!name_p.parse(pos, as_table, expected))
return false;

View File

@ -81,7 +81,7 @@ StorageMaterializedView::StorageMaterializedView(
DatabaseAndTableName(database_name, table_name));
// If the destination table is not set, use inner table
if (!query.storage)
if (!query.as_table.empty())
{
target_database_name = query.as_database;
target_table_name = query.as_table;

View File

@ -5,7 +5,8 @@ max_block_size=100
URL='http://localhost:8123/'
function query {
echo "SELECT toUInt8(intHash64(number)) FROM system.numbers LIMIT $1 FORMAT RowBinary"
# bash isn't able to store \0 bytes, so use [1; 255] random range
echo "SELECT greatest(toUInt8(1), toUInt8(intHash64(number))) FROM system.numbers LIMIT $1 FORMAT RowBinary"
}
function ch_url() {
@ -81,13 +82,12 @@ check_cli_and_http
# Check HTTP internal compression in normal case
# Skip if clickhouse-compressor not installed
function cmp_http_compression() {
clickhouse-client -q "`query $1`" > res0
ch_url 'compress=1' $1 | clickhouse-compressor --decompress > res1
ch_url "compress=1&buffer_size=$2&wait_end_of_query=0" $1 | clickhouse-compressor --decompress > res2
ch_url "compress=1&buffer_size=$2&wait_end_of_query=1" $1 | clickhouse-compressor --decompress > res3
ch_url 'compress=1' $1 | clickhouse compressor --decompress > res1
ch_url "compress=1&buffer_size=$2&wait_end_of_query=0" $1 | clickhouse compressor --decompress > res2
ch_url "compress=1&buffer_size=$2&wait_end_of_query=1" $1 | clickhouse compressor --decompress > res3
cmp res0 res1
cmp res1 res2
cmp res1 res3
@ -103,8 +103,4 @@ function check_http_compression() {
done
}
has_compressor=$(command -v clickhouse-compressor &>/dev/null && echo 1 || echo 0)
if [[ $has_compressor -eq 1 ]]; then
check_http_compression
fi
check_http_compression

View File

@ -3,7 +3,7 @@ DROP TABLE IF EXISTS test.dst;
DROP TABLE IF EXISTS test.mv;
CREATE TABLE test.src (x UInt8) ENGINE = Null;
CREATE TABLE test.dst (x UInt8) ENGINE = Memory();
CREATE TABLE test.dst (x UInt8) ENGINE = Memory;
CREATE MATERIALIZED VIEW test.mv TO test.dst AS SELECT * FROM test.src;
INSERT INTO test.src VALUES (1), (2);