Skip to content

Commit e3eb4cf

Browse files
committed
feat: Coerce strings in binary expressions
Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
1 parent 19a0ada commit e3eb4cf

File tree

16 files changed

+66
-40
lines changed

16 files changed

+66
-40
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion-cli/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repository = "https://github.com/apache/arrow-datafusion"
2828
rust-version = "1.59"
2929

3030
[dependencies]
31-
arrow = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "a03d4eef5640e05dddf99fc2357ad6d58b5337cb" }
31+
arrow = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "8277f9a051c90482ff9557a91c5dc3926d9ba19e" }
3232
clap = { version = "3", features = ["derive", "cargo"] }
3333
datafusion = { path = "../datafusion/core", version = "7.0.0", features = ["parquet-all-compressions"] }
3434
dirs = "4.0.0"

datafusion-examples/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ path = "examples/avro_sql.rs"
3434
required-features = ["datafusion/avro"]
3535

3636
[dev-dependencies]
37-
arrow-flight = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "a03d4eef5640e05dddf99fc2357ad6d58b5337cb" }
37+
arrow-flight = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "8277f9a051c90482ff9557a91c5dc3926d9ba19e" }
3838
async-trait = "0.1.41"
3939
datafusion = { path = "../datafusion/core" }
4040
futures = "0.3"

datafusion/common/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ pyarrow = ["pyo3"]
4040
parquet-all-compressions = ["parquet/snap", "parquet/brotli", "parquet/flate2", "parquet/lz4", "parquet/zstd"]
4141

4242
[dependencies]
43-
arrow = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "a03d4eef5640e05dddf99fc2357ad6d58b5337cb", features = ["prettyprint"] }
43+
arrow = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "8277f9a051c90482ff9557a91c5dc3926d9ba19e", features = ["prettyprint"] }
4444
avro-rs = { version = "0.13", features = ["snappy"], optional = true }
4545
cranelift-module = { version = "0.82.0", optional = true }
4646
ordered-float = "2.10"
47-
parquet = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "a03d4eef5640e05dddf99fc2357ad6d58b5337cb", features = ["arrow", "base64"], default-features = false, optional = true }
47+
parquet = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "8277f9a051c90482ff9557a91c5dc3926d9ba19e", features = ["arrow", "base64"], default-features = false, optional = true }
4848
pyo3 = { version = "0.16", optional = true }
4949
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "16f051486de78a23a0ff252155dd59fc2d35497d" }

datafusion/core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ parquet-all-compressions = ["datafusion-common/parquet-all-compressions", "parqu
5757

5858
[dependencies]
5959
ahash = { version = "0.7", default-features = false }
60-
arrow = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "a03d4eef5640e05dddf99fc2357ad6d58b5337cb", features = ["prettyprint"] }
60+
arrow = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "8277f9a051c90482ff9557a91c5dc3926d9ba19e", features = ["prettyprint"] }
6161
async-trait = "0.1.41"
6262
avro-rs = { version = "0.13", features = ["snappy"], optional = true }
6363
chrono = { version = "0.4", default-features = false }
@@ -76,7 +76,7 @@ num_cpus = "1.13.0"
7676
ordered-float = "2.10"
7777
parking_lot = "0.12"
7878
# All compression codes are disabled by default in our fork because it increases compilation time significantly.
79-
parquet = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "a03d4eef5640e05dddf99fc2357ad6d58b5337cb", features = ["arrow", "base64"], default-features = false }
79+
parquet = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "8277f9a051c90482ff9557a91c5dc3926d9ba19e", features = ["arrow", "base64"], default-features = false }
8080
paste = "^1.0"
8181
pin-project-lite= "^0.2.7"
8282
pyo3 = { version = "0.16", optional = true }

datafusion/core/fuzz-utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ edition = "2021"
2323
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2424

2525
[dependencies]
26-
arrow = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "a03d4eef5640e05dddf99fc2357ad6d58b5337cb", features = ["prettyprint"] }
26+
arrow = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "8277f9a051c90482ff9557a91c5dc3926d9ba19e", features = ["prettyprint"] }
2727
env_logger = "0.9.0"
2828
rand = "0.8"

datafusion/core/src/physical_optimizer/pruning.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,17 +1055,14 @@ mod tests {
10551055
num_containers: 1,
10561056
};
10571057

1058-
let batch =
1059-
build_statistics_record_batch(&statistics, &required_columns).unwrap();
1060-
let expected = vec![
1061-
"+--------+",
1062-
"| s1_min |",
1063-
"+--------+",
1064-
"| |",
1065-
"+--------+",
1066-
];
1067-
1068-
assert_batches_eq!(expected, &[batch]);
1058+
// NOTE(cubesql): error is returned on invalid cast
1059+
let result =
1060+
build_statistics_record_batch(&statistics, &required_columns).unwrap_err();
1061+
assert!(
1062+
result.to_string().contains("Cannot cast binary to string"),
1063+
"{}",
1064+
result
1065+
);
10691066
}
10701067

10711068
#[test]

datafusion/core/src/physical_plan/planner.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1929,7 +1929,8 @@ mod tests {
19291929
// u32 AND bool
19301930
col("c2").and(bool_expr),
19311931
// utf8 LIKE u32
1932-
col("c1").like(col("c2")),
1932+
// NOTE(cubesql): valid
1933+
//col("c1").like(col("c2")),
19331934
];
19341935
for case in cases {
19351936
let logical_plan = LogicalPlanBuilder::scan_csv(

datafusion/core/tests/sql/expr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,8 @@ async fn test_cast_expressions() -> Result<()> {
10571057
test_expression!("CAST('0' AS INT)", "0");
10581058
test_expression!("CAST(NULL AS INT)", "NULL");
10591059
test_expression!("TRY_CAST('0' AS INT)", "0");
1060-
test_expression!("TRY_CAST('x' AS INT)", "NULL");
1060+
// NOTE(cubesql): throws an error for this cast as PostgreSQL does
1061+
//test_expression!("TRY_CAST('x' AS INT)", "NULL");
10611062
Ok(())
10621063
}
10631064

0 commit comments

Comments
 (0)