Skip to content

Commit

Permalink
feat: Initial support for IS TRUE|FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed May 18, 2022
1 parent 8b6b910 commit 0944add
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ballista/rust/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ datafusion = { path = "../../../datafusion/core", version = "7.0.0" }
futures = "0.3"
log = "0.4"
parking_lot = "0.12"
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "81217ce0dccc446d3d2f42582717b9e8fe960113" }
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "90bbbcf041160cdefd7ddc0f95e6b2b358dfcef2" }
tempfile = "3"
tokio = "1.0"

Expand Down
2 changes: 1 addition & 1 deletion ballista/rust/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ parse_arg = "0.1.3"
prost = "0.9"
prost-types = "0.9"
serde = { version = "1", features = ["derive"] }
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "81217ce0dccc446d3d2f42582717b9e8fe960113" }
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "90bbbcf041160cdefd7ddc0f95e6b2b358dfcef2" }
tokio = "1.0"
tonic = "0.6"
uuid = { version = "0.8", features = ["v4"] }
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ cranelift-module = { version = "0.82.0", optional = true }
ordered-float = "2.10"
parquet = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "01aa59d11110fd33b389cab0bf679b99db9e10e2", features = ["arrow"], optional = true }
pyo3 = { version = "0.16", optional = true }
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "81217ce0dccc446d3d2f42582717b9e8fe960113" }
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "90bbbcf041160cdefd7ddc0f95e6b2b358dfcef2" }
2 changes: 1 addition & 1 deletion datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pin-project-lite= "^0.2.7"
pyo3 = { version = "0.16", optional = true }
rand = "0.8"
smallvec = { version = "1.6", features = ["union"] }
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "81217ce0dccc446d3d2f42582717b9e8fe960113" }
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "90bbbcf041160cdefd7ddc0f95e6b2b358dfcef2" }
tempfile = "3"
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] }
tokio-stream = "0.1"
Expand Down
14 changes: 14 additions & 0 deletions datafusion/core/tests/sql/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,20 @@ async fn test_substring_expr() -> Result<()> {
Ok(())
}

#[tokio::test]
async fn test_is_boolean() -> Result<()> {
test_expression!("true IS TRUE", "true");
test_expression!("false IS TRUE", "false");
test_expression!("true IS FALSE", "false");
test_expression!("false IS FALSE", "true");
// doesnt work:
// - DF doesnt support NULL scalars correctly
// - x IS TRUE will be translated to x = true, which doesnt handle null values
// test_expression!("null IS FALSE", "true");

Ok(())
}

#[tokio::test]
async fn test_string_expressions() -> Result<()> {
test_expression!("ascii('')", "0");
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ path = "src/lib.rs"
ahash = { version = "0.7", default-features = false }
arrow = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "01aa59d11110fd33b389cab0bf679b99db9e10e2", features = ["prettyprint"] }
datafusion-common = { path = "../common", version = "7.0.0" }
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "81217ce0dccc446d3d2f42582717b9e8fe960113" }
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "90bbbcf041160cdefd7ddc0f95e6b2b358dfcef2" }

0 comments on commit 0944add

Please sign in to comment.