Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
starocean999 committed Nov 6, 2024
1 parent b2e2e55 commit d205f14
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4019,15 +4019,15 @@ public LogicalPlan visitShowVariables(ShowVariablesContext ctx) {
return new ShowVariablesCommand(type, stripQuotes(ctx.wildWhere().STRING_LITERAL().getText()));
} else {
StringBuilder sb = new StringBuilder();
sb.append("select VARIABLE_NAME as Variable_name, VARIABLE_VALUE as Value from ");
sb.append(InternalCatalog.INTERNAL_CATALOG_NAME);
sb.append("SELECT `VARIABLE_NAME` AS `Variable_name`, `VARIABLE_VALUE` AS `Value` FROM ");
sb.append("`").append(InternalCatalog.INTERNAL_CATALOG_NAME).append("`");
sb.append(".");
sb.append(InfoSchemaDb.DATABASE_NAME);
sb.append("`").append(InfoSchemaDb.DATABASE_NAME).append("`");
sb.append(".");
if (type == SetType.GLOBAL) {
sb.append("GLOBAL_VARIABLES ");
sb.append("`global_variables` ");
} else {
sb.append("SESSION_VARIABLES ");
sb.append("`session_variables` ");
}
sb.append(getOriginSql(ctx.wildWhere()));
return new NereidsParser().parseSingle(sb.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ public class ShowVariablesCommand extends ShowCommand {
.addColumn(new Column(DEFAULT_VALUE_COL, ScalarType.createVarchar(20)))
.addColumn(new Column(CHANGED_COL, ScalarType.createVarchar(20)))
.build();
private SetType type;
private String pattern;

private final SetType type;
private final String pattern;

public ShowVariablesCommand(SetType type, String pattern) {
super(PlanType.SHOW_VARIABLES_COMMAND);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public class ShowViewCommand extends ShowCommand {
.addColumn(new Column("View", ScalarType.createVarchar(30)))
.addColumn(new Column("Create View", ScalarType.createVarchar(65535)))
.build();
private String db;
private TableNameInfo tbl;

private final String db;
private final TableNameInfo tbl;
private List<View> matchViews = Lists.newArrayList();

public ShowViewCommand(String db, TableNameInfo tbl) {
Expand All @@ -72,9 +73,6 @@ public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
}

private void validate(ConnectContext ctx) throws Exception {
if (tbl == null) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_TABLES_USED);
}
if (!Strings.isNullOrEmpty(db)) {
// if user specify the `from db`, overwrite the db in `tbl` with this db.
// for example:
Expand Down

0 comments on commit d205f14

Please sign in to comment.