waitingkuo commented on code in PR #3455:
URL: https://github.com/apache/arrow-datafusion/pull/3455#discussion_r968910885


##########
datafusion/core/tests/sql/information_schema.rs:
##########
@@ -436,15 +444,40 @@ async fn information_schema_show_table_table_names() {
     );
 }
 
+//#[tokio::test]
+//async fn show_unsupported() {
+//    let ctx = SessionContext::with_config(SessionConfig::new());
+//
+//    let err = plan_and_collect(&ctx, "SHOW SOMETHING_UNKNOWN")
+//        .await
+//        .unwrap_err();
+//
+//    assert_eq!(err.to_string(), "This feature is not implemented: SHOW 
SOMETHING_UNKNOWN not implemented. Supported syntax: SHOW <TABLES>");
+//}
+
+// FIXME
+// currently we cannot know whether a variable exists or not while the 
collect, this will output 0 row instead
+// one way to fix this is to generate a ConfigOptions and get options' key to 
compare
+// however config.rs is currently in core lib, could not be used by 
datafusion_sql due to the dependency cycle
 #[tokio::test]
-async fn show_unsupported() {
-    let ctx = SessionContext::with_config(SessionConfig::new());
+async fn show_non_existing_variable() {
+    let ctx =
+        
SessionContext::with_config(SessionConfig::new().with_information_schema(true));
 
-    let err = plan_and_collect(&ctx, "SHOW SOMETHING_UNKNOWN")
+    let result = plan_and_collect(&ctx, "SHOW SOMETHING_UNKNOWN")
         .await
-        .unwrap_err();
+        .unwrap();
 
-    assert_eq!(err.to_string(), "This feature is not implemented: SHOW 
SOMETHING_UNKNOWN not implemented. Supported syntax: SHOW <TABLES>");
+    assert_eq!(result.len(), 0);
+}

Review Comment:
   currently we cannot know whether a variable exists or not, it will always 
show 0 rows instead while trying to show non-existing variable 
   ```bash
   ❯ show a;
   0 rows in set. Query took 0.003 seconds.
   ```
   
   one way to solve this is to generate a `ConfigOptions` here, however 
config.rs is currently in core lib, could not be used by datafusion_sql due to 
the dependency cycle



-- 
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]

Reply via email to