-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cubesql): ProtocolDetails - support session variables (#8587)
- Loading branch information
Showing
13 changed files
with
99 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use datafusion::{scalar::ScalarValue, variable::VarType}; | ||
use std::collections::HashMap; | ||
|
||
pub type DatabaseVariablesToUpdate = Vec<DatabaseVariable>; | ||
pub type DatabaseVariables = HashMap<String, DatabaseVariable>; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct DatabaseVariable { | ||
pub name: String, | ||
pub value: ScalarValue, | ||
pub var_type: VarType, | ||
pub readonly: bool, | ||
// Postgres schema includes a range of additional parameters | ||
pub additional_params: Option<HashMap<String, ScalarValue>>, | ||
} | ||
|
||
impl DatabaseVariable { | ||
pub fn system( | ||
name: String, | ||
value: ScalarValue, | ||
additional_params: Option<HashMap<String, ScalarValue>>, | ||
) -> Self { | ||
Self { | ||
name: name, | ||
value: value, | ||
var_type: VarType::System, | ||
readonly: false, | ||
additional_params, | ||
} | ||
} | ||
|
||
pub fn user_defined( | ||
name: String, | ||
value: ScalarValue, | ||
additional_params: Option<HashMap<String, ScalarValue>>, | ||
) -> Self { | ||
Self { | ||
name: name, | ||
value: value, | ||
var_type: VarType::UserDefined, | ||
readonly: false, | ||
additional_params, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
rust/cubesql/cubesql/src/sql/database_variables/mysql/global_vars.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
rust/cubesql/cubesql/src/sql/database_variables/mysql/session_vars.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
rust/cubesql/cubesql/src/sql/database_variables/postgres/session_vars.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters