MCPcopy Create free account
hub / github.com/apache/datafusion / case_when

Function case_when

datafusion/optimizer/tests/optimizer_integration.rs:100–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98
99#[test]
100fn case_when() -> Result<()> {
101 let sql = "SELECT CASE WHEN col_int32 > 0 THEN 1 ELSE 0 END FROM test";
102 let plan = test_sql(sql)?;
103
104 assert_snapshot!(
105 format!("{plan}"),
106 @r"
107 Projection: CASE WHEN test.col_int32 > Int32(0) THEN Int64(1) ELSE Int64(0) END AS CASE WHEN test.col_int32 > Int64(0) THEN Int64(1) ELSE Int64(0) END
108 TableScan: test projection=[col_int32]
109 "
110 );
111
112 let sql = "SELECT CASE WHEN col_uint32 > 0 THEN 1 ELSE 0 END FROM test";
113 let plan = test_sql(sql)?;
114
115 assert_snapshot!(
116 format!("{plan}"),
117 @r"
118 Projection: CASE WHEN test.col_uint32 > UInt32(0) THEN Int64(1) ELSE Int64(0) END AS CASE WHEN test.col_uint32 > Int64(0) THEN Int64(1) ELSE Int64(0) END
119 TableScan: test projection=[col_uint32]
120 "
121 );
122 Ok(())
123}
124
125#[test]
126fn subquery_filter_with_cast() -> Result<()> {

Callers

nothing calls this directly

Calls 1

test_sqlFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…