feat: add SHOW TABLES and `select * from information_schema.columns` (#1102)

* chore: update dependencies

* test: add tests for new information schema
pull/24376/head
Andrew Lamb 2021-04-01 08:50:37 -04:00 committed by GitHub
parent 0d599eeaf4
commit a59a6edbb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 9 deletions

9
Cargo.lock generated
View File

@ -111,7 +111,7 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "arrow"
version = "4.0.0-SNAPSHOT"
source = "git+https://github.com/apache/arrow.git?rev=9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f#9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f"
source = "git+https://github.com/apache/arrow.git?rev=090f11cf9583a72a967956d383e5d452db17bd96#090f11cf9583a72a967956d383e5d452db17bd96"
dependencies = [
"cfg_aliases",
"chrono",
@ -134,7 +134,7 @@ dependencies = [
[[package]]
name = "arrow-flight"
version = "4.0.0-SNAPSHOT"
source = "git+https://github.com/apache/arrow.git?rev=9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f#9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f"
source = "git+https://github.com/apache/arrow.git?rev=090f11cf9583a72a967956d383e5d452db17bd96#090f11cf9583a72a967956d383e5d452db17bd96"
dependencies = [
"arrow",
"bytes",
@ -777,7 +777,7 @@ dependencies = [
[[package]]
name = "datafusion"
version = "4.0.0-SNAPSHOT"
source = "git+https://github.com/apache/arrow.git?rev=9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f#9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f"
source = "git+https://github.com/apache/arrow.git?rev=090f11cf9583a72a967956d383e5d452db17bd96#090f11cf9583a72a967956d383e5d452db17bd96"
dependencies = [
"ahash 0.7.2",
"arrow",
@ -792,6 +792,7 @@ dependencies = [
"parquet",
"paste",
"pin-project-lite",
"smallvec",
"sqlparser",
"tokio",
"tokio-stream",
@ -2253,7 +2254,7 @@ dependencies = [
[[package]]
name = "parquet"
version = "4.0.0-SNAPSHOT"
source = "git+https://github.com/apache/arrow.git?rev=9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f#9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f"
source = "git+https://github.com/apache/arrow.git?rev=090f11cf9583a72a967956d383e5d452db17bd96#090f11cf9583a72a967956d383e5d452db17bd96"
dependencies = [
"arrow",
"base64 0.12.3",

View File

@ -8,14 +8,14 @@ description = "Apache Arrow / Parquet / DataFusion dependencies for InfluxDB IOx
[dependencies] # In alphabetical order
# We are using development version of arrow/parquet/datafusion and the dependencies are at the same rev
# The version can be found here: https://github.com/apache/arrow/commit/9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f
# The version can be found here: https://github.com/apache/arrow/commit/090f11cf9583a72a967956d383e5d452db17bd96
#
arrow = { git = "https://github.com/apache/arrow.git", rev = "9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f" , features = ["simd"] }
arrow-flight = { git = "https://github.com/apache/arrow.git", rev = "9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f" }
arrow = { git = "https://github.com/apache/arrow.git", rev = "090f11cf9583a72a967956d383e5d452db17bd96" , features = ["simd"] }
arrow-flight = { git = "https://github.com/apache/arrow.git", rev = "090f11cf9583a72a967956d383e5d452db17bd96" }
# Turn off optional datafusion features (function packages)
datafusion = { git = "https://github.com/apache/arrow.git", rev = "9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f", default-features = false }
datafusion = { git = "https://github.com/apache/arrow.git", rev = "090f11cf9583a72a967956d383e5d452db17bd96", default-features = false }
# Turn off the "arrow" feature; it currently has a bug that causes the crate to rebuild every time
# and we're not currently using it anyway
parquet = { git = "https://github.com/apache/arrow.git", rev = "9aa0f85a2750b7faaf8ad069e05a89b4f8a1754f", default-features = false, features = ["snap", "brotli", "flate2", "lz4", "zstd"] }
parquet = { git = "https://github.com/apache/arrow.git", rev = "090f11cf9583a72a967956d383e5d452db17bd96", default-features = false, features = ["snap", "brotli", "flate2", "lz4", "zstd"] }

View File

@ -191,6 +191,7 @@ async fn sql_select_from_information_schema_tables() {
"| public | iox | h2o | BASE TABLE |",
"| public | iox | o2 | BASE TABLE |",
"| public | information_schema | tables | VIEW |",
"| public | information_schema | columns | VIEW |",
"+---------------+--------------------+------------+------------+",
];
run_sql_test_case!(
@ -198,6 +199,35 @@ async fn sql_select_from_information_schema_tables() {
"SELECT * from information_schema.tables",
&expected
);
run_sql_test_case!(TwoMeasurementsManyFields {}, "SHOW TABLES", &expected);
}
#[tokio::test]
async fn sql_select_from_information_schema_columns() {
// validate we have access to information schema for listing columns
// names
let expected = vec![
"+---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+-------------------------+---------------+--------------------+---------------+",
"| table_catalog | table_schema | table_name | column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length | character_octet_length | numeric_precision | numeric_precision_radix | numeric_scale | datetime_precision | interval_type |",
"+---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+-------------------------+---------------+--------------------+---------------+",
"| public | iox | h2o | city | 0 | | YES | Utf8 | | 2147483647 | | | | | |",
"| public | iox | h2o | moisture | 1 | | YES | Float64 | | | 24 | 2 | | | |",
"| public | iox | h2o | other_temp | 2 | | YES | Float64 | | | 24 | 2 | | | |",
"| public | iox | h2o | state | 3 | | YES | Utf8 | | 2147483647 | | | | | |",
"| public | iox | h2o | temp | 4 | | YES | Float64 | | | 24 | 2 | | | |",
"| public | iox | h2o | time | 5 | | NO | Int64 | | | | | | | |",
"| public | iox | o2 | city | 0 | | YES | Utf8 | | 2147483647 | | | | | |",
"| public | iox | o2 | reading | 1 | | YES | Float64 | | | 24 | 2 | | | |",
"| public | iox | o2 | state | 2 | | YES | Utf8 | | 2147483647 | | | | | |",
"| public | iox | o2 | temp | 3 | | YES | Float64 | | | 24 | 2 | | | |",
"| public | iox | o2 | time | 4 | | NO | Int64 | | | | | | | |",
"+---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+-------------------------+---------------+--------------------+---------------+",
];
run_sql_test_case!(
TwoMeasurementsManyFields {},
"SELECT * from information_schema.columns",
&expected
);
}
#[tokio::test]