You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e41c4df
Browse filesBrowse the repository at this point in the historyBrowse files
let sql = "select '2000-01-01'::timestamp >= '2000-01-01'::date";
1635
+
let df = ctx.sql(sql).await.unwrap();
1636
+
1637
+
let plan = df.explain(true,false)?.collect().await?;
1638
+
let batch = &plan[0];
1639
+
letmut res:Option<String> = None;
1640
+
for row in0..batch.num_rows(){
1641
+
if&array_value_to_string(batch.column(0), row)?
1642
+
== "logical_plan after type_coercion"
1643
+
{
1644
+
res = Some(array_value_to_string(batch.column(1), row)?);
1645
+
break;
1646
+
}
1647
+
}
1648
+
assert_eq!(res,Some("Projection: CAST(Utf8(\"2000-01-01\") AS Timestamp(Nanosecond, None)) >= CAST(CAST(Utf8(\"2000-01-01\") AS Date32) AS Timestamp(Nanosecond, None))\n EmptyRelation".to_string()));
1649
+
1650
+
//test cast path timestamp date using function
1651
+
let sql = "select now() >= '2000-01-01'::date";
1652
+
let df = ctx.sql(sql).await.unwrap();
1653
+
1654
+
let plan = df.explain(true,false)?.collect().await?;
1655
+
let batch = &plan[0];
1656
+
letmut res:Option<String> = None;
1657
+
for row in0..batch.num_rows(){
1658
+
if&array_value_to_string(batch.column(0), row)?
1659
+
== "logical_plan after type_coercion"
1660
+
{
1661
+
res = Some(array_value_to_string(batch.column(1), row)?);
1662
+
break;
1663
+
}
1664
+
}
1665
+
assert_eq!(res,Some("Projection: CAST(now() AS Timestamp(Nanosecond, None)) >= CAST(CAST(Utf8(\"2000-01-01\") AS Date32) AS Timestamp(Nanosecond, None))\n EmptyRelation".to_string()));
1666
+
1667
+
let sql = "select now() = current_date()";
1668
+
let df = ctx.sql(sql).await.unwrap();
1669
+
1670
+
let plan = df.explain(true,false)?.collect().await?;
1671
+
let batch = &plan[0];
1672
+
letmut res:Option<String> = None;
1673
+
for row in0..batch.num_rows(){
1674
+
if&array_value_to_string(batch.column(0), row)?
1675
+
== "logical_plan after type_coercion"
1676
+
{
1677
+
res = Some(array_value_to_string(batch.column(1), row)?);
1678
+
break;
1679
+
}
1680
+
}
1681
+
assert_eq!(res,Some("Projection: CAST(now() AS Timestamp(Nanosecond, None)) = CAST(currentdate() AS Timestamp(Nanosecond, None))\n EmptyRelation".to_string()));
let empty = Arc::new(LogicalPlan::EmptyRelation(EmptyRelation{
1050
+
produce_one_row:false,
1051
+
schema:Arc::new(DFSchema::empty()),
1052
+
}));
1053
+
let plan = LogicalPlan::Projection(Projection::try_new(vec![expr], empty)?);
1054
+
dbg!(&plan);
1055
+
let expected =
1056
+
"Projection: CAST(Utf8(\"1998-03-18\") AS Timestamp(Nanosecond, None)) = CAST(CAST(Utf8(\"1998-03-18\") AS Date32) AS Timestamp(Nanosecond, None))\n EmptyRelation";
0 commit comments