Skip to content

Commit

Permalink
Interpreter: Remove Table properties query (#4586)
Browse files Browse the repository at this point in the history
ref #4860
  • Loading branch information
ywqzzy authored May 12, 2022
1 parent c49258b commit ace1369
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 307 deletions.
9 changes: 0 additions & 9 deletions dbms/src/Interpreters/InterpreterFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <Interpreters/InterpreterSelectQuery.h>
#include <Interpreters/InterpreterSelectWithUnionQuery.h>
#include <Interpreters/InterpreterSetQuery.h>
#include <Interpreters/InterpreterShowCreateQuery.h>
#include <Interpreters/InterpreterShowProcesslistQuery.h>
#include <Interpreters/InterpreterShowTablesQuery.h>
#include <Interpreters/InterpreterSystemQuery.h>
Expand Down Expand Up @@ -122,14 +121,6 @@ std::unique_ptr<IInterpreter> InterpreterFactory::get(ASTPtr & query, Context &
{
return std::make_unique<InterpreterExistsQuery>(query, context);
}
else if (typeid_cast<ASTShowCreateTableQuery *>(query.get()))
{
return std::make_unique<InterpreterShowCreateQuery>(query, context);
}
else if (typeid_cast<ASTShowCreateDatabaseQuery *>(query.get()))
{
return std::make_unique<InterpreterShowCreateQuery>(query, context);
}
else if (typeid_cast<ASTDescribeQuery *>(query.get()))
{
return std::make_unique<InterpreterDescribeQuery>(query, context);
Expand Down
82 changes: 0 additions & 82 deletions dbms/src/Interpreters/InterpreterShowCreateQuery.cpp

This file was deleted.

49 changes: 0 additions & 49 deletions dbms/src/Interpreters/InterpreterShowCreateQuery.h

This file was deleted.

4 changes: 0 additions & 4 deletions dbms/src/Parsers/ParserQueryWithOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@
#include <Parsers/ParserSelectWithUnionQuery.h>
#include <Parsers/ParserShowProcesslistQuery.h>
#include <Parsers/ParserShowTablesQuery.h>
#include <Parsers/ParserTablePropertiesQuery.h>


namespace DB
{
bool ParserQueryWithOutput::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
ParserShowTablesQuery show_tables_p;
ParserSelectWithUnionQuery select_p;
ParserTablePropertiesQuery table_p;
ParserDescribeTableQuery describe_table_p;
ParserShowProcesslistQuery show_processlist_p;
ParserCreateQuery create_p;
Expand All @@ -42,7 +39,6 @@ bool ParserQueryWithOutput::parseImpl(Pos & pos, ASTPtr & node, Expected & expec

bool parsed = select_p.parse(pos, query, expected)
|| show_tables_p.parse(pos, query, expected)
|| table_p.parse(pos, query, expected)
|| describe_table_p.parse(pos, query, expected)
|| show_processlist_p.parse(pos, query, expected)
|| create_p.parse(pos, query, expected)
Expand Down
103 changes: 0 additions & 103 deletions dbms/src/Parsers/ParserTablePropertiesQuery.cpp

This file was deleted.

34 changes: 0 additions & 34 deletions dbms/src/Parsers/ParserTablePropertiesQuery.h

This file was deleted.

27 changes: 1 addition & 26 deletions dbms/src/Parsers/TablePropertiesQueriesASTs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,19 @@

namespace DB
{

struct ASTExistsQueryIDAndQueryNames
{
static constexpr auto ID = "ExistsQuery";
static constexpr auto Query = "EXISTS TABLE";
};

struct ASTShowCreateTableQueryIDAndQueryNames
{
static constexpr auto ID = "ShowCreateTableQuery";
static constexpr auto Query = "SHOW CREATE TABLE";
};

struct ASTShowCreateDatabaseQueryIDAndQueryNames
{
static constexpr auto ID = "ShowCreateDatabaseQuery";
static constexpr auto Query = "SHOW CREATE DATABASE";
};

struct ASTDescribeQueryExistsQueryIDAndQueryNames
{
static constexpr auto ID = "DescribeQuery";
static constexpr auto Query = "DESCRIBE TABLE";
};

using ASTExistsQuery = ASTQueryWithTableAndOutputImpl<ASTExistsQueryIDAndQueryNames>;
using ASTShowCreateTableQuery = ASTQueryWithTableAndOutputImpl<ASTShowCreateTableQueryIDAndQueryNames>;

class ASTShowCreateDatabaseQuery : public ASTQueryWithTableAndOutputImpl<ASTShowCreateDatabaseQueryIDAndQueryNames>
{
protected:
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << ASTShowCreateDatabaseQueryIDAndQueryNames::Query
<< " " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(database);
}
};

class ASTDescribeQuery : public ASTQueryWithOutput
{
Expand Down Expand Up @@ -84,7 +60,6 @@ class ASTDescribeQuery : public ASTQueryWithOutput
<< "DESCRIBE TABLE " << (settings.hilite ? hilite_none : "");
table_expression->formatImpl(settings, state, frame);
}

};

}
} // namespace DB

0 comments on commit ace1369

Please sign in to comment.