Skip to content

Commit dd0c274

Browse files
committed
test(cube): Fix test failures broken by string->boolean coercion change
1 parent e193b4d commit dd0c274

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

datafusion/optimizer/src/analyzer/type_coercion.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,11 +1632,15 @@ mod test {
16321632
let expected = "Projection: a IS UNKNOWN\n EmptyRelation";
16331633
assert_analyzed_plan_eq(Arc::new(TypeCoercion::new()), plan, expected)?;
16341634

1635-
let empty = empty_with_type(Utf8);
1635+
// Cube: Using Binary instead of Utf8, because string->boolean coercion has been added.
1636+
// let empty = empty_with_type(Utf8);
1637+
let empty = empty_with_type(DataType::Binary);
16361638
let plan = LogicalPlan::Projection(Projection::try_new(vec![expr], empty)?);
16371639
let ret = assert_analyzed_plan_eq(Arc::new(TypeCoercion::new()), plan, expected);
16381640
let err = ret.unwrap_err().to_string();
1639-
assert!(err.contains("Cannot infer common argument type for comparison operation Utf8 IS DISTINCT FROM Boolean"), "{err}");
1641+
// Cube:
1642+
// assert!(err.contains("Cannot infer common argument type for comparison operation Utf8 IS DISTINCT FROM Boolean"), "{err}");
1643+
assert!(err.contains("Cannot infer common argument type for comparison operation Binary IS DISTINCT FROM Boolean"), "{err}");
16401644

16411645
// is not unknown
16421646
let expr = col("a").is_not_unknown();

datafusion/sqllogictest/test_files/scalar.slt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,9 @@ SELECT null, not(null)
15481548
----
15491549
NULL NULL
15501550

1551-
query error type_coercion\ncaused by\nError during planning: Cannot infer common argument type for comparison operation Utf8 IS DISTINCT FROM Boolean
1551+
# Cube: We added string->bool conversion
1552+
# query error type_coercion\ncaused by\nError during planning: Cannot infer common argument type for comparison operation Utf8 IS DISTINCT FROM Boolean
1553+
query error DataFusion error: Arrow error: Cast error: Cannot cast value 'hi' to value of Boolean type
15521554
SELECT NOT('hi')
15531555

15541556
# test_negative_expressions()

datafusion/sqllogictest/test_files/type_coercion.slt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ logical_plan
239239
11)----------EmptyRelation
240240

241241
# union_with_incompatible_data_types()
242-
query error Incompatible inputs for Union: Previous inputs were of type Utf8, but got incompatible type Boolean on column 'a'
243-
SELECT 'a' a UNION ALL SELECT true a
242+
# Cube: Changed this test to avoid string->boolean coercion that was added
243+
query error Incompatible inputs for Union: Previous inputs were of type Binary, but got incompatible type Boolean on column 'a'
244+
SELECT CAST('a' AS BYTEA) a UNION ALL SELECT true a
244245

245246
statement ok
246247
SET datafusion.optimizer.max_passes = 3;

0 commit comments

Comments
 (0)