Skip to content

Commit

Permalink
Refactor show
Browse files Browse the repository at this point in the history
Signed-off-by: Jin Hai <[email protected]>
  • Loading branch information
JinHai-CN committed Oct 10, 2024
1 parent afbd1b6 commit 50681c7
Show file tree
Hide file tree
Showing 10 changed files with 265 additions and 281 deletions.
84 changes: 45 additions & 39 deletions src/executor/explain_physical_plan.cpp

Large diffs are not rendered by default.

146 changes: 73 additions & 73 deletions src/executor/operator/physical_show.cpp

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/executor/operator/physical_show.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ import data_type;
import variables;
import data_block;
import logger;
import show_statement;

namespace infinity {

export class PhysicalShow : public PhysicalOperator {
public:
explicit PhysicalShow(u64 id,
ShowType type,
ShowStmtType type,
String db_name,
String object_name,
u64 table_index,
Expand Down Expand Up @@ -70,7 +71,7 @@ public:
return 0;
}

inline ShowType show_type() const { return show_type_; }
inline ShowStmtType show_type() const { return show_type_; }

inline const String &db_name() const { return db_name_; };

Expand Down Expand Up @@ -156,7 +157,7 @@ private:
void ExecuteShowMemoryAllocation(QueryContext *query_context, ShowOperatorState *operator_state);

private:
ShowType show_type_{ShowType::kInvalid};
ShowStmtType show_type_{ShowStmtType::kInvalid};
String db_name_{};
String object_name_{};
u64 table_index_{};
Expand Down
4 changes: 4 additions & 0 deletions src/parser/statement/show_statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ namespace infinity {
std::string ShowStatement::ToString() const {
std::stringstream ss;
switch (show_type_) {
case ShowStmtType::kInvalid: {
ParserError("Invalid show statement");
break;
}
case ShowStmtType::kDatabase: {
ss << "Show database, database: " << schema_name_;
break;
Expand Down
1 change: 1 addition & 0 deletions src/parser/statement/show_statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
namespace infinity {

enum class ShowStmtType {
kInvalid,
kDatabase,
kTable,
kIndex,
Expand Down
4 changes: 4 additions & 0 deletions src/planner/explain_ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,10 @@ Status ExplainAST::BuildShow(const ShowStatement *show_statement, SharedPtr<Vect
result->emplace_back(MakeShared<String>("SHOW FUNCTION"));
break;
}
case ShowStmtType::kInvalid: {
String error_message = "Invalid show statement type";
UnrecoverableError(error_message);
}
}
return Status::OK();
}
Expand Down
Loading

0 comments on commit 50681c7

Please sign in to comment.