-
Notifications
You must be signed in to change notification settings - Fork 322
Description
Is your feature request related to a problem? Please describe.
Now, OpenMLDB has support setting variable by SET var_name = xxx
. In order to adapt to different kinds of scenarios, We would like to support setting system variables and global variables. In addition to that, users might have a need to show variables.
In this issue, we are going to support setting and showing system variables and global variables in SQL syntax and logical plan.
Describe the solution you'd like
resolve #576
- design system variables and global variable setting syntax. (running)
- support ASTNode converter
- support logical plan
- Add related unit tests
Syntax
Set variables syntax overview
SET variable = expr [, variable = expr] ...
variable: {
| {@@GLOBAL.} system_var_name
| [@@SESSION. | @@] system_var_name
}
we are not going to support PERSIST or PERSIST_ONLY variable in OpenMLDB currently.
we won't support user variable, local variable, parameter variable in this version.
@tobegit3hub @dl239
Set global system variable
SET @@GLOBAL.sys_var1 = 'xxxx';
Set session system varible
SET @@SESSION.session_var1 = 'xxxx';
SET @@session_var1 = 'xxxx';
Show Variables
reference:
https://dev.mysql.com/doc/refman/8.0/en/show-variables.html
SHOW VARIABLES shows the values of OpenMLDB system variables.
This statement does not require any privilege. It requires only the ability to connect to the server.
Show global variable:
SHOW GLOBAL VARIABLES;
Show session variables:
SHOW SESSION VARIABLES;
SHOW VARIABLES;
SELECT Variable non-support currently
We won't support SELECT variables in this version. @tobegit3hub @dl239
-- non-support currently
SELECT @user_var1, @@gloabl.system_var2, @@session.sess_var3;
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.