[Improvement](meta) add default_value column & is changed column for result of show_variables stmt (#23017)

* [Improvement](meta) add default_value column for result of show_variables stmt

* add Changed column to show whether value is modified

* fix code style issue
This commit is contained in:
Yulei-Yang
2023-08-20 20:48:45 +08:00
committed by GitHub
parent 97fa840324
commit 6ffc26858a
4 changed files with 24 additions and 4 deletions

View File

@ -26,16 +26,18 @@ public class ShowVariablesStmtTest {
ShowVariablesStmt stmt = new ShowVariablesStmt(null, null);
stmt.analyze(null);
Assert.assertEquals("SHOW DEFAULT VARIABLES", stmt.toString());
Assert.assertEquals(2, stmt.getMetaData().getColumnCount());
Assert.assertEquals(4, stmt.getMetaData().getColumnCount());
Assert.assertEquals("Variable_name", stmt.getMetaData().getColumn(0).getName());
Assert.assertEquals("Value", stmt.getMetaData().getColumn(1).getName());
Assert.assertEquals("Default_Value", stmt.getMetaData().getColumn(2).getName());
Assert.assertEquals("Changed", stmt.getMetaData().getColumn(3).getName());
Assert.assertNull(stmt.getPattern());
Assert.assertEquals(SetType.DEFAULT, stmt.getType());
stmt = new ShowVariablesStmt(SetType.GLOBAL, "abc");
stmt.analyze(null);
Assert.assertEquals("SHOW GLOBAL VARIABLES LIKE 'abc'", stmt.toString());
Assert.assertEquals(2, stmt.getMetaData().getColumnCount());
Assert.assertEquals(4, stmt.getMetaData().getColumnCount());
Assert.assertEquals("Variable_name", stmt.getMetaData().getColumn(0).getName());
Assert.assertEquals("Value", stmt.getMetaData().getColumn(1).getName());
Assert.assertEquals("abc", stmt.getPattern());