mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #48679 from ucasfl/scheme-infer
Make Schema inference works for CREATE AS SELECT
This commit is contained in:
commit
a8c892f925
@ -1614,6 +1614,8 @@ BlockIO InterpreterCreateQuery::fillTableIfNeeded(const ASTCreateQuery & create)
|
|||||||
else
|
else
|
||||||
insert->select = create.select->clone();
|
insert->select = create.select->clone();
|
||||||
|
|
||||||
|
getContext()->getQueryContext()->setInsertionTable(insert->table_id);
|
||||||
|
|
||||||
return InterpreterInsertQuery(insert, getContext(),
|
return InterpreterInsertQuery(insert, getContext(),
|
||||||
getContext()->getSettingsRef().insert_allow_materialized_columns).execute();
|
getContext()->getSettingsRef().insert_allow_materialized_columns).execute();
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,6 @@ BlockIO InterpreterInsertQuery::execute()
|
|||||||
|
|
||||||
auto new_context = Context::createCopy(context);
|
auto new_context = Context::createCopy(context);
|
||||||
new_context->setSettings(new_settings);
|
new_context->setSettings(new_settings);
|
||||||
new_context->setInsertionTable(getContext()->getInsertionTable());
|
|
||||||
|
|
||||||
auto select_query_options = SelectQueryOptions(QueryProcessingStage::Complete, 1);
|
auto select_query_options = SelectQueryOptions(QueryProcessingStage::Complete, 1);
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
10
|
@ -0,0 +1,7 @@
|
|||||||
|
DROP TABLE IF EXISTS t;
|
||||||
|
|
||||||
|
CREATE TABLE t(n UInt32, s String) engine=Log AS SELECT * from generateRandom() limit 10;
|
||||||
|
|
||||||
|
select count() from t;
|
||||||
|
|
||||||
|
DROP TABLE t;
|
Loading…
Reference in New Issue
Block a user