waitingkuo commented on code in PR #3455:
URL: https://github.com/apache/arrow-datafusion/pull/3455#discussion_r968911696
##########
datafusion/sql/src/planner.rs:
##########
@@ -2378,10 +2378,27 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
fn show_variable_to_plan(&self, variable: &[Ident]) -> Result<LogicalPlan>
{
let variable = ObjectName(variable.to_vec()).to_string();
- Err(DataFusionError::NotImplemented(format!(
- "SHOW {} not implemented. Supported syntax: SHOW <TABLES>",
- variable
- )))
+
+ if !self.has_table("information_schema", "settings") {
+ return Err(DataFusionError::Plan(
+ "SHOW [VARIABLE] is not supported unless information_schema is
enabled"
+ .to_string(),
+ ));
+ }
+
+ let query = if variable.to_lowercase() == "all" {
+ String::from("SELECT name, setting FROM
information_schema.settings")
+ } else {
+ format!(
+ "SELECT name, setting FROM information_schema.settings WHERE
name = '{}'",
+ variable
+ )
+ };
+
+ let mut rewrite = DFParser::parse_sql(&query)?;
+ assert_eq!(rewrite.len(), 1);
+
+ self.statement_to_plan(rewrite.pop_front().unwrap())
}
Review Comment:
`show [Variable]` will be converted to the `select` statement
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]