Skip to content

Commit

Permalink
Ignore indices for CREATE TABLE .. AS .. if storage do not support them
Browse files Browse the repository at this point in the history
  • Loading branch information
azat committed Sep 19, 2019
1 parent 1fe79ad commit b2a3db1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dbms/src/Interpreters/InterpreterCreateQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <Poco/File.h>

#include <Common/StringUtils/StringUtils.h>
#include <Common/escapeForFileName.h>
#include <Common/typeid_cast.h>

Expand Down Expand Up @@ -416,7 +417,8 @@ ColumnsDescription InterpreterCreateQuery::setProperties(
else if (!create.as_table.empty())
{
columns = as_storage->getColumns();
indices = as_storage->getIndices();
if (create.storage && endsWith(create.storage->engine->name, "MergeTree"))
indices = as_storage->getIndices();
constraints = as_storage->getConstraints();
}
else if (create.select)
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SET allow_experimental_data_skipping_indices=1;
CREATE TABLE foo (key int, INDEX i1 key TYPE minmax GRANULARITY 1) Engine=MergeTree() ORDER BY key;
CREATE TABLE as_foo AS foo;
CREATE TABLE dist (key int, INDEX i1 key TYPE minmax GRANULARITY 1) Engine=Distributed(test_shard_localhost, currentDatabase(), 'foo'); -- { serverError 36 }
CREATE TABLE dist_as_foo Engine=Distributed(test_shard_localhost, currentDatabase(), 'foo') AS foo;

0 comments on commit b2a3db1

Please sign in to comment.