This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new a02d5e1 Implement Display for Expr, improve operator display (#971)
a02d5e1 is described below
commit a02d5e1be7c40f84f5090f81a795bb6de663af18
Author: Matthew Turner <[email protected]>
AuthorDate: Wed Sep 22 13:00:36 2021 -0400
Implement Display for Expr, improve operator display (#971)
* # This is a combination of 3 commits.
# This is the 1st commit message:
Add Display for Expr::BinaryExpr
# This is the commit message #2:
Update logical_plan/operators tests
# This is the commit message #3:
rebase and debug display for non binary expr
* Add Display for Expr::BinaryExpr
Update logical_plan/operators tests
rebase and debug display for non binary expr
Add Display for Expr::BinaryExpr
Update logical_plan/operators tests
Updating tests
Update aggregate display
Updating tests without aggregate
More tests
Working on agg/scalar functions
Fix binary_expr in create_name function and attendant tests
More tests
More tests
Doc tests
Rebase and update new tests
* Submodule update
* Restore submodule references from master
Co-authored-by: Andrew Lamb <[email protected]>
---
datafusion/src/execution/context.rs | 18 ++--
datafusion/src/logical_plan/builder.rs | 2 +-
datafusion/src/logical_plan/expr.rs | 53 +++++++--
datafusion/src/logical_plan/operators.rs | 8 +-
datafusion/src/logical_plan/plan.rs | 10 +-
.../src/optimizer/common_subexpr_eliminate.rs | 16 +--
datafusion/src/optimizer/constant_folding.rs | 4 +-
datafusion/src/optimizer/filter_push_down.rs | 100 ++++++++---------
datafusion/src/optimizer/projection_push_down.rs | 10 +-
datafusion/src/optimizer/simplify_expressions.rs | 4 +-
datafusion/src/physical_optimizer/pruning.rs | 24 ++---
datafusion/src/sql/planner.rs | 118 ++++++++++-----------
datafusion/tests/sql.rs | 40 +++----
13 files changed, 220 insertions(+), 187 deletions(-)
diff --git a/datafusion/src/execution/context.rs
b/datafusion/src/execution/context.rs
index f8b344f..adc53a0 100644
--- a/datafusion/src/execution/context.rs
+++ b/datafusion/src/execution/context.rs
@@ -1696,15 +1696,15 @@ mod tests {
.await?;
let expected = vec![
-
"+----+----+--------------+-----------------------------------+----------------------------------+------------------------------------------+--------------+----------------+--------------+--------------+--------------+",
- "| c1 | c2 | ROW_NUMBER() | FIRST_VALUE(test.c2 Plus test.c1) |
LAST_VALUE(test.c2 Plus test.c1) | NTH_VALUE(test.c2 Plus test.c1,Int64(1)) |
SUM(test.c2) | COUNT(test.c2) | MAX(test.c2) | MIN(test.c2) | AVG(test.c2) |",
-
"+----+----+--------------+-----------------------------------+----------------------------------+------------------------------------------+--------------+----------------+--------------+--------------+--------------+",
- "| 0 | 1 | 1 | 1 | 1
| 1 | 1
| 1 | 1 | 1 | 1 |",
- "| 0 | 2 | 1 | 2 | 2
| 2 | 2
| 1 | 2 | 2 | 2 |",
- "| 0 | 3 | 1 | 3 | 3
| 3 | 3
| 1 | 3 | 3 | 3 |",
- "| 0 | 4 | 1 | 4 | 4
| 4 | 4
| 1 | 4 | 4 | 4 |",
- "| 0 | 5 | 1 | 5 | 5
| 5 | 5
| 1 | 5 | 5 | 5 |",
-
"+----+----+--------------+-----------------------------------+----------------------------------+------------------------------------------+--------------+----------------+--------------+--------------+--------------+",
+
"+----+----+--------------+--------------------------------+-------------------------------+---------------------------------------+--------------+----------------+--------------+--------------+--------------+",
+ "| c1 | c2 | ROW_NUMBER() | FIRST_VALUE(test.c2 + test.c1) |
LAST_VALUE(test.c2 + test.c1) | NTH_VALUE(test.c2 + test.c1,Int64(1)) |
SUM(test.c2) | COUNT(test.c2) | MAX(test.c2) | MIN(test.c2) | AVG(test.c2) |",
+
"+----+----+--------------+--------------------------------+-------------------------------+---------------------------------------+--------------+----------------+--------------+--------------+--------------+",
+ "| 0 | 1 | 1 | 1 | 1
| 1 | 1
| 1 | 1 | 1 | 1 |",
+ "| 0 | 2 | 1 | 2 | 2
| 2 | 2
| 1 | 2 | 2 | 2 |",
+ "| 0 | 3 | 1 | 3 | 3
| 3 | 3
| 1 | 3 | 3 | 3 |",
+ "| 0 | 4 | 1 | 4 | 4
| 4 | 4
| 1 | 4 | 4 | 4 |",
+ "| 0 | 5 | 1 | 5 | 5
| 5 | 5
| 1 | 5 | 5 | 5 |",
+
"+----+----+--------------+--------------------------------+-------------------------------+---------------------------------------+--------------+----------------+--------------+--------------+--------------+",
];
// window function shall respect ordering
diff --git a/datafusion/src/logical_plan/builder.rs
b/datafusion/src/logical_plan/builder.rs
index 5555939..c032273 100644
--- a/datafusion/src/logical_plan/builder.rs
+++ b/datafusion/src/logical_plan/builder.rs
@@ -663,7 +663,7 @@ mod tests {
.build()?;
let expected = "Projection: #employee_csv.id\
- \n Filter: #employee_csv.state Eq Utf8(\"CO\")\
+ \n Filter: #employee_csv.state = Utf8(\"CO\")\
\n TableScan: employee_csv projection=Some([0, 3])";
assert_eq!(expected, format!("{:?}", plan));
diff --git a/datafusion/src/logical_plan/expr.rs
b/datafusion/src/logical_plan/expr.rs
index 0ec445a..62dbf24 100644
--- a/datafusion/src/logical_plan/expr.rs
+++ b/datafusion/src/logical_plan/expr.rs
@@ -941,6 +941,33 @@ impl Not for Expr {
}
}
+impl std::fmt::Display for Expr {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ match self {
+ Expr::BinaryExpr {
+ ref left,
+ ref right,
+ ref op,
+ } => write!(f, "{} {} {}", left, op, right),
+ Expr::AggregateFunction {
+ /// Name of the function
+ ref fun,
+ /// List of expressions to feed to the functions as arguments
+ ref args,
+ /// Whether this is a DISTINCT aggregation or not
+ ref distinct,
+ } => fmt_function(f, &fun.to_string(), *distinct, args, true),
+ Expr::ScalarFunction {
+ /// Name of the function
+ ref fun,
+ /// List of expressions to feed to the functions as arguments
+ ref args,
+ } => fmt_function(f, &fun.to_string(), false, args, true),
+ _ => write!(f, "{:?}", self),
+ }
+ }
+}
+
#[allow(clippy::boxed_local)]
fn rewrite_boxed<R>(boxed_expr: Box<Expr>, rewriter: &mut R) ->
Result<Box<Expr>>
where
@@ -1603,8 +1630,14 @@ fn fmt_function(
fun: &str,
distinct: bool,
args: &[Expr],
+ display: bool,
) -> fmt::Result {
- let args: Vec<String> = args.iter().map(|arg| format!("{:?}",
arg)).collect();
+ let args: Vec<String> = match display {
+ true => args.iter().map(|arg| format!("{}", arg)).collect(),
+ false => args.iter().map(|arg| format!("{:?}", arg)).collect(),
+ };
+
+ // let args: Vec<String> = args.iter().map(|arg| format!("{:?}",
arg)).collect();
let distinct_str = match distinct {
true => "DISTINCT ",
false => "",
@@ -1648,7 +1681,7 @@ impl fmt::Debug for Expr {
Expr::IsNull(expr) => write!(f, "{:?} IS NULL", expr),
Expr::IsNotNull(expr) => write!(f, "{:?} IS NOT NULL", expr),
Expr::BinaryExpr { left, op, right } => {
- write!(f, "{:?} {:?} {:?}", left, op, right)
+ write!(f, "{:?} {} {:?}", left, op, right)
}
Expr::Sort {
expr,
@@ -1667,10 +1700,10 @@ impl fmt::Debug for Expr {
}
}
Expr::ScalarFunction { fun, args, .. } => {
- fmt_function(f, &fun.to_string(), false, args)
+ fmt_function(f, &fun.to_string(), false, args, false)
}
Expr::ScalarUDF { fun, ref args, .. } => {
- fmt_function(f, &fun.name, false, args)
+ fmt_function(f, &fun.name, false, args, false)
}
Expr::WindowFunction {
fun,
@@ -1679,7 +1712,7 @@ impl fmt::Debug for Expr {
order_by,
window_frame,
} => {
- fmt_function(f, &fun.to_string(), false, args)?;
+ fmt_function(f, &fun.to_string(), false, args, false)?;
if !partition_by.is_empty() {
write!(f, " PARTITION BY {:?}", partition_by)?;
}
@@ -1702,9 +1735,9 @@ impl fmt::Debug for Expr {
distinct,
ref args,
..
- } => fmt_function(f, &fun.to_string(), *distinct, args),
+ } => fmt_function(f, &fun.to_string(), *distinct, args, true),
Expr::AggregateUDF { fun, ref args, .. } => {
- fmt_function(f, &fun.name, false, args)
+ fmt_function(f, &fun.name, false, args, false)
}
Expr::Between {
expr,
@@ -1762,7 +1795,7 @@ fn create_name(e: &Expr, input_schema: &DFSchema) ->
Result<String> {
Expr::BinaryExpr { left, op, right } => {
let left = create_name(left, input_schema)?;
let right = create_name(right, input_schema)?;
- Ok(format!("{} {:?} {}", left, op, right))
+ Ok(format!("{} {} {}", left, op, right))
}
Expr::Case {
expr,
@@ -1925,12 +1958,12 @@ mod tests {
assert_eq!(
rewriter.v,
vec![
- "Previsited #state Eq Utf8(\"CO\")",
+ "Previsited #state = Utf8(\"CO\")",
"Previsited #state",
"Mutated #state",
"Previsited Utf8(\"CO\")",
"Mutated Utf8(\"CO\")",
- "Mutated #state Eq Utf8(\"CO\")"
+ "Mutated #state = Utf8(\"CO\")"
]
)
}
diff --git a/datafusion/src/logical_plan/operators.rs
b/datafusion/src/logical_plan/operators.rs
index 4e9ccb7..0e00736 100644
--- a/datafusion/src/logical_plan/operators.rs
+++ b/datafusion/src/logical_plan/operators.rs
@@ -129,19 +129,19 @@ mod tests {
fn test_operators() {
assert_eq!(
format!("{:?}", lit(1u32) + lit(2u32)),
- "UInt32(1) Plus UInt32(2)"
+ "UInt32(1) + UInt32(2)"
);
assert_eq!(
format!("{:?}", lit(1u32) - lit(2u32)),
- "UInt32(1) Minus UInt32(2)"
+ "UInt32(1) - UInt32(2)"
);
assert_eq!(
format!("{:?}", lit(1u32) * lit(2u32)),
- "UInt32(1) Multiply UInt32(2)"
+ "UInt32(1) * UInt32(2)"
);
assert_eq!(
format!("{:?}", lit(1u32) / lit(2u32)),
- "UInt32(1) Divide UInt32(2)"
+ "UInt32(1) / UInt32(2)"
);
}
}
diff --git a/datafusion/src/logical_plan/plan.rs
b/datafusion/src/logical_plan/plan.rs
index cb81b8d..4b91ade 100644
--- a/datafusion/src/logical_plan/plan.rs
+++ b/datafusion/src/logical_plan/plan.rs
@@ -551,7 +551,7 @@ impl LogicalPlan {
/// // Format using display_indent
/// let display_string = format!("{}", plan.display_indent());
///
- /// assert_eq!("Filter: #foo_csv.id Eq Int32(5)\
+ /// assert_eq!("Filter: #foo_csv.id = Int32(5)\
/// \n TableScan: foo_csv projection=None",
/// display_string);
/// ```
@@ -575,7 +575,7 @@ impl LogicalPlan {
///
/// ```text
/// Projection: #employee.id [id:Int32]\
- /// Filter: #employee.state Eq Utf8(\"CO\") [id:Int32, state:Utf8]\
+ /// Filter: #employee.state = Utf8(\"CO\") [id:Int32, state:Utf8]\
/// TableScan: employee projection=Some([0, 3]) [id:Int32,
state:Utf8]";
/// ```
///
@@ -592,7 +592,7 @@ impl LogicalPlan {
/// // Format using display_indent_schema
/// let display_string = format!("{}", plan.display_indent_schema());
///
- /// assert_eq!("Filter: #foo_csv.id Eq Int32(5) [id:Int32]\
+ /// assert_eq!("Filter: #foo_csv.id = Int32(5) [id:Int32]\
/// \n TableScan: foo_csv projection=None [id:Int32]",
/// display_string);
/// ```
@@ -939,7 +939,7 @@ mod tests {
let plan = display_plan();
let expected = "Projection: #employee_csv.id\
- \n Filter: #employee_csv.state Eq Utf8(\"CO\")\
+ \n Filter: #employee_csv.state = Utf8(\"CO\")\
\n TableScan: employee_csv projection=Some([0, 3])";
assert_eq!(expected, format!("{}", plan.display_indent()));
@@ -950,7 +950,7 @@ mod tests {
let plan = display_plan();
let expected = "Projection: #employee_csv.id [id:Int32]\
- \n Filter: #employee_csv.state Eq Utf8(\"CO\")
[id:Int32, state:Utf8]\
+ \n Filter: #employee_csv.state = Utf8(\"CO\")
[id:Int32, state:Utf8]\
\n TableScan: employee_csv projection=Some([0, 3])
[id:Int32, state:Utf8]";
assert_eq!(expected, format!("{}", plan.display_indent_schema()));
diff --git a/datafusion/src/optimizer/common_subexpr_eliminate.rs
b/datafusion/src/optimizer/common_subexpr_eliminate.rs
index 7510948..4bda181 100644
--- a/datafusion/src/optimizer/common_subexpr_eliminate.rs
+++ b/datafusion/src/optimizer/common_subexpr_eliminate.rs
@@ -714,8 +714,8 @@ mod test {
)?
.build()?;
- let expected = "Aggregate: groupBy=[[]],
aggr=[[SUM(#BinaryExpr-*BinaryExpr--Column-test.bLiteral1Column-test.a AS
test.a Multiply Int32(1) Minus test.b),
SUM(#BinaryExpr-*BinaryExpr--Column-test.bLiteral1Column-test.a AS test.a
Multiply Int32(1) Minus test.b Multiply Int32(1) Plus #test.c)]]\
- \n Projection: #test.a Multiply Int32(1) Minus #test.b AS
BinaryExpr-*BinaryExpr--Column-test.bLiteral1Column-test.a, #test.a, #test.b,
#test.c\
+ let expected = "Aggregate: groupBy=[[]],
aggr=[[SUM(#BinaryExpr-*BinaryExpr--Column-test.bLiteral1Column-test.a AS
test.a * Int32(1) - test.b),
SUM(#BinaryExpr-*BinaryExpr--Column-test.bLiteral1Column-test.a AS test.a *
Int32(1) - test.b * Int32(1) + #test.c)]]\
+ \n Projection: #test.a * Int32(1) - #test.b AS
BinaryExpr-*BinaryExpr--Column-test.bLiteral1Column-test.a, #test.a, #test.b,
#test.c\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
@@ -737,7 +737,7 @@ mod test {
)?
.build()?;
- let expected = "Aggregate: groupBy=[[]], aggr=[[Int32(1) Plus
#AggregateFunction-AVGfalseColumn-test.a AS AVG(test.a), Int32(1) Minus
#AggregateFunction-AVGfalseColumn-test.a AS AVG(test.a)]]\
+ let expected = "Aggregate: groupBy=[[]], aggr=[[Int32(1) +
#AggregateFunction-AVGfalseColumn-test.a AS AVG(test.a), Int32(1) -
#AggregateFunction-AVGfalseColumn-test.a AS AVG(test.a)]]\
\n Projection: AVG(#test.a) AS
AggregateFunction-AVGfalseColumn-test.a, #test.a, #test.b, #test.c\
\n TableScan: test projection=None";
@@ -757,8 +757,8 @@ mod test {
])?
.build()?;
- let expected = "Projection: #BinaryExpr-+Column-test.aLiteral1 AS
Int32(1) Plus test.a AS first, #BinaryExpr-+Column-test.aLiteral1 AS Int32(1)
Plus test.a AS second\
- \n Projection: Int32(1) Plus #test.a AS
BinaryExpr-+Column-test.aLiteral1, #test.a, #test.b, #test.c\
+ let expected = "Projection: #BinaryExpr-+Column-test.aLiteral1 AS
Int32(1) + test.a AS first, #BinaryExpr-+Column-test.aLiteral1 AS Int32(1) +
test.a AS second\
+ \n Projection: Int32(1) + #test.a AS
BinaryExpr-+Column-test.aLiteral1, #test.a, #test.b, #test.c\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
@@ -777,7 +777,7 @@ mod test {
])?
.build()?;
- let expected = "Projection: Int32(1) Plus #test.a, #test.a Plus
Int32(1)\
+ let expected = "Projection: Int32(1) + #test.a, #test.a + Int32(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
@@ -794,8 +794,8 @@ mod test {
.project(vec![binary_expr(lit(1), Operator::Plus, col("a"))])?
.build()?;
- let expected = "Projection: #Int32(1) Plus test.a\
- \n Projection: Int32(1) Plus #test.a\
+ let expected = "Projection: #Int32(1) + test.a\
+ \n Projection: Int32(1) + #test.a\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
diff --git a/datafusion/src/optimizer/constant_folding.rs
b/datafusion/src/optimizer/constant_folding.rs
index 31b0b7f..4d8f06f 100644
--- a/datafusion/src/optimizer/constant_folding.rs
+++ b/datafusion/src/optimizer/constant_folding.rs
@@ -592,7 +592,7 @@ mod tests {
let expected = "\
Projection: #test.a\
- \n Filter: NOT #test.b And #test.c\
+ \n Filter: NOT #test.b AND #test.c\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
@@ -609,7 +609,7 @@ mod tests {
let expected = "\
Projection: #test.a\
- \n Filter: NOT #test.b Or NOT #test.c\
+ \n Filter: NOT #test.b OR NOT #test.c\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
diff --git a/datafusion/src/optimizer/filter_push_down.rs
b/datafusion/src/optimizer/filter_push_down.rs
index 594e371..7fc6540 100644
--- a/datafusion/src/optimizer/filter_push_down.rs
+++ b/datafusion/src/optimizer/filter_push_down.rs
@@ -573,7 +573,7 @@ mod tests {
// filter is before projection
let expected = "\
Projection: #test.a, #test.b\
- \n Filter: #test.a Eq Int64(1)\
+ \n Filter: #test.a = Int64(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -589,7 +589,7 @@ mod tests {
.build()?;
// filter is before single projection
let expected = "\
- Filter: #test.a Eq Int64(1)\
+ Filter: #test.a = Int64(1)\
\n Limit: 10\
\n Projection: #test.a, #test.b\
\n TableScan: test projection=None";
@@ -604,7 +604,7 @@ mod tests {
.filter(lit(0i64).eq(lit(1i64)))?
.build()?;
let expected = "\
- Filter: Int64(0) Eq Int64(1)\
+ Filter: Int64(0) = Int64(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -622,7 +622,7 @@ mod tests {
let expected = "\
Projection: #test.c, #test.b\
\n Projection: #test.a, #test.b, #test.c\
- \n Filter: #test.a Eq Int64(1)\
+ \n Filter: #test.a = Int64(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -638,7 +638,7 @@ mod tests {
// filter of key aggregation is commutative
let expected = "\
Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b) AS
total_salary]]\
- \n Filter: #test.a Gt Int64(10)\
+ \n Filter: #test.a > Int64(10)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -653,7 +653,7 @@ mod tests {
.build()?;
// filter of aggregate is after aggregation since they are
non-commutative
let expected = "\
- Filter: #b Gt Int64(10)\
+ Filter: #b > Int64(10)\
\n Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b) AS b]]\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
@@ -671,7 +671,7 @@ mod tests {
// filter is before projection
let expected = "\
Projection: #test.a AS b, #test.c\
- \n Filter: #test.a Eq Int64(1)\
+ \n Filter: #test.a = Int64(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -709,15 +709,15 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #b Eq Int64(1)\
- \n Projection: #test.a Multiply Int32(2) Plus #test.c AS b,
#test.c\
+ Filter: #b = Int64(1)\
+ \n Projection: #test.a * Int32(2) + #test.c AS b, #test.c\
\n TableScan: test projection=None"
);
// filter is before projection
let expected = "\
- Projection: #test.a Multiply Int32(2) Plus #test.c AS b, #test.c\
- \n Filter: #test.a Multiply Int32(2) Plus #test.c Eq Int64(1)\
+ Projection: #test.a * Int32(2) + #test.c AS b, #test.c\
+ \n Filter: #test.a * Int32(2) + #test.c = Int64(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -741,17 +741,17 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #a Eq Int64(1)\
- \n Projection: #b Multiply Int32(3) AS a, #test.c\
- \n Projection: #test.a Multiply Int32(2) Plus #test.c AS b,
#test.c\
+ Filter: #a = Int64(1)\
+ \n Projection: #b * Int32(3) AS a, #test.c\
+ \n Projection: #test.a * Int32(2) + #test.c AS b, #test.c\
\n TableScan: test projection=None"
);
// filter is before the projections
let expected = "\
- Projection: #b Multiply Int32(3) AS a, #test.c\
- \n Projection: #test.a Multiply Int32(2) Plus #test.c AS b, #test.c\
- \n Filter: #test.a Multiply Int32(2) Plus #test.c Multiply Int32(3)
Eq Int64(1)\
+ Projection: #b * Int32(3) AS a, #test.c\
+ \n Projection: #test.a * Int32(2) + #test.c AS b, #test.c\
+ \n Filter: #test.a * Int32(2) + #test.c * Int32(3) = Int64(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -774,8 +774,8 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #SUM(test.c) Gt Int64(10)\
- \n Filter: #b Gt Int64(10)\
+ Filter: #SUM(test.c) > Int64(10)\
+ \n Filter: #b > Int64(10)\
\n Aggregate: groupBy=[[#b]], aggr=[[SUM(#test.c)]]\
\n Projection: #test.a AS b, #test.c\
\n TableScan: test projection=None"
@@ -783,10 +783,10 @@ mod tests {
// filter is before the projections
let expected = "\
- Filter: #SUM(test.c) Gt Int64(10)\
+ Filter: #SUM(test.c) > Int64(10)\
\n Aggregate: groupBy=[[#b]], aggr=[[SUM(#test.c)]]\
\n Projection: #test.a AS b, #test.c\
- \n Filter: #test.a Gt Int64(10)\
+ \n Filter: #test.a > Int64(10)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
@@ -812,7 +812,7 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #SUM(test.c) Gt Int64(10) And #b Gt Int64(10) And
#SUM(test.c) Lt Int64(20)\
+ Filter: #SUM(test.c) > Int64(10) AND #b > Int64(10) AND
#SUM(test.c) < Int64(20)\
\n Aggregate: groupBy=[[#b]], aggr=[[SUM(#test.c)]]\
\n Projection: #test.a AS b, #test.c\
\n TableScan: test projection=None"
@@ -820,10 +820,10 @@ mod tests {
// filter is before the projections
let expected = "\
- Filter: #SUM(test.c) Gt Int64(10) And #SUM(test.c) Lt Int64(20)\
+ Filter: #SUM(test.c) > Int64(10) AND #SUM(test.c) < Int64(20)\
\n Aggregate: groupBy=[[#b]], aggr=[[SUM(#test.c)]]\
\n Projection: #test.a AS b, #test.c\
- \n Filter: #test.a Gt Int64(10)\
+ \n Filter: #test.a > Int64(10)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
@@ -844,7 +844,7 @@ mod tests {
// filter does not just any of the limits
let expected = "\
Projection: #test.a, #test.b\
- \n Filter: #test.a Eq Int64(1)\
+ \n Filter: #test.a = Int64(1)\
\n Limit: 10\
\n Limit: 20\
\n Projection: #test.a, #test.b\
@@ -863,9 +863,9 @@ mod tests {
// filter appears below Union
let expected = "\
Union\
- \n Filter: #a Eq Int64(1)\
+ \n Filter: #a = Int64(1)\
\n TableScan: test projection=None\
- \n Filter: #a Eq Int64(1)\
+ \n Filter: #a = Int64(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -887,20 +887,20 @@ mod tests {
// not part of the test
assert_eq!(
format!("{:?}", plan),
- "Filter: #test.a GtEq Int64(1)\
+ "Filter: #test.a >= Int64(1)\
\n Projection: #test.a\
\n Limit: 1\
- \n Filter: #test.a LtEq Int64(1)\
+ \n Filter: #test.a <= Int64(1)\
\n Projection: #test.a\
\n TableScan: test projection=None"
);
let expected = "\
Projection: #test.a\
- \n Filter: #test.a GtEq Int64(1)\
+ \n Filter: #test.a >= Int64(1)\
\n Limit: 1\
\n Projection: #test.a\
- \n Filter: #test.a LtEq Int64(1)\
+ \n Filter: #test.a <= Int64(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
@@ -922,15 +922,15 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"Projection: #test.a\
- \n Filter: #test.a GtEq Int64(1)\
- \n Filter: #test.a LtEq Int64(1)\
+ \n Filter: #test.a >= Int64(1)\
+ \n Filter: #test.a <= Int64(1)\
\n Limit: 1\
\n TableScan: test projection=None"
);
let expected = "\
Projection: #test.a\
- \n Filter: #test.a GtEq Int64(1) And #test.a LtEq Int64(1)\
+ \n Filter: #test.a >= Int64(1) AND #test.a <= Int64(1)\
\n Limit: 1\
\n TableScan: test projection=None";
@@ -951,7 +951,7 @@ mod tests {
let expected = "\
TestUserDefined\
- \n Filter: #test.a LtEq Int64(1)\
+ \n Filter: #test.a <= Int64(1)\
\n TableScan: test projection=None";
// not part of the test
@@ -983,7 +983,7 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.a LtEq Int64(1)\
+ Filter: #test.a <= Int64(1)\
\n Join: #test.a = #test2.a\
\n TableScan: test projection=None\
\n Projection: #test2.a\
@@ -993,10 +993,10 @@ mod tests {
// filter sent to side before the join
let expected = "\
Join: #test.a = #test2.a\
- \n Filter: #test.a LtEq Int64(1)\
+ \n Filter: #test.a <= Int64(1)\
\n TableScan: test projection=None\
\n Projection: #test2.a\
- \n Filter: #test2.a LtEq Int64(1)\
+ \n Filter: #test2.a <= Int64(1)\
\n TableScan: test2 projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1024,7 +1024,7 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.a LtEq Int64(1)\
+ Filter: #test.a <= Int64(1)\
\n Join: Using #test.a = #test2.a\
\n TableScan: test projection=None\
\n Projection: #test2.a\
@@ -1034,10 +1034,10 @@ mod tests {
// filter sent to side before the join
let expected = "\
Join: Using #test.a = #test2.a\
- \n Filter: #test.a LtEq Int64(1)\
+ \n Filter: #test.a <= Int64(1)\
\n TableScan: test projection=None\
\n Projection: #test2.a\
- \n Filter: #test2.a LtEq Int64(1)\
+ \n Filter: #test2.a <= Int64(1)\
\n TableScan: test2 projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1068,7 +1068,7 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.c LtEq #test2.b\
+ Filter: #test.c <= #test2.b\
\n Join: #test.a = #test2.a\
\n Projection: #test.a, #test.c\
\n TableScan: test projection=None\
@@ -1107,7 +1107,7 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.b LtEq Int64(1)\
+ Filter: #test.b <= Int64(1)\
\n Join: #test.a = #test2.a\
\n Projection: #test.a, #test.b\
\n TableScan: test projection=None\
@@ -1118,7 +1118,7 @@ mod tests {
let expected = "\
Join: #test.a = #test2.a\
\n Projection: #test.a, #test.b\
- \n Filter: #test.b LtEq Int64(1)\
+ \n Filter: #test.b <= Int64(1)\
\n TableScan: test projection=None\
\n Projection: #test2.a, #test2.c\
\n TableScan: test2 projection=None";
@@ -1192,7 +1192,7 @@ mod tests {
let plan =
table_scan_with_pushdown_provider(TableProviderFilterPushDown::Exact)?;
let expected = "\
- TableScan: test projection=None, filters=[#a Eq Int64(1)]";
+ TableScan: test projection=None, filters=[#a = Int64(1)]";
assert_optimized_plan_eq(&plan, expected);
Ok(())
}
@@ -1203,8 +1203,8 @@ mod tests {
table_scan_with_pushdown_provider(TableProviderFilterPushDown::Inexact)?;
let expected = "\
- Filter: #a Eq Int64(1)\
- \n TableScan: test projection=None, filters=[#a Eq Int64(1)]";
+ Filter: #a = Int64(1)\
+ \n TableScan: test projection=None, filters=[#a = Int64(1)]";
assert_optimized_plan_eq(&plan, expected);
Ok(())
}
@@ -1217,8 +1217,8 @@ mod tests {
let optimised_plan = optimize_plan(&plan);
let expected = "\
- Filter: #a Eq Int64(1)\
- \n TableScan: test projection=None, filters=[#a Eq Int64(1)]";
+ Filter: #a = Int64(1)\
+ \n TableScan: test projection=None, filters=[#a = Int64(1)]";
// Optimizing the same plan multiple times should produce the same plan
// each time.
@@ -1232,7 +1232,7 @@ mod tests {
table_scan_with_pushdown_provider(TableProviderFilterPushDown::Unsupported)?;
let expected = "\
- Filter: #a Eq Int64(1)\
+ Filter: #a = Int64(1)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
Ok(())
diff --git a/datafusion/src/optimizer/projection_push_down.rs
b/datafusion/src/optimizer/projection_push_down.rs
index 7dddbff..927e3cb 100644
--- a/datafusion/src/optimizer/projection_push_down.rs
+++ b/datafusion/src/optimizer/projection_push_down.rs
@@ -561,9 +561,9 @@ mod tests {
.project(vec![col("a"), col("c"), col("b")])?
.build()?;
let expected = "Projection: #test.a, #test.c, #test.b\
- \n Filter: #test.a Gt Int32(1)\
- \n Filter: #test.b Gt Int32(1)\
- \n Filter: #test.c Gt Int32(1)\
+ \n Filter: #test.a > Int32(1)\
+ \n Filter: #test.b > Int32(1)\
+ \n Filter: #test.c > Int32(1)\
\n TableScan: test projection=Some([0, 1, 2])";
assert_optimized_plan_eq(&plan, expected);
@@ -818,7 +818,7 @@ mod tests {
let expected = "\
Aggregate: groupBy=[[#test.c]], aggr=[[MAX(#test.a)]]\
- \n Filter: #test.c Gt Int32(1)\
+ \n Filter: #test.c > Int32(1)\
\n Projection: #test.c, #test.a\
\n TableScan: test projection=Some([0, 2])";
@@ -888,7 +888,7 @@ mod tests {
assert_fields_eq(&plan, vec!["c", "a", "MAX(test.b)"]);
let expected = "Projection: #test.c, #test.a, #MAX(test.b)\
- \n Filter: #test.c Gt Int32(1)\
+ \n Filter: #test.c > Int32(1)\
\n Aggregate: groupBy=[[#test.a, #test.c]], aggr=[[MAX(#test.b)]]\
\n TableScan: test projection=Some([0, 1, 2])";
diff --git a/datafusion/src/optimizer/simplify_expressions.rs
b/datafusion/src/optimizer/simplify_expressions.rs
index f629eaf..5a2e856 100644
--- a/datafusion/src/optimizer/simplify_expressions.rs
+++ b/datafusion/src/optimizer/simplify_expressions.rs
@@ -491,7 +491,7 @@ mod tests {
assert_optimized_plan_eq(
&plan,
"\
- Filter: #test.b Gt Int32(1)\
+ Filter: #test.b > Int32(1)\
\n Projection: #test.a\
\n TableScan: test projection=None",
);
@@ -513,7 +513,7 @@ mod tests {
assert_optimized_plan_eq(
&plan,
"\
- Filter: #test.a Gt Int32(5) And #test.b Lt Int32(6)\
+ Filter: #test.a > Int32(5) AND #test.b < Int32(6)\
\n Projection: #test.a\
\n TableScan: test projection=None",
);
diff --git a/datafusion/src/physical_optimizer/pruning.rs
b/datafusion/src/physical_optimizer/pruning.rs
index 2a10cfa..29a196d 100644
--- a/datafusion/src/physical_optimizer/pruning.rs
+++ b/datafusion/src/physical_optimizer/pruning.rs
@@ -1020,7 +1020,7 @@ mod tests {
#[test]
fn row_group_predicate_eq() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Int32,
false)]);
- let expected_expr = "#c1_min LtEq Int32(1) And Int32(1) LtEq #c1_max";
+ let expected_expr = "#c1_min <= Int32(1) AND Int32(1) <= #c1_max";
// test column on the left
let expr = col("c1").eq(lit(1));
@@ -1040,7 +1040,7 @@ mod tests {
#[test]
fn row_group_predicate_not_eq() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Int32,
false)]);
- let expected_expr = "#c1_min NotEq Int32(1) Or Int32(1) NotEq #c1_max";
+ let expected_expr = "#c1_min != Int32(1) OR Int32(1) != #c1_max";
// test column on the left
let expr = col("c1").not_eq(lit(1));
@@ -1060,7 +1060,7 @@ mod tests {
#[test]
fn row_group_predicate_gt() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Int32,
false)]);
- let expected_expr = "#c1_max Gt Int32(1)";
+ let expected_expr = "#c1_max > Int32(1)";
// test column on the left
let expr = col("c1").gt(lit(1));
@@ -1080,7 +1080,7 @@ mod tests {
#[test]
fn row_group_predicate_gt_eq() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Int32,
false)]);
- let expected_expr = "#c1_max GtEq Int32(1)";
+ let expected_expr = "#c1_max >= Int32(1)";
// test column on the left
let expr = col("c1").gt_eq(lit(1));
@@ -1099,7 +1099,7 @@ mod tests {
#[test]
fn row_group_predicate_lt() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Int32,
false)]);
- let expected_expr = "#c1_min Lt Int32(1)";
+ let expected_expr = "#c1_min < Int32(1)";
// test column on the left
let expr = col("c1").lt(lit(1));
@@ -1119,7 +1119,7 @@ mod tests {
#[test]
fn row_group_predicate_lt_eq() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Int32,
false)]);
- let expected_expr = "#c1_min LtEq Int32(1)";
+ let expected_expr = "#c1_min <= Int32(1)";
// test column on the left
let expr = col("c1").lt_eq(lit(1));
@@ -1144,7 +1144,7 @@ mod tests {
]);
// test AND operator joining supported c1 < 1 expression and
unsupported c2 > c3 expression
let expr = col("c1").lt(lit(1)).and(col("c2").lt(col("c3")));
- let expected_expr = "#c1_min Lt Int32(1) And Boolean(true)";
+ let expected_expr = "#c1_min < Int32(1) AND Boolean(true)";
let predicate_expr =
build_predicate_expression(&expr, &schema, &mut
RequiredStatColumns::new())?;
assert_eq!(format!("{:?}", predicate_expr), expected_expr);
@@ -1160,7 +1160,7 @@ mod tests {
]);
// test OR operator joining supported c1 < 1 expression and
unsupported c2 % 2 expression
let expr = col("c1").lt(lit(1)).or(col("c2").modulus(lit(2)));
- let expected_expr = "#c1_min Lt Int32(1) Or Boolean(true)";
+ let expected_expr = "#c1_min < Int32(1) OR Boolean(true)";
let predicate_expr =
build_predicate_expression(&expr, &schema, &mut
RequiredStatColumns::new())?;
assert_eq!(format!("{:?}", predicate_expr), expected_expr);
@@ -1184,7 +1184,7 @@ mod tests {
#[test]
fn row_group_predicate_not_bool() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Boolean,
false)]);
- let expected_expr = "NOT #c1_min And #c1_max";
+ let expected_expr = "NOT #c1_min AND #c1_max";
let expr = col("c1").not();
let predicate_expr =
@@ -1197,7 +1197,7 @@ mod tests {
#[test]
fn row_group_predicate_bool() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Boolean,
false)]);
- let expected_expr = "#c1_min Or #c1_max";
+ let expected_expr = "#c1_min OR #c1_max";
let expr = col("c1");
let predicate_expr =
@@ -1210,7 +1210,7 @@ mod tests {
#[test]
fn row_group_predicate_lt_bool() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Boolean,
false)]);
- let expected_expr = "#c1_min Lt Boolean(true)";
+ let expected_expr = "#c1_min < Boolean(true)";
// DF doesn't support arithmetic on boolean columns so
// this predicate will error when evaluated
@@ -1233,7 +1233,7 @@ mod tests {
let expr = col("c1")
.lt(lit(1))
.and(col("c2").eq(lit(2)).or(col("c2").eq(lit(3))));
- let expected_expr = "#c1_min Lt Int32(1) And #c2_min LtEq Int32(2) And
Int32(2) LtEq #c2_max Or #c2_min LtEq Int32(3) And Int32(3) LtEq #c2_max";
+ let expected_expr = "#c1_min < Int32(1) AND #c2_min <= Int32(2) AND
Int32(2) <= #c2_max OR #c2_min <= Int32(3) AND Int32(3) <= #c2_max";
let predicate_expr =
build_predicate_expression(&expr, &schema, &mut required_columns)?;
assert_eq!(format!("{:?}", predicate_expr), expected_expr);
diff --git a/datafusion/src/sql/planner.rs b/datafusion/src/sql/planner.rs
index 50c36dd..f3d1e9e 100644
--- a/datafusion/src/sql/planner.rs
+++ b/datafusion/src/sql/planner.rs
@@ -1913,7 +1913,7 @@ mod tests {
let sql = "SELECT id, first_name, last_name \
FROM person WHERE state = 'CO'";
let expected = "Projection: #person.id, #person.first_name,
#person.last_name\
- \n Filter: #person.state Eq Utf8(\"CO\")\
+ \n Filter: #person.state = Utf8(\"CO\")\
\n TableScan: person projection=None";
quick_test(sql, expected);
}
@@ -1953,7 +1953,7 @@ mod tests {
let sql = "SELECT id, first_name, last_name \
FROM person WHERE state = 'CO' AND age >= 21 AND age <= 65";
let expected = "Projection: #person.id, #person.first_name,
#person.last_name\
- \n Filter: #person.state Eq Utf8(\"CO\") And #person.age GtEq
Int64(21) And #person.age LtEq Int64(65)\
+ \n Filter: #person.state = Utf8(\"CO\") AND #person.age >=
Int64(21) AND #person.age <= Int64(65)\
\n TableScan: person projection=None";
quick_test(sql, expected);
}
@@ -1964,7 +1964,7 @@ mod tests {
"SELECT state FROM person WHERE birth_date < CAST
(158412331400600000 as timestamp)";
let expected = "Projection: #person.state\
- \n Filter: #person.birth_date Lt CAST(Int64(158412331400600000)
AS Timestamp(Nanosecond, None))\
+ \n Filter: #person.birth_date < CAST(Int64(158412331400600000) AS
Timestamp(Nanosecond, None))\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -1976,7 +1976,7 @@ mod tests {
"SELECT state FROM person WHERE birth_date < CAST ('2020-01-01' as
date)";
let expected = "Projection: #person.state\
- \n Filter: #person.birth_date Lt CAST(Utf8(\"2020-01-01\") AS
Date32)\
+ \n Filter: #person.birth_date < CAST(Utf8(\"2020-01-01\") AS
Date32)\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -1993,12 +1993,12 @@ mod tests {
AND age < 65 \
AND age <= 65";
let expected = "Projection: #person.age, #person.first_name,
#person.last_name\
- \n Filter: #person.age Eq Int64(21) \
- And #person.age NotEq Int64(21) \
- And #person.age Gt Int64(21) \
- And #person.age GtEq Int64(21) \
- And #person.age Lt Int64(65) \
- And #person.age LtEq Int64(65)\
+ \n Filter: #person.age = Int64(21) \
+ AND #person.age != Int64(21) \
+ AND #person.age > Int64(21) \
+ AND #person.age >= Int64(21) \
+ AND #person.age < Int64(65) \
+ AND #person.age <= Int64(65)\
\n TableScan: person projection=None";
quick_test(sql, expected);
}
@@ -2051,9 +2051,9 @@ mod tests {
WHERE fn1 = 'X' AND age < 30";
let expected = "Projection: #fn1, #person.age\
- \n Filter: #fn1 Eq Utf8(\"X\") And #person.age Lt
Int64(30)\
+ \n Filter: #fn1 = Utf8(\"X\") AND #person.age <
Int64(30)\
\n Projection: #person.first_name AS fn1,
#person.age\
- \n Filter: #person.age Gt Int64(20)\
+ \n Filter: #person.age > Int64(20)\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2086,7 +2086,7 @@ mod tests {
FROM person
HAVING age > 100 AND age < 200";
let expected = "Projection: #person.id, #person.age\
- \n Filter: #person.age Gt Int64(100) And #person.age
Lt Int64(200)\
+ \n Filter: #person.age > Int64(100) AND #person.age <
Int64(200)\
\n TableScan: person projection=None";
quick_test(sql, expected);
}
@@ -2133,7 +2133,7 @@ mod tests {
FROM person
HAVING MAX(age) < 30";
let expected = "Projection: #MAX(person.age)\
- \n Filter: #MAX(person.age) Lt Int64(30)\
+ \n Filter: #MAX(person.age) < Int64(30)\
\n Aggregate: groupBy=[[]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2145,7 +2145,7 @@ mod tests {
FROM person
HAVING MAX(first_name) > 'M'";
let expected = "Projection: #MAX(person.age)\
- \n Filter: #MAX(person.first_name) Gt Utf8(\"M\")\
+ \n Filter: #MAX(person.first_name) > Utf8(\"M\")\
\n Aggregate: groupBy=[[]],
aggr=[[MAX(#person.age), MAX(#person.first_name)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2170,7 +2170,7 @@ mod tests {
HAVING max_age < 30";
// FIXME: add test for having in execution
let expected = "Projection: #MAX(person.age) AS max_age\
- \n Filter: #MAX(person.age) Lt Int64(30)\
+ \n Filter: #MAX(person.age) < Int64(30)\
\n Aggregate: groupBy=[[]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2182,7 +2182,7 @@ mod tests {
FROM person
HAVING MAX(age) < 30";
let expected = "Projection: #MAX(person.age) AS max_age\
- \n Filter: #MAX(person.age) Lt Int64(30)\
+ \n Filter: #MAX(person.age) < Int64(30)\
\n Aggregate: groupBy=[[]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2195,7 +2195,7 @@ mod tests {
GROUP BY first_name
HAVING first_name = 'M'";
let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #person.first_name Eq Utf8(\"M\")\
+ \n Filter: #person.first_name = Utf8(\"M\")\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2209,9 +2209,9 @@ mod tests {
GROUP BY first_name
HAVING MAX(age) < 100";
let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) Lt Int64(100)\
+ \n Filter: #MAX(person.age) < Int64(100)\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age)]]\
- \n Filter: #person.id Gt Int64(5)\
+ \n Filter: #person.id > Int64(5)\
\n TableScan: person projection=None";
quick_test(sql, expected);
}
@@ -2225,9 +2225,9 @@ mod tests {
GROUP BY first_name
HAVING MAX(age) < 100";
let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) Lt Int64(100)\
+ \n Filter: #MAX(person.age) < Int64(100)\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age)]]\
- \n Filter: #person.id Gt Int64(5) And #person.age
Gt Int64(18)\
+ \n Filter: #person.id > Int64(5) AND #person.age
> Int64(18)\
\n TableScan: person projection=None";
quick_test(sql, expected);
}
@@ -2239,7 +2239,7 @@ mod tests {
GROUP BY first_name
HAVING MAX(age) > 2 AND fn = 'M'";
let expected = "Projection: #person.first_name AS fn, #MAX(person.age)\
- \n Filter: #MAX(person.age) Gt Int64(2) And
#person.first_name Eq Utf8(\"M\")\
+ \n Filter: #MAX(person.age) > Int64(2) AND
#person.first_name = Utf8(\"M\")\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2253,7 +2253,7 @@ mod tests {
GROUP BY first_name
HAVING MAX(age) > 2 AND max_age < 5 AND first_name = 'M'
AND fn = 'N'";
let expected = "Projection: #person.first_name AS fn, #MAX(person.age)
AS max_age\
- \n Filter: #MAX(person.age) Gt Int64(2) And
#MAX(person.age) Lt Int64(5) And #person.first_name Eq Utf8(\"M\") And
#person.first_name Eq Utf8(\"N\")\
+ \n Filter: #MAX(person.age) > Int64(2) AND
#MAX(person.age) < Int64(5) AND #person.first_name = Utf8(\"M\") AND
#person.first_name = Utf8(\"N\")\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2266,7 +2266,7 @@ mod tests {
GROUP BY first_name
HAVING MAX(age) > 100";
let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) Gt Int64(100)\
+ \n Filter: #MAX(person.age) > Int64(100)\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2292,7 +2292,7 @@ mod tests {
GROUP BY first_name
HAVING MAX(age) > 100 AND MAX(age) < 200";
let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) Gt Int64(100) And
#MAX(person.age) Lt Int64(200)\
+ \n Filter: #MAX(person.age) > Int64(100) AND
#MAX(person.age) < Int64(200)\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2305,7 +2305,7 @@ mod tests {
GROUP BY first_name
HAVING MAX(age) > 100 AND MIN(id) < 50";
let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) Gt Int64(100) And
#MIN(person.id) Lt Int64(50)\
+ \n Filter: #MAX(person.age) > Int64(100) AND
#MIN(person.id) < Int64(50)\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age), MIN(#person.id)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2319,7 +2319,7 @@ mod tests {
GROUP BY first_name
HAVING max_age > 100";
let expected = "Projection: #person.first_name, #MAX(person.age) AS
max_age\
- \n Filter: #MAX(person.age) Gt Int64(100)\
+ \n Filter: #MAX(person.age) > Int64(100)\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2333,8 +2333,8 @@ mod tests {
GROUP BY first_name
HAVING max_age_plus_one > 100";
let expected =
- "Projection: #person.first_name, #MAX(person.age) Plus Int64(1) AS
max_age_plus_one\
- \n Filter: #MAX(person.age) Plus Int64(1) Gt
Int64(100)\
+ "Projection: #person.first_name, #MAX(person.age) + Int64(1) AS
max_age_plus_one\
+ \n Filter: #MAX(person.age) + Int64(1) > Int64(100)\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age)]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2348,8 +2348,8 @@ mod tests {
GROUP BY first_name
HAVING MAX(age) > 100 AND MIN(id - 2) < 50";
let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) Gt Int64(100) And
#MIN(person.id Minus Int64(2)) Lt Int64(50)\
- \n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age), MIN(#person.id Minus Int64(2))]]\
+ \n Filter: #MAX(person.age) > Int64(100) AND
#MIN(person.id - Int64(2)) < Int64(50)\
+ \n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age), MIN(#person.id - Int64(2))]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
}
@@ -2361,7 +2361,7 @@ mod tests {
GROUP BY first_name
HAVING MAX(age) > 100 AND COUNT(*) < 50";
let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) Gt Int64(100) And
#COUNT(UInt8(1)) Lt Int64(50)\
+ \n Filter: #MAX(person.age) > Int64(100) AND
#COUNT(UInt8(1)) < Int64(50)\
\n Aggregate: groupBy=[[#person.first_name]],
aggr=[[MAX(#person.age), COUNT(UInt8(1))]]\
\n TableScan: person projection=None";
quick_test(sql, expected);
@@ -2370,7 +2370,7 @@ mod tests {
#[test]
fn select_binary_expr() {
let sql = "SELECT age + salary from person";
- let expected = "Projection: #person.age Plus #person.salary\
+ let expected = "Projection: #person.age + #person.salary\
\n TableScan: person projection=None";
quick_test(sql, expected);
}
@@ -2378,7 +2378,7 @@ mod tests {
#[test]
fn select_binary_expr_nested() {
let sql = "SELECT (age + salary)/2 from person";
- let expected = "Projection: #person.age Plus #person.salary Divide
Int64(2)\
+ let expected = "Projection: #person.age + #person.salary / Int64(2)\
\n TableScan: person projection=None";
quick_test(sql, expected);
}
@@ -2627,7 +2627,7 @@ mod tests {
quick_test(
"SELECT MIN(first_name) FROM person GROUP BY age + 1",
"Projection: #MIN(person.first_name)\
- \n Aggregate: groupBy=[[#person.age Plus Int64(1)]],
aggr=[[MIN(#person.first_name)]]\
+ \n Aggregate: groupBy=[[#person.age + Int64(1)]],
aggr=[[MIN(#person.first_name)]]\
\n TableScan: person projection=None",
);
}
@@ -2637,14 +2637,14 @@ mod tests {
) {
quick_test(
"SELECT age + 1, MIN(first_name) FROM person GROUP BY age + 1",
- "Projection: #person.age Plus Int64(1), #MIN(person.first_name)\
- \n Aggregate: groupBy=[[#person.age Plus Int64(1)]],
aggr=[[MIN(#person.first_name)]]\
+ "Projection: #person.age + Int64(1), #MIN(person.first_name)\
+ \n Aggregate: groupBy=[[#person.age + Int64(1)]],
aggr=[[MIN(#person.first_name)]]\
\n TableScan: person projection=None",
);
quick_test(
"SELECT MIN(first_name), age + 1 FROM person GROUP BY age + 1",
- "Projection: #MIN(person.first_name), #person.age Plus Int64(1)\
- \n Aggregate: groupBy=[[#person.age Plus Int64(1)]],
aggr=[[MIN(#person.first_name)]]\
+ "Projection: #MIN(person.first_name), #person.age + Int64(1)\
+ \n Aggregate: groupBy=[[#person.age + Int64(1)]],
aggr=[[MIN(#person.first_name)]]\
\n TableScan: person projection=None",
);
}
@@ -2654,8 +2654,8 @@ mod tests {
{
quick_test(
"SELECT ((age + 1) / 2) * (age + 1), MIN(first_name) FROM person
GROUP BY age + 1",
- "Projection: #person.age Plus Int64(1) Divide Int64(2) Multiply
#person.age Plus Int64(1), #MIN(person.first_name)\
- \n Aggregate: groupBy=[[#person.age Plus Int64(1)]],
aggr=[[MIN(#person.first_name)]]\
+ "Projection: #person.age + Int64(1) / Int64(2) * #person.age +
Int64(1), #MIN(person.first_name)\
+ \n Aggregate: groupBy=[[#person.age + Int64(1)]],
aggr=[[MIN(#person.first_name)]]\
\n TableScan: person projection=None",
);
}
@@ -2688,7 +2688,7 @@ mod tests {
fn select_simple_aggregate_nested_in_binary_expr_with_groupby() {
quick_test(
"SELECT state, MIN(age) < 10 FROM person GROUP BY state",
- "Projection: #person.state, #MIN(person.age) Lt Int64(10)\
+ "Projection: #person.state, #MIN(person.age) < Int64(10)\
\n Aggregate: groupBy=[[#person.state]],
aggr=[[MIN(#person.age)]]\
\n TableScan: person projection=None",
);
@@ -2698,7 +2698,7 @@ mod tests {
fn select_simple_aggregate_and_nested_groupby_column() {
quick_test(
"SELECT age + 1, MAX(first_name) FROM person GROUP BY age",
- "Projection: #person.age Plus Int64(1), #MAX(person.first_name)\
+ "Projection: #person.age + Int64(1), #MAX(person.first_name)\
\n Aggregate: groupBy=[[#person.age]],
aggr=[[MAX(#person.first_name)]]\
\n TableScan: person projection=None",
);
@@ -2708,7 +2708,7 @@ mod tests {
fn select_aggregate_compounded_with_groupby_column() {
quick_test(
"SELECT age + MIN(salary) FROM person GROUP BY age",
- "Projection: #person.age Plus #MIN(person.salary)\
+ "Projection: #person.age + #MIN(person.salary)\
\n Aggregate: groupBy=[[#person.age]],
aggr=[[MIN(#person.salary)]]\
\n TableScan: person projection=None",
);
@@ -2718,8 +2718,8 @@ mod tests {
fn select_aggregate_with_non_column_inner_expression_with_groupby() {
quick_test(
"SELECT state, MIN(age + 1) FROM person GROUP BY state",
- "Projection: #person.state, #MIN(person.age Plus Int64(1))\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[MIN(#person.age
Plus Int64(1))]]\
+ "Projection: #person.state, #MIN(person.age + Int64(1))\
+ \n Aggregate: groupBy=[[#person.state]], aggr=[[MIN(#person.age +
Int64(1))]]\
\n TableScan: person projection=None",
);
}
@@ -2771,8 +2771,8 @@ mod tests {
fn select_where_nullif_division() {
let sql = "SELECT c3/(c4+c5) \
FROM aggregate_test_100 WHERE c3/nullif(c4+c5, 0) > 0.1";
- let expected = "Projection: #aggregate_test_100.c3 Divide
#aggregate_test_100.c4 Plus #aggregate_test_100.c5\
- \n Filter: #aggregate_test_100.c3 Divide
nullif(#aggregate_test_100.c4 Plus #aggregate_test_100.c5, Int64(0)) Gt
Float64(0.1)\
+ let expected = "Projection: #aggregate_test_100.c3 /
#aggregate_test_100.c4 + #aggregate_test_100.c5\
+ \n Filter: #aggregate_test_100.c3 / nullif(#aggregate_test_100.c4
+ #aggregate_test_100.c5, Int64(0)) > Float64(0.1)\
\n TableScan: aggregate_test_100 projection=None";
quick_test(sql, expected);
}
@@ -2781,7 +2781,7 @@ mod tests {
fn select_where_with_negative_operator() {
let sql = "SELECT c3 FROM aggregate_test_100 WHERE c3 > -0.1 AND -c4 >
0";
let expected = "Projection: #aggregate_test_100.c3\
- \n Filter: #aggregate_test_100.c3 Gt Float64(-0.1) And (-
#aggregate_test_100.c4) Gt Int64(0)\
+ \n Filter: #aggregate_test_100.c3 > Float64(-0.1) AND (-
#aggregate_test_100.c4) > Int64(0)\
\n TableScan: aggregate_test_100 projection=None";
quick_test(sql, expected);
}
@@ -2790,7 +2790,7 @@ mod tests {
fn select_where_with_positive_operator() {
let sql = "SELECT c3 FROM aggregate_test_100 WHERE c3 > +0.1 AND +c4 >
0";
let expected = "Projection: #aggregate_test_100.c3\
- \n Filter: #aggregate_test_100.c3 Gt Float64(0.1) And
#aggregate_test_100.c4 Gt Int64(0)\
+ \n Filter: #aggregate_test_100.c3 > Float64(0.1) AND
#aggregate_test_100.c4 > Int64(0)\
\n TableScan: aggregate_test_100 projection=None";
quick_test(sql, expected);
}
@@ -2945,7 +2945,7 @@ mod tests {
JOIN orders \
ON id = customer_id AND order_id > 1 ";
let expected = "Projection: #person.id, #orders.order_id\
- \n Filter: #orders.order_id Gt Int64(1)\
+ \n Filter: #orders.order_id > Int64(1)\
\n Join: #person.id = #orders.customer_id\
\n TableScan: person projection=None\
\n TableScan: orders projection=None";
@@ -2961,7 +2961,7 @@ mod tests {
let expected = "Projection: #person.id, #orders.order_id\
\n Join: #person.id = #orders.customer_id\
\n TableScan: person projection=None\
- \n Filter: #orders.order_id Gt Int64(1)\
+ \n Filter: #orders.order_id > Int64(1)\
\n TableScan: orders projection=None";
quick_test(sql, expected);
}
@@ -2974,7 +2974,7 @@ mod tests {
ON id = customer_id AND id > 1";
let expected = "Projection: #person.id, #orders.order_id\
\n Join: #person.id = #orders.customer_id\
- \n Filter: #person.id Gt Int64(1)\
+ \n Filter: #person.id > Int64(1)\
\n TableScan: person projection=None\
\n TableScan: orders projection=None";
quick_test(sql, expected);
@@ -3041,7 +3041,7 @@ mod tests {
FROM orders \
WHERE delivered = false OR delivered = true";
let expected = "Projection: #orders.order_id\
- \n Filter: #orders.delivered Eq Boolean(false) Or
#orders.delivered Eq Boolean(true)\
+ \n Filter: #orders.delivered = Boolean(false) OR
#orders.delivered = Boolean(true)\
\n TableScan: orders projection=None";
quick_test(sql, expected);
}
@@ -3130,8 +3130,8 @@ mod tests {
fn empty_over_plus() {
let sql = "SELECT order_id, MAX(qty * 1.1) OVER () from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty Multiply Float64(1.1))\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty Multiply Float64(1.1))]]\
+ Projection: #orders.order_id, #MAX(orders.qty * Float64(1.1))\
+ \n WindowAggr: windowExpr=[[MAX(#orders.qty * Float64(1.1))]]\
\n TableScan: orders projection=None";
quick_test(sql, expected);
}
@@ -3270,9 +3270,9 @@ mod tests {
fn over_order_by_two_sort_keys() {
let sql = "SELECT order_id, MAX(qty) OVER (ORDER BY order_id),
MIN(qty) OVER (ORDER BY (order_id + 1)) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) ORDER BY
[#orders.order_id ASC NULLS FIRST], #MIN(orders.qty) ORDER BY [#orders.order_id
Plus Int64(1) ASC NULLS FIRST]\
+ Projection: #orders.order_id, #MAX(orders.qty) ORDER BY
[#orders.order_id ASC NULLS FIRST], #MIN(orders.qty) ORDER BY [#orders.order_id
+ Int64(1) ASC NULLS FIRST]\
\n WindowAggr: windowExpr=[[MAX(#orders.qty) ORDER BY
[#orders.order_id ASC NULLS FIRST]]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY
[#orders.order_id Plus Int64(1) ASC NULLS FIRST]]]\
+ \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY
[#orders.order_id + Int64(1) ASC NULLS FIRST]]]\
\n TableScan: orders projection=None";
quick_test(sql, expected);
}
diff --git a/datafusion/tests/sql.rs b/datafusion/tests/sql.rs
index a67c82b..55f719b 100644
--- a/datafusion/tests/sql.rs
+++ b/datafusion/tests/sql.rs
@@ -1867,7 +1867,7 @@ async fn equijoin_and_unsupported_condition() ->
Result<()> {
let res = ctx.create_logical_plan(sql);
assert!(res.is_err());
- assert_eq!(format!("{}", res.unwrap_err()), "This feature is not
implemented: Unsupported expressions in Left JOIN: [#t1_id GtEq Utf8(\"44\")]");
+ assert_eq!(format!("{}", res.unwrap_err()), "This feature is not
implemented: Unsupported expressions in Left JOIN: [#t1_id >= Utf8(\"44\")]");
Ok(())
}
@@ -2271,7 +2271,7 @@ async fn csv_explain() {
vec![
"logical_plan",
"Projection: #aggregate_test_100.c1\
- \n Filter: #aggregate_test_100.c2 Gt Int64(10)\
+ \n Filter: #aggregate_test_100.c2 > Int64(10)\
\n TableScan: aggregate_test_100 projection=Some([0, 1])"
],
vec!["physical_plan",
@@ -2507,7 +2507,7 @@ async fn csv_explain_plans() {
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
" Projection: #aggregate_test_100.c1 [c1:Utf8]",
- " Filter: #aggregate_test_100.c2 Gt Int64(10) [c1:Utf8, c2:Int32,
c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:Int64, c10:Utf8,
c11:Float32, c12:Float64, c13:Utf8]",
+ " Filter: #aggregate_test_100.c2 > Int64(10) [c1:Utf8, c2:Int32,
c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:Int64, c10:Utf8,
c11:Float32, c12:Float64, c13:Utf8]",
" TableScan: aggregate_test_100 projection=None [c1:Utf8,
c2:Int32, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:Int64,
c10:Utf8, c11:Float32, c12:Float64, c13:Utf8]",
];
let formatted = plan.display_indent_schema().to_string();
@@ -2522,7 +2522,7 @@ async fn csv_explain_plans() {
let expected = vec![
"Explain",
" Projection: #aggregate_test_100.c1",
- " Filter: #aggregate_test_100.c2 Gt Int64(10)",
+ " Filter: #aggregate_test_100.c2 > Int64(10)",
" TableScan: aggregate_test_100 projection=None",
];
let formatted = plan.display_indent().to_string();
@@ -2543,7 +2543,7 @@ async fn csv_explain_plans() {
" 2[shape=box label=\"Explain\"]",
" 3[shape=box label=\"Projection: #aggregate_test_100.c1\"]",
" 2 -> 3 [arrowhead=none, arrowtail=normal, dir=back]",
- " 4[shape=box label=\"Filter: #aggregate_test_100.c2 Gt
Int64(10)\"]",
+ " 4[shape=box label=\"Filter: #aggregate_test_100.c2 >
Int64(10)\"]",
" 3 -> 4 [arrowhead=none, arrowtail=normal, dir=back]",
" 5[shape=box label=\"TableScan: aggregate_test_100
projection=None\"]",
" 4 -> 5 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -2554,7 +2554,7 @@ async fn csv_explain_plans() {
" 7[shape=box label=\"Explain\\nSchema: [plan_type:Utf8,
plan:Utf8]\"]",
" 8[shape=box label=\"Projection: #aggregate_test_100.c1\\nSchema:
[c1:Utf8]\"]",
" 7 -> 8 [arrowhead=none, arrowtail=normal, dir=back]",
- " 9[shape=box label=\"Filter: #aggregate_test_100.c2 Gt
Int64(10)\\nSchema: [c1:Utf8, c2:Int32, c3:Int16, c4:Int16, c5:Int32, c6:Int64,
c7:Int16, c8:Int32, c9:Int64, c10:Utf8, c11:Float32, c12:Float64, c13:Utf8]\"]",
+ " 9[shape=box label=\"Filter: #aggregate_test_100.c2 >
Int64(10)\\nSchema: [c1:Utf8, c2:Int32, c3:Int16, c4:Int16, c5:Int32, c6:Int64,
c7:Int16, c8:Int32, c9:Int64, c10:Utf8, c11:Float32, c12:Float64, c13:Utf8]\"]",
" 8 -> 9 [arrowhead=none, arrowtail=normal, dir=back]",
" 10[shape=box label=\"TableScan: aggregate_test_100
projection=None\\nSchema: [c1:Utf8, c2:Int32, c3:Int16, c4:Int16, c5:Int32,
c6:Int64, c7:Int16, c8:Int32, c9:Int64, c10:Utf8, c11:Float32, c12:Float64,
c13:Utf8]\"]",
" 9 -> 10 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -2582,7 +2582,7 @@ async fn csv_explain_plans() {
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
" Projection: #aggregate_test_100.c1 [c1:Utf8]",
- " Filter: #aggregate_test_100.c2 Gt Int64(10) [c1:Utf8, c2:Int32]",
+ " Filter: #aggregate_test_100.c2 > Int64(10) [c1:Utf8, c2:Int32]",
" TableScan: aggregate_test_100 projection=Some([0, 1]) [c1:Utf8,
c2:Int32]",
];
let formatted = plan.display_indent_schema().to_string();
@@ -2597,7 +2597,7 @@ async fn csv_explain_plans() {
let expected = vec![
"Explain",
" Projection: #aggregate_test_100.c1",
- " Filter: #aggregate_test_100.c2 Gt Int64(10)",
+ " Filter: #aggregate_test_100.c2 > Int64(10)",
" TableScan: aggregate_test_100 projection=Some([0, 1])",
];
let formatted = plan.display_indent().to_string();
@@ -2618,7 +2618,7 @@ async fn csv_explain_plans() {
" 2[shape=box label=\"Explain\"]",
" 3[shape=box label=\"Projection: #aggregate_test_100.c1\"]",
" 2 -> 3 [arrowhead=none, arrowtail=normal, dir=back]",
- " 4[shape=box label=\"Filter: #aggregate_test_100.c2 Gt
Int64(10)\"]",
+ " 4[shape=box label=\"Filter: #aggregate_test_100.c2 >
Int64(10)\"]",
" 3 -> 4 [arrowhead=none, arrowtail=normal, dir=back]",
" 5[shape=box label=\"TableScan: aggregate_test_100
projection=Some([0, 1])\"]",
" 4 -> 5 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -2629,7 +2629,7 @@ async fn csv_explain_plans() {
" 7[shape=box label=\"Explain\\nSchema: [plan_type:Utf8,
plan:Utf8]\"]",
" 8[shape=box label=\"Projection: #aggregate_test_100.c1\\nSchema:
[c1:Utf8]\"]",
" 7 -> 8 [arrowhead=none, arrowtail=normal, dir=back]",
- " 9[shape=box label=\"Filter: #aggregate_test_100.c2 Gt
Int64(10)\\nSchema: [c1:Utf8, c2:Int32]\"]",
+ " 9[shape=box label=\"Filter: #aggregate_test_100.c2 >
Int64(10)\\nSchema: [c1:Utf8, c2:Int32]\"]",
" 8 -> 9 [arrowhead=none, arrowtail=normal, dir=back]",
" 10[shape=box label=\"TableScan: aggregate_test_100
projection=Some([0, 1])\\nSchema: [c1:Utf8, c2:Int32]\"]",
" 9 -> 10 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -2659,7 +2659,7 @@ async fn csv_explain_plans() {
// Since the plan contains path that are environmentally dependant (e.g.
full path of the test file), only verify important content
assert_contains!(&actual, "logical_plan");
assert_contains!(&actual, "Projection: #aggregate_test_100.c1");
- assert_contains!(actual, "Filter: #aggregate_test_100.c2 Gt Int64(10)");
+ assert_contains!(actual, "Filter: #aggregate_test_100.c2 > Int64(10)");
}
#[tokio::test]
@@ -2677,7 +2677,7 @@ async fn csv_explain_verbose() {
// pain). Instead just check for a few key pieces.
assert_contains!(&actual, "logical_plan");
assert_contains!(&actual, "physical_plan");
- assert_contains!(&actual, "#aggregate_test_100.c2 Gt Int64(10)");
+ assert_contains!(&actual, "#aggregate_test_100.c2 > Int64(10)");
// ensure the "same text as above" optimization is working
assert_contains!(actual, "SAME TEXT AS ABOVE");
@@ -2704,7 +2704,7 @@ async fn csv_explain_verbose_plans() {
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
" Projection: #aggregate_test_100.c1 [c1:Utf8]",
- " Filter: #aggregate_test_100.c2 Gt Int64(10) [c1:Utf8, c2:Int32,
c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:Int64, c10:Utf8,
c11:Float32, c12:Float64, c13:Utf8]",
+ " Filter: #aggregate_test_100.c2 > Int64(10) [c1:Utf8, c2:Int32,
c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:Int64, c10:Utf8,
c11:Float32, c12:Float64, c13:Utf8]",
" TableScan: aggregate_test_100 projection=None [c1:Utf8,
c2:Int32, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:Int64,
c10:Utf8, c11:Float32, c12:Float64, c13:Utf8]",
];
let formatted = plan.display_indent_schema().to_string();
@@ -2719,7 +2719,7 @@ async fn csv_explain_verbose_plans() {
let expected = vec![
"Explain",
" Projection: #aggregate_test_100.c1",
- " Filter: #aggregate_test_100.c2 Gt Int64(10)",
+ " Filter: #aggregate_test_100.c2 > Int64(10)",
" TableScan: aggregate_test_100 projection=None",
];
let formatted = plan.display_indent().to_string();
@@ -2740,7 +2740,7 @@ async fn csv_explain_verbose_plans() {
" 2[shape=box label=\"Explain\"]",
" 3[shape=box label=\"Projection: #aggregate_test_100.c1\"]",
" 2 -> 3 [arrowhead=none, arrowtail=normal, dir=back]",
- " 4[shape=box label=\"Filter: #aggregate_test_100.c2 Gt
Int64(10)\"]",
+ " 4[shape=box label=\"Filter: #aggregate_test_100.c2 >
Int64(10)\"]",
" 3 -> 4 [arrowhead=none, arrowtail=normal, dir=back]",
" 5[shape=box label=\"TableScan: aggregate_test_100
projection=None\"]",
" 4 -> 5 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -2751,7 +2751,7 @@ async fn csv_explain_verbose_plans() {
" 7[shape=box label=\"Explain\\nSchema: [plan_type:Utf8,
plan:Utf8]\"]",
" 8[shape=box label=\"Projection: #aggregate_test_100.c1\\nSchema:
[c1:Utf8]\"]",
" 7 -> 8 [arrowhead=none, arrowtail=normal, dir=back]",
- " 9[shape=box label=\"Filter: #aggregate_test_100.c2 Gt
Int64(10)\\nSchema: [c1:Utf8, c2:Int32, c3:Int16, c4:Int16, c5:Int32, c6:Int64,
c7:Int16, c8:Int32, c9:Int64, c10:Utf8, c11:Float32, c12:Float64, c13:Utf8]\"]",
+ " 9[shape=box label=\"Filter: #aggregate_test_100.c2 >
Int64(10)\\nSchema: [c1:Utf8, c2:Int32, c3:Int16, c4:Int16, c5:Int32, c6:Int64,
c7:Int16, c8:Int32, c9:Int64, c10:Utf8, c11:Float32, c12:Float64, c13:Utf8]\"]",
" 8 -> 9 [arrowhead=none, arrowtail=normal, dir=back]",
" 10[shape=box label=\"TableScan: aggregate_test_100
projection=None\\nSchema: [c1:Utf8, c2:Int32, c3:Int16, c4:Int16, c5:Int32,
c6:Int64, c7:Int16, c8:Int32, c9:Int64, c10:Utf8, c11:Float32, c12:Float64,
c13:Utf8]\"]",
" 9 -> 10 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -2779,7 +2779,7 @@ async fn csv_explain_verbose_plans() {
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
" Projection: #aggregate_test_100.c1 [c1:Utf8]",
- " Filter: #aggregate_test_100.c2 Gt Int64(10) [c1:Utf8, c2:Int32]",
+ " Filter: #aggregate_test_100.c2 > Int64(10) [c1:Utf8, c2:Int32]",
" TableScan: aggregate_test_100 projection=Some([0, 1]) [c1:Utf8,
c2:Int32]",
];
let formatted = plan.display_indent_schema().to_string();
@@ -2794,7 +2794,7 @@ async fn csv_explain_verbose_plans() {
let expected = vec![
"Explain",
" Projection: #aggregate_test_100.c1",
- " Filter: #aggregate_test_100.c2 Gt Int64(10)",
+ " Filter: #aggregate_test_100.c2 > Int64(10)",
" TableScan: aggregate_test_100 projection=Some([0, 1])",
];
let formatted = plan.display_indent().to_string();
@@ -2815,7 +2815,7 @@ async fn csv_explain_verbose_plans() {
" 2[shape=box label=\"Explain\"]",
" 3[shape=box label=\"Projection: #aggregate_test_100.c1\"]",
" 2 -> 3 [arrowhead=none, arrowtail=normal, dir=back]",
- " 4[shape=box label=\"Filter: #aggregate_test_100.c2 Gt
Int64(10)\"]",
+ " 4[shape=box label=\"Filter: #aggregate_test_100.c2 >
Int64(10)\"]",
" 3 -> 4 [arrowhead=none, arrowtail=normal, dir=back]",
" 5[shape=box label=\"TableScan: aggregate_test_100
projection=Some([0, 1])\"]",
" 4 -> 5 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -2826,7 +2826,7 @@ async fn csv_explain_verbose_plans() {
" 7[shape=box label=\"Explain\\nSchema: [plan_type:Utf8,
plan:Utf8]\"]",
" 8[shape=box label=\"Projection: #aggregate_test_100.c1\\nSchema:
[c1:Utf8]\"]",
" 7 -> 8 [arrowhead=none, arrowtail=normal, dir=back]",
- " 9[shape=box label=\"Filter: #aggregate_test_100.c2 Gt
Int64(10)\\nSchema: [c1:Utf8, c2:Int32]\"]",
+ " 9[shape=box label=\"Filter: #aggregate_test_100.c2 >
Int64(10)\\nSchema: [c1:Utf8, c2:Int32]\"]",
" 8 -> 9 [arrowhead=none, arrowtail=normal, dir=back]",
" 10[shape=box label=\"TableScan: aggregate_test_100
projection=Some([0, 1])\\nSchema: [c1:Utf8, c2:Int32]\"]",
" 9 -> 10 [arrowhead=none, arrowtail=normal, dir=back]",