forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add_show_tables' into 'master'
- Loading branch information
Showing
5 changed files
with
100 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,56 @@ | ||
use datafusion::assert_batches_eq; | ||
use common::config::ArgoEngineConfig; | ||
use rust_client::argo_engine_context::ArgoEngineContext; | ||
|
||
#[cfg(feature = "standalone")] | ||
#[tokio::test] | ||
async fn test_argo_engine_server() { | ||
start_server().await; | ||
test_server().await; | ||
} | ||
|
||
#[cfg(feature = "standalone")] | ||
async fn start_server() { | ||
ArgoEngineContext::standalone(&ArgoEngineConfig::new(), 1) | ||
.await | ||
.unwrap(); | ||
} | ||
|
||
#[cfg(feature = "standalone")] | ||
async fn test_server() { | ||
let context_remote = ArgoEngineContext::remote("localhost", 50050, &ArgoEngineConfig::new()); | ||
|
||
let dir = env!("CARGO_MANIFEST_DIR"); | ||
let sql = format!("CREATE EXTERNAL TABLE inte_test_table (a INT, b INT) STORED AS CSV LOCATION '{}/data/test_inte/test.csv'", dir); | ||
println!("sql={}", sql); | ||
let results = context_remote.sql(sql.as_str()).await; | ||
assert!(results.is_ok()); | ||
|
||
let sql = "select * from inte_test_table"; | ||
println!("sql={}", sql); | ||
let df = context_remote.sql(sql).await.unwrap(); | ||
let results = df.collect().await.unwrap(); | ||
let vec1 = vec![ | ||
"+---+---+", | ||
"| a | b |", | ||
"+---+---+", | ||
"| 3 | 4 |", | ||
"+---+---+", | ||
]; | ||
assert_batches_eq!(vec1, &results); | ||
|
||
let sql = "show tables"; | ||
println!("sql={}", sql); | ||
let df = context_remote.sql(sql).await.unwrap(); | ||
let results = df.collect().await.unwrap(); | ||
let vec1 = vec![ | ||
"+---------------+--------------------+-----------------+------------+", | ||
"| table_catalog | table_schema | table_name | table_type |", | ||
"+---------------+--------------------+-----------------+------------+", | ||
"| datafusion | public | inte_test_table | BASE TABLE |", | ||
"| datafusion | information_schema | tables | VIEW |", | ||
"| datafusion | information_schema | columns | VIEW |", | ||
"+---------------+--------------------+-----------------+------------+", | ||
]; | ||
assert_batches_eq!(vec1, &results); | ||
} |
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