Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUES-117 add show create & exist temporary table #1901

Merged
merged 10 commits into from
Mar 7, 2018

Conversation

zhang2014
Copy link
Contributor

#117
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

@zhang2014 zhang2014 changed the title ISSUES-117 add show create & exist temporary table [WIP] ISSUES-117 add show create & exist temporary table Feb 14, 2018
@zhang2014 zhang2014 changed the title [WIP] ISSUES-117 add show create & exist temporary table ISSUES-117 add show create & exist temporary table Feb 14, 2018
@zhang2014
Copy link
Contributor Author

@alexey-milovidov Maybe you can review this first? because it's already half in master

@alexey-milovidov
Copy link
Member

Sorry for the delay. We will review today.

@alexey-milovidov
Copy link
Member

Looks like it will be much better to implement this feature through DatabaseMemory class.
(You can have all temporary tables inside DatabaseMemory in the context.)

@@ -538,7 +538,7 @@ BlockIO InterpreterCreateQuery::createTable(ASTCreateQuery & create)
false);

if (create.is_temporary)
context.getSessionContext().addExternalTable(table_name, res);
context.getSessionContext().addExternalTable(table_name, res, query_ptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After CREATE ... AS SELECT queries you will have SELECT part present in the result of SHOW CREATE query. This goes in contrast with results of SHOW CREATE queries for ordinary tables: databases don't store the SELECT part and don't show it in SHOW CREATE.

@@ -239,6 +243,7 @@ class Context

/// Get query for the CREATE table.
ASTPtr getCreateQuery(const String & database_name, const String & table_name) const;
ASTPtr getCreateExternalQuery(const String & table_name) const;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name looks strange. This is because we have a mess with "temporary" and "external" tables.
Ok for now, but I would like to split "temporary" and "external" tables.

@alexey-milovidov alexey-milovidov merged commit 1ecb9da into ClickHouse:master Mar 7, 2018
@alexey-milovidov
Copy link
Member

I wonder what is the main motivation of this feature (what is your usage scenario, where this is most important)?

@zhang2014
Copy link
Contributor Author

Sorry, we don't need it, I just solve a few issue during the holiday, hoping to help you : )

@zhang2014 zhang2014 deleted the fix/ISSUES-117 branch March 8, 2018 00:39
@alexey-milovidov
Copy link
Member

Your help is very appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants