Skip to content

Apache DataFusion SQL Query Engine

Make column name consistent between Expr::name and Display/Debug (#3712)

Andy Groved72eb9a1c4c1
diff --git a/datafusion/common/src/column.rs b/datafusion/common/src/column.rs
index 37fe172e33..2c196b10b5 100644
--- a/datafusion/common/src/column.rs
+++ b/datafusion/common/src/column.rs
@@ -148,9 +148,6 @@ impl FromStr for Column {
impl fmt::Display for Column {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match &self.relation {
- Some(r) => write!(f, "#{}.{}", r, self.name),
- None => write!(f, "#{}", self.name),
- }
+ write!(f, "{}", self.flat_name())
}
}
diff --git a/datafusion/core/src/dataframe.rs b/datafusion/core/src/dataframe.rs
index e683455b30..8adfaf9856 100644
--- a/datafusion/core/src/dataframe.rs
+++ b/datafusion/core/src/dataframe.rs
@@ -1284,20 +1284,20 @@ mod tests {
let df_renamed = df.with_column_renamed("t1.c1", "AAA")?;
assert_eq!("\
- Projection: #t1.c1 AS AAA, #t1.c2, #t1.c3, #t2.c1, #t2.c2, #t2.c3\
+ Projection: t1.c1 AS AAA, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3\
\n Limit: skip=0, fetch=1\
- \n Sort: #t1.c1 ASC NULLS FIRST, #t1.c2 ASC NULLS FIRST, #t1.c3 ASC NULLS FIRST, #t2.c1 ASC NULLS FIRST, #t2.c2 ASC NULLS FIRST, #t2.c3 ASC NULLS FIRST\
- \n Inner Join: #t1.c1 = #t2.c1\
+ \n Sort: t1.c1 ASC NULLS FIRST, t1.c2 ASC NULLS FIRST, t1.c3 ASC NULLS FIRST, t2.c1 ASC NULLS FIRST, t2.c2 ASC NULLS FIRST, t2.c3 ASC NULLS FIRST\
+ \n Inner Join: t1.c1 = t2.c1\
\n TableScan: t1\
\n TableScan: t2",
format!("{:?}", df_renamed.to_unoptimized_plan())
);
assert_eq!("\
- Projection: #t1.c1 AS AAA, #t1.c2, #t1.c3, #t2.c1, #t2.c2, #t2.c3\
+ Projection: t1.c1 AS AAA, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3\
\n Limit: skip=0, fetch=1\
- \n Sort: #t1.c1 ASC NULLS FIRST, #t1.c2 ASC NULLS FIRST, #t1.c3 ASC NULLS FIRST, #t2.c1 ASC NULLS FIRST, #t2.c2 ASC NULLS FIRST, #t2.c3 ASC NULLS FIRST, fetch=1\
- \n Inner Join: #t1.c1 = #t2.c1\
+ \n Sort: t1.c1 ASC NULLS FIRST, t1.c2 ASC NULLS FIRST, t1.c3 ASC NULLS FIRST, t2.c1 ASC NULLS FIRST, t2.c2 ASC NULLS FIRST, t2.c3 ASC NULLS FIRST, fetch=1\
+ \n Inner Join: t1.c1 = t2.c1\
\n TableScan: t1 projection=[c1, c2, c3]\
\n TableScan: t2 projection=[c1, c2, c3]",
format!("{:?}", df_renamed.to_logical_plan()?)
diff --git a/datafusion/core/src/datasource/view.rs b/datafusion/core/src/datasource/view.rs
index ef7e12aa2b..534359b837 100644
--- a/datafusion/core/src/datasource/view.rs
+++ b/datafusion/core/src/datasource/view.rs
@@ -409,7 +409,7 @@ mod tests {
"| plan_type | plan |",
"+---------------+-----------------------------------------------------------+",
"| logical_plan | CreateView: \"xyz\" |",
- "| | Projection: #abc.column1, #abc.column2, #abc.column3 |",
+ "| | Projection: abc.column1, abc.column2, abc.column3 |",
"| | TableScan: abc projection=[column1, column2, column3] |",
"| physical_plan | EmptyExec: produce_one_row=false |",
"| | |",
@@ -429,8 +429,8 @@ mod tests {
"| plan_type | plan |",
"+---------------+-------------------------------------------------------------+",
"| logical_plan | CreateView: \"xyz\" |",
- "| | Projection: #abc.column1, #abc.column2, #abc.column3 |",
- "| | Filter: #abc.column2 = Int64(5) |",
+ "| | Projection: abc.column1, abc.column2, abc.column3 |",
+ "| | Filter: abc.column2 = Int64(5) |",
"| | TableScan: abc projection=[column1, column2, column3] |",
"| physical_plan | EmptyExec: produce_one_row=false |",
"| | |",
@@ -450,8 +450,8 @@ mod tests {
"| plan_type | plan |",
"+---------------+----------------------------------------------------+",
"| logical_plan | CreateView: \"xyz\" |",
- "| | Projection: #abc.column1, #abc.column2 |",
- "| | Filter: #abc.column2 = Int64(5) |",
+ "| | Projection: abc.column1, abc.column2 |",
+ "| | Filter: abc.column2 = Int64(5) |",
"| | TableScan: abc projection=[column1, column2] |",
"| physical_plan | EmptyExec: produce_one_row=false |",
"| | |",
diff --git a/datafusion/core/src/physical_optimizer/pruning.rs b/datafusion/core/src/physical_optimizer/pruning.rs
index 9c53e0a6a2..107bbed461 100644
--- a/datafusion/core/src/physical_optimizer/pruning.rs
+++ b/datafusion/core/src/physical_optimizer/pruning.rs
@@ -1254,7 +1254,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 <= Int32(1) AND Int32(1) <= #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));
@@ -1274,7 +1274,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 != Int32(1) OR Int32(1) != #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));
@@ -1294,7 +1294,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 > Int32(1)";
+ let expected_expr = "c1_max > Int32(1)";
// test column on the left
let expr = col("c1").gt(lit(1));
@@ -1314,7 +1314,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 >= Int32(1)";
+ let expected_expr = "c1_max >= Int32(1)";
// test column on the left
let expr = col("c1").gt_eq(lit(1));
@@ -1333,7 +1333,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 < Int32(1)";
+ let expected_expr = "c1_min < Int32(1)";
// test column on the left
let expr = col("c1").lt(lit(1));
@@ -1353,7 +1353,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 <= Int32(1)";
+ let expected_expr = "c1_min <= Int32(1)";
// test column on the left
let expr = col("c1").lt_eq(lit(1));
@@ -1378,7 +1378,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 < 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);
@@ -1394,7 +1394,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 < 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);
@@ -1418,7 +1418,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 =
@@ -1431,7 +1431,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 =
@@ -1444,7 +1444,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 < Boolean(true)";
+ let expected_expr = "c1_min < Boolean(true)";
// DF doesn't support arithmetic on boolean columns so
// this predicate will error when evaluated
@@ -1467,7 +1467,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 < Int32(1) AND #c2_min <= Int32(2) AND Int32(2) <= #c2_max OR #c2_min <= Int32(3) AND Int32(3) <= #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);
@@ -1506,7 +1506,7 @@ mod tests {
list: vec![lit(1), lit(2), lit(3)],
negated: false,
};
- let expected_expr = "#c1_min <= Int32(1) AND Int32(1) <= #c1_max OR #c1_min <= Int32(2) AND Int32(2) <= #c1_max OR #c1_min <= Int32(3) AND Int32(3) <= #c1_max";
+ let expected_expr = "c1_min <= Int32(1) AND Int32(1) <= c1_max OR c1_min <= Int32(2) AND Int32(2) <= c1_max OR c1_min <= Int32(3) AND Int32(3) <= c1_max";
let predicate_expr =
build_predicate_expression(&expr, &schema, &mut RequiredStatColumns::new())?;
assert_eq!(format!("{:?}", predicate_expr), expected_expr);
@@ -1546,7 +1546,7 @@ mod tests {
list: vec![lit(1), lit(2), lit(3)],
negated: true,
};
- let expected_expr = "#c1_min != Int32(1) OR Int32(1) != #c1_max AND #c1_min != Int32(2) OR Int32(2) != #c1_max AND #c1_min != Int32(3) OR Int32(3) != #c1_max";
+ let expected_expr = "c1_min != Int32(1) OR Int32(1) != c1_max AND c1_min != Int32(2) OR Int32(2) != c1_max AND c1_min != Int32(3) OR Int32(3) != c1_max";
let predicate_expr =
build_predicate_expression(&expr, &schema, &mut RequiredStatColumns::new())?;
assert_eq!(format!("{:?}", predicate_expr), expected_expr);
@@ -1558,7 +1558,7 @@ mod tests {
fn row_group_predicate_cast() -> Result<()> {
let schema = Schema::new(vec![Field::new("c1", DataType::Int32, false)]);
let expected_expr =
- "CAST(#c1_min AS Int64) <= Int64(1) AND Int64(1) <= CAST(#c1_max AS Int64)";
+ "CAST(c1_min AS Int64) <= Int64(1) AND Int64(1) <= CAST(c1_max AS Int64)";
// test column on the left
let expr = cast(col("c1"), DataType::Int64).eq(lit(ScalarValue::Int64(Some(1))));
@@ -1572,7 +1572,7 @@ mod tests {
build_predicate_expression(&expr, &schema, &mut RequiredStatColumns::new())?;
assert_eq!(format!("{:?}", predicate_expr), expected_expr);
- let expected_expr = "TRY_CAST(#c1_max AS Int64) > Int64(1)";
+ let expected_expr = "TRY_CAST(c1_max AS Int64) > Int64(1)";
// test column on the left
let expr =
@@ -1604,7 +1604,7 @@ mod tests {
],
negated: false,
};
- let expected_expr = "CAST(#c1_min AS Int64) <= Int64(1) AND Int64(1) <= CAST(#c1_max AS Int64) OR CAST(#c1_min AS Int64) <= Int64(2) AND Int64(2) <= CAST(#c1_max AS Int64) OR CAST(#c1_min AS Int64) <= Int64(3) AND Int64(3) <= CAST(#c1_max AS Int64)";
+ let expected_expr = "CAST(c1_min AS Int64) <= Int64(1) AND Int64(1) <= CAST(c1_max AS Int64) OR CAST(c1_min AS Int64) <= Int64(2) AND Int64(2) <= CAST(c1_max AS Int64) OR CAST(c1_min AS Int64) <= Int64(3) AND Int64(3) <= CAST(c1_max AS Int64)";
let predicate_expr =
build_predicate_expression(&expr, &schema, &mut RequiredStatColumns::new())?;
assert_eq!(format!("{:?}", predicate_expr), expected_expr);
@@ -1618,7 +1618,7 @@ mod tests {
],
negated: true,
};
- let expected_expr = "CAST(#c1_min AS Int64) != Int64(1) OR Int64(1) != CAST(#c1_max AS Int64) AND CAST(#c1_min AS Int64) != Int64(2) OR Int64(2) != CAST(#c1_max AS Int64) AND CAST(#c1_min AS Int64) != Int64(3) OR Int64(3) != CAST(#c1_max AS Int64)";
+ let expected_expr = "CAST(c1_min AS Int64) != Int64(1) OR Int64(1) != CAST(c1_max AS Int64) AND CAST(c1_min AS Int64) != Int64(2) OR Int64(2) != CAST(c1_max AS Int64) AND CAST(c1_min AS Int64) != Int64(3) OR Int64(3) != CAST(c1_max AS Int64)";
let predicate_expr =
build_predicate_expression(&expr, &schema, &mut RequiredStatColumns::new())?;
assert_eq!(format!("{:?}", predicate_expr), expected_expr);
diff --git a/datafusion/core/src/physical_plan/mod.rs b/datafusion/core/src/physical_plan/mod.rs
index 4613be7cdc..259a119925 100644
--- a/datafusion/core/src/physical_plan/mod.rs
+++ b/datafusion/core/src/physical_plan/mod.rs
@@ -360,7 +360,7 @@ pub fn accept<V: ExecutionPlanVisitor>(
/// For example, for an execution plan that looks like:
///
/// ```text
-/// ProjectionExec: #id
+/// ProjectionExec: id
/// FilterExec: state = CO
/// CsvExec:
/// ```
diff --git a/datafusion/core/tests/custom_sources.rs b/datafusion/core/tests/custom_sources.rs
index 88131313bc..c8fbc76662 100644
--- a/datafusion/core/tests/custom_sources.rs
+++ b/datafusion/core/tests/custom_sources.rs
@@ -238,7 +238,7 @@ async fn custom_source_dataframe() -> Result<()> {
}
let expected = format!(
- "Projection: #{}.c2\
+ "Projection: {}.c2\
\n TableScan: {} projection=[c2]",
UNNAMED_TABLE, UNNAMED_TABLE
);
diff --git a/datafusion/core/tests/sql/avro.rs b/datafusion/core/tests/sql/avro.rs
index 8fdef28bd3..c57fc820f0 100644
--- a/datafusion/core/tests/sql/avro.rs
+++ b/datafusion/core/tests/sql/avro.rs
@@ -143,7 +143,7 @@ async fn avro_explain() {
let expected = vec![
vec![
"logical_plan",
- "Projection: #COUNT(UInt8(1))\
+ "Projection: COUNT(UInt8(1))\
\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
\n TableScan: alltypes_plain projection=[id]",
],
diff --git a/datafusion/core/tests/sql/explain_analyze.rs b/datafusion/core/tests/sql/explain_analyze.rs
index 7d09d94834..ca13d61e98 100644
--- a/datafusion/core/tests/sql/explain_analyze.rs
+++ b/datafusion/core/tests/sql/explain_analyze.rs
@@ -195,8 +195,8 @@ async fn csv_explain_plans() {
// Verify schema
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #aggregate_test_100.c1 [c1:Utf8]",
- " Filter: #aggregate_test_100.c2 > Int64(10) [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]",
+ " Projection: aggregate_test_100.c1 [c1:Utf8]",
+ " Filter: aggregate_test_100.c2 > Int64(10) [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]",
" TableScan: aggregate_test_100 [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]",
];
let formatted = plan.display_indent_schema().to_string();
@@ -210,8 +210,8 @@ async fn csv_explain_plans() {
// Verify the text format of the plan
let expected = vec![
"Explain",
- " Projection: #aggregate_test_100.c1",
- " Filter: #aggregate_test_100.c2 > Int64(10)",
+ " Projection: aggregate_test_100.c1",
+ " Filter: aggregate_test_100.c2 > Int64(10)",
" TableScan: aggregate_test_100",
];
let formatted = plan.display_indent().to_string();
@@ -230,9 +230,9 @@ async fn csv_explain_plans() {
" {",
" graph[label=\"LogicalPlan\"]",
" 2[shape=box label=\"Explain\"]",
- " 3[shape=box label=\"Projection: #aggregate_test_100.c1\"]",
+ " 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 > 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\"]",
" 4 -> 5 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -241,9 +241,9 @@ async fn csv_explain_plans() {
" {",
" graph[label=\"Detailed LogicalPlan\"]",
" 7[shape=box label=\"Explain\\nSchema: [plan_type:Utf8, plan:Utf8]\"]",
- " 8[shape=box label=\"Projection: #aggregate_test_100.c1\\nSchema: [c1: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 > Int64(10)\\nSchema: [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]\"]",
+ " 9[shape=box label=\"Filter: aggregate_test_100.c2 > Int64(10)\\nSchema: [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]\"]",
" 8 -> 9 [arrowhead=none, arrowtail=normal, dir=back]",
" 10[shape=box label=\"TableScan: aggregate_test_100\\nSchema: [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]\"]",
" 9 -> 10 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -270,9 +270,9 @@ async fn csv_explain_plans() {
// Verify schema
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #aggregate_test_100.c1 [c1:Utf8]",
- " Filter: #aggregate_test_100.c2 > Int8(10) [c1:Utf8, c2:Int8]",
- " TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[#aggregate_test_100.c2 > Int8(10)] [c1:Utf8, c2:Int8]",
+ " Projection: aggregate_test_100.c1 [c1:Utf8]",
+ " Filter: aggregate_test_100.c2 > Int8(10) [c1:Utf8, c2:Int8]",
+ " TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)] [c1:Utf8, c2:Int8]",
];
let formatted = plan.display_indent_schema().to_string();
let actual: Vec<&str> = formatted.trim().lines().collect();
@@ -285,9 +285,9 @@ async fn csv_explain_plans() {
// Verify the text format of the plan
let expected = vec![
"Explain",
- " Projection: #aggregate_test_100.c1",
- " Filter: #aggregate_test_100.c2 > Int8(10)",
- " TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[#aggregate_test_100.c2 > Int8(10)]",
+ " Projection: aggregate_test_100.c1",
+ " Filter: aggregate_test_100.c2 > Int8(10)",
+ " TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)]",
];
let formatted = plan.display_indent().to_string();
let actual: Vec<&str> = formatted.trim().lines().collect();
@@ -305,22 +305,22 @@ async fn csv_explain_plans() {
" {",
" graph[label=\"LogicalPlan\"]",
" 2[shape=box label=\"Explain\"]",
- " 3[shape=box label=\"Projection: #aggregate_test_100.c1\"]",
+ " 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 > Int8(10)\"]",
+ " 4[shape=box label=\"Filter: aggregate_test_100.c2 > Int8(10)\"]",
" 3 -> 4 [arrowhead=none, arrowtail=normal, dir=back]",
- " 5[shape=box label=\"TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[#aggregate_test_100.c2 > Int8(10)]\"]",
+ " 5[shape=box label=\"TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)]\"]",
" 4 -> 5 [arrowhead=none, arrowtail=normal, dir=back]",
" }",
" subgraph cluster_6",
" {",
" graph[label=\"Detailed LogicalPlan\"]",
" 7[shape=box label=\"Explain\\nSchema: [plan_type:Utf8, plan:Utf8]\"]",
- " 8[shape=box label=\"Projection: #aggregate_test_100.c1\\nSchema: [c1: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 > Int8(10)\\nSchema: [c1:Utf8, c2:Int8]\"]",
+ " 9[shape=box label=\"Filter: aggregate_test_100.c2 > Int8(10)\\nSchema: [c1:Utf8, c2:Int8]\"]",
" 8 -> 9 [arrowhead=none, arrowtail=normal, dir=back]",
- " 10[shape=box label=\"TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[#aggregate_test_100.c2 > Int8(10)]\\nSchema: [c1:Utf8, c2:Int8]\"]",
+ " 10[shape=box label=\"TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)]\\nSchema: [c1:Utf8, c2:Int8]\"]",
" 9 -> 10 [arrowhead=none, arrowtail=normal, dir=back]",
" }",
"}",
@@ -348,8 +348,8 @@ async fn csv_explain_plans() {
let actual = actual.into_iter().map(|r| r.join("\t")).collect::<String>();
// 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 > Int8(10)");
+ assert_contains!(&actual, "Projection: aggregate_test_100.c1");
+ assert_contains!(actual, "Filter: aggregate_test_100.c2 > Int8(10)");
}
#[tokio::test]
@@ -367,7 +367,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 > 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");
@@ -390,12 +390,12 @@ async fn csv_explain_inlist_verbose() {
// before optimization (Int64 literals)
assert_contains!(
&actual,
- "#aggregate_test_100.c2 IN ([Int64(1), Int64(2), Int64(4)])"
+ "aggregate_test_100.c2 IN ([Int64(1), Int64(2), Int64(4)])"
);
// after optimization (casted to Int8)
assert_contains!(
&actual,
- "#aggregate_test_100.c2 IN ([Int8(1), Int8(2), Int8(4)])"
+ "aggregate_test_100.c2 IN ([Int8(1), Int8(2), Int8(4)])"
);
}
@@ -419,8 +419,8 @@ async fn csv_explain_verbose_plans() {
// Verify schema
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #aggregate_test_100.c1 [c1:Utf8]",
- " Filter: #aggregate_test_100.c2 > Int64(10) [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]",
+ " Projection: aggregate_test_100.c1 [c1:Utf8]",
+ " Filter: aggregate_test_100.c2 > Int64(10) [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]",
" TableScan: aggregate_test_100 [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]",
];
let formatted = plan.display_indent_schema().to_string();
@@ -434,8 +434,8 @@ async fn csv_explain_verbose_plans() {
// Verify the text format of the plan
let expected = vec![
"Explain",
- " Projection: #aggregate_test_100.c1",
- " Filter: #aggregate_test_100.c2 > Int64(10)",
+ " Projection: aggregate_test_100.c1",
+ " Filter: aggregate_test_100.c2 > Int64(10)",
" TableScan: aggregate_test_100",
];
let formatted = plan.display_indent().to_string();
@@ -454,9 +454,9 @@ async fn csv_explain_verbose_plans() {
" {",
" graph[label=\"LogicalPlan\"]",
" 2[shape=box label=\"Explain\"]",
- " 3[shape=box label=\"Projection: #aggregate_test_100.c1\"]",
+ " 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 > 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\"]",
" 4 -> 5 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -465,9 +465,9 @@ async fn csv_explain_verbose_plans() {
" {",
" graph[label=\"Detailed LogicalPlan\"]",
" 7[shape=box label=\"Explain\\nSchema: [plan_type:Utf8, plan:Utf8]\"]",
- " 8[shape=box label=\"Projection: #aggregate_test_100.c1\\nSchema: [c1: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 > Int64(10)\\nSchema: [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]\"]",
+ " 9[shape=box label=\"Filter: aggregate_test_100.c2 > Int64(10)\\nSchema: [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]\"]",
" 8 -> 9 [arrowhead=none, arrowtail=normal, dir=back]",
" 10[shape=box label=\"TableScan: aggregate_test_100\\nSchema: [c1:Utf8, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8]\"]",
" 9 -> 10 [arrowhead=none, arrowtail=normal, dir=back]",
@@ -494,9 +494,9 @@ async fn csv_explain_verbose_plans() {
// Verify schema
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #aggregate_test_100.c1 [c1:Utf8]",
- " Filter: #aggregate_test_100.c2 > Int8(10) [c1:Utf8, c2:Int8]",
- " TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[#aggregate_test_100.c2 > Int8(10)] [c1:Utf8, c2:Int8]",
+ " Projection: aggregate_test_100.c1 [c1:Utf8]",
+ " Filter: aggregate_test_100.c2 > Int8(10) [c1:Utf8, c2:Int8]",
+ " TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)] [c1:Utf8, c2:Int8]",
];
let formatted = plan.display_indent_schema().to_string();
let actual: Vec<&str> = formatted.trim().lines().collect();
@@ -509,9 +509,9 @@ async fn csv_explain_verbose_plans() {
// Verify the text format of the plan
let expected = vec![
"Explain",
- " Projection: #aggregate_test_100.c1",
- " Filter: #aggregate_test_100.c2 > Int8(10)",
- " TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[#aggregate_test_100.c2 > Int8(10)]",
+ " Projection: aggregate_test_100.c1",
+ " Filter: aggregate_test_100.c2 > Int8(10)",
+ " TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)]",
];
let formatted = plan.display_indent().to_string();
let actual: Vec<&str> = formatted.trim().lines().collect();
@@ -529,22 +529,22 @@ async fn csv_explain_verbose_plans() {
" {",
" graph[label=\"LogicalPlan\"]",
" 2[shape=box label=\"Explain\"]",
- " 3[shape=box label=\"Projection: #aggregate_test_100.c1\"]",
+ " 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 > Int8(10)\"]",
+ " 4[shape=box label=\"Filter: aggregate_test_100.c2 > Int8(10)\"]",
" 3 -> 4 [arrowhead=none, arrowtail=normal, dir=back]",
- " 5[shape=box label=\"TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[#aggregate_test_100.c2 > Int8(10)]\"]",
+ " 5[shape=box label=\"TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)]\"]",
" 4 -> 5 [arrowhead=none, arrowtail=normal, dir=back]",
" }",
" subgraph cluster_6",
" {",
" graph[label=\"Detailed LogicalPlan\"]",
" 7[shape=box label=\"Explain\\nSchema: [plan_type:Utf8, plan:Utf8]\"]",
- " 8[shape=box label=\"Projection: #aggregate_test_100.c1\\nSchema: [c1: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 > Int8(10)\\nSchema: [c1:Utf8, c2:Int8]\"]",
+ " 9[shape=box label=\"Filter: aggregate_test_100.c2 > Int8(10)\\nSchema: [c1:Utf8, c2:Int8]\"]",
" 8 -> 9 [arrowhead=none, arrowtail=normal, dir=back]",
- " 10[shape=box label=\"TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[#aggregate_test_100.c2 > Int8(10)]\\nSchema: [c1:Utf8, c2:Int8]\"]",
+ " 10[shape=box label=\"TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)]\\nSchema: [c1:Utf8, c2:Int8]\"]",
" 9 -> 10 [arrowhead=none, arrowtail=normal, dir=back]",
" }",
"}",
@@ -651,17 +651,17 @@ order by
plan = ctx.optimize(&plan.unwrap());
let expected = "\
- Sort: #revenue DESC NULLS FIRST\
- \n Projection: #customer.c_custkey, #customer.c_name, #SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount) AS revenue, #customer.c_acctbal, #nation.n_name, #customer.c_address, #customer.c_phone, #customer.c_comment\
- \n Aggregate: groupBy=[[#customer.c_custkey, #customer.c_name, #customer.c_acctbal, #customer.c_phone, #nation.n_name, #customer.c_address, #customer.c_comment]], aggr=[[SUM(CAST(#lineitem.l_extendedprice AS Decimal128(38, 4)) * CAST(Decimal128(Some(100),23,2) - CAST(#lineitem.l_discount AS Decimal128(23, 2)) AS Decimal128(38, 4))) AS SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)]]\
- \n Inner Join: #customer.c_nationkey = #nation.n_nationkey\
- \n Inner Join: #orders.o_orderkey = #lineitem.l_orderkey\
- \n Inner Join: #customer.c_custkey = #orders.o_custkey\
+ Sort: revenue DESC NULLS FIRST\
+ \n Projection: customer.c_custkey, customer.c_name, SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount) AS revenue, customer.c_acctbal, nation.n_name, customer.c_address, customer.c_phone, customer.c_comment\
+ \n Aggregate: groupBy=[[customer.c_custkey, customer.c_name, customer.c_acctbal, customer.c_phone, nation.n_name, customer.c_address, customer.c_comment]], aggr=[[SUM(CAST(lineitem.l_extendedprice AS Decimal128(38, 4)) * CAST(Decimal128(Some(100),23,2) - CAST(lineitem.l_discount AS Decimal128(23, 2)) AS Decimal128(38, 4))) AS SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)]]\
+ \n Inner Join: customer.c_nationkey = nation.n_nationkey\
+ \n Inner Join: orders.o_orderkey = lineitem.l_orderkey\
+ \n Inner Join: customer.c_custkey = orders.o_custkey\
\n TableScan: customer projection=[c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_comment]\
- \n Filter: #orders.o_orderdate >= Date32(\"8674\") AND #orders.o_orderdate < Date32(\"8766\")\
- \n TableScan: orders projection=[o_orderkey, o_custkey, o_orderdate], partial_filters=[#orders.o_orderdate >= Date32(\"8674\"), #orders.o_orderdate < Date32(\"8766\")]\
- \n Filter: #lineitem.l_returnflag = Utf8(\"R\")\
- \n TableScan: lineitem projection=[l_orderkey, l_extendedprice, l_discount, l_returnflag], partial_filters=[#lineitem.l_returnflag = Utf8(\"R\")]\
+ \n Filter: orders.o_orderdate >= Date32(\"8674\") AND orders.o_orderdate < Date32(\"8766\")\
+ \n TableScan: orders projection=[o_orderkey, o_custkey, o_orderdate], partial_filters=[orders.o_orderdate >= Date32(\"8674\"), orders.o_orderdate < Date32(\"8766\")]\
+ \n Filter: lineitem.l_returnflag = Utf8(\"R\")\
+ \n TableScan: lineitem projection=[l_orderkey, l_extendedprice, l_discount, l_returnflag], partial_filters=[lineitem.l_returnflag = Utf8(\"R\")]\
\n TableScan: nation projection=[n_nationkey, n_name]";
assert_eq!(expected, format!("{:?}", plan.unwrap()),);
@@ -780,9 +780,9 @@ async fn csv_explain() {
let expected = vec![
vec![
"logical_plan",
- "Projection: #aggregate_test_100.c1\
- \n Filter: #aggregate_test_100.c2 > Int8(10)\
- \n TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[#aggregate_test_100.c2 > Int8(10)]"
+ "Projection: aggregate_test_100.c1\
+ \n Filter: aggregate_test_100.c2 > Int8(10)\
+ \n TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)]"
],
vec!["physical_plan",
"ProjectionExec: expr=[c1@0 as c1]\
@@ -850,7 +850,7 @@ async fn explain_logical_plan_only() {
let expected = vec![
vec![
"logical_plan",
- "Projection: #COUNT(UInt8(1))\
+ "Projection: COUNT(UInt8(1))\
\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
\n Values: (Utf8(\"a\"), Int64(1), Int64(100)), (Utf8(\"a\"), Int64(2), Int64(150))",
]];
diff --git a/datafusion/core/tests/sql/expr.rs b/datafusion/core/tests/sql/expr.rs
index 93e453101d..12344e4703 100644
--- a/datafusion/core/tests/sql/expr.rs
+++ b/datafusion/core/tests/sql/expr.rs
@@ -29,14 +29,14 @@ async fn case_when() -> Result<()> {
FROM t1";
let actual = execute_to_batches(&ctx, sql).await;
let expected = vec![
- "+--------------------------------------------------------------------------------------+",
- "| CASE WHEN #t1.c1 = Utf8(\"a\") THEN Int64(1) WHEN #t1.c1 = Utf8(\"b\") THEN Int64(2) END |",
- "+--------------------------------------------------------------------------------------+",
- "| 1 |",
- "| 2 |",
- "| |",
- "| |",
- "+--------------------------------------------------------------------------------------+",
+ "+------------------------------------------------------------------------------------+",
+ "| CASE WHEN t1.c1 = Utf8(\"a\") THEN Int64(1) WHEN t1.c1 = Utf8(\"b\") THEN Int64(2) END |",
+ "+------------------------------------------------------------------------------------+",
+ "| 1 |",
+ "| 2 |",
+ "| |",
+ "| |",
+ "+------------------------------------------------------------------------------------+",
];
assert_batches_eq!(expected, &actual);
Ok(())
@@ -52,14 +52,14 @@ async fn case_when_else() -> Result<()> {
FROM t1";
let actual = execute_to_batches(&ctx, sql).await;
let expected = vec![
- "+------------------------------------------------------------------------------------------------------+",
- "| CASE WHEN #t1.c1 = Utf8(\"a\") THEN Int64(1) WHEN #t1.c1 = Utf8(\"b\") THEN Int64(2) ELSE Int64(999) END |",
- "+------------------------------------------------------------------------------------------------------+",
- "| 1 |",
- "| 2 |",
- "| 999 |",
- "| 999 |",
- "+------------------------------------------------------------------------------------------------------+",
+ "+----------------------------------------------------------------------------------------------------+",
+ "| CASE WHEN t1.c1 = Utf8(\"a\") THEN Int64(1) WHEN t1.c1 = Utf8(\"b\") THEN Int64(2) ELSE Int64(999) END |",
+ "+----------------------------------------------------------------------------------------------------+",
+ "| 1 |",
+ "| 2 |",
+ "| 999 |",
+ "| 999 |",
+ "+----------------------------------------------------------------------------------------------------+",
];
assert_batches_eq!(expected, &actual);
Ok(())
@@ -75,14 +75,14 @@ async fn case_when_with_base_expr() -> Result<()> {
FROM t1";
let actual = execute_to_batches(&ctx, sql).await;
let expected = vec![
- "+---------------------------------------------------------------------------+",
- "| CASE #t1.c1 WHEN Utf8(\"a\") THEN Int64(1) WHEN Utf8(\"b\") THEN Int64(2) END |",
- "+---------------------------------------------------------------------------+",
- "| 1 |",
- "| 2 |",
- "| |",
- "| |",
- "+---------------------------------------------------------------------------+",
+ "+--------------------------------------------------------------------------+",
+ "| CASE t1.c1 WHEN Utf8(\"a\") THEN Int64(1) WHEN Utf8(\"b\") THEN Int64(2) END |",
+ "+--------------------------------------------------------------------------+",
+ "| 1 |",
+ "| 2 |",
+ "| |",
+ "| |",
+ "+--------------------------------------------------------------------------+",
];
assert_batches_eq!(expected, &actual);
Ok(())
@@ -98,14 +98,14 @@ async fn case_when_else_with_base_expr() -> Result<()> {
FROM t1";
let actual = execute_to_batches(&ctx, sql).await;
let expected = vec![
- "+-------------------------------------------------------------------------------------------+",
- "| CASE #t1.c1 WHEN Utf8(\"a\") THEN Int64(1) WHEN Utf8(\"b\") THEN Int64(2) ELSE Int64(999) END |",
- "+-------------------------------------------------------------------------------------------+",
- "| 1 |",
- "| 2 |",
- "| 999 |",
- "| 999 |",
- "+-------------------------------------------------------------------------------------------+",
+ "+------------------------------------------------------------------------------------------+",
+ "| CASE t1.c1 WHEN Utf8(\"a\") THEN Int64(1) WHEN Utf8(\"b\") THEN Int64(2) ELSE Int64(999) END |",
+ "+------------------------------------------------------------------------------------------+",
+ "| 1 |",
+ "| 2 |",
+ "| 999 |",
+ "| 999 |",
+ "+------------------------------------------------------------------------------------------+",
];
assert_batches_eq!(expected, &actual);
Ok(())
@@ -121,14 +121,14 @@ async fn case_when_else_with_null_contant() -> Result<()> {
FROM t1";
let actual = execute_to_batches(&ctx, sql).await;
let expected = vec![
- "+----------------------------------------------------------------------------------------+",
- "| CASE WHEN #t1.c1 = Utf8(\"a\") THEN Int64(1) WHEN NULL THEN Int64(2) ELSE Int64(999) END |",
- "+----------------------------------------------------------------------------------------+",
- "| 1 |",
- "| 999 |",
- "| 999 |",
- "| 999 |",
- "+----------------------------------------------------------------------------------------+",
+ "+---------------------------------------------------------------------------------------+",
+ "| CASE WHEN t1.c1 = Utf8(\"a\") THEN Int64(1) WHEN NULL THEN Int64(2) ELSE Int64(999) END |",
+ "+---------------------------------------------------------------------------------------+",
+ "| 1 |",
+ "| 999 |",
+ "| 999 |",
+ "| 999 |",
+ "+---------------------------------------------------------------------------------------+",
];
assert_batches_eq!(expected, &actual);
diff --git a/datafusion/core/tests/sql/joins.rs b/datafusion/core/tests/sql/joins.rs
index d0a3ee6fb5..b5b59b1b64 100644
--- a/datafusion/core/tests/sql/joins.rs
+++ b/datafusion/core/tests/sql/joins.rs
@@ -1255,8 +1255,8 @@ async fn hash_join_with_date32() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.c1, #t1.c2, #t1.c3, #t1.c4, #t2.c1, #t2.c2, #t2.c3, #t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
- " Inner Join: #t1.c1 = #t2.c1 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
+ " Projection: t1.c1, t1.c2, t1.c3, t1.c4, t2.c1, t2.c2, t2.c3, t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
+ " Inner Join: t1.c1 = t2.c1 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
" TableScan: t1 projection=[c1, c2, c3, c4] [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N]",
" TableScan: t2 projection=[c1, c2, c3, c4] [c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
];
@@ -1297,8 +1297,8 @@ async fn hash_join_with_date64() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.c1, #t1.c2, #t1.c3, #t1.c4, #t2.c1, #t2.c2, #t2.c3, #t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
- " Left Join: #t1.c2 = #t2.c2 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
+ " Projection: t1.c1, t1.c2, t1.c3, t1.c4, t2.c1, t2.c2, t2.c3, t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
+ " Left Join: t1.c2 = t2.c2 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
" TableScan: t1 projection=[c1, c2, c3, c4] [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N]",
" TableScan: t2 projection=[c1, c2, c3, c4] [c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
];
@@ -1341,8 +1341,8 @@ async fn hash_join_with_decimal() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.c1, #t1.c2, #t1.c3, #t1.c4, #t2.c1, #t2.c2, #t2.c3, #t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
- " Right Join: #t1.c3 = #t2.c3 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
+ " Projection: t1.c1, t1.c2, t1.c3, t1.c4, t2.c1, t2.c2, t2.c3, t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
+ " Right Join: t1.c3 = t2.c3 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
" TableScan: t1 projection=[c1, c2, c3, c4] [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N]",
" TableScan: t2 projection=[c1, c2, c3, c4] [c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
];
@@ -1385,8 +1385,8 @@ async fn hash_join_with_dictionary() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.c1, #t1.c2, #t1.c3, #t1.c4, #t2.c1, #t2.c2, #t2.c3, #t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
- " Inner Join: #t1.c4 = #t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
+ " Projection: t1.c1, t1.c2, t1.c3, t1.c4, t2.c1, t2.c2, t2.c3, t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
+ " Inner Join: t1.c4 = t2.c4 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
" TableScan: t1 projection=[c1, c2, c3, c4] [c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N]",
" TableScan: t2 projection=[c1, c2, c3, c4] [c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32, Utf8);N]",
];
@@ -1426,11 +1426,11 @@ async fn reduce_left_join_1() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.t1_id, #t1.t1_name, #t1.t1_int, #t2.t2_id, #t2.t2_name, #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Inner Join: #t1.t1_id = #t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Filter: CAST(#t1.t1_id AS Int64) < Int64(100) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
+ " Projection: t1.t1_id, t1.t1_name, t1.t1_int, t2.t2_id, t2.t2_name, t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Inner Join: t1.t1_id = t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: CAST(t1.t1_id AS Int64) < Int64(100) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
" TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
- " Filter: CAST(#t2.t2_id AS Int64) < Int64(100) [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: CAST(t2.t2_id AS Int64) < Int64(100) [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
" TableScan: t2 projection=[t2_id, t2_name, t2_int] [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
];
let formatted = plan.display_indent_schema().to_string();
@@ -1470,9 +1470,9 @@ async fn reduce_left_join_2() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.t1_id, #t1.t1_name, #t1.t1_int, #t2.t2_id, #t2.t2_name, #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Filter: CAST(#t2.t2_int AS Int64) < Int64(10) OR CAST(#t1.t1_int AS Int64) > Int64(2) AND #t2.t2_name != Utf8(\"w\") [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Inner Join: #t1.t1_id = #t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Projection: t1.t1_id, t1.t1_name, t1.t1_int, t2.t2_id, t2.t2_name, t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: CAST(t2.t2_int AS Int64) < Int64(10) OR CAST(t1.t1_int AS Int64) > Int64(2) AND t2.t2_name != Utf8(\"w\") [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Inner Join: t1.t1_id = t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
" TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
" TableScan: t2 projection=[t2_id, t2_name, t2_int] [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
];
@@ -1513,14 +1513,14 @@ async fn reduce_left_join_3() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t3.t1_id, #t3.t1_name, #t3.t1_int, #t2.t2_id, #t2.t2_name, #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Left Join: #t3.t1_int = #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Projection: #t3.t1_id, #t3.t1_name, #t3.t1_int, alias=t3 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
- " Projection: #t1.t1_id, #t1.t1_name, #t1.t1_int, alias=t3 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
- " Inner Join: #t1.t1_id = #t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Filter: CAST(#t1.t1_id AS Int64) < Int64(100) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
+ " Projection: t3.t1_id, t3.t1_name, t3.t1_int, t2.t2_id, t2.t2_name, t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Left Join: t3.t1_int = t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Projection: t3.t1_id, t3.t1_name, t3.t1_int, alias=t3 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
+ " Projection: t1.t1_id, t1.t1_name, t1.t1_int, alias=t3 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
+ " Inner Join: t1.t1_id = t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: CAST(t1.t1_id AS Int64) < Int64(100) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
" TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
- " Filter: CAST(#t2.t2_int AS Int64) < Int64(3) AND CAST(#t2.t2_id AS Int64) < Int64(100) [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: CAST(t2.t2_int AS Int64) < Int64(3) AND CAST(t2.t2_id AS Int64) < Int64(100) [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
" TableScan: t2 projection=[t2_id, t2_name, t2_int] [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
" TableScan: t2 projection=[t2_id, t2_name, t2_int] [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
];
@@ -1559,9 +1559,9 @@ async fn reduce_right_join_1() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.t1_id, #t1.t1_name, #t1.t1_int, #t2.t2_id, #t2.t2_name, #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Inner Join: #t1.t1_id = #t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Filter: #t1.t1_int IS NOT NULL [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
+ " Projection: t1.t1_id, t1.t1_name, t1.t1_int, t2.t2_id, t2.t2_name, t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Inner Join: t1.t1_id = t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: t1.t1_int IS NOT NULL [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
" TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
" TableScan: t2 projection=[t2_id, t2_name, t2_int] [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
];
@@ -1602,9 +1602,9 @@ async fn reduce_right_join_2() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.t1_id, #t1.t1_name, #t1.t1_int, #t2.t2_id, #t2.t2_name, #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Filter: #t1.t1_int != #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Inner Join: #t1.t1_id = #t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Projection: t1.t1_id, t1.t1_name, t1.t1_int, t2.t2_id, t2.t2_name, t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: t1.t1_int != t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Inner Join: t1.t1_id = t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
" TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
" TableScan: t2 projection=[t2_id, t2_name, t2_int] [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
];
@@ -1645,10 +1645,10 @@ async fn reduce_full_join_to_right_join() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.t1_id, #t1.t1_name, #t1.t1_int, #t2.t2_id, #t2.t2_name, #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Right Join: #t1.t1_id = #t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Projection: t1.t1_id, t1.t1_name, t1.t1_int, t2.t2_id, t2.t2_name, t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Right Join: t1.t1_id = t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
" TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
- " Filter: #t2.t2_name IS NOT NULL [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: t2.t2_name IS NOT NULL [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
" TableScan: t2 projection=[t2_id, t2_name, t2_int] [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
];
let formatted = plan.display_indent_schema().to_string();
@@ -1690,9 +1690,9 @@ async fn reduce_full_join_to_left_join() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.t1_id, #t1.t1_name, #t1.t1_int, #t2.t2_id, #t2.t2_name, #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Left Join: #t1.t1_id = #t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Filter: #t1.t1_name != Utf8(\"b\") [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
+ " Projection: t1.t1_id, t1.t1_name, t1.t1_int, t2.t2_id, t2.t2_name, t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Left Join: t1.t1_id = t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: t1.t1_name != Utf8(\"b\") [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
" TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
" TableScan: t2 projection=[t2_id, t2_name, t2_int] [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
];
@@ -1732,11 +1732,11 @@ async fn reduce_full_join_to_inner_join() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #t1.t1_id, #t1.t1_name, #t1.t1_int, #t2.t2_id, #t2.t2_name, #t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Inner Join: #t1.t1_id = #t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
- " Filter: #t1.t1_name != Utf8(\"b\") [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
+ " Projection: t1.t1_id, t1.t1_name, t1.t1_int, t2.t2_id, t2.t2_name, t2.t2_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Inner Join: t1.t1_id = t2.t2_id [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N, t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: t1.t1_name != Utf8(\"b\") [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
" TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
- " Filter: #t2.t2_name = Utf8(\"x\") [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
+ " Filter: t2.t2_name = Utf8(\"x\") [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
" TableScan: t2 projection=[t2_id, t2_name, t2_int] [t2_id:UInt32;N, t2_name:Utf8;N, t2_int:UInt32;N]",
];
let formatted = plan.display_indent_schema().to_string();
diff --git a/datafusion/core/tests/sql/json.rs b/datafusion/core/tests/sql/json.rs
index 3293ecf43f..1f52625e11 100644
--- a/datafusion/core/tests/sql/json.rs
+++ b/datafusion/core/tests/sql/json.rs
@@ -86,7 +86,7 @@ async fn json_explain() {
let expected = vec![
vec![
"logical_plan",
- "Projection: #COUNT(UInt8(1))\
+ "Projection: COUNT(UInt8(1))\
\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
\n TableScan: t1 projection=[a]",
],
diff --git a/datafusion/core/tests/sql/predicates.rs b/datafusion/core/tests/sql/predicates.rs
index 34c9cc98ae..bb4391c4fe 100644
--- a/datafusion/core/tests/sql/predicates.rs
+++ b/datafusion/core/tests/sql/predicates.rs
@@ -464,13 +464,13 @@ async fn multiple_or_predicates() -> Result<()> {
let plan = ctx.create_logical_plan(sql).expect(&msg);
let state = ctx.state();
let plan = state.optimize(&plan)?;
- // Note that we expect `#part.p_partkey = #lineitem.l_partkey` to have been
+ // Note that we expect `part.p_partkey = lineitem.l_partkey` to have been
// factored out and appear only once in the following plan
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: #lineitem.l_partkey [l_partkey:Int64]",
- " Filter: #part.p_brand = Utf8(\"Brand#12\") AND #lineitem.l_quantity >= Decimal128(Some(100),15,2) AND #lineitem.l_quantity <= Decimal128(Some(1100),15,2) AND CAST(#part.p_size AS Int64) BETWEEN Int64(1) AND Int64(5) OR #part.p_brand = Utf8(\"Brand#23\") AND #lineitem.l_quantity >= Decimal128(Some(1000),15,2) AND #lineitem.l_quantity <= Decimal128(Some(2000),15,2) AND CAST(#part.p_size AS Int64) BETWEEN Int64(1) AND Int64(10) OR #part.p_brand = Utf8(\"Brand#34\") AND #lineitem.l_quantity >= Decimal128(Some(2000),15,2) AND #lineitem.l_quantity <= Decimal128(Some(3000),15,2) AND CAST(#part.p_size AS Int64) BETWEEN Int64(1) AND Int64(15) [l_partkey:Int64, l_quantity:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
- " Inner Join: #lineitem.l_partkey = #part.p_partkey [l_partkey:Int64, l_quantity:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
+ " Projection: lineitem.l_partkey [l_partkey:Int64]",
+ " Filter: part.p_brand = Utf8(\"Brand#12\") AND lineitem.l_quantity >= Decimal128(Some(100),15,2) AND lineitem.l_quantity <= Decimal128(Some(1100),15,2) AND CAST(part.p_size AS Int64) BETWEEN Int64(1) AND Int64(5) OR part.p_brand = Utf8(\"Brand#23\") AND lineitem.l_quantity >= Decimal128(Some(1000),15,2) AND lineitem.l_quantity <= Decimal128(Some(2000),15,2) AND CAST(part.p_size AS Int64) BETWEEN Int64(1) AND Int64(10) OR part.p_brand = Utf8(\"Brand#34\") AND lineitem.l_quantity >= Decimal128(Some(2000),15,2) AND lineitem.l_quantity <= Decimal128(Some(3000),15,2) AND CAST(part.p_size AS Int64) BETWEEN Int64(1) AND Int64(15) [l_partkey:Int64, l_quantity:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
+ " Inner Join: lineitem.l_partkey = part.p_partkey [l_partkey:Int64, l_quantity:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
" TableScan: lineitem projection=[l_partkey, l_quantity] [l_partkey:Int64, l_quantity:Decimal128(15, 2)]",
" TableScan: part projection=[p_partkey, p_brand, p_size] [p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
];
@@ -527,13 +527,13 @@ where
let formatted = plan.display_indent_schema().to_string();
let actual: Vec<&str> = formatted.trim().lines().collect();
let expected =vec![
- "Projection: #part.p_partkey, #SUM(lineitem.l_extendedprice), #AVG(lineitem.l_discount), #COUNT(DISTINCT partsupp.ps_suppkey) [p_partkey:Int64, SUM(lineitem.l_extendedprice):Decimal128(25, 2);N, AVG(lineitem.l_discount):Decimal128(19, 6);N, COUNT(DISTINCT partsupp.ps_suppkey):Int64;N]",
- " Aggregate: groupBy=[[#part.p_partkey]], aggr=[[SUM(#lineitem.l_extendedprice), AVG(#lineitem.l_discount), COUNT(DISTINCT #partsupp.ps_suppkey)]] [p_partkey:Int64, SUM(lineitem.l_extendedprice):Decimal128(25, 2);N, AVG(lineitem.l_discount):Decimal128(19, 6);N, COUNT(DISTINCT partsupp.ps_suppkey):Int64;N]",
- " Inner Join: #part.p_partkey = #partsupp.ps_partkey [l_partkey:Int64, l_extendedprice:Decimal128(15, 2), l_discount:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, ps_partkey:Int64, ps_suppkey:Int64]",
- " Inner Join: #lineitem.l_partkey = #part.p_partkey [l_partkey:Int64, l_extendedprice:Decimal128(15, 2), l_discount:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8]",
+ "Projection: part.p_partkey, SUM(lineitem.l_extendedprice), AVG(lineitem.l_discount), COUNT(DISTINCT partsupp.ps_suppkey) [p_partkey:Int64, SUM(lineitem.l_extendedprice):Decimal128(25, 2);N, AVG(lineitem.l_discount):Decimal128(19, 6);N, COUNT(DISTINCT partsupp.ps_suppkey):Int64;N]",
+ " Aggregate: groupBy=[[part.p_partkey]], aggr=[[SUM(lineitem.l_extendedprice), AVG(lineitem.l_discount), COUNT(DISTINCT partsupp.ps_suppkey)]] [p_partkey:Int64, SUM(lineitem.l_extendedprice):Decimal128(25, 2);N, AVG(lineitem.l_discount):Decimal128(19, 6);N, COUNT(DISTINCT partsupp.ps_suppkey):Int64;N]",
+ " Inner Join: part.p_partkey = partsupp.ps_partkey [l_partkey:Int64, l_extendedprice:Decimal128(15, 2), l_discount:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, ps_partkey:Int64, ps_suppkey:Int64]",
+ " Inner Join: lineitem.l_partkey = part.p_partkey [l_partkey:Int64, l_extendedprice:Decimal128(15, 2), l_discount:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8]",
" TableScan: lineitem projection=[l_partkey, l_extendedprice, l_discount] [l_partkey:Int64, l_extendedprice:Decimal128(15, 2), l_discount:Decimal128(15, 2)]",
- " Filter: #part.p_brand = Utf8(\"Brand#12\") OR #part.p_brand = Utf8(\"Brand#23\") [p_partkey:Int64, p_brand:Utf8]",
- " TableScan: part projection=[p_partkey, p_brand], partial_filters=[#part.p_brand = Utf8(\"Brand#12\") OR #part.p_brand = Utf8(\"Brand#23\")] [p_partkey:Int64, p_brand:Utf8]",
+ " Filter: part.p_brand = Utf8(\"Brand#12\") OR part.p_brand = Utf8(\"Brand#23\") [p_partkey:Int64, p_brand:Utf8]",
+ " TableScan: part projection=[p_partkey, p_brand], partial_filters=[part.p_brand = Utf8(\"Brand#12\") OR part.p_brand = Utf8(\"Brand#23\")] [p_partkey:Int64, p_brand:Utf8]",
" TableScan: partsupp projection=[ps_partkey, ps_suppkey] [ps_partkey:Int64, ps_suppkey:Int64]",
];
diff --git a/datafusion/core/tests/sql/projection.rs b/datafusion/core/tests/sql/projection.rs
index cee8e706c6..4a339edd21 100644
--- a/datafusion/core/tests/sql/projection.rs
+++ b/datafusion/core/tests/sql/projection.rs
@@ -188,7 +188,7 @@ async fn projection_on_table_scan() -> Result<()> {
_ => panic!("expect optimized_plan to be projection"),
}
- let expected = "Projection: #test.c2\
+ let expected = "Projection: test.c2\
\n TableScan: test projection=[c2]";
assert_eq!(format!("{:?}", optimized_plan), expected);
@@ -306,7 +306,7 @@ async fn projection_on_memory_scan() -> Result<()> {
}
let expected = format!(
- "Projection: #{}.b\
+ "Projection: {}.b\
\n TableScan: {} projection=[b]",
UNNAMED_TABLE, UNNAMED_TABLE
);
diff --git a/datafusion/core/tests/sql/select.rs b/datafusion/core/tests/sql/select.rs
index 1d124a5dc9..1ea530bfb6 100644
--- a/datafusion/core/tests/sql/select.rs
+++ b/datafusion/core/tests/sql/select.rs
@@ -525,7 +525,7 @@ async fn use_between_expression_in_select_query() -> Result<()> {
// Only test that the projection exprs are correct, rather than entire output
let needle = "ProjectionExec: expr=[c1@0 >= 2 AND c1@0 <= 3 as test.c1 BETWEEN Int64(2) AND Int64(3)]";
assert_contains!(&formatted, needle);
- let needle = "Projection: #test.c1 >= Int64(2) AND #test.c1 <= Int64(3)";
+ let needle = "Projection: test.c1 >= Int64(2) AND test.c1 <= Int64(3)";
assert_contains!(&formatted, needle);
Ok(())
}
diff --git a/datafusion/core/tests/sql/subqueries.rs b/datafusion/core/tests/sql/subqueries.rs
index 4b4f23e13b..f91018d8bf 100644
--- a/datafusion/core/tests/sql/subqueries.rs
+++ b/datafusion/core/tests/sql/subqueries.rs
@@ -50,18 +50,18 @@ where c_acctbal < (
let plan = ctx.optimize(&plan).unwrap();
let actual = format!("{}", plan.display_indent());
- let expected = r#"Sort: #customer.c_custkey ASC NULLS LAST
- Projection: #customer.c_custkey
- Filter: CAST(#customer.c_acctbal AS Decimal128(25, 2)) < #__sq_2.__value
- Inner Join: #customer.c_custkey = #__sq_2.o_custkey
+ let expected = r#"Sort: customer.c_custkey ASC NULLS LAST
+ Projection: customer.c_custkey
+ Filter: CAST(customer.c_acctbal AS Decimal128(25, 2)) < __sq_2.__value
+ Inner Join: customer.c_custkey = __sq_2.o_custkey
TableScan: customer projection=[c_custkey, c_acctbal]
- Projection: #orders.o_custkey, #SUM(orders.o_totalprice) AS __value, alias=__sq_2
- Aggregate: groupBy=[[#orders.o_custkey]], aggr=[[SUM(#orders.o_totalprice)]]
- Filter: CAST(#orders.o_totalprice AS Decimal128(25, 2)) < #__sq_1.__value
- Inner Join: #orders.o_orderkey = #__sq_1.l_orderkey
+ Projection: orders.o_custkey, SUM(orders.o_totalprice) AS __value, alias=__sq_2
+ Aggregate: groupBy=[[orders.o_custkey]], aggr=[[SUM(orders.o_totalprice)]]
+ Filter: CAST(orders.o_totalprice AS Decimal128(25, 2)) < __sq_1.__value
+ Inner Join: orders.o_orderkey = __sq_1.l_orderkey
TableScan: orders projection=[o_orderkey, o_custkey, o_totalprice]
- Projection: #lineitem.l_orderkey, #SUM(lineitem.l_extendedprice) AS price AS __value, alias=__sq_1
- Aggregate: groupBy=[[#lineitem.l_orderkey]], aggr=[[SUM(#lineitem.l_extendedprice)]]
+ Projection: lineitem.l_orderkey, SUM(lineitem.l_extendedprice) AS price AS __value, alias=__sq_1
+ Aggregate: groupBy=[[lineitem.l_orderkey]], aggr=[[SUM(lineitem.l_extendedprice)]]
TableScan: lineitem projection=[l_orderkey, l_extendedprice]"#
.to_string();
assert_eq!(actual, expected);
@@ -93,10 +93,10 @@ where o_orderstatus in (
let plan = ctx.create_logical_plan(sql).unwrap();
let plan = ctx.optimize(&plan).unwrap();
let actual = format!("{}", plan.display_indent());
- let expected = r#"Projection: #orders.o_orderkey
- Semi Join: #orders.o_orderstatus = #__sq_1.l_linestatus, #orders.o_orderkey = #__sq_1.l_orderkey
+ let expected = r#"Projection: orders.o_orderkey
+ Semi Join: orders.o_orderstatus = __sq_1.l_linestatus, orders.o_orderkey = __sq_1.l_orderkey
TableScan: orders projection=[o_orderkey, o_orderstatus]
- Projection: #lineitem.l_linestatus AS l_linestatus, #lineitem.l_orderkey AS l_orderkey, alias=__sq_1
+ Projection: lineitem.l_linestatus AS l_linestatus, lineitem.l_orderkey AS l_orderkey, alias=__sq_1
TableScan: lineitem projection=[l_orderkey, l_linestatus]"#
.to_string();
assert_eq!(actual, expected);
@@ -139,31 +139,31 @@ order by s_acctbal desc, n_name, s_name, p_partkey;"#;
let plan = ctx.create_logical_plan(sql).unwrap();
let plan = ctx.optimize(&plan).unwrap();
let actual = format!("{}", plan.display_indent());
- let expected = r#"Sort: #supplier.s_acctbal DESC NULLS FIRST, #nation.n_name ASC NULLS LAST, #supplier.s_name ASC NULLS LAST, #part.p_partkey ASC NULLS LAST
- Projection: #supplier.s_acctbal, #supplier.s_name, #nation.n_name, #part.p_partkey, #part.p_mfgr, #supplier.s_address, #supplier.s_phone, #supplier.s_comment
- Filter: #partsupp.ps_supplycost = #__sq_1.__value
- Inner Join: #part.p_partkey = #__sq_1.ps_partkey
- Inner Join: #nation.n_regionkey = #region.r_regionkey
- Inner Join: #supplier.s_nationkey = #nation.n_nationkey
- Inner Join: #partsupp.ps_suppkey = #supplier.s_suppkey
- Inner Join: #part.p_partkey = #partsupp.ps_partkey
- Filter: #part.p_size = Int32(15) AND #part.p_type LIKE Utf8("%BRASS")
- TableScan: part projection=[p_partkey, p_mfgr, p_type, p_size], partial_filters=[#part.p_size = Int32(15), #part.p_type LIKE Utf8("%BRASS")]
+ let expected = r#"Sort: supplier.s_acctbal DESC NULLS FIRST, nation.n_name ASC NULLS LAST, supplier.s_name ASC NULLS LAST, part.p_partkey ASC NULLS LAST
+ Projection: supplier.s_acctbal, supplier.s_name, nation.n_name, part.p_partkey, part.p_mfgr, supplier.s_address, supplier.s_phone, supplier.s_comment
+ Filter: partsupp.ps_supplycost = __sq_1.__value
+ Inner Join: part.p_partkey = __sq_1.ps_partkey
+ Inner Join: nation.n_regionkey = region.r_regionkey
+ Inner Join: supplier.s_nationkey = nation.n_nationkey
+ Inner Join: partsupp.ps_suppkey = supplier.s_suppkey
+ Inner Join: part.p_partkey = partsupp.ps_partkey
+ Filter: part.p_size = Int32(15) AND part.p_type LIKE Utf8("%BRASS")
+ TableScan: part projection=[p_partkey, p_mfgr, p_type, p_size], partial_filters=[part.p_size = Int32(15), part.p_type LIKE Utf8("%BRASS")]
TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_supplycost]
TableScan: supplier projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]
TableScan: nation projection=[n_nationkey, n_name, n_regionkey]
- Filter: #region.r_name = Utf8("EUROPE")
- TableScan: region projection=[r_regionkey, r_name], partial_filters=[#region.r_name = Utf8("EUROPE")]
- Projection: #partsupp.ps_partkey, #MIN(partsupp.ps_supplycost) AS __value, alias=__sq_1
- Aggregate: groupBy=[[#partsupp.ps_partkey]], aggr=[[MIN(#partsupp.ps_supplycost)]]
- Inner Join: #nation.n_regionkey = #region.r_regionkey
- Inner Join: #supplier.s_nationkey = #nation.n_nationkey
- Inner Join: #partsupp.ps_suppkey = #supplier.s_suppkey
+ Filter: region.r_name = Utf8("EUROPE")
+ TableScan: region projection=[r_regionkey, r_name], partial_filters=[region.r_name = Utf8("EUROPE")]
+ Projection: partsupp.ps_partkey, MIN(partsupp.ps_supplycost) AS __value, alias=__sq_1
+ Aggregate: groupBy=[[partsupp.ps_partkey]], aggr=[[MIN(partsupp.ps_supplycost)]]
+ Inner Join: nation.n_regionkey = region.r_regionkey
+ Inner Join: supplier.s_nationkey = nation.n_nationkey
+ Inner Join: partsupp.ps_suppkey = supplier.s_suppkey
TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_supplycost]
TableScan: supplier projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]
TableScan: nation projection=[n_nationkey, n_name, n_regionkey]
- Filter: #region.r_name = Utf8("EUROPE")
- TableScan: region projection=[r_regionkey, r_name], partial_filters=[#region.r_name = Utf8("EUROPE")]"#
+ Filter: region.r_name = Utf8("EUROPE")
+ TableScan: region projection=[r_regionkey, r_name], partial_filters=[region.r_name = Utf8("EUROPE")]"#
.to_string();
assert_eq!(actual, expected);
@@ -203,12 +203,12 @@ async fn tpch_q4_correlated() -> Result<()> {
let plan = ctx.create_logical_plan(sql).unwrap();
let plan = ctx.optimize(&plan).unwrap();
let actual = format!("{}", plan.display_indent());
- let expected = r#"Sort: #orders.o_orderpriority ASC NULLS LAST
- Projection: #orders.o_orderpriority, #COUNT(UInt8(1)) AS order_count
- Aggregate: groupBy=[[#orders.o_orderpriority]], aggr=[[COUNT(UInt8(1))]]
- Semi Join: #orders.o_orderkey = #lineitem.l_orderkey
+ let expected = r#"Sort: orders.o_orderpriority ASC NULLS LAST
+ Projection: orders.o_orderpriority, COUNT(UInt8(1)) AS order_count
+ Aggregate: groupBy=[[orders.o_orderpriority]], aggr=[[COUNT(UInt8(1))]]
+ Semi Join: orders.o_orderkey = lineitem.l_orderkey
TableScan: orders projection=[o_orderkey, o_orderpriority]
- Filter: #lineitem.l_commitdate < #lineitem.l_receiptdate
+ Filter: lineitem.l_commitdate < lineitem.l_receiptdate
TableScan: lineitem projection=[l_orderkey, l_commitdate, l_receiptdate]"#
.to_string();
assert_eq!(actual, expected);
@@ -261,16 +261,16 @@ async fn tpch_q17_correlated() -> Result<()> {
.map_err(|e| format!("{:?} at {}", e, "error"))
.unwrap();
let actual = format!("{}", plan.display_indent());
- let expected = r#"Projection: CAST(#SUM(lineitem.l_extendedprice) AS Decimal128(38, 33)) / CAST(Float64(7) AS Decimal128(38, 33)) AS avg_yearly
- Aggregate: groupBy=[[]], aggr=[[SUM(#lineitem.l_extendedprice)]]
- Filter: CAST(#lineitem.l_quantity AS Decimal128(38, 21)) < #__sq_1.__value
- Inner Join: #part.p_partkey = #__sq_1.l_partkey
- Inner Join: #lineitem.l_partkey = #part.p_partkey
+ let expected = r#"Projection: CAST(SUM(lineitem.l_extendedprice) AS Decimal128(38, 33)) / CAST(Float64(7) AS Decimal128(38, 33)) AS avg_yearly
+ Aggregate: groupBy=[[]], aggr=[[SUM(lineitem.l_extendedprice)]]
+ Filter: CAST(lineitem.l_quantity AS Decimal128(38, 21)) < __sq_1.__value
+ Inner Join: part.p_partkey = __sq_1.l_partkey
+ Inner Join: lineitem.l_partkey = part.p_partkey
TableScan: lineitem projection=[l_partkey, l_quantity, l_extendedprice]
- Filter: #part.p_brand = Utf8("Brand#23") AND #part.p_container = Utf8("MED BOX")
+ Filter: part.p_brand = Utf8("Brand#23") AND part.p_container = Utf8("MED BOX")
TableScan: part projection=[p_partkey, p_brand, p_container]
- Projection: #lineitem.l_partkey, CAST(Float64(0.2) AS Decimal128(38, 21)) * CAST(#AVG(lineitem.l_quantity) AS Decimal128(38, 21)) AS __value, alias=__sq_1
- Aggregate: groupBy=[[#lineitem.l_partkey]], aggr=[[AVG(#lineitem.l_quantity)]]
+ Projection: lineitem.l_partkey, CAST(Float64(0.2) AS Decimal128(38, 21)) * CAST(AVG(lineitem.l_quantity) AS Decimal128(38, 21)) AS __value, alias=__sq_1
+ Aggregate: groupBy=[[lineitem.l_partkey]], aggr=[[AVG(lineitem.l_quantity)]]
TableScan: lineitem projection=[l_partkey, l_quantity, l_extendedprice]"#
.to_string();
assert_eq!(actual, expected);
@@ -321,25 +321,25 @@ order by s_name;
.map_err(|e| format!("{:?} at {}", e, "error"))
.unwrap();
let actual = format!("{}", plan.display_indent());
- let expected = r#"Sort: #supplier.s_name ASC NULLS LAST
- Projection: #supplier.s_name, #supplier.s_address
- Semi Join: #supplier.s_suppkey = #__sq_2.ps_suppkey
- Inner Join: #supplier.s_nationkey = #nation.n_nationkey
+ let expected = r#"Sort: supplier.s_name ASC NULLS LAST
+ Projection: supplier.s_name, supplier.s_address
+ Semi Join: supplier.s_suppkey = __sq_2.ps_suppkey
+ Inner Join: supplier.s_nationkey = nation.n_nationkey
TableScan: supplier projection=[s_suppkey, s_name, s_address, s_nationkey]
- Filter: #nation.n_name = Utf8("CANADA")
- TableScan: nation projection=[n_nationkey, n_name], partial_filters=[#nation.n_name = Utf8("CANADA")]
- Projection: #partsupp.ps_suppkey AS ps_suppkey, alias=__sq_2
- Filter: CAST(#partsupp.ps_availqty AS Decimal128(38, 17)) > #__sq_3.__value
- Inner Join: #partsupp.ps_partkey = #__sq_3.l_partkey, #partsupp.ps_suppkey = #__sq_3.l_suppkey
- Semi Join: #partsupp.ps_partkey = #__sq_1.p_partkey
+ Filter: nation.n_name = Utf8("CANADA")
+ TableScan: nation projection=[n_nationkey, n_name], partial_filters=[nation.n_name = Utf8("CANADA")]
+ Projection: partsupp.ps_suppkey AS ps_suppkey, alias=__sq_2
+ Filter: CAST(partsupp.ps_availqty AS Decimal128(38, 17)) > __sq_3.__value
+ Inner Join: partsupp.ps_partkey = __sq_3.l_partkey, partsupp.ps_suppkey = __sq_3.l_suppkey
+ Semi Join: partsupp.ps_partkey = __sq_1.p_partkey
TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_availqty]
- Projection: #part.p_partkey AS p_partkey, alias=__sq_1
- Filter: #part.p_name LIKE Utf8("forest%")
- TableScan: part projection=[p_partkey, p_name], partial_filters=[#part.p_name LIKE Utf8("forest%")]
- Projection: #lineitem.l_partkey, #lineitem.l_suppkey, CAST(Float64(0.5) AS Decimal128(38, 17)) * CAST(#SUM(lineitem.l_quantity) AS Decimal128(38, 17)) AS __value, alias=__sq_3
- Aggregate: groupBy=[[#lineitem.l_partkey, #lineitem.l_suppkey]], aggr=[[SUM(#lineitem.l_quantity)]]
- Filter: #lineitem.l_shipdate >= CAST(Utf8("1994-01-01") AS Date32)
- TableScan: lineitem projection=[l_partkey, l_suppkey, l_quantity, l_shipdate], partial_filters=[#lineitem.l_shipdate >= CAST(Utf8("1994-01-01") AS Date32)]"#
+ Projection: part.p_partkey AS p_partkey, alias=__sq_1
+ Filter: part.p_name LIKE Utf8("forest%")
+ TableScan: part projection=[p_partkey, p_name], partial_filters=[part.p_name LIKE Utf8("forest%")]
+ Projection: lineitem.l_partkey, lineitem.l_suppkey, CAST(Float64(0.5) AS Decimal128(38, 17)) * CAST(SUM(lineitem.l_quantity) AS Decimal128(38, 17)) AS __value, alias=__sq_3
+ Aggregate: groupBy=[[lineitem.l_partkey, lineitem.l_suppkey]], aggr=[[SUM(lineitem.l_quantity)]]
+ Filter: lineitem.l_shipdate >= CAST(Utf8("1994-01-01") AS Date32)
+ TableScan: lineitem projection=[l_partkey, l_suppkey, l_quantity, l_shipdate], partial_filters=[lineitem.l_shipdate >= CAST(Utf8("1994-01-01") AS Date32)]"#
.to_string();
assert_eq!(actual, expected);
@@ -380,21 +380,21 @@ order by cntrycode;"#;
.map_err(|e| format!("{:?} at {}", e, "error"))
.unwrap();
let actual = format!("{}", plan.display_indent());
- let expected = r#"Sort: #custsale.cntrycode ASC NULLS LAST
- Projection: #custsale.cntrycode, #COUNT(UInt8(1)) AS numcust, #SUM(custsale.c_acctbal) AS totacctbal
- Aggregate: groupBy=[[#custsale.cntrycode]], aggr=[[COUNT(UInt8(1)), SUM(#custsale.c_acctbal)]]
- Projection: #custsale.cntrycode, #custsale.c_acctbal, alias=custsale
- Projection: substr(#customer.c_phone, Int64(1), Int64(2)) AS cntrycode, #customer.c_acctbal, alias=custsale
- Filter: CAST(#customer.c_acctbal AS Decimal128(19, 6)) > #__sq_1.__value
+ let expected = r#"Sort: custsale.cntrycode ASC NULLS LAST
+ Projection: custsale.cntrycode, COUNT(UInt8(1)) AS numcust, SUM(custsale.c_acctbal) AS totacctbal
+ Aggregate: groupBy=[[custsale.cntrycode]], aggr=[[COUNT(UInt8(1)), SUM(custsale.c_acctbal)]]
+ Projection: custsale.cntrycode, custsale.c_acctbal, alias=custsale
+ Projection: substr(customer.c_phone, Int64(1), Int64(2)) AS cntrycode, customer.c_acctbal, alias=custsale
+ Filter: CAST(customer.c_acctbal AS Decimal128(19, 6)) > __sq_1.__value
CrossJoin:
- Anti Join: #customer.c_custkey = #orders.o_custkey
- Filter: substr(#customer.c_phone, Int64(1), Int64(2)) IN ([Utf8("13"), Utf8("31"), Utf8("23"), Utf8("29"), Utf8("30"), Utf8("18"), Utf8("17")])
- TableScan: customer projection=[c_custkey, c_phone, c_acctbal], partial_filters=[substr(#customer.c_phone, Int64(1), Int64(2)) IN ([Utf8("13"), Utf8("31"), Utf8("23"), Utf8("29"), Utf8("30"), Utf8("18"), Utf8("17")])]
+ Anti Join: customer.c_custkey = orders.o_custkey
+ Filter: substr(customer.c_phone, Int64(1), Int64(2)) IN ([Utf8("13"), Utf8("31"), Utf8("23"), Utf8("29"), Utf8("30"), Utf8("18"), Utf8("17")])
+ TableScan: customer projection=[c_custkey, c_phone, c_acctbal], partial_filters=[substr(customer.c_phone, Int64(1), Int64(2)) IN ([Utf8("13"), Utf8("31"), Utf8("23"), Utf8("29"), Utf8("30"), Utf8("18"), Utf8("17")])]
TableScan: orders projection=[o_custkey]
- Projection: #AVG(customer.c_acctbal) AS __value, alias=__sq_1
- Aggregate: groupBy=[[]], aggr=[[AVG(#customer.c_acctbal)]]
- Filter: CAST(#customer.c_acctbal AS Decimal128(30, 15)) > CAST(Float64(0) AS Decimal128(30, 15)) AND substr(#customer.c_phone, Int64(1), Int64(2)) IN ([Utf8("13"), Utf8("31"), Utf8("23"), Utf8("29"), Utf8("30"), Utf8("18"), Utf8("17")])
- TableScan: customer projection=[c_phone, c_acctbal], partial_filters=[CAST(#customer.c_acctbal AS Decimal128(30, 15)) > CAST(Float64(0) AS Decimal128(30, 15)), substr(#customer.c_phone, Int64(1), Int64(2)) IN ([Utf8("13"), Utf8("31"), Utf8("23"), Utf8("29"), Utf8("30"), Utf8("18"), Utf8("17")])]"#
+ Projection: AVG(customer.c_acctbal) AS __value, alias=__sq_1
+ Aggregate: groupBy=[[]], aggr=[[AVG(customer.c_acctbal)]]
+ Filter: CAST(customer.c_acctbal AS Decimal128(30, 15)) > CAST(Float64(0) AS Decimal128(30, 15)) AND substr(customer.c_phone, Int64(1), Int64(2)) IN ([Utf8("13"), Utf8("31"), Utf8("23"), Utf8("29"), Utf8("30"), Utf8("18"), Utf8("17")])
+ TableScan: customer projection=[c_phone, c_acctbal], partial_filters=[CAST(customer.c_acctbal AS Decimal128(30, 15)) > CAST(Float64(0) AS Decimal128(30, 15)), substr(customer.c_phone, Int64(1), Int64(2)) IN ([Utf8("13"), Utf8("31"), Utf8("23"), Utf8("29"), Utf8("30"), Utf8("18"), Utf8("17")])]"#
.to_string();
assert_eq!(actual, expected);
@@ -442,25 +442,25 @@ order by value desc;
.map_err(|e| format!("{:?} at {}", e, "error"))
.unwrap();
let actual = format!("{}", plan.display_indent());
- let expected = r#"Sort: #value DESC NULLS FIRST
- Projection: #partsupp.ps_partkey, #SUM(partsupp.ps_supplycost * partsupp.ps_availqty) AS value
- Filter: CAST(#SUM(partsupp.ps_supplycost * partsupp.ps_availqty) AS Decimal128(38, 17)) > #__sq_1.__value
+ let expected = r#"Sort: value DESC NULLS FIRST
+ Projection: partsupp.ps_partkey, SUM(partsupp.ps_supplycost * partsupp.ps_availqty) AS value
+ Filter: CAST(SUM(partsupp.ps_supplycost * partsupp.ps_availqty) AS Decimal128(38, 17)) > __sq_1.__value
CrossJoin:
- Aggregate: groupBy=[[#partsupp.ps_partkey]], aggr=[[SUM(CAST(#partsupp.ps_supplycost AS Decimal128(26, 2)) * CAST(#partsupp.ps_availqty AS Decimal128(26, 2)))]]
- Inner Join: #supplier.s_nationkey = #nation.n_nationkey
- Inner Join: #partsupp.ps_suppkey = #supplier.s_suppkey
+ Aggregate: groupBy=[[partsupp.ps_partkey]], aggr=[[SUM(CAST(partsupp.ps_supplycost AS Decimal128(26, 2)) * CAST(partsupp.ps_availqty AS Decimal128(26, 2)))]]
+ Inner Join: supplier.s_nationkey = nation.n_nationkey
+ Inner Join: partsupp.ps_suppkey = supplier.s_suppkey
TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_availqty, ps_supplycost]
TableScan: supplier projection=[s_suppkey, s_nationkey]
- Filter: #nation.n_name = Utf8("GERMANY")
- TableScan: nation projection=[n_nationkey, n_name], partial_filters=[#nation.n_name = Utf8("GERMANY")]
- Projection: CAST(#SUM(partsupp.ps_supplycost * partsupp.ps_availqty) AS Decimal128(38, 17)) * CAST(Float64(0.0001) AS Decimal128(38, 17)) AS __value, alias=__sq_1
- Aggregate: groupBy=[[]], aggr=[[SUM(CAST(#partsupp.ps_supplycost AS Decimal128(26, 2)) * CAST(#partsupp.ps_availqty AS Decimal128(26, 2)))]]
- Inner Join: #supplier.s_nationkey = #nation.n_nationkey
- Inner Join: #partsupp.ps_suppkey = #supplier.s_suppkey
+ Filter: nation.n_name = Utf8("GERMANY")
+ TableScan: nation projection=[n_nationkey, n_name], partial_filters=[nation.n_name = Utf8("GERMANY")]
+ Projection: CAST(SUM(partsupp.ps_supplycost * partsupp.ps_availqty) AS Decimal128(38, 17)) * CAST(Float64(0.0001) AS Decimal128(38, 17)) AS __value, alias=__sq_1
+ Aggregate: groupBy=[[]], aggr=[[SUM(CAST(partsupp.ps_supplycost AS Decimal128(26, 2)) * CAST(partsupp.ps_availqty AS Decimal128(26, 2)))]]
+ Inner Join: supplier.s_nationkey = nation.n_nationkey
+ Inner Join: partsupp.ps_suppkey = supplier.s_suppkey
TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_availqty, ps_supplycost]
TableScan: supplier projection=[s_suppkey, s_nationkey]
- Filter: #nation.n_name = Utf8("GERMANY")
- TableScan: nation projection=[n_nationkey, n_name], partial_filters=[#nation.n_name = Utf8("GERMANY")]"#
+ Filter: nation.n_name = Utf8("GERMANY")
+ TableScan: nation projection=[n_nationkey, n_name], partial_filters=[nation.n_name = Utf8("GERMANY")]"#
.to_string();
assert_eq!(actual, expected);
diff --git a/datafusion/core/tests/sql/udf.rs b/datafusion/core/tests/sql/udf.rs
index e145a7fad3..b2440dc222 100644
--- a/datafusion/core/tests/sql/udf.rs
+++ b/datafusion/core/tests/sql/udf.rs
@@ -91,7 +91,7 @@ async fn scalar_udf() -> Result<()> {
assert_eq!(
format!("{:?}", plan),
- "Projection: #t.a, #t.b, my_add(#t.a, #t.b)\n TableScan: t projection=[a, b]"
+ "Projection: t.a, t.b, my_add(t.a, t.b)\n TableScan: t projection=[a, b]"
);
let plan = ctx.optimize(&plan)?;
diff --git a/datafusion/core/tests/sql/window.rs b/datafusion/core/tests/sql/window.rs
index fe1b539c77..2708d91e0d 100644
--- a/datafusion/core/tests/sql/window.rs
+++ b/datafusion/core/tests/sql/window.rs
@@ -332,12 +332,12 @@ async fn window_expr_eliminate() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Sort: #d.b ASC NULLS LAST [b:Utf8, max_a:Int64;N]",
- " Projection: #d.b, #MAX(d.a) AS max_a [b:Utf8, max_a:Int64;N]",
- " Aggregate: groupBy=[[#d.b]], aggr=[[MAX(#d.a)]] [b:Utf8, MAX(d.a):Int64;N]",
- " Projection: #_data2.a, #_data2.b, alias=d [a:Int64, b:Utf8]",
- " Projection: #s.a, #s.b, alias=_data2 [a:Int64, b:Utf8]",
- " Projection: #a, #b, alias=s [a:Int64, b:Utf8]",
+ " Sort: d.b ASC NULLS LAST [b:Utf8, max_a:Int64;N]",
+ " Projection: d.b, MAX(d.a) AS max_a [b:Utf8, max_a:Int64;N]",
+ " Aggregate: groupBy=[[d.b]], aggr=[[MAX(d.a)]] [b:Utf8, MAX(d.a):Int64;N]",
+ " Projection: _data2.a, _data2.b, alias=d [a:Int64, b:Utf8]",
+ " Projection: s.a, s.b, alias=_data2 [a:Int64, b:Utf8]",
+ " Projection: a, b, alias=s [a:Int64, b:Utf8]",
" Union [a:Int64, b:Utf8]",
" Projection: Int64(1) AS a, Utf8(\"aa\") AS b [a:Int64, b:Utf8]",
" EmptyRelation []",
@@ -395,13 +395,13 @@ async fn window_expr_eliminate() -> Result<()> {
let plan = state.optimize(&plan)?;
let expected = vec![
"Explain [plan_type:Utf8, plan:Utf8]",
- " Sort: #d.b ASC NULLS LAST [b:Utf8, max_a:Int64;N, MAX(d.seq):UInt64;N]",
- " Projection: #d.b, #MAX(d.a) AS max_a, #MAX(d.seq) [b:Utf8, max_a:Int64;N, MAX(d.seq):UInt64;N]",
- " Aggregate: groupBy=[[#d.b]], aggr=[[MAX(#d.a), MAX(#d.seq)]] [b:Utf8, MAX(d.a):Int64;N, MAX(d.seq):UInt64;N]",
- " Projection: #_data2.seq, #_data2.a, #_data2.b, alias=d [seq:UInt64;N, a:Int64, b:Utf8]",
- " Projection: #ROW_NUMBER() PARTITION BY [#s.b] ORDER BY [#s.a ASC NULLS LAST] AS seq, #s.a, #s.b, alias=_data2 [seq:UInt64;N, a:Int64, b:Utf8]",
- " WindowAggr: windowExpr=[[ROW_NUMBER() PARTITION BY [#s.b] ORDER BY [#s.a ASC NULLS LAST]]] [ROW_NUMBER() PARTITION BY [#s.b] ORDER BY [#s.a ASC NULLS LAST]:UInt64;N, a:Int64, b:Utf8]",
- " Projection: #a, #b, alias=s [a:Int64, b:Utf8]",
+ " Sort: d.b ASC NULLS LAST [b:Utf8, max_a:Int64;N, MAX(d.seq):UInt64;N]",
+ " Projection: d.b, MAX(d.a) AS max_a, MAX(d.seq) [b:Utf8, max_a:Int64;N, MAX(d.seq):UInt64;N]",
+ " Aggregate: groupBy=[[d.b]], aggr=[[MAX(d.a), MAX(d.seq)]] [b:Utf8, MAX(d.a):Int64;N, MAX(d.seq):UInt64;N]",
+ " Projection: _data2.seq, _data2.a, _data2.b, alias=d [seq:UInt64;N, a:Int64, b:Utf8]",
+ " Projection: ROW_NUMBER() PARTITION BY [s.b] ORDER BY [s.a ASC NULLS LAST] AS seq, s.a, s.b, alias=_data2 [seq:UInt64;N, a:Int64, b:Utf8]",
+ " WindowAggr: windowExpr=[[ROW_NUMBER() PARTITION BY [s.b] ORDER BY [s.a ASC NULLS LAST]]] [ROW_NUMBER() PARTITION BY [s.b] ORDER BY [s.a ASC NULLS LAST]:UInt64;N, a:Int64, b:Utf8]",
+ " Projection: a, b, alias=s [a:Int64, b:Utf8]",
" Union [a:Int64, b:Utf8]",
" Projection: Int64(1) AS a, Utf8(\"aa\") AS b [a:Int64, b:Utf8]",
" EmptyRelation []",
@@ -440,12 +440,12 @@ async fn window_in_expression() -> Result<()> {
let sql = "select 1 - lag(amount, 1) over (order by idx) from (values ('a', 1, 100), ('a', 2, 150)) as t (col1, idx, amount)";
let actual = execute_to_batches(&ctx, sql).await;
let expected = vec![
- "+--------------------------------------------------------------------+",
- "| Int64(1) - LAG(t.amount,Int64(1)) ORDER BY [#t.idx ASC NULLS LAST] |",
- "+--------------------------------------------------------------------+",
- "| |",
- "| -99 |",
- "+--------------------------------------------------------------------+",
+ "+-------------------------------------------------------------------+",
+ "| Int64(1) - LAG(t.amount,Int64(1)) ORDER BY [t.idx ASC NULLS LAST] |",
+ "+-------------------------------------------------------------------+",
+ "| |",
+ "| -99 |",
+ "+-------------------------------------------------------------------+",
];
assert_batches_eq!(expected, &actual);
Ok(())
diff --git a/datafusion/core/tests/user_defined_plan.rs b/datafusion/core/tests/user_defined_plan.rs
index c577e48e78..edd8812668 100644
--- a/datafusion/core/tests/user_defined_plan.rs
+++ b/datafusion/core/tests/user_defined_plan.rs
@@ -44,8 +44,8 @@
//! | plan_type | plan |
//! +--------------+----------------------------------------+
//! | logical_plan | Limit: 3 |
-//! | | Sort: #revenue DESC NULLS FIRST |
-//! | | Projection: #customer_id, #revenue |
+//! | | Sort: revenue DESC NULLS FIRST |
+//! | | Projection: customer_id, revenue |
//! | | TableScan: sales |
//! +--------------+----------------------------------------+
//! ```
@@ -218,7 +218,7 @@ async fn topk_plan() -> Result<()> {
let mut expected = vec![
"| logical_plan after topk | TopK: k=3 |",
- "| | Projection: #sales.customer_id, #sales.revenue |",
+ "| | Projection: sales.customer_id, sales.revenue |",
"| | TableScan: sales projection=[customer_id,revenue] |",
].join("\n");
diff --git a/datafusion/expr/src/expr.rs b/datafusion/expr/src/expr.rs
index 0b44546235..008a2c454d 100644
--- a/datafusion/expr/src/expr.rs
+++ b/datafusion/expr/src/expr.rs
@@ -1164,11 +1164,11 @@ mod test {
.when(lit(1), lit(true))
.when(lit(0), lit(false))
.otherwise(lit(ScalarValue::Null))?;
- let expected_canonical = "CASE #a WHEN Int32(1) THEN Boolean(true) WHEN Int32(0) THEN Boolean(false) ELSE NULL END";
- assert_eq!(expected_canonical, expr.canonical_name());
- assert_eq!(expected_canonical, format!("{}", expr));
- assert_eq!(expected_canonical, format!("{:?}", expr));
- assert_eq!("CASE a WHEN Int32(1) THEN Boolean(true) WHEN Int32(0) THEN Boolean(false) ELSE NULL END", expr.name()?);
+ let expected = "CASE a WHEN Int32(1) THEN Boolean(true) WHEN Int32(0) THEN Boolean(false) ELSE NULL END";
+ assert_eq!(expected, expr.canonical_name());
+ assert_eq!(expected, format!("{}", expr));
+ assert_eq!(expected, format!("{:?}", expr));
+ assert_eq!(expected, expr.name()?);
Ok(())
}
diff --git a/datafusion/expr/src/expr_fn.rs b/datafusion/expr/src/expr_fn.rs
index 7b11b63046..9c9ce04451 100644
--- a/datafusion/expr/src/expr_fn.rs
+++ b/datafusion/expr/src/expr_fn.rs
@@ -588,10 +588,10 @@ mod test {
fn filter_is_null_and_is_not_null() {
let col_null = col("col1");
let col_not_null = col("col2");
- assert_eq!(format!("{:?}", col_null.is_null()), "#col1 IS NULL");
+ assert_eq!(format!("{:?}", col_null.is_null()), "col1 IS NULL");
assert_eq!(
format!("{:?}", col_not_null.is_not_null()),
- "#col2 IS NOT NULL"
+ "col2 IS NOT NULL"
);
}
diff --git a/datafusion/expr/src/expr_rewriter.rs b/datafusion/expr/src/expr_rewriter.rs
index 1c81b4c4a6..6bdb54522c 100644
--- a/datafusion/expr/src/expr_rewriter.rs
+++ b/datafusion/expr/src/expr_rewriter.rs
@@ -702,12 +702,12 @@ mod test {
assert_eq!(
rewriter.v,
vec![
- "Previsited #state = Utf8(\"CO\")",
- "Previsited #state",
- "Mutated #state",
+ "Previsited state = Utf8(\"CO\")",
+ "Previsited state",
+ "Mutated state",
"Previsited Utf8(\"CO\")",
"Mutated Utf8(\"CO\")",
- "Mutated #state = Utf8(\"CO\")"
+ "Mutated state = Utf8(\"CO\")"
]
)
}
diff --git a/datafusion/expr/src/logical_plan/builder.rs b/datafusion/expr/src/logical_plan/builder.rs
index 6b396b0d65..e881b05ed1 100644
--- a/datafusion/expr/src/logical_plan/builder.rs
+++ b/datafusion/expr/src/logical_plan/builder.rs
@@ -1072,8 +1072,8 @@ mod tests {
.project(vec![col("id")])?
.build()?;
- let expected = "Projection: #employee_csv.id\
- \n Filter: #employee_csv.state = Utf8(\"CO\")\
+ let expected = "Projection: employee_csv.id\
+ \n Filter: employee_csv.state = Utf8(\"CO\")\
\n TableScan: employee_csv projection=[id, state]";
assert_eq!(expected, format!("{:?}", plan));
@@ -1105,8 +1105,8 @@ mod tests {
.build()?;
let expected = "Limit: skip=2, fetch=10\
- \n Projection: #employee_csv.state, #total_salary\
- \n Aggregate: groupBy=[[#employee_csv.state]], aggr=[[SUM(#employee_csv.salary) AS total_salary]]\
+ \n Projection: employee_csv.state, total_salary\
+ \n Aggregate: groupBy=[[employee_csv.state]], aggr=[[SUM(employee_csv.salary) AS total_salary]]\
\n TableScan: employee_csv projection=[state, salary]";
assert_eq!(expected, format!("{:?}", plan));
@@ -1132,7 +1132,7 @@ mod tests {
])?
.build()?;
- let expected = "Sort: #employee_csv.state ASC NULLS FIRST, #employee_csv.salary DESC NULLS LAST\
+ let expected = "Sort: employee_csv.state ASC NULLS FIRST, employee_csv.salary DESC NULLS LAST\
\n TableScan: employee_csv projection=[state, salary]";
assert_eq!(expected, format!("{:?}", plan));
@@ -1150,8 +1150,8 @@ mod tests {
.build()?;
// id column should only show up once in projection
- let expected = "Projection: #t1.id, #t1.first_name, #t1.last_name, #t1.state, #t1.salary, #t2.first_name, #t2.last_name, #t2.state, #t2.salary\
- \n Inner Join: Using #t1.id = #t2.id\
+ let expected = "Projection: t1.id, t1.first_name, t1.last_name, t1.state, t1.salary, t2.first_name, t2.last_name, t2.state, t2.salary\
+ \n Inner Join: Using t1.id = t2.id\
\n TableScan: t1\
\n TableScan: t2";
@@ -1235,8 +1235,8 @@ mod tests {
let expected = "\
Distinct:\
- \n Projection: #employee_csv.id\
- \n Filter: #employee_csv.state = Utf8(\"CO\")\
+ \n Projection: employee_csv.id\
+ \n Filter: employee_csv.state = Utf8(\"CO\")\
\n TableScan: employee_csv projection=[id, state]";
assert_eq!(expected, format!("{:?}", plan));
@@ -1261,10 +1261,10 @@ mod tests {
let expected = "Filter: EXISTS (<subquery>)\
\n Subquery:\
- \n Filter: #foo.a = #bar.a\
- \n Projection: #foo.a\
+ \n Filter: foo.a = bar.a\
+ \n Projection: foo.a\
\n TableScan: foo\
- \n Projection: #bar.a\
+ \n Projection: bar.a\
\n TableScan: bar";
assert_eq!(expected, format!("{:?}", outer_query));
@@ -1287,12 +1287,12 @@ mod tests {
.filter(in_subquery(col("a"), Arc::new(subquery)))?
.build()?;
- let expected = "Filter: #bar.a IN (<subquery>)\
+ let expected = "Filter: bar.a IN (<subquery>)\
\n Subquery:\
- \n Filter: #foo.a = #bar.a\
- \n Projection: #foo.a\
+ \n Filter: foo.a = bar.a\
+ \n Projection: foo.a\
\n TableScan: foo\
- \n Projection: #bar.a\
+ \n Projection: bar.a\
\n TableScan: bar";
assert_eq!(expected, format!("{:?}", outer_query));
@@ -1316,8 +1316,8 @@ mod tests {
let expected = "Projection: (<subquery>)\
\n Subquery:\
- \n Filter: #foo.a = #bar.a\
- \n Projection: #foo.b\
+ \n Filter: foo.a = bar.a\
+ \n Projection: foo.b\
\n TableScan: foo\
\n TableScan: bar";
assert_eq!(expected, format!("{:?}", outer_query));
diff --git a/datafusion/expr/src/logical_plan/display.rs b/datafusion/expr/src/logical_plan/display.rs
index 66c7328f71..757d130d48 100644
--- a/datafusion/expr/src/logical_plan/display.rs
+++ b/datafusion/expr/src/logical_plan/display.rs
@@ -22,8 +22,8 @@ use std::fmt;
/// Formats plans with a single line per node. For example:
///
-/// Projection: #id
-/// Filter: #state Eq Utf8(\"CO\")\
+/// Projection: id
+/// Filter: state Eq Utf8(\"CO\")\
/// CsvScan: employee.csv projection=Some([0, 3])";
pub struct IndentVisitor<'a, 'b> {
f: &'a mut fmt::Formatter<'b>,
diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs
index a803f569cc..896f79a20e 100644
--- a/datafusion/expr/src/logical_plan/plan.rs
+++ b/datafusion/expr/src/logical_plan/plan.rs
@@ -352,8 +352,8 @@ impl LogicalPlan {
/// For example, for a logical plan like:
///
/// ```text
-/// Projection: #id
-/// Filter: #state Eq Utf8(\"CO\")\
+/// Projection: id
+/// Filter: state Eq Utf8(\"CO\")\
/// CsvScan: employee.csv projection=Some([0, 3])";
/// ```
///
@@ -520,8 +520,8 @@ impl LogicalPlan {
/// per node. For example:
///
/// ```text
- /// Projection: #employee.id
- /// Filter: #employee.state Eq Utf8(\"CO\")\
+ /// Projection: employee.id
+ /// Filter: employee.state Eq Utf8(\"CO\")\
/// CsvScan: employee projection=Some([0, 3])
/// ```
///
@@ -538,7 +538,7 @@ impl LogicalPlan {
/// // Format using display_indent
/// let display_string = format!("{}", plan.display_indent());
///
- /// assert_eq!("Filter: #t1.id = Int32(5)\n TableScan: t1",
+ /// assert_eq!("Filter: t1.id = Int32(5)\n TableScan: t1",
/// display_string);
/// ```
pub fn display_indent(&self) -> impl fmt::Display + '_ {
@@ -562,8 +562,8 @@ impl LogicalPlan {
/// per node that includes the output schema. For example:
///
/// ```text
- /// Projection: #employee.id [id:Int32]\
- /// Filter: #employee.state = Utf8(\"CO\") [id:Int32, state:Utf8]\
+ /// Projection: employee.id [id:Int32]\
+ /// Filter: employee.state = Utf8(\"CO\") [id:Int32, state:Utf8]\
/// TableScan: employee projection=[0, 3] [id:Int32, state:Utf8]";
/// ```
///
@@ -580,7 +580,7 @@ impl LogicalPlan {
/// // Format using display_indent_schema
/// let display_string = format!("{}", plan.display_indent_schema());
///
- /// assert_eq!("Filter: #t1.id = Int32(5) [id:Int32]\
+ /// assert_eq!("Filter: t1.id = Int32(5) [id:Int32]\
/// \n TableScan: t1 [id:Int32]",
/// display_string);
/// ```
@@ -666,7 +666,7 @@ impl LogicalPlan {
/// children. For example:
///
/// ```text
- /// Projection: #id
+ /// Projection: id
/// ```
/// ```
/// use arrow::datatypes::{Field, Schema, DataType};
@@ -1573,8 +1573,8 @@ mod tests {
fn test_display_indent() -> Result<()> {
let plan = display_plan()?;
- let expected = "Projection: #employee_csv.id\
- \n Filter: #employee_csv.state IN (<subquery>)\
+ let expected = "Projection: employee_csv.id\
+ \n Filter: employee_csv.state IN (<subquery>)\
\n Subquery:\
\n TableScan: employee_csv projection=[state]\
\n TableScan: employee_csv projection=[id, state]";
@@ -1587,8 +1587,8 @@ mod tests {
fn test_display_indent_schema() -> Result<()> {
let plan = display_plan()?;
- let expected = "Projection: #employee_csv.id [id:Int32]\
- \n Filter: #employee_csv.state IN (<subquery>) [id:Int32, state:Utf8]\
+ let expected = "Projection: employee_csv.id [id:Int32]\
+ \n Filter: employee_csv.state IN (<subquery>) [id:Int32, state:Utf8]\
\n Subquery: [state:Utf8]\
\n TableScan: employee_csv projection=[state] [state:Utf8]\
\n TableScan: employee_csv projection=[id, state] [id:Int32, state:Utf8]";
diff --git a/datafusion/expr/src/utils.rs b/datafusion/expr/src/utils.rs
index 4ace809b81..21f2c95f6a 100644
--- a/datafusion/expr/src/utils.rs
+++ b/datafusion/expr/src/utils.rs
@@ -589,7 +589,7 @@ pub fn exprlist_to_fields<'a>(
let exprs: Vec<Expr> = expr.into_iter().cloned().collect();
// when dealing with aggregate plans we cannot simply look in the aggregate output schema
// because it will contain columns representing complex expressions (such a column named
- // `#GROUPING(person.state)` so in order to resolve `person.state` in this case we need to
+ // `GROUPING(person.state)` so in order to resolve `person.state` in this case we need to
// look at the input to the aggregate instead.
let fields = match plan {
LogicalPlan::Aggregate(agg) => {
@@ -625,7 +625,7 @@ pub fn exprlist_to_fields<'a>(
///
/// ```text
/// .aggregate(vec![col("c1")], vec![sum(col("c2"))])?
-/// .project(vec![col("c1"), col("SUM(#c2)")?
+/// .project(vec![col("c1"), col("SUM(c2)")?
/// ```
pub fn columnize_expr(e: Expr, input_schema: &DFSchema) -> Expr {
match e {
diff --git a/datafusion/optimizer/src/common_subexpr_eliminate.rs b/datafusion/optimizer/src/common_subexpr_eliminate.rs
index b17dd9492e..d2b30e77f8 100644
--- a/datafusion/optimizer/src/common_subexpr_eliminate.rs
+++ b/datafusion/optimizer/src/common_subexpr_eliminate.rs
@@ -609,13 +609,13 @@ mod test {
expr_to_identifier(&expr, &mut HashMap::new(), &mut id_array, DataType::Int64)?;
let expected = vec![
- (9, "SUM(#a + Utf8(\"1\")) - AVG(#c) * Int32(2)Int32(2)SUM(#a + Utf8(\"1\")) - AVG(#c)AVG(#c)#cSUM(#a + Utf8(\"1\"))#a + Utf8(\"1\")Utf8(\"1\")#a"),
- (7, "SUM(#a + Utf8(\"1\")) - AVG(#c)AVG(#c)#cSUM(#a + Utf8(\"1\"))#a + Utf8(\"1\")Utf8(\"1\")#a"),
- (4, "SUM(#a + Utf8(\"1\"))#a + Utf8(\"1\")Utf8(\"1\")#a"),
- (3, "#a + Utf8(\"1\")Utf8(\"1\")#a"),
+ (9, "SUM(a + Utf8(\"1\")) - AVG(c) * Int32(2)Int32(2)SUM(a + Utf8(\"1\")) - AVG(c)AVG(c)cSUM(a + Utf8(\"1\"))a + Utf8(\"1\")Utf8(\"1\")a"),
+ (7, "SUM(a + Utf8(\"1\")) - AVG(c)AVG(c)cSUM(a + Utf8(\"1\"))a + Utf8(\"1\")Utf8(\"1\")a"),
+ (4, "SUM(a + Utf8(\"1\"))a + Utf8(\"1\")Utf8(\"1\")a"),
+ (3, "a + Utf8(\"1\")Utf8(\"1\")a"),
(1, ""),
(2, ""),
- (6, "AVG(#c)#c"),
+ (6, "AVG(c)c"),
(5, ""),
(8, "")
]
@@ -661,8 +661,8 @@ mod test {
)?
.build()?;
- let expected = "Aggregate: groupBy=[[]], aggr=[[SUM(##test.a * Int32(1) - #test.bInt32(1) - #test.b#test.bInt32(1)#test.a AS test.a * Int32(1) - test.b), SUM(##test.a * Int32(1) - #test.bInt32(1) - #test.b#test.bInt32(1)#test.a AS test.a * Int32(1) - test.b * Int32(1) + #test.c)]]\
- \n Projection: #test.a * Int32(1) - #test.b AS #test.a * Int32(1) - #test.bInt32(1) - #test.b#test.bInt32(1)#test.a, #test.a, #test.b, #test.c\
+ let expected = "Aggregate: groupBy=[[]], aggr=[[SUM(test.a * Int32(1) - test.bInt32(1) - test.btest.bInt32(1)test.a AS test.a * Int32(1) - test.b), SUM(test.a * Int32(1) - test.bInt32(1) - test.btest.bInt32(1)test.a AS test.a * Int32(1) - test.b * Int32(1) + test.c)]]\
+ \n Projection: test.a * Int32(1) - test.b AS test.a * Int32(1) - test.bInt32(1) - test.btest.bInt32(1)test.a, test.a, test.b, test.c\
\n TableScan: test";
assert_optimized_plan_eq(expected, &plan);
@@ -684,8 +684,8 @@ mod test {
)?
.build()?;
- let expected = "Aggregate: groupBy=[[]], aggr=[[Int32(1) + #AVG(#test.a)#test.a AS AVG(test.a), Int32(1) - #AVG(#test.a)#test.a AS AVG(test.a)]]\
- \n Projection: AVG(#test.a) AS AVG(#test.a)#test.a, #test.a, #test.b, #test.c\
+ let expected = "Aggregate: groupBy=[[]], aggr=[[Int32(1) + AVG(test.a)test.a AS AVG(test.a), Int32(1) - AVG(test.a)test.a AS AVG(test.a)]]\
+ \n Projection: AVG(test.a) AS AVG(test.a)test.a, test.a, test.b, test.c\
\n TableScan: test";
assert_optimized_plan_eq(expected, &plan);
@@ -704,8 +704,8 @@ mod test {
])?
.build()?;
- let expected = "Projection: #Int32(1) + #test.a#test.aInt32(1) AS Int32(1) + test.a AS first, #Int32(1) + #test.a#test.aInt32(1) AS Int32(1) + test.a AS second\
- \n Projection: Int32(1) + #test.a AS Int32(1) + #test.a#test.aInt32(1), #test.a, #test.b, #test.c\
+ let expected = "Projection: Int32(1) + test.atest.aInt32(1) AS Int32(1) + test.a AS first, Int32(1) + test.atest.aInt32(1) AS Int32(1) + test.a AS second\
+ \n Projection: Int32(1) + test.a AS Int32(1) + test.atest.aInt32(1), test.a, test.b, test.c\
\n TableScan: test";
assert_optimized_plan_eq(expected, &plan);
@@ -724,7 +724,7 @@ mod test {
])?
.build()?;
- let expected = "Projection: Int32(1) + #test.a, #test.a + Int32(1)\
+ let expected = "Projection: Int32(1) + test.a, test.a + Int32(1)\
\n TableScan: test";
assert_optimized_plan_eq(expected, &plan);
@@ -741,8 +741,8 @@ mod test {
.project(vec![binary_expr(lit(1), Operator::Plus, col("a"))])?
.build()?;
- let expected = "Projection: #Int32(1) + test.a\
- \n Projection: Int32(1) + #test.a\
+ let expected = "Projection: Int32(1) + test.a\
+ \n Projection: Int32(1) + test.a\
\n TableScan: test";
assert_optimized_plan_eq(expected, &plan);
diff --git a/datafusion/optimizer/src/decorrelate_where_exists.rs b/datafusion/optimizer/src/decorrelate_where_exists.rs
index 90fff3f800..485ab0f6e7 100644
--- a/datafusion/optimizer/src/decorrelate_where_exists.rs
+++ b/datafusion/optimizer/src/decorrelate_where_exists.rs
@@ -218,9 +218,9 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #orders.o_custkey [c_custkey:Int64, c_name:Utf8]
- Semi Join: #customer.c_custkey = #orders.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = orders.o_custkey [c_custkey:Int64, c_name:Utf8]
+ Semi Join: customer.c_custkey = orders.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
@@ -254,10 +254,10 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #orders.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = orders.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Semi Join: #orders.o_orderkey = #lineitem.l_orderkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Semi Join: orders.o_orderkey = lineitem.l_orderkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: lineitem [l_orderkey:Int64, l_partkey:Int64, l_suppkey:Int64, l_linenumber:Int32, l_quantity:Float64, l_extendedprice:Float64]"#;
@@ -284,10 +284,10 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #orders.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = orders.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Filter: #orders.o_orderkey = Int32(1) [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Filter: orders.o_orderkey = Int32(1) [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&DecorrelateWhereExists::new(), &plan, expected);
@@ -439,8 +439,8 @@ mod tests {
.build()?;
// Doesn't matter we projected an expression, just that we returned a result
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #orders.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = orders.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
@@ -462,9 +462,9 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
- Semi Join: #customer.c_custkey = #orders.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
+ Semi Join: customer.c_custkey = orders.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
@@ -488,11 +488,11 @@ mod tests {
.build()?;
// not optimized
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: EXISTS (<subquery>) OR #customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: EXISTS (<subquery>) OR customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
Subquery: [o_custkey:Int64]
- Projection: #orders.o_custkey [o_custkey:Int64]
- Filter: #customer.c_custkey = #orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: orders.o_custkey [o_custkey:Int64]
+ Filter: customer.c_custkey = orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]"#;
@@ -515,8 +515,8 @@ mod tests {
.project(vec![col("test.c")])?
.build()?;
- let expected = r#"Projection: #test.c [c:UInt32]
- Semi Join: #test.a = #sq.a [a:UInt32, b:UInt32, c:UInt32]
+ let expected = r#"Projection: test.c [c:UInt32]
+ Semi Join: test.a = sq.a [a:UInt32, b:UInt32, c:UInt32]
TableScan: test [a:UInt32, b:UInt32, c:UInt32]
TableScan: sq [a:UInt32, b:UInt32, c:UInt32]"#;
diff --git a/datafusion/optimizer/src/decorrelate_where_in.rs b/datafusion/optimizer/src/decorrelate_where_in.rs
index 5da7d80c16..d5af0911d3 100644
--- a/datafusion/optimizer/src/decorrelate_where_in.rs
+++ b/datafusion/optimizer/src/decorrelate_where_in.rs
@@ -260,13 +260,13 @@ mod tests {
.build()?;
debug!("plan to optimize:\n{}", plan.display_indent());
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #__sq_2.o_custkey [c_custkey:Int64, c_name:Utf8]
- Semi Join: #customer.c_custkey = #__sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = __sq_2.o_custkey [c_custkey:Int64, c_name:Utf8]
+ Semi Join: customer.c_custkey = __sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
+ Projection: orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
- Projection: #orders.o_custkey AS o_custkey, alias=__sq_2 [o_custkey:Int64]
+ Projection: orders.o_custkey AS o_custkey, alias=__sq_2 [o_custkey:Int64]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
Ok(())
@@ -298,13 +298,13 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #__sq_2.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = __sq_2.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey AS o_custkey, alias=__sq_2 [o_custkey:Int64]
- Semi Join: #orders.o_orderkey = #__sq_1.l_orderkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: orders.o_custkey AS o_custkey, alias=__sq_2 [o_custkey:Int64]
+ Semi Join: orders.o_orderkey = __sq_1.l_orderkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
- Projection: #lineitem.l_orderkey AS l_orderkey, alias=__sq_1 [l_orderkey:Int64]
+ Projection: lineitem.l_orderkey AS l_orderkey, alias=__sq_1 [l_orderkey:Int64]
TableScan: lineitem [l_orderkey:Int64, l_partkey:Int64, l_suppkey:Int64, l_linenumber:Int32, l_quantity:Float64, l_extendedprice:Float64]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
@@ -330,11 +330,11 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #__sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = __sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
- Filter: #orders.o_orderkey = Int32(1) [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
+ Filter: orders.o_orderkey = Int32(1) [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
@@ -357,11 +357,11 @@ mod tests {
.build()?;
// Query will fail, but we can still transform the plan
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #__sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = __sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
- Filter: #customer.c_custkey = #customer.c_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
+ Filter: customer.c_custkey = customer.c_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
@@ -383,11 +383,11 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #__sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = __sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
- Filter: #orders.o_custkey = #orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
+ Filter: orders.o_custkey = orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
@@ -409,10 +409,10 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Semi Join: #customer.c_custkey = #__sq_1.o_custkey Filter: #customer.c_custkey != #orders.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Semi Join: customer.c_custkey = __sq_1.o_custkey Filter: customer.c_custkey != orders.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
+ Projection: orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
@@ -585,11 +585,11 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
- Semi Join: #customer.c_custkey = #__sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
+ Semi Join: customer.c_custkey = __sq_1.o_custkey [c_custkey:Int64, c_name:Utf8]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
+ Projection: orders.o_custkey AS o_custkey, alias=__sq_1 [o_custkey:Int64]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
@@ -615,11 +615,11 @@ mod tests {
.build()?;
// TODO: support disjunction - for now expect unaltered plan
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_custkey IN (<subquery>) OR #customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_custkey IN (<subquery>) OR customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
Subquery: [o_custkey:Int64]
- Projection: #orders.o_custkey [o_custkey:Int64]
- Filter: #customer.c_custkey = #orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: orders.o_custkey [o_custkey:Int64]
+ Filter: customer.c_custkey = orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]"#;
@@ -642,10 +642,10 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = r#"Projection: #test.b [b:UInt32]
- Semi Join: #test.c = #__sq_1.c, #test.a = #__sq_1.a [a:UInt32, b:UInt32, c:UInt32]
+ let expected = r#"Projection: test.b [b:UInt32]
+ Semi Join: test.c = __sq_1.c, test.a = __sq_1.a [a:UInt32, b:UInt32, c:UInt32]
TableScan: test [a:UInt32, b:UInt32, c:UInt32]
- Projection: #sq.c AS c, #sq.a AS a, alias=__sq_1 [c:UInt32, a:UInt32]
+ Projection: sq.c AS c, sq.a AS a, alias=__sq_1 [c:UInt32, a:UInt32]
TableScan: sq [a:UInt32, b:UInt32, c:UInt32]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
@@ -661,10 +661,10 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = r#"Projection: #test.b [b:UInt32]
- Semi Join: #test.c = #__sq_1.c [a:UInt32, b:UInt32, c:UInt32]
+ let expected = r#"Projection: test.b [b:UInt32]
+ Semi Join: test.c = __sq_1.c [a:UInt32, b:UInt32, c:UInt32]
TableScan: test [a:UInt32, b:UInt32, c:UInt32]
- Projection: #sq.c AS c, alias=__sq_1 [c:UInt32]
+ Projection: sq.c AS c, alias=__sq_1 [c:UInt32]
TableScan: sq [a:UInt32, b:UInt32, c:UInt32]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
@@ -680,10 +680,10 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = r#"Projection: #test.b [b:UInt32]
- Anti Join: #test.c = #__sq_1.c [a:UInt32, b:UInt32, c:UInt32]
+ let expected = r#"Projection: test.b [b:UInt32]
+ Anti Join: test.c = __sq_1.c [a:UInt32, b:UInt32, c:UInt32]
TableScan: test [a:UInt32, b:UInt32, c:UInt32]
- Projection: #sq.c AS c, alias=__sq_1 [c:UInt32]
+ Projection: sq.c AS c, alias=__sq_1 [c:UInt32]
TableScan: sq [a:UInt32, b:UInt32, c:UInt32]"#;
assert_optimized_plan_eq(&DecorrelateWhereIn::new(), &plan, expected);
diff --git a/datafusion/optimizer/src/eliminate_filter.rs b/datafusion/optimizer/src/eliminate_filter.rs
index 10175c1878..61e9613cfa 100644
--- a/datafusion/optimizer/src/eliminate_filter.rs
+++ b/datafusion/optimizer/src/eliminate_filter.rs
@@ -132,7 +132,7 @@ mod tests {
// Left side is removed
let expected = "Union\
\n EmptyRelation\
- \n Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b)]]\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[SUM(test.b)]]\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
}
@@ -150,7 +150,7 @@ mod tests {
.build()
.unwrap();
- let expected = "Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b)]]\
+ let expected = "Aggregate: groupBy=[[test.a]], aggr=[[SUM(test.b)]]\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
}
@@ -177,9 +177,9 @@ mod tests {
// Filter is removed
let expected = "Union\
- \n Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b)]]\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[SUM(test.b)]]\
\n TableScan: test\
- \n Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b)]]\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[SUM(test.b)]]\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
}
@@ -208,7 +208,7 @@ mod tests {
.unwrap();
// Filter is removed
- let expected = "Projection: #test.a\
+ let expected = "Projection: test.a\
\n EmptyRelation";
assert_optimized_plan_eq(&plan, expected);
}
diff --git a/datafusion/optimizer/src/eliminate_limit.rs b/datafusion/optimizer/src/eliminate_limit.rs
index 45011070b4..2deea4eb9f 100644
--- a/datafusion/optimizer/src/eliminate_limit.rs
+++ b/datafusion/optimizer/src/eliminate_limit.rs
@@ -203,7 +203,7 @@ mod tests {
// Left side is removed
let expected = "Union\
\n EmptyRelation\
- \n Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b)]]\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[SUM(test.b)]]\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
}
@@ -243,7 +243,7 @@ mod tests {
.unwrap();
let expected = "Limit: skip=2, fetch=1\
- \n Sort: #test.a\
+ \n Sort: test.a\
\n EmptyRelation";
assert_optimized_plan_eq(&plan, expected);
}
@@ -264,9 +264,9 @@ mod tests {
.unwrap();
let expected = "Limit: skip=0, fetch=1\
- \n Sort: #test.a\
+ \n Sort: test.a\
\n Limit: skip=0, fetch=2\
- \n Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b)]]\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[SUM(test.b)]]\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
}
@@ -287,7 +287,7 @@ mod tests {
.unwrap();
let expected = "Limit: skip=3, fetch=1\
- \n Sort: #test.a\
+ \n Sort: test.a\
\n EmptyRelation";
assert_optimized_plan_eq(&plan, expected);
}
@@ -311,7 +311,7 @@ mod tests {
.unwrap();
let expected = "Limit: skip=3, fetch=1\
- \n Inner Join: Using #test.a = #test1.a\
+ \n Inner Join: Using test.a = test1.a\
\n Limit: skip=2, fetch=1\
\n TableScan: test\
\n TableScan: test1";
@@ -329,7 +329,7 @@ mod tests {
.build()
.unwrap();
- let expected = "Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b)]]\
+ let expected = "Aggregate: groupBy=[[test.a]], aggr=[[SUM(test.b)]]\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
}
diff --git a/datafusion/optimizer/src/filter_null_join_keys.rs b/datafusion/optimizer/src/filter_null_join_keys.rs
index cd64ea9dab..4d237dd04a 100644
--- a/datafusion/optimizer/src/filter_null_join_keys.rs
+++ b/datafusion/optimizer/src/filter_null_join_keys.rs
@@ -159,8 +159,8 @@ mod tests {
fn left_nullable() -> Result<()> {
let (t1, t2) = test_tables()?;
let plan = build_plan(t1, t2, "t1.optional_id", "t2.id")?;
- let expected = "Inner Join: #t1.optional_id = #t2.id\
- \n Filter: #t1.optional_id IS NOT NULL\
+ let expected = "Inner Join: t1.optional_id = t2.id\
+ \n Filter: t1.optional_id IS NOT NULL\
\n TableScan: t1\
\n TableScan: t2";
assert_optimized_plan_eq(&plan, expected);
@@ -171,8 +171,8 @@ mod tests {
fn left_nullable_on_condition_reversed() -> Result<()> {
let (t1, t2) = test_tables()?;
let plan = build_plan(t1, t2, "t2.id", "t1.optional_id")?;
- let expected = "Inner Join: #t1.optional_id = #t2.id\
- \n Filter: #t1.optional_id IS NOT NULL\
+ let expected = "Inner Join: t1.optional_id = t2.id\
+ \n Filter: t1.optional_id IS NOT NULL\
\n TableScan: t1\
\n TableScan: t2";
assert_optimized_plan_eq(&plan, expected);
@@ -206,11 +206,11 @@ mod tests {
None,
)?
.build()?;
- let expected = "Inner Join: #t3.t1_id = #t1.id, #t3.t2_id = #t2.id\
- \n Filter: #t3.t1_id IS NOT NULL AND #t3.t2_id IS NOT NULL\
+ let expected = "Inner Join: t3.t1_id = t1.id, t3.t2_id = t2.id\
+ \n Filter: t3.t1_id IS NOT NULL AND t3.t2_id IS NOT NULL\
\n TableScan: t3\
- \n Inner Join: #t1.optional_id = #t2.id\
- \n Filter: #t1.optional_id IS NOT NULL\
+ \n Inner Join: t1.optional_id = t2.id\
+ \n Filter: t1.optional_id IS NOT NULL\
\n TableScan: t1\
\n TableScan: t2";
assert_optimized_plan_eq(&plan, expected);
diff --git a/datafusion/optimizer/src/filter_push_down.rs b/datafusion/optimizer/src/filter_push_down.rs
index a91177b46b..6383cdcf85 100644
--- a/datafusion/optimizer/src/filter_push_down.rs
+++ b/datafusion/optimizer/src/filter_push_down.rs
@@ -42,13 +42,13 @@ use std::iter::once;
/// the closest possible to the scans, re-writing the filter expressions by every
/// projection that changes the filter's expression.
///
-/// Filter: #b Gt Int64(10)
-/// Projection: #a AS b
+/// Filter: b Gt Int64(10)
+/// Projection: a AS b
///
/// is optimized to
///
-/// Projection: #a AS b
-/// Filter: #a Gt Int64(10) <--- changed from #b to #a
+/// Projection: a AS b
+/// Filter: a Gt Int64(10) <--- changed from b to a
///
/// This performs a single pass through the plan. When it passes through a filter, it stores that filter,
/// and when it reaches a node that does not commute with it, it adds the filter to that place.
@@ -384,7 +384,7 @@ fn optimize(plan: &LogicalPlan, mut state: State) -> Result<LogicalPlan> {
.collect::<HashMap<_, _>>();
// re-write all filters based on this projection
- // E.g. in `Filter: #b\n Projection: #a > 1 as b`, we can swap them, but the filter must be "#a > 1"
+ // E.g. in `Filter: b\n Projection: a > 1 as b`, we can swap them, but the filter must be "a > 1"
for (predicate, columns) in state.filters.iter_mut() {
*predicate = replace_cols_by_name(predicate.clone(), &projection)?;
@@ -679,8 +679,8 @@ mod tests {
.build()?;
// filter is before projection
let expected = "\
- Projection: #test.a, #test.b\
- \n Filter: #test.a = Int64(1)\
+ Projection: test.a, test.b\
+ \n Filter: test.a = Int64(1)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -696,9 +696,9 @@ mod tests {
.build()?;
// filter is before single projection
let expected = "\
- Filter: #test.a = Int64(1)\
+ Filter: test.a = Int64(1)\
\n Limit: skip=0, fetch=10\
- \n Projection: #test.a, #test.b\
+ \n Projection: test.a, test.b\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -727,9 +727,9 @@ mod tests {
.build()?;
// filter is before double projection
let expected = "\
- Projection: #test.c, #test.b\
- \n Projection: #test.a, #test.b, #test.c\
- \n Filter: #test.a = Int64(1)\
+ Projection: test.c, test.b\
+ \n Projection: test.a, test.b, test.c\
+ \n Filter: test.a = Int64(1)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -744,8 +744,8 @@ mod tests {
.build()?;
// filter of key aggregation is commutative
let expected = "\
- Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b) AS total_salary]]\
- \n Filter: #test.a > Int64(10)\
+ Aggregate: groupBy=[[test.a]], aggr=[[SUM(test.b) AS total_salary]]\
+ \n Filter: test.a > Int64(10)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -760,8 +760,8 @@ mod tests {
.build()?;
// filter of aggregate is after aggregation since they are non-commutative
let expected = "\
- Filter: #b > Int64(10)\
- \n Aggregate: groupBy=[[#test.a]], aggr=[[SUM(#test.b) AS b]]\
+ Filter: b > Int64(10)\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[SUM(test.b) AS b]]\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -777,8 +777,8 @@ mod tests {
.build()?;
// filter is before projection
let expected = "\
- Projection: #test.a AS b, #test.c\
- \n Filter: #test.a = Int64(1)\
+ Projection: test.a AS b, test.c\
+ \n Filter: test.a = Int64(1)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -816,15 +816,15 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #b = Int64(1)\
- \n Projection: #test.a * Int32(2) + #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"
);
// filter is before projection
let expected = "\
- Projection: #test.a * Int32(2) + #test.c AS b, #test.c\
- \n Filter: #test.a * Int32(2) + #test.c = 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";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -848,17 +848,17 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- 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\
+ 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"
);
// filter is before the projections
let expected = "\
- 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)\
+ 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";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -881,19 +881,19 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- 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\
+ 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"
);
// filter is before the projections
let expected = "\
- 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 > 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 > Int64(10)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -919,18 +919,18 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- 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\
+ 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"
);
// filter is before the projections
let expected = "\
- 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 > Int64(10)\
+ 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 > Int64(10)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -950,11 +950,11 @@ mod tests {
.build()?;
// filter does not just any of the limits
let expected = "\
- Projection: #test.a, #test.b\
- \n Filter: #test.a = Int64(1)\
+ Projection: test.a, test.b\
+ \n Filter: test.a = Int64(1)\
\n Limit: skip=0, fetch=10\
\n Limit: skip=0, fetch=20\
- \n Projection: #test.a, #test.b\
+ \n Projection: test.a, test.b\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -970,9 +970,9 @@ mod tests {
// filter appears below Union
let expected = "\
Union\
- \n Filter: #a = Int64(1)\
+ \n Filter: a = Int64(1)\
\n TableScan: test\
- \n Filter: #a = Int64(1)\
+ \n Filter: a = Int64(1)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -991,9 +991,9 @@ mod tests {
// filter appears below Union without relation qualifier
let expected = "\
Union\
- \n Filter: #a = Int64(1)\
+ \n Filter: a = Int64(1)\
\n TableScan: test\
- \n Filter: #a = Int64(1)\
+ \n Filter: a = Int64(1)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1013,11 +1013,11 @@ mod tests {
// filter appears below Union
let expected = "\
Union\
- \n Projection: #test.a AS b, alias=test2\
- \n Filter: #test.a = Int64(1)\
+ \n Projection: test.a AS b, alias=test2\
+ \n Filter: test.a = Int64(1)\
\n TableScan: test\
- \n Projection: #test.a AS b, alias=test2\
- \n Filter: #test.a = Int64(1)\
+ \n Projection: test.a AS b, alias=test2\
+ \n Filter: test.a = Int64(1)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1039,20 +1039,20 @@ mod tests {
// not part of the test
assert_eq!(
format!("{:?}", plan),
- "Filter: #test.a >= Int64(1)\
- \n Projection: #test.a\
+ "Filter: test.a >= Int64(1)\
+ \n Projection: test.a\
\n Limit: skip=0, fetch=1\
- \n Filter: #test.a <= Int64(1)\
- \n Projection: #test.a\
+ \n Filter: test.a <= Int64(1)\
+ \n Projection: test.a\
\n TableScan: test"
);
let expected = "\
- Projection: #test.a\
- \n Filter: #test.a >= Int64(1)\
+ Projection: test.a\
+ \n Filter: test.a >= Int64(1)\
\n Limit: skip=0, fetch=1\
- \n Projection: #test.a\
- \n Filter: #test.a <= Int64(1)\
+ \n Projection: test.a\
+ \n Filter: test.a <= Int64(1)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -1073,16 +1073,16 @@ mod tests {
// not part of the test
assert_eq!(
format!("{:?}", plan),
- "Projection: #test.a\
- \n Filter: #test.a >= Int64(1)\
- \n Filter: #test.a <= Int64(1)\
+ "Projection: test.a\
+ \n Filter: test.a >= Int64(1)\
+ \n Filter: test.a <= Int64(1)\
\n Limit: skip=0, fetch=1\
\n TableScan: test"
);
let expected = "\
- Projection: #test.a\
- \n Filter: #test.a >= Int64(1) AND #test.a <= Int64(1)\
+ Projection: test.a\
+ \n Filter: test.a >= Int64(1) AND test.a <= Int64(1)\
\n Limit: skip=0, fetch=1\
\n TableScan: test";
@@ -1103,7 +1103,7 @@ mod tests {
let expected = "\
TestUserDefined\
- \n Filter: #test.a <= Int64(1)\
+ \n Filter: test.a <= Int64(1)\
\n TableScan: test";
// not part of the test
@@ -1136,20 +1136,20 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.a <= Int64(1)\
- \n Inner Join: #test.a = #test2.a\
+ Filter: test.a <= Int64(1)\
+ \n Inner Join: test.a = test2.a\
\n TableScan: test\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2"
);
// filter sent to side before the join
let expected = "\
- Inner Join: #test.a = #test2.a\
- \n Filter: #test.a <= Int64(1)\
+ Inner Join: test.a = test2.a\
+ \n Filter: test.a <= Int64(1)\
\n TableScan: test\
- \n Projection: #test2.a\
- \n Filter: #test2.a <= Int64(1)\
+ \n Projection: test2.a\
+ \n Filter: test2.a <= Int64(1)\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1177,20 +1177,20 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.a <= Int64(1)\
- \n Inner Join: Using #test.a = #test2.a\
+ Filter: test.a <= Int64(1)\
+ \n Inner Join: Using test.a = test2.a\
\n TableScan: test\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2"
);
// filter sent to side before the join
let expected = "\
- Inner Join: Using #test.a = #test2.a\
- \n Filter: #test.a <= Int64(1)\
+ Inner Join: Using test.a = test2.a\
+ \n Filter: test.a <= Int64(1)\
\n TableScan: test\
- \n Projection: #test2.a\
- \n Filter: #test2.a <= Int64(1)\
+ \n Projection: test2.a\
+ \n Filter: test2.a <= Int64(1)\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1222,11 +1222,11 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.c <= #test2.b\
- \n Inner Join: #test.a = #test2.a\
- \n Projection: #test.a, #test.c\
+ Filter: test.c <= test2.b\
+ \n Inner Join: test.a = test2.a\
+ \n Projection: test.a, test.c\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b\
+ \n Projection: test2.a, test2.b\
\n TableScan: test2"
);
@@ -1262,20 +1262,20 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.b <= Int64(1)\
- \n Inner Join: #test.a = #test2.a\
- \n Projection: #test.a, #test.b\
+ Filter: test.b <= Int64(1)\
+ \n Inner Join: test.a = test2.a\
+ \n Projection: test.a, test.b\
\n TableScan: test\
- \n Projection: #test2.a, #test2.c\
+ \n Projection: test2.a, test2.c\
\n TableScan: test2"
);
let expected = "\
- Inner Join: #test.a = #test2.a\
- \n Projection: #test.a, #test.b\
- \n Filter: #test.b <= Int64(1)\
+ Inner Join: test.a = test2.a\
+ \n Projection: test.a, test.b\
+ \n Filter: test.b <= Int64(1)\
\n TableScan: test\
- \n Projection: #test2.a, #test2.c\
+ \n Projection: test2.a, test2.c\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1304,19 +1304,19 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test2.a <= Int64(1)\
- \n Left Join: Using #test.a = #test2.a\
+ Filter: test2.a <= Int64(1)\
+ \n Left Join: Using test.a = test2.a\
\n TableScan: test\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2"
);
// filter not duplicated nor pushed down - i.e. noop
let expected = "\
- Filter: #test2.a <= Int64(1)\
- \n Left Join: Using #test.a = #test2.a\
+ Filter: test2.a <= Int64(1)\
+ \n Left Join: Using test.a = test2.a\
\n TableScan: test\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1345,19 +1345,19 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.a <= Int64(1)\
- \n Right Join: Using #test.a = #test2.a\
+ Filter: test.a <= Int64(1)\
+ \n Right Join: Using test.a = test2.a\
\n TableScan: test\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2"
);
// filter not duplicated nor pushed down - i.e. noop
let expected = "\
- Filter: #test.a <= Int64(1)\
- \n Right Join: Using #test.a = #test2.a\
+ Filter: test.a <= Int64(1)\
+ \n Right Join: Using test.a = test2.a\
\n TableScan: test\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1386,19 +1386,19 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test.a <= Int64(1)\
- \n Left Join: Using #test.a = #test2.a\
+ Filter: test.a <= Int64(1)\
+ \n Left Join: Using test.a = test2.a\
\n TableScan: test\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2"
);
// filter sent to left side of the join, not the right
let expected = "\
- Left Join: Using #test.a = #test2.a\
- \n Filter: #test.a <= Int64(1)\
+ Left Join: Using test.a = test2.a\
+ \n Filter: test.a <= Int64(1)\
\n TableScan: test\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1427,19 +1427,19 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #test2.a <= Int64(1)\
- \n Right Join: Using #test.a = #test2.a\
+ Filter: test2.a <= Int64(1)\
+ \n Right Join: Using test.a = test2.a\
\n TableScan: test\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2"
);
// filter sent to right side of join, not duplicated to the left
let expected = "\
- Right Join: Using #test.a = #test2.a\
+ Right Join: Using test.a = test2.a\
\n TableScan: test\
- \n Projection: #test2.a\
- \n Filter: #test2.a <= Int64(1)\
+ \n Projection: test2.a\
+ \n Filter: test2.a <= Int64(1)\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1473,20 +1473,20 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Inner Join: #test.a = #test2.a Filter: #test.c > UInt32(1) AND #test.b < #test2.b AND #test2.c > UInt32(4)\
- \n Projection: #test.a, #test.b, #test.c\
+ Inner Join: test.a = test2.a Filter: test.c > UInt32(1) AND test.b < test2.b AND test2.c > UInt32(4)\
+ \n Projection: test.a, test.b, test.c\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b, #test2.c\
+ \n Projection: test2.a, test2.b, test2.c\
\n TableScan: test2"
);
let expected = "\
- Inner Join: #test.a = #test2.a Filter: #test.b < #test2.b\
- \n Projection: #test.a, #test.b, #test.c\
- \n Filter: #test.c > UInt32(1)\
+ Inner Join: test.a = test2.a Filter: test.b < test2.b\
+ \n Projection: test.a, test.b, test.c\
+ \n Filter: test.c > UInt32(1)\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b, #test2.c\
- \n Filter: #test2.c > UInt32(4)\
+ \n Projection: test2.a, test2.b, test2.c\
+ \n Filter: test2.c > UInt32(4)\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1519,20 +1519,20 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Inner Join: #test.a = #test2.a Filter: #test.b > UInt32(1) AND #test2.c > UInt32(4)\
- \n Projection: #test.a, #test.b, #test.c\
+ Inner Join: test.a = test2.a Filter: test.b > UInt32(1) AND test2.c > UInt32(4)\
+ \n Projection: test.a, test.b, test.c\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b, #test2.c\
+ \n Projection: test2.a, test2.b, test2.c\
\n TableScan: test2"
);
let expected = "\
- Inner Join: #test.a = #test2.a\
- \n Projection: #test.a, #test.b, #test.c\
- \n Filter: #test.b > UInt32(1)\
+ Inner Join: test.a = test2.a\
+ \n Projection: test.a, test.b, test.c\
+ \n Filter: test.b > UInt32(1)\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b, #test2.c\
- \n Filter: #test2.c > UInt32(4)\
+ \n Projection: test2.a, test2.b, test2.c\
+ \n Filter: test2.c > UInt32(4)\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1563,20 +1563,20 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Inner Join: #test.a = #test2.b Filter: #test.a > UInt32(1)\
- \n Projection: #test.a\
+ Inner Join: test.a = test2.b Filter: test.a > UInt32(1)\
+ \n Projection: test.a\
\n TableScan: test\
- \n Projection: #test2.b\
+ \n Projection: test2.b\
\n TableScan: test2"
);
let expected = "\
- Inner Join: #test.a = #test2.b\
- \n Projection: #test.a\
- \n Filter: #test.a > UInt32(1)\
+ Inner Join: test.a = test2.b\
+ \n Projection: test.a\
+ \n Filter: test.a > UInt32(1)\
\n TableScan: test\
- \n Projection: #test2.b\
- \n Filter: #test2.b > UInt32(1)\
+ \n Projection: test2.b\
+ \n Filter: test2.b > UInt32(1)\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1610,19 +1610,19 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Left Join: #test.a = #test2.a Filter: #test.a > UInt32(1) AND #test.b < #test2.b AND #test2.c > UInt32(4)\
- \n Projection: #test.a, #test.b, #test.c\
+ Left Join: test.a = test2.a Filter: test.a > UInt32(1) AND test.b < test2.b AND test2.c > UInt32(4)\
+ \n Projection: test.a, test.b, test.c\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b, #test2.c\
+ \n Projection: test2.a, test2.b, test2.c\
\n TableScan: test2"
);
let expected = "\
- Left Join: #test.a = #test2.a Filter: #test.a > UInt32(1) AND #test.b < #test2.b\
- \n Projection: #test.a, #test.b, #test.c\
+ Left Join: test.a = test2.a Filter: test.a > UInt32(1) AND test.b < test2.b\
+ \n Projection: test.a, test.b, test.c\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b, #test2.c\
- \n Filter: #test2.c > UInt32(4)\
+ \n Projection: test2.a, test2.b, test2.c\
+ \n Filter: test2.c > UInt32(4)\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1656,19 +1656,19 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Right Join: #test.a = #test2.a Filter: #test.a > UInt32(1) AND #test.b < #test2.b AND #test2.c > UInt32(4)\
- \n Projection: #test.a, #test.b, #test.c\
+ Right Join: test.a = test2.a Filter: test.a > UInt32(1) AND test.b < test2.b AND test2.c > UInt32(4)\
+ \n Projection: test.a, test.b, test.c\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b, #test2.c\
+ \n Projection: test2.a, test2.b, test2.c\
\n TableScan: test2"
);
let expected = "\
- Right Join: #test.a = #test2.a Filter: #test.b < #test2.b AND #test2.c > UInt32(4)\
- \n Projection: #test.a, #test.b, #test.c\
- \n Filter: #test.a > UInt32(1)\
+ Right Join: test.a = test2.a Filter: test.b < test2.b AND test2.c > UInt32(4)\
+ \n Projection: test.a, test.b, test.c\
+ \n Filter: test.a > UInt32(1)\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b, #test2.c\
+ \n Projection: test2.a, test2.b, test2.c\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1702,10 +1702,10 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Full Join: #test.a = #test2.a Filter: #test.a > UInt32(1) AND #test.b < #test2.b AND #test2.c > UInt32(4)\
- \n Projection: #test.a, #test.b, #test.c\
+ Full Join: test.a = test2.a Filter: test.a > UInt32(1) AND test.b < test2.b AND test2.c > UInt32(4)\
+ \n Projection: test.a, test.b, test.c\
\n TableScan: test\
- \n Projection: #test2.a, #test2.b, #test2.c\
+ \n Projection: test2.a, test2.b, test2.c\
\n TableScan: test2"
);
@@ -1777,7 +1777,7 @@ mod tests {
let plan = table_scan_with_pushdown_provider(TableProviderFilterPushDown::Exact)?;
let expected = "\
- TableScan: test, full_filters=[#a = Int64(1)]";
+ TableScan: test, full_filters=[a = Int64(1)]";
assert_optimized_plan_eq(&plan, expected);
Ok(())
}
@@ -1788,8 +1788,8 @@ mod tests {
table_scan_with_pushdown_provider(TableProviderFilterPushDown::Inexact)?;
let expected = "\
- Filter: #a = Int64(1)\
- \n TableScan: test, partial_filters=[#a = Int64(1)]";
+ Filter: a = Int64(1)\
+ \n TableScan: test, partial_filters=[a = Int64(1)]";
assert_optimized_plan_eq(&plan, expected);
Ok(())
}
@@ -1802,8 +1802,8 @@ mod tests {
let optimised_plan = optimize_plan(&plan);
let expected = "\
- Filter: #a = Int64(1)\
- \n TableScan: test, partial_filters=[#a = Int64(1)]";
+ Filter: a = Int64(1)\
+ \n TableScan: test, partial_filters=[a = Int64(1)]";
// Optimizing the same plan multiple times should produce the same plan
// each time.
@@ -1817,7 +1817,7 @@ mod tests {
table_scan_with_pushdown_provider(TableProviderFilterPushDown::Unsupported)?;
let expected = "\
- Filter: #a = Int64(1)\
+ Filter: a = Int64(1)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -1845,9 +1845,9 @@ mod tests {
.project(vec![col("a"), col("b")])?
.build()?;
- let expected ="Projection: #a, #b\
- \n Filter: #a = Int64(10) AND #b > Int64(11)\
- \n TableScan: test projection=[a], partial_filters=[#a = Int64(10), #b > Int64(11)]";
+ let expected ="Projection: a, b\
+ \n Filter: a = Int64(10) AND b > Int64(11)\
+ \n TableScan: test projection=[a], partial_filters=[a = Int64(10), b > Int64(11)]";
assert_optimized_plan_eq(&plan, expected);
@@ -1869,16 +1869,16 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #b > Int64(10) AND #test.c > Int64(10)\
- \n Projection: #test.a AS b, #test.c\
+ Filter: b > Int64(10) AND test.c > Int64(10)\
+ \n Projection: test.a AS b, test.c\
\n TableScan: test\
"
);
// rewrite filter col b to test.a
let expected = "\
- Projection: #test.a AS b, #test.c\
- \n Filter: #test.a > Int64(10) AND #test.c > Int64(10)\
+ Projection: test.a AS b, test.c\
+ \n Filter: test.a > Int64(10) AND test.c > Int64(10)\
\n TableScan: test\
";
@@ -1903,18 +1903,18 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #b > Int64(10) AND #test.c > Int64(10)\
- \n Projection: #b, #test.c\
- \n Projection: #test.a AS b, #test.c\
+ Filter: b > Int64(10) AND test.c > Int64(10)\
+ \n Projection: b, test.c\
+ \n Projection: test.a AS b, test.c\
\n TableScan: test\
"
);
// rewrite filter col b to test.a
let expected = "\
- Projection: #b, #test.c\
- \n Projection: #test.a AS b, #test.c\
- \n Filter: #test.a > Int64(10) AND #test.c > Int64(10)\
+ Projection: b, test.c\
+ \n Projection: test.a AS b, test.c\
+ \n Filter: test.a > Int64(10) AND test.c > Int64(10)\
\n TableScan: test\
";
@@ -1935,16 +1935,16 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #b > Int64(10) AND #d > Int64(10)\
- \n Projection: #test.a AS b, #test.c AS d\
+ Filter: b > Int64(10) AND d > Int64(10)\
+ \n Projection: test.a AS b, test.c AS d\
\n TableScan: test\
"
);
// rewrite filter col b to test.a, col d to test.c
let expected = "\
- Projection: #test.a AS b, #test.c AS d\
- \n Filter: #test.a > Int64(10) AND #test.c > Int64(10)\
+ Projection: test.a AS b, test.c AS d\
+ \n Filter: test.a > Int64(10) AND test.c > Int64(10)\
\n TableScan: test\
";
@@ -1977,21 +1977,21 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Inner Join: #c = #d Filter: #c > UInt32(1)\
- \n Projection: #test.a AS c\
+ Inner Join: c = d Filter: c > UInt32(1)\
+ \n Projection: test.a AS c\
\n TableScan: test\
- \n Projection: #test2.b AS d\
+ \n Projection: test2.b AS d\
\n TableScan: test2"
);
// Change filter on col `c`, 'd' to `test.a`, 'test.b'
let expected = "\
- Inner Join: #c = #d\
- \n Projection: #test.a AS c\
- \n Filter: #test.a > UInt32(1)\
+ Inner Join: c = d\
+ \n Projection: test.a AS c\
+ \n Filter: test.a > UInt32(1)\
\n TableScan: test\
- \n Projection: #test2.b AS d\
- \n Filter: #test2.b > UInt32(1)\
+ \n Projection: test2.b AS d\
+ \n Filter: test2.b > UInt32(1)\
\n TableScan: test2";
assert_optimized_plan_eq(&plan, expected);
Ok(())
@@ -2013,16 +2013,16 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #b IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
- \n Projection: #test.a AS b, #test.c\
+ Filter: b IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
+ \n Projection: test.a AS b, test.c\
\n TableScan: test\
"
);
// rewrite filter col b to test.a
let expected = "\
- Projection: #test.a AS b, #test.c\
- \n Filter: #test.a IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
+ Projection: test.a AS b, test.c\
+ \n Filter: test.a IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
\n TableScan: test\
";
@@ -2048,18 +2048,18 @@ mod tests {
assert_eq!(
format!("{:?}", plan),
"\
- Filter: #b IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
- \n Projection: #b, #test.c\
- \n Projection: #test.a AS b, #test.c\
+ Filter: b IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
+ \n Projection: b, test.c\
+ \n Projection: test.a AS b, test.c\
\n TableScan: test\
"
);
// rewrite filter col b to test.a
let expected = "\
- Projection: #b, #test.c\
- \n Projection: #test.a AS b, #test.c\
- \n Filter: #test.a IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
+ Projection: b, test.c\
+ \n Projection: test.a AS b, test.c\
+ \n Filter: test.a IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
\n TableScan: test\
";
@@ -2086,20 +2086,20 @@ mod tests {
// filter on col b in subquery
let expected_before = "\
- Filter: #b IN (<subquery>)\
+ Filter: b IN (<subquery>)\
\n Subquery:\
- \n Projection: #sq.c\
+ \n Projection: sq.c\
\n TableScan: sq\
- \n Projection: #test.a AS b, #test.c\
+ \n Projection: test.a AS b, test.c\
\n TableScan: test";
assert_eq!(format!("{:?}", plan), expected_before);
// rewrite filter col b to test.a
let expected_after = "\
- Projection: #test.a AS b, #test.c\
- \n Filter: #test.a IN (<subquery>)\
+ Projection: test.a AS b, test.c\
+ \n Filter: test.a IN (<subquery>)\
\n Subquery:\
- \n Projection: #sq.c\
+ \n Projection: sq.c\
\n TableScan: sq\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected_after);
@@ -2118,9 +2118,9 @@ mod tests {
.build()?;
let expected_before = "\
- Projection: #b.a\
- \n Filter: #b.a = Int64(1)\
- \n Projection: #b.a, alias=b\
+ Projection: b.a\
+ \n Filter: b.a = Int64(1)\
+ \n Projection: b.a, alias=b\
\n Projection: Int64(0) AS a, alias=b\
\n EmptyRelation";
assert_eq!(format!("{:?}", plan), expected_before);
@@ -2128,8 +2128,8 @@ mod tests {
// Ensure that the predicate without any columns (0 = 1) is
// still there.
let expected_after = "\
- Projection: #b.a\
- \n Projection: #b.a, alias=b\
+ Projection: b.a\
+ \n Projection: b.a, alias=b\
\n Projection: Int64(0) AS a, alias=b\
\n Filter: Int64(0) = Int64(1)\
\n EmptyRelation";
diff --git a/datafusion/optimizer/src/limit_push_down.rs b/datafusion/optimizer/src/limit_push_down.rs
index cacbbfc5b2..cf58fe35b5 100644
--- a/datafusion/optimizer/src/limit_push_down.rs
+++ b/datafusion/optimizer/src/limit_push_down.rs
@@ -392,7 +392,7 @@ mod test {
// Should push the limit down to table provider
// When it has a select
let expected = "Limit: skip=0, fetch=1000\
- \n Projection: #test.a\
+ \n Projection: test.a\
\n TableScan: test, fetch=1000";
assert_optimized_plan_eq(&plan, expected);
@@ -431,7 +431,7 @@ mod test {
// Limit should *not* push down aggregate node
let expected = "Limit: skip=0, fetch=1000\
- \n Aggregate: groupBy=[[#test.a]], aggr=[[MAX(#test.b)]]\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[MAX(test.b)]]\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -472,7 +472,7 @@ mod test {
// Should push down limit to sort
let expected = "Limit: skip=0, fetch=10\
- \n Sort: #test.a, fetch=10\
+ \n Sort: test.a, fetch=10\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -491,7 +491,7 @@ mod test {
// Should push down limit to sort
let expected = "Limit: skip=5, fetch=10\
- \n Sort: #test.a, fetch=15\
+ \n Sort: test.a, fetch=15\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -511,7 +511,7 @@ mod test {
// Limit should use deeper LIMIT 1000, but Limit 10 shouldn't push down aggregation
let expected = "Limit: skip=0, fetch=10\
- \n Aggregate: groupBy=[[#test.a]], aggr=[[MAX(#test.b)]]\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[MAX(test.b)]]\
\n Limit: skip=0, fetch=1000\
\n TableScan: test, fetch=1000";
@@ -548,7 +548,7 @@ mod test {
// Should push the limit down to table provider
// When it has a select
let expected = "Limit: skip=10, fetch=1000\
- \n Projection: #test.a\
+ \n Projection: test.a\
\n TableScan: test, fetch=1010";
assert_optimized_plan_eq(&plan, expected);
@@ -568,7 +568,7 @@ mod test {
let expected = "Limit: skip=10, fetch=None\
\n Limit: skip=0, fetch=1000\
- \n Projection: #test.a\
+ \n Projection: test.a\
\n TableScan: test, fetch=1000";
assert_optimized_plan_eq(&plan, expected);
@@ -588,7 +588,7 @@ mod test {
let expected = "Limit: skip=0, fetch=1000\
\n Limit: skip=10, fetch=1000\
- \n Projection: #test.a\
+ \n Projection: test.a\
\n TableScan: test, fetch=1010";
assert_optimized_plan_eq(&plan, expected);
@@ -630,7 +630,7 @@ mod test {
// Limit should *not* push down aggregate node
let expected = "Limit: skip=10, fetch=1000\
- \n Aggregate: groupBy=[[#test.a]], aggr=[[MAX(#test.b)]]\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[MAX(test.b)]]\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -677,7 +677,7 @@ mod test {
// Limit pushdown Not supported in Join
let expected = "Limit: skip=10, fetch=1000\
- \n Inner Join: #test.a = #test2.a\
+ \n Inner Join: test.a = test2.a\
\n TableScan: test\
\n TableScan: test2";
@@ -703,7 +703,7 @@ mod test {
// Limit pushdown Not supported in Join
let expected = "Limit: skip=10, fetch=1000\
- \n Inner Join: #test.a = #test2.a\
+ \n Inner Join: test.a = test2.a\
\n TableScan: test\
\n TableScan: test2";
@@ -732,10 +732,10 @@ mod test {
let expected = "Limit: skip=10, fetch=100\
\n Filter: EXISTS (<subquery>)\
\n Subquery:\
- \n Filter: #test1.a = #test1.a\
- \n Projection: #test1.a\
+ \n Filter: test1.a = test1.a\
+ \n Projection: test1.a\
\n TableScan: test1\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2";
assert_optimized_plan_eq(&outer_query, expected);
@@ -763,10 +763,10 @@ mod test {
let expected = "Limit: skip=10, fetch=100\
\n Filter: EXISTS (<subquery>)\
\n Subquery:\
- \n Filter: #test1.a = #test1.a\
- \n Projection: #test1.a\
+ \n Filter: test1.a = test1.a\
+ \n Projection: test1.a\
\n TableScan: test1\
- \n Projection: #test2.a\
+ \n Projection: test2.a\
\n TableScan: test2";
assert_optimized_plan_eq(&outer_query, expected);
@@ -791,7 +791,7 @@ mod test {
// Limit pushdown Not supported in Join
let expected = "Limit: skip=0, fetch=1000\
- \n Left Join: #test.a = #test2.a\
+ \n Left Join: test.a = test2.a\
\n TableScan: test, fetch=1000\
\n TableScan: test2";
@@ -817,7 +817,7 @@ mod test {
// Limit pushdown Not supported in Join
let expected = "Limit: skip=10, fetch=1000\
- \n Left Join: #test.a = #test2.a\
+ \n Left Join: test.a = test2.a\
\n TableScan: test, fetch=1010\
\n TableScan: test2";
@@ -843,7 +843,7 @@ mod test {
// Limit pushdown Not supported in Join
let expected = "Limit: skip=0, fetch=1000\
- \n Right Join: #test.a = #test2.a\
+ \n Right Join: test.a = test2.a\
\n TableScan: test\
\n TableScan: test2, fetch=1000";
@@ -869,7 +869,7 @@ mod test {
// Limit pushdown with offset supported in right outer join
let expected = "Limit: skip=10, fetch=1000\
- \n Right Join: #test.a = #test2.a\
+ \n Right Join: test.a = test2.a\
\n TableScan: test\
\n TableScan: test2, fetch=1010";
diff --git a/datafusion/optimizer/src/projection_push_down.rs b/datafusion/optimizer/src/projection_push_down.rs
index 86f73c061a..6ee9b5dc74 100644
--- a/datafusion/optimizer/src/projection_push_down.rs
+++ b/datafusion/optimizer/src/projection_push_down.rs
@@ -546,7 +546,7 @@ mod tests {
.aggregate(Vec::<Expr>::new(), vec![max(col("b"))])?
.build()?;
- let expected = "Aggregate: groupBy=[[]], aggr=[[MAX(#test.b)]]\
+ let expected = "Aggregate: groupBy=[[]], aggr=[[MAX(test.b)]]\
\n TableScan: test projection=[b]";
assert_optimized_plan_eq(&plan, expected);
@@ -562,7 +562,7 @@ mod tests {
.aggregate(vec![col("c")], vec![max(col("b"))])?
.build()?;
- let expected = "Aggregate: groupBy=[[#test.c]], aggr=[[MAX(#test.b)]]\
+ let expected = "Aggregate: groupBy=[[test.c]], aggr=[[MAX(test.b)]]\
\n TableScan: test projection=[b, c]";
assert_optimized_plan_eq(&plan, expected);
@@ -579,7 +579,7 @@ mod tests {
.aggregate(vec![col("c")], vec![max(col("b"))])?
.build()?;
- let expected = "Aggregate: groupBy=[[#a.c]], aggr=[[MAX(#a.b)]]\
+ let expected = "Aggregate: groupBy=[[a.c]], aggr=[[MAX(a.b)]]\
\n SubqueryAlias: a\
\n TableScan: test projection=[b, c]";
@@ -597,8 +597,8 @@ mod tests {
.aggregate(Vec::<Expr>::new(), vec![max(col("b"))])?
.build()?;
- let expected = "Aggregate: groupBy=[[]], aggr=[[MAX(#test.b)]]\
- \n Filter: #test.c\
+ let expected = "Aggregate: groupBy=[[]], aggr=[[MAX(test.b)]]\
+ \n Filter: test.c\
\n TableScan: test projection=[b, c]";
assert_optimized_plan_eq(&plan, expected);
@@ -614,7 +614,7 @@ mod tests {
.project(vec![col("a"), col("b"), col("c")])?
.project(vec![col("a"), col("c"), col("b")])?
.build()?;
- let expected = "Projection: #test.a, #test.c, #test.b\
+ let expected = "Projection: test.a, test.c, test.b\
\n TableScan: test projection=[a, b, c]";
assert_optimized_plan_eq(&plan, expected);
@@ -629,7 +629,7 @@ mod tests {
let plan = LogicalPlanBuilder::from(table_scan)
.project(vec![col("c"), col("b"), col("a")])?
.build()?;
- let expected = "Projection: #test.c, #test.b, #test.a\
+ let expected = "Projection: test.c, test.b, test.a\
\n TableScan: test projection=[a, b, c]";
assert_optimized_plan_eq(&plan, expected);
@@ -649,10 +649,10 @@ mod tests {
.filter(col("a").gt(lit(1)))?
.project(vec![col("a"), col("c"), col("b")])?
.build()?;
- let expected = "Projection: #test.a, #test.c, #test.b\
- \n Filter: #test.a > Int32(1)\
- \n Filter: #test.b > Int32(1)\
- \n Filter: #test.c > Int32(1)\
+ let expected = "Projection: test.a, test.c, test.b\
+ \n Filter: test.a > Int32(1)\
+ \n Filter: test.b > Int32(1)\
+ \n Filter: test.c > Int32(1)\
\n TableScan: test projection=[a, b, c]";
assert_optimized_plan_eq(&plan, expected);
@@ -673,8 +673,8 @@ mod tests {
.build()?;
// make sure projections are pushed down to both table scans
- let expected = "Projection: #test.a, #test.b, #test2.c1\
- \n Left Join: #test.a = #test2.c1\
+ let expected = "Projection: test.a, test.b, test2.c1\
+ \n Left Join: test.a = test2.c1\
\n TableScan: test projection=[a, b]\
\n TableScan: test2 projection=[c1]";
@@ -716,8 +716,8 @@ mod tests {
.build()?;
// make sure projections are pushed down to both table scans
- let expected = "Projection: #test.a, #test.b\
- \n Left Join: #test.a = #test2.c1\
+ let expected = "Projection: test.a, test.b\
+ \n Left Join: test.a = test2.c1\
\n TableScan: test projection=[a, b]\
\n TableScan: test2 projection=[c1]";
@@ -757,8 +757,8 @@ mod tests {
.build()?;
// make sure projections are pushed down to table scan
- let expected = "Projection: #test.a, #test.b\
- \n Left Join: Using #test.a = #test2.a\
+ let expected = "Projection: test.a, test.b\
+ \n Left Join: Using test.a = test2.a\
\n TableScan: test projection=[a, b]\
\n TableScan: test2 projection=[a]";
@@ -794,7 +794,7 @@ mod tests {
}])?
.build()?;
- let expected = "Projection: CAST(#test.c AS Float64)\
+ let expected = "Projection: CAST(test.c AS Float64)\
\n TableScan: test projection=[c]";
assert_optimized_plan_eq(&projection, expected);
@@ -814,7 +814,7 @@ mod tests {
assert_fields_eq(&plan, vec!["a", "b"]);
- let expected = "Projection: #test.a, #test.b\
+ let expected = "Projection: test.a, test.b\
\n TableScan: test projection=[a, b]";
assert_optimized_plan_eq(&plan, expected);
@@ -841,7 +841,7 @@ mod tests {
assert_fields_eq(&plan, vec!["a", "b"]);
- let expected = "Projection: #a, #b\
+ let expected = "Projection: a, b\
\n TableScan: test projection=[a, b]";
assert_optimized_plan_eq(&plan, expected);
@@ -863,7 +863,7 @@ mod tests {
assert_fields_eq(&plan, vec!["c", "a"]);
let expected = "Limit: skip=0, fetch=5\
- \n Projection: #test.c, #test.a\
+ \n Projection: test.c, test.a\
\n TableScan: test projection=[a, c]";
assert_optimized_plan_eq(&plan, expected);
@@ -910,9 +910,9 @@ mod tests {
assert_fields_eq(&plan, vec!["c", "MAX(test.a)"]);
let expected = "\
- Aggregate: groupBy=[[#test.c]], aggr=[[MAX(#test.a)]]\
- \n Filter: #test.c > Int32(1)\
- \n Projection: #test.c, #test.a\
+ Aggregate: groupBy=[[test.c]], aggr=[[MAX(test.a)]]\
+ \n Filter: test.c > Int32(1)\
+ \n Projection: test.c, test.a\
\n TableScan: test projection=[a, c]";
assert_optimized_plan_eq(&plan, expected);
@@ -980,9 +980,9 @@ 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 > Int32(1)\
- \n Aggregate: groupBy=[[#test.a, #test.c]], aggr=[[MAX(#test.b)]]\
+ let expected = "Projection: test.c, test.a, MAX(test.b)\
+ \n Filter: test.c > Int32(1)\
+ \n Aggregate: groupBy=[[test.a, test.c]], aggr=[[MAX(test.b)]]\
\n TableScan: test projection=[a, b, c]";
assert_optimized_plan_eq(&plan, expected);
@@ -1008,7 +1008,7 @@ mod tests {
)?
.build()?;
- let expected = "Aggregate: groupBy=[[#test.a]], aggr=[[COUNT(#test.b), COUNT(#test.b) FILTER (WHERE #c > Int32(42)) AS count2]]\
+ let expected = "Aggregate: groupBy=[[test.a]], aggr=[[COUNT(test.b), COUNT(test.b) FILTER (WHERE c > Int32(42)) AS count2]]\
\n TableScan: test projection=[a, b, c]";
assert_optimized_plan_eq(&plan, expected);
diff --git a/datafusion/optimizer/src/reduce_cross_join.rs b/datafusion/optimizer/src/reduce_cross_join.rs
index 3fce05a472..4c43188cff 100644
--- a/datafusion/optimizer/src/reduce_cross_join.rs
+++ b/datafusion/optimizer/src/reduce_cross_join.rs
@@ -320,8 +320,8 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t2.c < UInt32(20) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t2.c < UInt32(20) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
];
@@ -348,7 +348,7 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t1.a = #t2.a OR #t2.b = #t1.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t1.a = t2.a OR t2.b = t1.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" CrossJoin: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
@@ -375,8 +375,8 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t2.c < UInt32(20) AND #t2.c = UInt32(10) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t2.c < UInt32(20) AND t2.c = UInt32(10) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
];
@@ -406,8 +406,8 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t2.c < UInt32(15) OR #t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t2.c < UInt32(15) OR t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
];
@@ -436,7 +436,7 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t1.a = #t2.a AND #t2.c < UInt32(15) OR #t1.b = #t2.b AND #t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t1.a = t2.a AND t2.c < UInt32(15) OR t1.b = t2.b AND t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" CrossJoin: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
@@ -462,7 +462,7 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t1.a = #t2.a AND #t2.c < UInt32(15) OR #t1.a = #t2.a OR #t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t1.a = t2.a AND t2.c < UInt32(15) OR t1.a = t2.a OR t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" CrossJoin: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
@@ -532,14 +532,14 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t4.c < UInt32(15) OR #t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Filter: #t2.c < UInt32(15) OR #t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t4.c < UInt32(15) OR t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Filter: t2.c < UInt32(15) OR t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
- " Filter: #t4.c < UInt32(15) OR #t3.c = UInt32(688) OR #t3.b = #t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t3.a = #t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Filter: t4.c < UInt32(15) OR t3.c = UInt32(688) OR t3.b = t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t3.a = t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t3 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t4 [a:UInt32, b:UInt32, c:UInt32]",
];
@@ -607,14 +607,14 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t3.a = #t1.a AND #t4.c < UInt32(15) OR #t3.a = #t1.a OR #t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t3.a = t1.a AND t4.c < UInt32(15) OR t3.a = t1.a OR t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" CrossJoin: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Filter: #t2.c < UInt32(15) OR #t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Filter: t2.c < UInt32(15) OR t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
- " Filter: #t4.c < UInt32(15) OR #t3.c = UInt32(688) OR #t3.b = #t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t3.a = #t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Filter: t4.c < UInt32(15) OR t3.c = UInt32(688) OR t3.b = t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t3.a = t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t3 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t4 [a:UInt32, b:UInt32, c:UInt32]",
];
@@ -682,13 +682,13 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t4.c < UInt32(15) OR #t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Filter: #t2.c < UInt32(15) OR #t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t4.c < UInt32(15) OR t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Filter: t2.c < UInt32(15) OR t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
- " Filter: #t3.a = #t4.a AND #t4.c < UInt32(15) OR #t3.a = #t4.a AND #t3.c = UInt32(688) OR #t3.a = #t4.a OR #t3.b = #t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Filter: t3.a = t4.a AND t4.c < UInt32(15) OR t3.a = t4.a AND t3.c = UInt32(688) OR t3.a = t4.a OR t3.b = t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" CrossJoin: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t3 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t4 [a:UInt32, b:UInt32, c:UInt32]",
@@ -761,14 +761,14 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t4.c < UInt32(15) OR #t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Filter: #t1.a = #t2.a OR #t2.c < UInt32(15) OR #t1.a = #t2.a AND #t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t4.c < UInt32(15) OR t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Filter: t1.a = t2.a OR t2.c < UInt32(15) OR t1.a = t2.a AND t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" CrossJoin: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
- " Filter: #t4.c < UInt32(15) OR #t3.c = UInt32(688) OR #t3.b = #t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t3.a = #t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Filter: t4.c < UInt32(15) OR t3.c = UInt32(688) OR t3.b = t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t3.a = t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t3 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t4 [a:UInt32, b:UInt32, c:UInt32]",
];
@@ -845,13 +845,13 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t4.c < UInt32(15) OR #t4.c = UInt32(688) AND #t4.c < UInt32(15) OR #t3.c = UInt32(688) OR #t3.b = #t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Filter: #t2.c < UInt32(15) AND #t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t4.c < UInt32(15) OR t4.c = UInt32(688) AND t4.c < UInt32(15) OR t3.c = UInt32(688) OR t3.b = t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Filter: t2.c < UInt32(15) AND t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t3.a = #t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t3.a = t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t3 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t4 [a:UInt32, b:UInt32, c:UInt32]",
];
@@ -933,12 +933,12 @@ mod tests {
.build()?;
let expected =vec![
- "Filter: #t4.c < UInt32(15) OR #t4.c = UInt32(688) AND #t4.c < UInt32(15) OR #t3.c = UInt32(688) OR #t3.b = #t4.b AND #t2.c < UInt32(15) AND #t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t1.a = #t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ "Filter: t4.c < UInt32(15) OR t4.c = UInt32(688) AND t4.c < UInt32(15) OR t3.c = UInt32(688) OR t3.b = t4.b AND t2.c < UInt32(15) AND t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t1.a = t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
- " Inner Join: #t3.a = #t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
+ " Inner Join: t3.a = t4.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t3 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t4 [a:UInt32, b:UInt32, c:UInt32]",
];
diff --git a/datafusion/optimizer/src/reduce_outer_join.rs b/datafusion/optimizer/src/reduce_outer_join.rs
index e0b0a2ed04..6ca4a59949 100644
--- a/datafusion/optimizer/src/reduce_outer_join.rs
+++ b/datafusion/optimizer/src/reduce_outer_join.rs
@@ -401,8 +401,8 @@ mod tests {
.filter(col("t2.b").is_null())?
.build()?;
let expected = "\
- Filter: #t2.b IS NULL\
- \n Left Join: #t1.a = #t2.a\
+ Filter: t2.b IS NULL\
+ \n Left Join: t1.a = t2.a\
\n TableScan: t1\
\n TableScan: t2";
assert_optimized_plan_eq(&plan, expected);
@@ -426,8 +426,8 @@ mod tests {
.filter(col("t2.b").is_not_null())?
.build()?;
let expected = "\
- Filter: #t2.b IS NOT NULL\
- \n Inner Join: #t1.a = #t2.a\
+ Filter: t2.b IS NOT NULL\
+ \n Inner Join: t1.a = t2.a\
\n TableScan: t1\
\n TableScan: t2";
assert_optimized_plan_eq(&plan, expected);
@@ -455,8 +455,8 @@ mod tests {
))?
.build()?;
let expected = "\
- Filter: #t1.b > UInt32(10) OR #t1.c < UInt32(20)\
- \n Inner Join: #t1.a = #t2.a\
+ Filter: t1.b > UInt32(10) OR t1.c < UInt32(20)\
+ \n Inner Join: t1.a = t2.a\
\n TableScan: t1\
\n TableScan: t2";
assert_optimized_plan_eq(&plan, expected);
@@ -484,8 +484,8 @@ mod tests {
))?
.build()?;
let expected = "\
- Filter: #t1.b > UInt32(10) AND #t2.c < UInt32(20)\
- \n Inner Join: #t1.a = #t2.a\
+ Filter: t1.b > UInt32(10) AND t2.c < UInt32(20)\
+ \n Inner Join: t1.a = t2.a\
\n TableScan: t1\
\n TableScan: t2";
assert_optimized_plan_eq(&plan, expected);
@@ -513,8 +513,8 @@ mod tests {
))?
.build()?;
let expected = "\
- Filter: CAST(#t1.b AS Int64) > UInt32(10) AND TRY_CAST(#t2.c AS Int64) < UInt32(20)\
- \n Inner Join: #t1.a = #t2.a\
+ Filter: CAST(t1.b AS Int64) > UInt32(10) AND TRY_CAST(t2.c AS Int64) < UInt32(20)\
+ \n Inner Join: t1.a = t2.a\
\n TableScan: t1\
\n TableScan: t2";
assert_optimized_plan_eq(&plan, expected);
diff --git a/datafusion/optimizer/src/scalar_subquery_to_join.rs b/datafusion/optimizer/src/scalar_subquery_to_join.rs
index 31a81b06dc..62ad72241a 100644
--- a/datafusion/optimizer/src/scalar_subquery_to_join.rs
+++ b/datafusion/optimizer/src/scalar_subquery_to_join.rs
@@ -343,17 +343,17 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: Int32(1) < #__sq_2.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N, o_custkey:Int64, __value:Int64;N]
- Inner Join: #customer.c_custkey = #__sq_2.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N, o_custkey:Int64, __value:Int64;N]
- Filter: Int32(1) < #__sq_1.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
- Inner Join: #customer.c_custkey = #__sq_1.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: Int32(1) < __sq_2.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N, o_custkey:Int64, __value:Int64;N]
+ Inner Join: customer.c_custkey = __sq_2.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N, o_custkey:Int64, __value:Int64;N]
+ Filter: Int32(1) < __sq_1.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
+ Inner Join: customer.c_custkey = __sq_1.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey, #MAX(orders.o_custkey) AS __value, alias=__sq_1 [o_custkey:Int64, __value:Int64;N]
- Aggregate: groupBy=[[#orders.o_custkey]], aggr=[[MAX(#orders.o_custkey)]] [o_custkey:Int64, MAX(orders.o_custkey):Int64;N]
+ Projection: orders.o_custkey, MAX(orders.o_custkey) AS __value, alias=__sq_1 [o_custkey:Int64, __value:Int64;N]
+ Aggregate: groupBy=[[orders.o_custkey]], aggr=[[MAX(orders.o_custkey)]] [o_custkey:Int64, MAX(orders.o_custkey):Int64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
- Projection: #orders.o_custkey, #MAX(orders.o_custkey) AS __value, alias=__sq_2 [o_custkey:Int64, __value:Int64;N]
- Aggregate: groupBy=[[#orders.o_custkey]], aggr=[[MAX(#orders.o_custkey)]] [o_custkey:Int64, MAX(orders.o_custkey):Int64;N]
+ Projection: orders.o_custkey, MAX(orders.o_custkey) AS __value, alias=__sq_2 [o_custkey:Int64, __value:Int64;N]
+ Aggregate: groupBy=[[orders.o_custkey]], aggr=[[MAX(orders.o_custkey)]] [o_custkey:Int64, MAX(orders.o_custkey):Int64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&ScalarSubqueryToJoin::new(), &plan, expected);
Ok(())
@@ -390,17 +390,17 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_acctbal < #__sq_2.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Float64;N]
- Inner Join: #customer.c_custkey = #__sq_2.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Float64;N]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_acctbal < __sq_2.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Float64;N]
+ Inner Join: customer.c_custkey = __sq_2.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Float64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey, #SUM(orders.o_totalprice) AS __value, alias=__sq_2 [o_custkey:Int64, __value:Float64;N]
- Aggregate: groupBy=[[#orders.o_custkey]], aggr=[[SUM(#orders.o_totalprice)]] [o_custkey:Int64, SUM(orders.o_totalprice):Float64;N]
- Filter: #orders.o_totalprice < #__sq_1.__value [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N, l_orderkey:Int64, __value:Float64;N]
- Inner Join: #orders.o_orderkey = #__sq_1.l_orderkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N, l_orderkey:Int64, __value:Float64;N]
+ Projection: orders.o_custkey, SUM(orders.o_totalprice) AS __value, alias=__sq_2 [o_custkey:Int64, __value:Float64;N]
+ Aggregate: groupBy=[[orders.o_custkey]], aggr=[[SUM(orders.o_totalprice)]] [o_custkey:Int64, SUM(orders.o_totalprice):Float64;N]
+ Filter: orders.o_totalprice < __sq_1.__value [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N, l_orderkey:Int64, __value:Float64;N]
+ Inner Join: orders.o_orderkey = __sq_1.l_orderkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N, l_orderkey:Int64, __value:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
- Projection: #lineitem.l_orderkey, #SUM(lineitem.l_extendedprice) AS __value, alias=__sq_1 [l_orderkey:Int64, __value:Float64;N]
- Aggregate: groupBy=[[#lineitem.l_orderkey]], aggr=[[SUM(#lineitem.l_extendedprice)]] [l_orderkey:Int64, SUM(lineitem.l_extendedprice):Float64;N]
+ Projection: lineitem.l_orderkey, SUM(lineitem.l_extendedprice) AS __value, alias=__sq_1 [l_orderkey:Int64, __value:Float64;N]
+ Aggregate: groupBy=[[lineitem.l_orderkey]], aggr=[[SUM(lineitem.l_extendedprice)]] [l_orderkey:Int64, SUM(lineitem.l_extendedprice):Float64;N]
TableScan: lineitem [l_orderkey:Int64, l_partkey:Int64, l_suppkey:Int64, l_linenumber:Int32, l_quantity:Float64, l_extendedprice:Float64]"#;
assert_optimized_plan_eq(&ScalarSubqueryToJoin::new(), &plan, expected);
Ok(())
@@ -426,13 +426,13 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_custkey = #__sq_1.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
- Inner Join: #customer.c_custkey = #__sq_1.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_custkey = __sq_1.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
+ Inner Join: customer.c_custkey = __sq_1.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey, #MAX(orders.o_custkey) AS __value, alias=__sq_1 [o_custkey:Int64, __value:Int64;N]
- Aggregate: groupBy=[[#orders.o_custkey]], aggr=[[MAX(#orders.o_custkey)]] [o_custkey:Int64, MAX(orders.o_custkey):Int64;N]
- Filter: #orders.o_orderkey = Int32(1) [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: orders.o_custkey, MAX(orders.o_custkey) AS __value, alias=__sq_1 [o_custkey:Int64, __value:Int64;N]
+ Aggregate: groupBy=[[orders.o_custkey]], aggr=[[MAX(orders.o_custkey)]] [o_custkey:Int64, MAX(orders.o_custkey):Int64;N]
+ Filter: orders.o_orderkey = Int32(1) [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&ScalarSubqueryToJoin::new(), &plan, expected);
@@ -456,13 +456,13 @@ mod tests {
.build()?;
// it will optimize, but fail for the same reason the unoptimized query would
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_custkey = #__sq_1.__value [c_custkey:Int64, c_name:Utf8, __value:Int64;N]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_custkey = __sq_1.__value [c_custkey:Int64, c_name:Utf8, __value:Int64;N]
CrossJoin: [c_custkey:Int64, c_name:Utf8, __value:Int64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #MAX(orders.o_custkey) AS __value, alias=__sq_1 [__value:Int64;N]
- Aggregate: groupBy=[[]], aggr=[[MAX(#orders.o_custkey)]] [MAX(orders.o_custkey):Int64;N]
- Filter: #customer.c_custkey = #customer.c_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: MAX(orders.o_custkey) AS __value, alias=__sq_1 [__value:Int64;N]
+ Aggregate: groupBy=[[]], aggr=[[MAX(orders.o_custkey)]] [MAX(orders.o_custkey):Int64;N]
+ Filter: customer.c_custkey = customer.c_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&ScalarSubqueryToJoin::new(), &plan, expected);
Ok(())
@@ -484,13 +484,13 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_custkey = #__sq_1.__value [c_custkey:Int64, c_name:Utf8, __value:Int64;N]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_custkey = __sq_1.__value [c_custkey:Int64, c_name:Utf8, __value:Int64;N]
CrossJoin: [c_custkey:Int64, c_name:Utf8, __value:Int64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #MAX(orders.o_custkey) AS __value, alias=__sq_1 [__value:Int64;N]
- Aggregate: groupBy=[[]], aggr=[[MAX(#orders.o_custkey)]] [MAX(orders.o_custkey):Int64;N]
- Filter: #orders.o_custkey = #orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: MAX(orders.o_custkey) AS __value, alias=__sq_1 [__value:Int64;N]
+ Aggregate: groupBy=[[]], aggr=[[MAX(orders.o_custkey)]] [MAX(orders.o_custkey):Int64;N]
+ Filter: orders.o_custkey = orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&ScalarSubqueryToJoin::new(), &plan, expected);
@@ -654,13 +654,13 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
- Filter: #customer.c_custkey = #__sq_1.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
- Inner Join: #customer.c_custkey = #__sq_1.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
+ Filter: customer.c_custkey = __sq_1.__value [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
+ Inner Join: customer.c_custkey = __sq_1.o_custkey [c_custkey:Int64, c_name:Utf8, o_custkey:Int64, __value:Int64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #orders.o_custkey, #MAX(orders.o_custkey) AS __value, alias=__sq_1 [o_custkey:Int64, __value:Int64;N]
- Aggregate: groupBy=[[#orders.o_custkey]], aggr=[[MAX(#orders.o_custkey)]] [o_custkey:Int64, MAX(orders.o_custkey):Int64;N]
+ Projection: orders.o_custkey, MAX(orders.o_custkey) AS __value, alias=__sq_1 [o_custkey:Int64, __value:Int64;N]
+ Aggregate: groupBy=[[orders.o_custkey]], aggr=[[MAX(orders.o_custkey)]] [o_custkey:Int64, MAX(orders.o_custkey):Int64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&ScalarSubqueryToJoin::new(), &plan, expected);
@@ -688,12 +688,12 @@ mod tests {
.build()?;
// unoptimized plan because we don't support disjunctions yet
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_custkey = (<subquery>) OR #customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_custkey = (<subquery>) OR customer.c_custkey = Int32(1) [c_custkey:Int64, c_name:Utf8]
Subquery: [MAX(orders.o_custkey):Int64;N]
- Projection: #MAX(orders.o_custkey) [MAX(orders.o_custkey):Int64;N]
- Aggregate: groupBy=[[]], aggr=[[MAX(#orders.o_custkey)]] [MAX(orders.o_custkey):Int64;N]
- Filter: #customer.c_custkey = #orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
+ Projection: MAX(orders.o_custkey) [MAX(orders.o_custkey):Int64;N]
+ Aggregate: groupBy=[[]], aggr=[[MAX(orders.o_custkey)]] [MAX(orders.o_custkey):Int64;N]
+ Filter: customer.c_custkey = orders.o_custkey [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]"#;
assert_optimized_plan_eq(&ScalarSubqueryToJoin::new(), &plan, expected);
@@ -716,12 +716,12 @@ mod tests {
.project(vec![col("test.c")])?
.build()?;
- let expected = r#"Projection: #test.c [c:UInt32]
- Filter: #test.c < #__sq_1.__value [a:UInt32, b:UInt32, c:UInt32, a:UInt32, __value:UInt32;N]
- Inner Join: #test.a = #__sq_1.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, __value:UInt32;N]
+ let expected = r#"Projection: test.c [c:UInt32]
+ Filter: test.c < __sq_1.__value [a:UInt32, b:UInt32, c:UInt32, a:UInt32, __value:UInt32;N]
+ Inner Join: test.a = __sq_1.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, __value:UInt32;N]
TableScan: test [a:UInt32, b:UInt32, c:UInt32]
- Projection: #sq.a, #MIN(sq.c) AS __value, alias=__sq_1 [a:UInt32, __value:UInt32;N]
- Aggregate: groupBy=[[#sq.a]], aggr=[[MIN(#sq.c)]] [a:UInt32, MIN(sq.c):UInt32;N]
+ Projection: sq.a, MIN(sq.c) AS __value, alias=__sq_1 [a:UInt32, __value:UInt32;N]
+ Aggregate: groupBy=[[sq.a]], aggr=[[MIN(sq.c)]] [a:UInt32, MIN(sq.c):UInt32;N]
TableScan: sq [a:UInt32, b:UInt32, c:UInt32]"#;
assert_optimized_plan_eq(&ScalarSubqueryToJoin::new(), &plan, expected);
@@ -743,12 +743,12 @@ mod tests {
.project(vec![col("customer.c_custkey")])?
.build()?;
- let expected = r#"Projection: #customer.c_custkey [c_custkey:Int64]
- Filter: #customer.c_custkey = #__sq_1.__value [c_custkey:Int64, c_name:Utf8, __value:Int64;N]
+ let expected = r#"Projection: customer.c_custkey [c_custkey:Int64]
+ Filter: customer.c_custkey = __sq_1.__value [c_custkey:Int64, c_name:Utf8, __value:Int64;N]
CrossJoin: [c_custkey:Int64, c_name:Utf8, __value:Int64;N]
TableScan: customer [c_custkey:Int64, c_name:Utf8]
- Projection: #MAX(orders.o_custkey) AS __value, alias=__sq_1 [__value:Int64;N]
- Aggregate: groupBy=[[]], aggr=[[MAX(#orders.o_custkey)]] [MAX(orders.o_custkey):Int64;N]
+ Projection: MAX(orders.o_custkey) AS __value, alias=__sq_1 [__value:Int64;N]
+ Aggregate: groupBy=[[]], aggr=[[MAX(orders.o_custkey)]] [MAX(orders.o_custkey):Int64;N]
TableScan: orders [o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]"#;
assert_optimized_plan_eq(&ScalarSubqueryToJoin::new(), &plan, expected);
diff --git a/datafusion/optimizer/src/simplify_expressions.rs b/datafusion/optimizer/src/simplify_expressions.rs
index 4f92a65e45..2901bfa8a0 100644
--- a/datafusion/optimizer/src/simplify_expressions.rs
+++ b/datafusion/optimizer/src/simplify_expressions.rs
@@ -1917,8 +1917,8 @@ mod tests {
assert_optimized_plan_eq(
&plan,
"\
- Filter: #test.b > Int32(1) AS test.b > Int32(1) AND test.b > Int32(1)\
- \n Projection: #test.a\
+ Filter: test.b > Int32(1) AS test.b > Int32(1) AND test.b > Int32(1)\
+ \n Projection: test.a\
\n TableScan: test",
);
}
@@ -1941,8 +1941,8 @@ mod tests {
assert_optimized_plan_eq(
&plan,
"\
- Filter: #test.a > Int32(5) AND #test.b < Int32(6) AS test.a > Int32(5) AND test.b < Int32(6) AND test.a > Int32(5)\
- \n Projection: #test.a, #test.b\
+ Filter: test.a > Int32(5) AND test.b < Int32(6) AS test.a > Int32(5) AND test.b < Int32(6) AND test.a > Int32(5)\
+ \n Projection: test.a, test.b\
\n TableScan: test",
);
}
@@ -1961,9 +1961,9 @@ mod tests {
.unwrap();
let expected = "\
- Projection: #test.a\
- \n Filter: NOT #test.c AS test.c = Boolean(false)\
- \n Filter: #test.b AS test.b = Boolean(true)\
+ Projection: test.a\
+ \n Filter: NOT test.c AS test.c = Boolean(false)\
+ \n Filter: test.b AS test.b = Boolean(true)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -1985,10 +1985,10 @@ mod tests {
.unwrap();
let expected = "\
- Projection: #test.a\
+ Projection: test.a\
\n Limit: skip=0, fetch=1\
- \n Filter: #test.c AS test.c != Boolean(false)\
- \n Filter: NOT #test.b AS test.b != Boolean(true)\
+ \n Filter: test.c AS test.c != Boolean(false)\
+ \n Filter: NOT test.b AS test.b != Boolean(true)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2006,8 +2006,8 @@ mod tests {
.unwrap();
let expected = "\
- Projection: #test.a\
- \n Filter: NOT #test.b AND #test.c AS test.b != Boolean(true) AND test.c = Boolean(true)\
+ Projection: test.a\
+ \n Filter: NOT test.b AND test.c AS test.b != Boolean(true) AND test.c = Boolean(true)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2025,8 +2025,8 @@ mod tests {
.unwrap();
let expected = "\
- Projection: #test.a\
- \n Filter: NOT #test.b OR NOT #test.c AS test.b != Boolean(true) OR test.c = Boolean(false)\
+ Projection: test.a\
+ \n Filter: NOT test.b OR NOT test.c AS test.b != Boolean(true) OR test.c = Boolean(false)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2044,8 +2044,8 @@ mod tests {
.unwrap();
let expected = "\
- Projection: #test.a\
- \n Filter: #test.b AS NOT test.b = Boolean(false)\
+ Projection: test.a\
+ \n Filter: test.b AS NOT test.b = Boolean(false)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2061,7 +2061,7 @@ mod tests {
.unwrap();
let expected = "\
- Projection: #test.a, #test.d, NOT #test.b AS test.b = Boolean(false)\
+ Projection: test.a, test.d, NOT test.b AS test.b = Boolean(false)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2085,8 +2085,8 @@ mod tests {
.unwrap();
let expected = "\
- Aggregate: groupBy=[[#test.a, #test.c]], aggr=[[MAX(#test.b) AS MAX(test.b = Boolean(true)), MIN(#test.b)]]\
- \n Projection: #test.a, #test.c, #test.b\
+ Aggregate: groupBy=[[test.a, test.c]], aggr=[[MAX(test.b) AS MAX(test.b = Boolean(true)), MIN(test.b)]]\
+ \n Projection: test.a, test.c, test.b\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2252,7 +2252,7 @@ mod tests {
let actual = get_optimized_plan_formatted(&plan, &time);
let expected =
- "Projection: NOT #test.a AS Boolean(true) OR Boolean(false) != test.a\
+ "Projection: NOT test.a AS Boolean(true) OR Boolean(false) != test.a\
\n TableScan: test";
assert_eq!(expected, actual);
@@ -2327,7 +2327,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d <= Int32(10) AS NOT test.d > Int32(10)\
+ let expected = "Filter: test.d <= Int32(10) AS NOT test.d > Int32(10)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2342,7 +2342,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d <= Int32(10) OR #test.d >= Int32(100) AS NOT test.d > Int32(10) AND test.d < Int32(100)\
+ let expected = "Filter: test.d <= Int32(10) OR test.d >= Int32(100) AS NOT test.d > Int32(10) AND test.d < Int32(100)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2357,7 +2357,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d <= Int32(10) AND #test.d >= Int32(100) AS NOT test.d > Int32(10) OR test.d < Int32(100)\
+ let expected = "Filter: test.d <= Int32(10) AND test.d >= Int32(100) AS NOT test.d > Int32(10) OR test.d < Int32(100)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2372,7 +2372,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d > Int32(10) AS NOT NOT test.d > Int32(10)\
+ let expected = "Filter: test.d > Int32(10) AS NOT NOT test.d > Int32(10)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2387,7 +2387,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d IS NOT NULL AS NOT test.d IS NULL\
+ let expected = "Filter: test.d IS NOT NULL AS NOT test.d IS NULL\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2402,7 +2402,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d IS NULL AS NOT test.d IS NOT NULL\
+ let expected = "Filter: test.d IS NULL AS NOT test.d IS NOT NULL\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2417,7 +2417,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d NOT IN ([Int32(1), Int32(2), Int32(3)]) AS NOT test.d IN (Map { iter: Iter([Int32(1), Int32(2), Int32(3)]) })\
+ let expected = "Filter: test.d NOT IN ([Int32(1), Int32(2), Int32(3)]) AS NOT test.d IN (Map { iter: Iter([Int32(1), Int32(2), Int32(3)]) })\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2432,7 +2432,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d IN ([Int32(1), Int32(2), Int32(3)]) AS NOT test.d NOT IN (Map { iter: Iter([Int32(1), Int32(2), Int32(3)]) })\
+ let expected = "Filter: test.d IN ([Int32(1), Int32(2), Int32(3)]) AS NOT test.d NOT IN (Map { iter: Iter([Int32(1), Int32(2), Int32(3)]) })\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2453,7 +2453,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d < Int32(1) OR #test.d > Int32(10) AS NOT test.d BETWEEN Int32(1) AND Int32(10)\
+ let expected = "Filter: test.d < Int32(1) OR test.d > Int32(10) AS NOT test.d BETWEEN Int32(1) AND Int32(10)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2474,7 +2474,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d >= Int32(1) AND #test.d <= Int32(10) AS NOT test.d NOT BETWEEN Int32(1) AND Int32(10)\
+ let expected = "Filter: test.d >= Int32(1) AND test.d <= Int32(10) AS NOT test.d NOT BETWEEN Int32(1) AND Int32(10)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2496,7 +2496,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.a NOT LIKE #test.b AS NOT test.a LIKE test.b\
+ let expected = "Filter: test.a NOT LIKE test.b AS NOT test.a LIKE test.b\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2518,7 +2518,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.a LIKE #test.b AS NOT test.a NOT LIKE test.b\
+ let expected = "Filter: test.a LIKE test.b AS NOT test.a NOT LIKE test.b\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2533,7 +2533,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d IS NOT DISTINCT FROM Int32(10) AS NOT test.d IS DISTINCT FROM Int32(10)\
+ let expected = "Filter: test.d IS NOT DISTINCT FROM Int32(10) AS NOT test.d IS DISTINCT FROM Int32(10)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
@@ -2548,7 +2548,7 @@ mod tests {
.unwrap()
.build()
.unwrap();
- let expected = "Filter: #test.d IS DISTINCT FROM Int32(10) AS NOT test.d IS NOT DISTINCT FROM Int32(10)\
+ let expected = "Filter: test.d IS DISTINCT FROM Int32(10) AS NOT test.d IS NOT DISTINCT FROM Int32(10)\
\n TableScan: test";
assert_optimized_plan_eq(&plan, expected);
diff --git a/datafusion/optimizer/src/single_distinct_to_groupby.rs b/datafusion/optimizer/src/single_distinct_to_groupby.rs
index f1982bcf1b..0dbbb0bbfe 100644
--- a/datafusion/optimizer/src/single_distinct_to_groupby.rs
+++ b/datafusion/optimizer/src/single_distinct_to_groupby.rs
@@ -250,7 +250,7 @@ mod tests {
// Do nothing
let expected =
- "Aggregate: groupBy=[[]], aggr=[[MAX(#test.b)]] [MAX(test.b):UInt32;N]\
+ "Aggregate: groupBy=[[]], aggr=[[MAX(test.b)]] [MAX(test.b):UInt32;N]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -266,9 +266,9 @@ mod tests {
.build()?;
// Should work
- let expected = "Projection: #COUNT(alias1) AS COUNT(DISTINCT test.b) [COUNT(DISTINCT test.b):Int64;N]\
- \n Aggregate: groupBy=[[]], aggr=[[COUNT(#alias1)]] [COUNT(alias1):Int64;N]\
- \n Aggregate: groupBy=[[#test.b AS alias1]], aggr=[[]] [alias1:UInt32]\
+ let expected = "Projection: COUNT(alias1) AS COUNT(DISTINCT test.b) [COUNT(DISTINCT test.b):Int64;N]\
+ \n Aggregate: groupBy=[[]], aggr=[[COUNT(alias1)]] [COUNT(alias1):Int64;N]\
+ \n Aggregate: groupBy=[[test.b AS alias1]], aggr=[[]] [alias1:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -290,7 +290,7 @@ mod tests {
.build()?;
// Should not be optimized
- let expected = "Aggregate: groupBy=[[GROUPING SETS ((#test.a), (#test.b))]], aggr=[[COUNT(DISTINCT #test.c)]] [a:UInt32, b:UInt32, COUNT(DISTINCT test.c):Int64;N]\
+ let expected = "Aggregate: groupBy=[[GROUPING SETS ((test.a), (test.b))]], aggr=[[COUNT(DISTINCT test.c)]] [a:UInt32, b:UInt32, COUNT(DISTINCT test.c):Int64;N]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -311,7 +311,7 @@ mod tests {
println!("{:?}", plan);
// Should not be optimized
- let expected = "Aggregate: groupBy=[[CUBE (#test.a, #test.b)]], aggr=[[COUNT(DISTINCT #test.c)]] [a:UInt32, b:UInt32, COUNT(DISTINCT test.c):Int64;N]\
+ let expected = "Aggregate: groupBy=[[CUBE (test.a, test.b)]], aggr=[[COUNT(DISTINCT test.c)]] [a:UInt32, b:UInt32, COUNT(DISTINCT test.c):Int64;N]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -331,7 +331,7 @@ mod tests {
.build()?;
// Should not be optimized
- let expected = "Aggregate: groupBy=[[ROLLUP (#test.a, #test.b)]], aggr=[[COUNT(DISTINCT #test.c)]] [a:UInt32, b:UInt32, COUNT(DISTINCT test.c):Int64;N]\
+ let expected = "Aggregate: groupBy=[[ROLLUP (test.a, test.b)]], aggr=[[COUNT(DISTINCT test.c)]] [a:UInt32, b:UInt32, COUNT(DISTINCT test.c):Int64;N]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -346,9 +346,9 @@ mod tests {
.aggregate(Vec::<Expr>::new(), vec![count_distinct(lit(2) * col("b"))])?
.build()?;
- let expected = "Projection: #COUNT(alias1) AS COUNT(DISTINCT Int32(2) * test.b) [COUNT(DISTINCT Int32(2) * test.b):Int64;N]\
- \n Aggregate: groupBy=[[]], aggr=[[COUNT(#alias1)]] [COUNT(alias1):Int64;N]\
- \n Aggregate: groupBy=[[Int32(2) * #test.b AS alias1]], aggr=[[]] [alias1:Int32]\
+ let expected = "Projection: COUNT(alias1) AS COUNT(DISTINCT Int32(2) * test.b) [COUNT(DISTINCT Int32(2) * test.b):Int64;N]\
+ \n Aggregate: groupBy=[[]], aggr=[[COUNT(alias1)]] [COUNT(alias1):Int64;N]\
+ \n Aggregate: groupBy=[[Int32(2) * test.b AS alias1]], aggr=[[]] [alias1:Int32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -364,9 +364,9 @@ mod tests {
.build()?;
// Should work
- let expected = "Projection: #group_alias_0 AS a, #COUNT(alias1) AS COUNT(DISTINCT test.b) [a:UInt32, COUNT(DISTINCT test.b):Int64;N]\
- \n Aggregate: groupBy=[[#group_alias_0]], aggr=[[COUNT(#alias1)]] [group_alias_0:UInt32, COUNT(alias1):Int64;N]\
- \n Aggregate: groupBy=[[#test.a AS group_alias_0, #test.b AS alias1]], aggr=[[]] [group_alias_0:UInt32, alias1:UInt32]\
+ let expected = "Projection: group_alias_0 AS a, COUNT(alias1) AS COUNT(DISTINCT test.b) [a:UInt32, COUNT(DISTINCT test.b):Int64;N]\
+ \n Aggregate: groupBy=[[group_alias_0]], aggr=[[COUNT(alias1)]] [group_alias_0:UInt32, COUNT(alias1):Int64;N]\
+ \n Aggregate: groupBy=[[test.a AS group_alias_0, test.b AS alias1]], aggr=[[]] [group_alias_0:UInt32, alias1:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -385,7 +385,7 @@ mod tests {
.build()?;
// Do nothing
- let expected = "Aggregate: groupBy=[[#test.a]], aggr=[[COUNT(DISTINCT #test.b), COUNT(DISTINCT #test.c)]] [a:UInt32, COUNT(DISTINCT test.b):Int64;N, COUNT(DISTINCT test.c):Int64;N]\
+ let expected = "Aggregate: groupBy=[[test.a]], aggr=[[COUNT(DISTINCT test.b), COUNT(DISTINCT test.c)]] [a:UInt32, COUNT(DISTINCT test.b):Int64;N, COUNT(DISTINCT test.c):Int64;N]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -411,9 +411,9 @@ mod tests {
)?
.build()?;
// Should work
- let expected = "Projection: #group_alias_0 AS a, #COUNT(alias1) AS COUNT(DISTINCT test.b), #MAX(alias1) AS MAX(DISTINCT test.b) [a:UInt32, COUNT(DISTINCT test.b):Int64;N, MAX(DISTINCT test.b):UInt32;N]\
- \n Aggregate: groupBy=[[#group_alias_0]], aggr=[[COUNT(#alias1), MAX(#alias1)]] [group_alias_0:UInt32, COUNT(alias1):Int64;N, MAX(alias1):UInt32;N]\
- \n Aggregate: groupBy=[[#test.a AS group_alias_0, #test.b AS alias1]], aggr=[[]] [group_alias_0:UInt32, alias1:UInt32]\
+ let expected = "Projection: group_alias_0 AS a, COUNT(alias1) AS COUNT(DISTINCT test.b), MAX(alias1) AS MAX(DISTINCT test.b) [a:UInt32, COUNT(DISTINCT test.b):Int64;N, MAX(DISTINCT test.b):UInt32;N]\
+ \n Aggregate: groupBy=[[group_alias_0]], aggr=[[COUNT(alias1), MAX(alias1)]] [group_alias_0:UInt32, COUNT(alias1):Int64;N, MAX(alias1):UInt32;N]\
+ \n Aggregate: groupBy=[[test.a AS group_alias_0, test.b AS alias1]], aggr=[[]] [group_alias_0:UInt32, alias1:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -432,7 +432,7 @@ mod tests {
.build()?;
// Do nothing
- let expected = "Aggregate: groupBy=[[#test.a]], aggr=[[COUNT(DISTINCT #test.b), COUNT(#test.c)]] [a:UInt32, COUNT(DISTINCT test.b):Int64;N, COUNT(test.c):Int64;N]\
+ let expected = "Aggregate: groupBy=[[test.a]], aggr=[[COUNT(DISTINCT test.b), COUNT(test.c)]] [a:UInt32, COUNT(DISTINCT test.b):Int64;N, COUNT(test.c):Int64;N]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -450,9 +450,9 @@ mod tests {
.unwrap();
// Should work
- let expected = "Projection: #group_alias_0 AS test.a + Int32(1), #COUNT(alias1) AS COUNT(DISTINCT test.c) [test.a + Int32(1):Int32, COUNT(DISTINCT test.c):Int64;N]\
- \n Aggregate: groupBy=[[#group_alias_0]], aggr=[[COUNT(#alias1)]] [group_alias_0:Int32, COUNT(alias1):Int64;N]\
- \n Aggregate: groupBy=[[#test.a + Int32(1) AS group_alias_0, #test.c AS alias1]], aggr=[[]] [group_alias_0:Int32, alias1:UInt32]\
+ let expected = "Projection: group_alias_0 AS test.a + Int32(1), COUNT(alias1) AS COUNT(DISTINCT test.c) [test.a + Int32(1):Int32, COUNT(DISTINCT test.c):Int64;N]\
+ \n Aggregate: groupBy=[[group_alias_0]], aggr=[[COUNT(alias1)]] [group_alias_0:Int32, COUNT(alias1):Int64;N]\
+ \n Aggregate: groupBy=[[test.a + Int32(1) AS group_alias_0, test.c AS alias1]], aggr=[[]] [group_alias_0:Int32, alias1:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
diff --git a/datafusion/optimizer/src/subquery_filter_to_join.rs b/datafusion/optimizer/src/subquery_filter_to_join.rs
index 092f315bc2..91d31f28ed 100644
--- a/datafusion/optimizer/src/subquery_filter_to_join.rs
+++ b/datafusion/optimizer/src/subquery_filter_to_join.rs
@@ -231,10 +231,10 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = "Projection: #test.b [b:UInt32]\
- \n Semi Join: #test.c = #sq.c [a:UInt32, b:UInt32, c:UInt32]\
+ let expected = "Projection: test.b [b:UInt32]\
+ \n Semi Join: test.c = sq.c [a:UInt32, b:UInt32, c:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]\
- \n Projection: #sq.c [c:UInt32]\
+ \n Projection: sq.c [c:UInt32]\
\n TableScan: sq [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -250,10 +250,10 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = "Projection: #test.b [b:UInt32]\
- \n Anti Join: #test.c = #sq.c [a:UInt32, b:UInt32, c:UInt32]\
+ let expected = "Projection: test.b [b:UInt32]\
+ \n Anti Join: test.c = sq.c [a:UInt32, b:UInt32, c:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]\
- \n Projection: #sq.c [c:UInt32]\
+ \n Projection: sq.c [c:UInt32]\
\n TableScan: sq [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -272,13 +272,13 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = "Projection: #test.b [b:UInt32]\
- \n Semi Join: #test.b = #sq_2.c [a:UInt32, b:UInt32, c:UInt32]\
- \n Semi Join: #test.c = #sq_1.c [a:UInt32, b:UInt32, c:UInt32]\
+ let expected = "Projection: test.b [b:UInt32]\
+ \n Semi Join: test.b = sq_2.c [a:UInt32, b:UInt32, c:UInt32]\
+ \n Semi Join: test.c = sq_1.c [a:UInt32, b:UInt32, c:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]\
- \n Projection: #sq_1.c [c:UInt32]\
+ \n Projection: sq_1.c [c:UInt32]\
\n TableScan: sq_1 [a:UInt32, b:UInt32, c:UInt32]\
- \n Projection: #sq_2.c [c:UInt32]\
+ \n Projection: sq_2.c [c:UInt32]\
\n TableScan: sq_2 [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -300,11 +300,11 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = "Projection: #test.b [b:UInt32]\
- \n Filter: #test.a = UInt32(1) AND #test.b < UInt32(30) [a:UInt32, b:UInt32, c:UInt32]\
- \n Semi Join: #test.c = #sq.c [a:UInt32, b:UInt32, c:UInt32]\
+ let expected = "Projection: test.b [b:UInt32]\
+ \n Filter: test.a = UInt32(1) AND test.b < UInt32(30) [a:UInt32, b:UInt32, c:UInt32]\
+ \n Semi Join: test.c = sq.c [a:UInt32, b:UInt32, c:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]\
- \n Projection: #sq.c [c:UInt32]\
+ \n Projection: sq.c [c:UInt32]\
\n TableScan: sq [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -327,10 +327,10 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = "Projection: #test.b [b:UInt32]\
- \n Filter: #test.a = UInt32(1) AND #test.b < UInt32(30) OR #test.c IN (<subquery>) [a:UInt32, b:UInt32, c:UInt32]\
+ let expected = "Projection: test.b [b:UInt32]\
+ \n Filter: test.a = UInt32(1) AND test.b < UInt32(30) OR test.c IN (<subquery>) [a:UInt32, b:UInt32, c:UInt32]\
\n Subquery: [c:UInt32]\
- \n Projection: #sq.c [c:UInt32]\
+ \n Projection: sq.c [c:UInt32]\
\n TableScan: sq [a:UInt32, b:UInt32, c:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
@@ -352,13 +352,13 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = "Projection: #test.b [b:UInt32]\
- \n Filter: #test.a = UInt32(1) OR #test.b IN (<subquery>) AND #test.c IN (<subquery>) [a:UInt32, b:UInt32, c:UInt32]\
+ let expected = "Projection: test.b [b:UInt32]\
+ \n Filter: test.a = UInt32(1) OR test.b IN (<subquery>) AND test.c IN (<subquery>) [a:UInt32, b:UInt32, c:UInt32]\
\n Subquery: [c:UInt32]\
- \n Projection: #sq1.c [c:UInt32]\
+ \n Projection: sq1.c [c:UInt32]\
\n TableScan: sq1 [a:UInt32, b:UInt32, c:UInt32]\
\n Subquery: [c:UInt32]\
- \n Projection: #sq2.c [c:UInt32]\
+ \n Projection: sq2.c [c:UInt32]\
\n TableScan: sq2 [a:UInt32, b:UInt32, c:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
@@ -381,13 +381,13 @@ mod tests {
.project(vec![col("test.b")])?
.build()?;
- let expected = "Projection: #test.b [b:UInt32]\
- \n Semi Join: #test.b = #sq.a [a:UInt32, b:UInt32, c:UInt32]\
+ let expected = "Projection: test.b [b:UInt32]\
+ \n Semi Join: test.b = sq.a [a:UInt32, b:UInt32, c:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]\
- \n Projection: #sq.a [a:UInt32]\
- \n Semi Join: #sq.a = #sq_nested.c [a:UInt32, b:UInt32, c:UInt32]\
+ \n Projection: sq.a [a:UInt32]\
+ \n Semi Join: sq.a = sq_nested.c [a:UInt32, b:UInt32, c:UInt32]\
\n TableScan: sq [a:UInt32, b:UInt32, c:UInt32]\
- \n Projection: #sq_nested.c [c:UInt32]\
+ \n Projection: sq_nested.c [c:UInt32]\
\n TableScan: sq_nested [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
@@ -409,14 +409,14 @@ mod tests {
.project(vec![col("b")])?
.build()?;
- let expected = "Projection: #wrapped.b [b:UInt32]\
- \n Filter: #wrapped.b < UInt32(30) OR #wrapped.c IN (<subquery>) [b:UInt32, c:UInt32]\
- \n Subquery: [c:UInt32]\n Projection: #sq_outer.c [c:UInt32]\
+ let expected = "Projection: wrapped.b [b:UInt32]\
+ \n Filter: wrapped.b < UInt32(30) OR wrapped.c IN (<subquery>) [b:UInt32, c:UInt32]\
+ \n Subquery: [c:UInt32]\n Projection: sq_outer.c [c:UInt32]\
\n TableScan: sq_outer [a:UInt32, b:UInt32, c:UInt32]\
- \n Projection: #test.b, #test.c, alias=wrapped [b:UInt32, c:UInt32]\
- \n Semi Join: #test.c = #sq_inner.c [a:UInt32, b:UInt32, c:UInt32]\
+ \n Projection: test.b, test.c, alias=wrapped [b:UInt32, c:UInt32]\
+ \n Semi Join: test.c = sq_inner.c [a:UInt32, b:UInt32, c:UInt32]\
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]\
- \n Projection: #sq_inner.c [c:UInt32]\
+ \n Projection: sq_inner.c [c:UInt32]\
\n TableScan: sq_inner [a:UInt32, b:UInt32, c:UInt32]";
assert_optimized_plan_eq(&plan, expected);
diff --git a/datafusion/optimizer/src/type_coercion.rs b/datafusion/optimizer/src/type_coercion.rs
index c7f107b5ec..2073713ddd 100644
--- a/datafusion/optimizer/src/type_coercion.rs
+++ b/datafusion/optimizer/src/type_coercion.rs
@@ -510,7 +510,7 @@ mod test {
let mut config = OptimizerConfig::default();
let plan = rule.optimize(&plan, &mut config)?;
assert_eq!(
- "Projection: #a < CAST(UInt32(2) AS Float64)\n EmptyRelation",
+ "Projection: a < CAST(UInt32(2) AS Float64)\n EmptyRelation",
&format!("{:?}", plan)
);
Ok(())
@@ -538,7 +538,7 @@ mod test {
let mut config = OptimizerConfig::default();
let plan = rule.optimize(&plan, &mut config)?;
assert_eq!(
- "Projection: #a < CAST(UInt32(2) AS Float64) OR #a < CAST(UInt32(2) AS Float64)\
+ "Projection: a < CAST(UInt32(2) AS Float64) OR a < CAST(UInt32(2) AS Float64)\
\n EmptyRelation",
&format!("{:?}", plan)
);
@@ -637,7 +637,7 @@ mod test {
let mut config = OptimizerConfig::default();
let plan = rule.optimize(&plan, &mut config)?;
assert_eq!(
- "Projection: #a IN ([CAST(Int32(1) AS Int64), CAST(Int8(4) AS Int64), Int64(8)])\n EmptyRelation",
+ "Projection: a IN ([CAST(Int32(1) AS Int64), CAST(Int8(4) AS Int64), Int64(8)])\n EmptyRelation",
&format!("{:?}", plan)
);
// a in (1,4,8), a is decimal
@@ -655,7 +655,7 @@ mod test {
let plan = LogicalPlan::Projection(Projection::try_new(vec![expr], empty, None)?);
let plan = rule.optimize(&plan, &mut config)?;
assert_eq!(
- "Projection: CAST(#a AS Decimal128(24, 4)) IN ([CAST(Int32(1) AS Decimal128(24, 4)), CAST(Int8(4) AS Decimal128(24, 4)), CAST(Int64(8) AS Decimal128(24, 4))])\n EmptyRelation",
+ "Projection: CAST(a AS Decimal128(24, 4)) IN ([CAST(Int32(1) AS Decimal128(24, 4)), CAST(Int8(4) AS Decimal128(24, 4)), CAST(Int64(8) AS Decimal128(24, 4))])\n EmptyRelation",
&format!("{:?}", plan)
);
Ok(())
@@ -675,7 +675,7 @@ mod test {
let mut config = OptimizerConfig::default();
let plan = rule.optimize(&plan, &mut config).unwrap();
assert_eq!(
- "Projection: #a IS TRUE\n EmptyRelation",
+ "Projection: a IS TRUE\n EmptyRelation",
&format!("{:?}", plan)
);
let empty = empty_with_type(DataType::Int64);
@@ -690,7 +690,7 @@ mod test {
let plan = LogicalPlan::Projection(Projection::try_new(vec![expr], empty, None)?);
let plan = rule.optimize(&plan, &mut config).unwrap();
assert_eq!(
- "Projection: #a IS NOT TRUE\n EmptyRelation",
+ "Projection: a IS NOT TRUE\n EmptyRelation",
&format!("{:?}", plan)
);
@@ -700,7 +700,7 @@ mod test {
let plan = LogicalPlan::Projection(Projection::try_new(vec![expr], empty, None)?);
let plan = rule.optimize(&plan, &mut config).unwrap();
assert_eq!(
- "Projection: #a IS FALSE\n EmptyRelation",
+ "Projection: a IS FALSE\n EmptyRelation",
&format!("{:?}", plan)
);
@@ -710,7 +710,7 @@ mod test {
let plan = LogicalPlan::Projection(Projection::try_new(vec![expr], empty, None)?);
let plan = rule.optimize(&plan, &mut config).unwrap();
assert_eq!(
- "Projection: #a IS NOT FALSE\n EmptyRelation",
+ "Projection: a IS NOT FALSE\n EmptyRelation",
&format!("{:?}", plan)
);
Ok(())
@@ -734,7 +734,7 @@ mod test {
let mut config = OptimizerConfig::default();
let plan = rule.optimize(&plan, &mut config).unwrap();
assert_eq!(
- "Projection: #a LIKE Utf8(\"abc\")\n EmptyRelation",
+ "Projection: a LIKE Utf8(\"abc\")\n EmptyRelation",
&format!("{:?}", plan)
);
@@ -753,7 +753,7 @@ mod test {
let mut config = OptimizerConfig::default();
let plan = rule.optimize(&plan, &mut config).unwrap();
assert_eq!(
- "Projection: #a LIKE CAST(NULL AS Utf8)\n EmptyRelation",
+ "Projection: a LIKE CAST(NULL AS Utf8)\n EmptyRelation",
&format!("{:?}", plan)
);
@@ -790,7 +790,7 @@ mod test {
let mut config = OptimizerConfig::default();
let plan = rule.optimize(&plan, &mut config).unwrap();
assert_eq!(
- "Projection: #a IS UNKNOWN\n EmptyRelation",
+ "Projection: a IS UNKNOWN\n EmptyRelation",
&format!("{:?}", plan)
);
@@ -810,7 +810,7 @@ mod test {
let mut config = OptimizerConfig::default();
let plan = rule.optimize(&plan, &mut config).unwrap();
assert_eq!(
- "Projection: #a IS NOT UNKNOWN\n EmptyRelation",
+ "Projection: a IS NOT UNKNOWN\n EmptyRelation",
&format!("{:?}", plan)
);
Ok(())
diff --git a/datafusion/optimizer/tests/integration-test.rs b/datafusion/optimizer/tests/integration-test.rs
index e7245c06c1..6dea1a243f 100644
--- a/datafusion/optimizer/tests/integration-test.rs
+++ b/datafusion/optimizer/tests/integration-test.rs
@@ -33,13 +33,14 @@ use std::sync::Arc;
fn case_when() -> Result<()> {
let sql = "SELECT CASE WHEN col_int32 > 0 THEN 1 ELSE 0 END FROM test";
let plan = test_sql(sql)?;
- let expected = "Projection: CASE WHEN #test.col_int32 > Int32(0) THEN Int64(1) ELSE Int64(0) END\
+ let expected =
+ "Projection: CASE WHEN test.col_int32 > Int32(0) THEN Int64(1) ELSE Int64(0) END\
\n TableScan: test projection=[col_int32]";
assert_eq!(expected, format!("{:?}", plan));
let sql = "SELECT CASE WHEN col_uint32 > 0 THEN 1 ELSE 0 END FROM test";
let plan = test_sql(sql)?;
- let expected = "Projection: CASE WHEN CAST(#test.col_uint32 AS Int64) > Int64(0) THEN Int64(1) ELSE Int64(0) END\
+ let expected = "Projection: CASE WHEN CAST(test.col_uint32 AS Int64) > Int64(0) THEN Int64(1) ELSE Int64(0) END\
\n TableScan: test projection=[col_uint32]";
assert_eq!(expected, format!("{:?}", plan));
Ok(())
@@ -49,8 +50,8 @@ fn case_when() -> Result<()> {
fn unsigned_target_type() -> Result<()> {
let sql = "SELECT * FROM test WHERE col_uint32 > 0";
let plan = test_sql(sql)?;
- let expected = "Projection: #test.col_int32, #test.col_uint32, #test.col_utf8, #test.col_date32, #test.col_date64\
- \n Filter: CAST(#test.col_uint32 AS Int64) > Int64(0)\
+ let expected = "Projection: test.col_int32, test.col_uint32, test.col_utf8, test.col_date32, test.col_date64\
+ \n Filter: CAST(test.col_uint32 AS Int64) > Int64(0)\
\n TableScan: test projection=[col_int32, col_uint32, col_utf8, col_date32, col_date64]";
assert_eq!(expected, format!("{:?}", plan));
Ok(())
@@ -61,8 +62,8 @@ fn distribute_by() -> Result<()> {
// regression test for https://github.com/apache/arrow-datafusion/issues/3234
let sql = "SELECT col_int32, col_utf8 FROM test DISTRIBUTE BY (col_utf8)";
let plan = test_sql(sql)?;
- let expected = "Repartition: DistributeBy(#col_utf8)\
- \n Projection: #test.col_int32, #test.col_utf8\
+ let expected = "Repartition: DistributeBy(col_utf8)\
+ \n Projection: test.col_int32, test.col_utf8\
\n TableScan: test projection=[col_int32, col_utf8]";
assert_eq!(expected, format!("{:?}", plan));
Ok(())
@@ -75,9 +76,9 @@ fn intersect() -> Result<()> {
INTERSECT SELECT col_int32, col_utf8 FROM test";
let plan = test_sql(sql)?;
let expected =
- "Semi Join: #test.col_int32 = #test.col_int32, #test.col_utf8 = #test.col_utf8\
+ "Semi Join: test.col_int32 = test.col_int32, test.col_utf8 = test.col_utf8\
\n Distinct:\
- \n Semi Join: #test.col_int32 = #test.col_int32, #test.col_utf8 = #test.col_utf8\
+ \n Semi Join: test.col_int32 = test.col_int32, test.col_utf8 = test.col_utf8\
\n Distinct:\
\n TableScan: test projection=[col_int32, col_utf8]\
\n TableScan: test projection=[col_int32, col_utf8]\
@@ -92,8 +93,8 @@ fn between_date32_plus_interval() -> Result<()> {
WHERE col_date32 between '1998-03-18' AND cast('1998-03-18' as date) + INTERVAL '90 days'";
let plan = test_sql(sql)?;
let expected =
- "Projection: #COUNT(UInt8(1))\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
- \n Filter: #test.col_date32 >= Date32(\"10303\") AND #test.col_date32 <= Date32(\"10393\")\
+ "Projection: COUNT(UInt8(1))\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
+ \n Filter: test.col_date32 >= Date32(\"10303\") AND test.col_date32 <= Date32(\"10393\")\
\n TableScan: test projection=[col_date32]";
assert_eq!(expected, format!("{:?}", plan));
Ok(())
@@ -105,8 +106,8 @@ fn between_date64_plus_interval() -> Result<()> {
WHERE col_date64 between '1998-03-18T00:00:00' AND cast('1998-03-18' as date) + INTERVAL '90 days'";
let plan = test_sql(sql)?;
let expected =
- "Projection: #COUNT(UInt8(1))\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
- \n Filter: #test.col_date64 >= Date64(\"890179200000\") AND #test.col_date64 <= Date64(\"897955200000\")\
+ "Projection: COUNT(UInt8(1))\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
+ \n Filter: test.col_date64 >= Date64(\"890179200000\") AND test.col_date64 <= Date64(\"897955200000\")\
\n TableScan: test projection=[col_date64]";
assert_eq!(expected, format!("{:?}", plan));
Ok(())
diff --git a/datafusion/sql/README.md b/datafusion/sql/README.md
index 9f40d53ed6..2ad994e4eb 100644
--- a/datafusion/sql/README.md
+++ b/datafusion/sql/README.md
@@ -66,12 +66,12 @@ logical plan. The [datafusion-optimizer](https://crates.io/crates/datafusion-opt
optimizer that can be applied to plans produced by this crate.
```
-Sort: #state_tax DESC NULLS FIRST
- Projection: #c.id, #c.first_name, #c.last_name, #COUNT(UInt8(1)) AS num_orders, #SUM(o.price) AS total_price, #SUM(o.price * s.sales_tax) AS state_tax
- Aggregate: groupBy=[[#c.id, #c.first_name, #c.last_name]], aggr=[[COUNT(UInt8(1)), SUM(#o.price), SUM(#o.price * #s.sales_tax)]]
- Filter: #o.price > Int64(0) AND #c.last_name LIKE Utf8("G%")
- Inner Join: #c.id = #o.customer_id
- Inner Join: #c.state = #s.id
+Sort: state_tax DESC NULLS FIRST
+ Projection: c.id, c.first_name, c.last_name, COUNT(UInt8(1)) AS num_orders, SUM(o.price) AS total_price, SUM(o.price * s.sales_tax) AS state_tax
+ Aggregate: groupBy=[[c.id, c.first_name, c.last_name]], aggr=[[COUNT(UInt8(1)), SUM(o.price), SUM(o.price * s.sales_tax)]]
+ Filter: o.price > Int64(0) AND c.last_name LIKE Utf8("G%")
+ Inner Join: c.id = o.customer_id
+ Inner Join: c.state = s.id
SubqueryAlias: c
TableScan: customer
SubqueryAlias: s
diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rs
index ef57be27f3..a872e161b5 100644
--- a/datafusion/sql/src/planner.rs
+++ b/datafusion/sql/src/planner.rs
@@ -1234,7 +1234,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
// in this next section of code we are re-writing the projection to refer to columns
// output by the aggregate plan. For example, if the projection contains the expression
- // `SUM(a)` then we replace that with a reference to a column `#SUM(a)` produced by
+ // `SUM(a)` then we replace that with a reference to a column `SUM(a)` produced by
// the aggregate plan.
// combine the original grouping and aggregate expressions into one list (note that
@@ -2844,7 +2844,7 @@ mod tests {
let sql = "SELECT age, age FROM person";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- r##"Plan("Projections require unique expression names but the expression \"#person.age\" at position 0 and \"#person.age\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
+ r##"Plan("Projections require unique expression names but the expression \"person.age\" at position 0 and \"person.age\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
format!("{:?}", err)
);
}
@@ -2854,7 +2854,7 @@ mod tests {
let sql = "SELECT *, age FROM person";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- r##"Plan("Projections require unique expression names but the expression \"#person.age\" at position 3 and \"#person.age\" at position 8 have the same name. Consider aliasing (\"AS\") one of them.")"##,
+ r##"Plan("Projections require unique expression names but the expression \"person.age\" at position 3 and \"person.age\" at position 8 have the same name. Consider aliasing (\"AS\") one of them.")"##,
format!("{:?}", err)
);
}
@@ -2863,7 +2863,7 @@ mod tests {
fn select_wildcard_with_repeated_column_but_is_aliased() {
quick_test(
"SELECT *, first_name AS fn from person",
- "Projection: #person.id, #person.first_name, #person.last_name, #person.age, #person.state, #person.salary, #person.birth_date, #person.πŸ˜€, #person.first_name AS fn\
+ "Projection: person.id, person.first_name, person.last_name, person.age, person.state, person.salary, person.birth_date, person.πŸ˜€, person.first_name AS fn\
\n TableScan: person",
);
}
@@ -2881,8 +2881,8 @@ mod tests {
fn select_simple_filter() {
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 = Utf8(\"CO\")\
+ let expected = "Projection: person.id, person.first_name, person.last_name\
+ \n Filter: person.state = Utf8(\"CO\")\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -2905,8 +2905,8 @@ mod tests {
fn select_neg_filter() {
let sql = "SELECT id, first_name, last_name \
FROM person WHERE NOT state";
- let expected = "Projection: #person.id, #person.first_name, #person.last_name\
- \n Filter: NOT #person.state\
+ let expected = "Projection: person.id, person.first_name, person.last_name\
+ \n Filter: NOT person.state\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -2915,8 +2915,8 @@ mod tests {
fn select_compound_filter() {
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 = Utf8(\"CO\") AND #person.age >= Int64(21) AND #person.age <= Int64(65)\
+ let expected = "Projection: person.id, person.first_name, person.last_name\
+ \n Filter: person.state = Utf8(\"CO\") AND person.age >= Int64(21) AND person.age <= Int64(65)\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -2926,8 +2926,8 @@ mod tests {
let sql =
"SELECT state FROM person WHERE birth_date < CAST (158412331400600000 as timestamp)";
- let expected = "Projection: #person.state\
- \n Filter: #person.birth_date < CAST(Int64(158412331400600000) AS Timestamp(Nanosecond, None))\
+ let expected = "Projection: person.state\
+ \n Filter: person.birth_date < CAST(Int64(158412331400600000) AS Timestamp(Nanosecond, None))\
\n TableScan: person";
quick_test(sql, expected);
@@ -2938,8 +2938,8 @@ mod tests {
let sql =
"SELECT state FROM person WHERE birth_date < CAST ('2020-01-01' as date)";
- let expected = "Projection: #person.state\
- \n Filter: #person.birth_date < CAST(Utf8(\"2020-01-01\") AS Date32)\
+ let expected = "Projection: person.state\
+ \n Filter: person.birth_date < CAST(Utf8(\"2020-01-01\") AS Date32)\
\n TableScan: person";
quick_test(sql, expected);
@@ -2955,13 +2955,13 @@ mod tests {
AND age >= 21 \
AND age < 65 \
AND age <= 65";
- let expected = "Projection: #person.age, #person.first_name, #person.last_name\
- \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)\
+ let expected = "Projection: person.age, person.first_name, person.last_name\
+ \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";
quick_test(sql, expected);
}
@@ -2969,8 +2969,8 @@ mod tests {
#[test]
fn select_between() {
let sql = "SELECT state FROM person WHERE age BETWEEN 21 AND 65";
- let expected = "Projection: #person.state\
- \n Filter: #person.age BETWEEN Int64(21) AND Int64(65)\
+ let expected = "Projection: person.state\
+ \n Filter: person.age BETWEEN Int64(21) AND Int64(65)\
\n TableScan: person";
quick_test(sql, expected);
@@ -2979,8 +2979,8 @@ mod tests {
#[test]
fn select_between_negated() {
let sql = "SELECT state FROM person WHERE age NOT BETWEEN 21 AND 65";
- let expected = "Projection: #person.state\
- \n Filter: #person.age NOT BETWEEN Int64(21) AND Int64(65)\
+ let expected = "Projection: person.state\
+ \n Filter: person.age NOT BETWEEN Int64(21) AND Int64(65)\
\n TableScan: person";
quick_test(sql, expected);
@@ -2996,11 +2996,11 @@ mod tests {
FROM person
) AS a
) AS b";
- let expected = "Projection: #b.fn2, #b.last_name\
- \n Projection: #b.fn2, #b.last_name, #b.birth_date, alias=b\
- \n Projection: #a.fn1 AS fn2, #a.last_name, #a.birth_date, alias=b\
- \n Projection: #a.fn1, #a.last_name, #a.birth_date, #a.age, alias=a\
- \n Projection: #person.first_name AS fn1, #person.last_name, #person.birth_date, #person.age, alias=a\
+ let expected = "Projection: b.fn2, b.last_name\
+ \n Projection: b.fn2, b.last_name, b.birth_date, alias=b\
+ \n Projection: a.fn1 AS fn2, a.last_name, a.birth_date, alias=b\
+ \n Projection: a.fn1, a.last_name, a.birth_date, a.age, alias=a\
+ \n Projection: person.first_name AS fn1, person.last_name, person.birth_date, person.age, alias=a\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3015,11 +3015,11 @@ mod tests {
) AS a
WHERE fn1 = 'X' AND age < 30";
- let expected = "Projection: #a.fn1, #a.age\
- \n Filter: #a.fn1 = Utf8(\"X\") AND #a.age < Int64(30)\
- \n Projection: #a.fn1, #a.age, alias=a\
- \n Projection: #person.first_name AS fn1, #person.age, alias=a\
- \n Filter: #person.age > Int64(20)\
+ let expected = "Projection: a.fn1, a.age\
+ \n Filter: a.fn1 = Utf8(\"X\") AND a.age < Int64(30)\
+ \n Projection: a.fn1, a.age, alias=a\
+ \n Projection: person.first_name AS fn1, person.age, alias=a\
+ \n Filter: person.age > Int64(20)\
\n TableScan: person";
quick_test(sql, expected);
@@ -3029,8 +3029,8 @@ mod tests {
fn table_with_column_alias() {
let sql = "SELECT a, b, c
FROM lineitem l (a, b, c)";
- let expected = "Projection: #l.a, #l.b, #l.c\
- \n Projection: #l.l_item_id AS a, #l.l_description AS b, #l.price AS c, alias=l\
+ let expected = "Projection: l.a, l.b, l.c\
+ \n Projection: l.l_item_id AS a, l.l_description AS b, l.price AS c, alias=l\
\n SubqueryAlias: l\
\n TableScan: lineitem";
quick_test(sql, expected);
@@ -3052,8 +3052,8 @@ mod tests {
let sql = "SELECT id, age
FROM person
HAVING age > 100 AND age < 200";
- let expected = "Projection: #person.id, #person.age\
- \n Filter: #person.age > Int64(100) AND #person.age < Int64(200)\
+ let expected = "Projection: person.id, person.age\
+ \n Filter: person.age > Int64(100) AND person.age < Int64(200)\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3065,7 +3065,7 @@ mod tests {
HAVING first_name = 'M'";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- "Plan(\"HAVING clause references column(s) not provided by the select: Expression #person.first_name could not be resolved from available columns: #person.id, #person.age\")",
+ "Plan(\"HAVING clause references column(s) not provided by the select: Expression person.first_name could not be resolved from available columns: person.id, person.age\")",
format!("{:?}", err)
);
}
@@ -3078,8 +3078,8 @@ mod tests {
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
"Plan(\"HAVING clause references column(s) not provided by the select: \
- Expression #person.age could not be resolved from available columns: \
- #person.id, #person.age + Int64(1)\")",
+ Expression person.age could not be resolved from available columns: \
+ person.id, person.age + Int64(1)\")",
format!("{:?}", err)
);
}
@@ -3091,7 +3091,7 @@ mod tests {
HAVING MAX(age) > 100";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- "Plan(\"Projection references non-aggregate values: Expression #person.first_name could not be resolved from available columns: #MAX(person.age)\")",
+ "Plan(\"Projection references non-aggregate values: Expression person.first_name could not be resolved from available columns: MAX(person.age)\")",
format!("{:?}", err)
);
}
@@ -3101,9 +3101,9 @@ mod tests {
let sql = "SELECT MAX(age)
FROM person
HAVING MAX(age) < 30";
- let expected = "Projection: #MAX(person.age)\
- \n Filter: #MAX(person.age) < Int64(30)\
- \n Aggregate: groupBy=[[]], aggr=[[MAX(#person.age)]]\
+ let expected = "Projection: MAX(person.age)\
+ \n Filter: MAX(person.age) < Int64(30)\
+ \n Aggregate: groupBy=[[]], aggr=[[MAX(person.age)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3113,9 +3113,9 @@ mod tests {
let sql = "SELECT MAX(age)
FROM person
HAVING MAX(first_name) > 'M'";
- let expected = "Projection: #MAX(person.age)\
- \n Filter: #MAX(person.first_name) > Utf8(\"M\")\
- \n Aggregate: groupBy=[[]], aggr=[[MAX(#person.age), MAX(#person.first_name)]]\
+ let expected = "Projection: MAX(person.age)\
+ \n Filter: MAX(person.first_name) > Utf8(\"M\")\
+ \n Aggregate: groupBy=[[]], aggr=[[MAX(person.age), MAX(person.first_name)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3128,8 +3128,8 @@ mod tests {
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
"Plan(\"HAVING clause references non-aggregate values: \
- Expression #person.first_name could not be resolved from available columns: \
- #COUNT(UInt8(1))\")",
+ Expression person.first_name could not be resolved from available columns: \
+ COUNT(UInt8(1))\")",
format!("{:?}", err)
);
}
@@ -3140,9 +3140,9 @@ mod tests {
FROM person
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) < Int64(30)\
- \n Aggregate: groupBy=[[]], aggr=[[MAX(#person.age)]]\
+ let expected = "Projection: MAX(person.age) AS max_age\
+ \n Filter: MAX(person.age) < Int64(30)\
+ \n Aggregate: groupBy=[[]], aggr=[[MAX(person.age)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3152,9 +3152,9 @@ mod tests {
let sql = "SELECT MAX(age) as max_age
FROM person
HAVING MAX(age) < 30";
- let expected = "Projection: #MAX(person.age) AS max_age\
- \n Filter: #MAX(person.age) < Int64(30)\
- \n Aggregate: groupBy=[[]], aggr=[[MAX(#person.age)]]\
+ let expected = "Projection: MAX(person.age) AS max_age\
+ \n Filter: MAX(person.age) < Int64(30)\
+ \n Aggregate: groupBy=[[]], aggr=[[MAX(person.age)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3165,9 +3165,9 @@ mod tests {
FROM person
GROUP BY first_name
HAVING first_name = 'M'";
- let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #person.first_name = Utf8(\"M\")\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.age)]]\
+ let expected = "Projection: person.first_name, MAX(person.age)\
+ \n Filter: person.first_name = Utf8(\"M\")\
+ \n Aggregate: groupBy=[[person.first_name]], aggr=[[MAX(person.age)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3179,10 +3179,10 @@ mod tests {
WHERE id > 5
GROUP BY first_name
HAVING MAX(age) < 100";
- let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) < Int64(100)\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.age)]]\
- \n Filter: #person.id > Int64(5)\
+ let expected = "Projection: person.first_name, MAX(person.age)\
+ \n Filter: MAX(person.age) < Int64(100)\
+ \n Aggregate: groupBy=[[person.first_name]], aggr=[[MAX(person.age)]]\
+ \n Filter: person.id > Int64(5)\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3195,10 +3195,10 @@ mod tests {
WHERE id > 5 AND age > 18
GROUP BY first_name
HAVING MAX(age) < 100";
- let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) < Int64(100)\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.age)]]\
- \n Filter: #person.id > Int64(5) AND #person.age > Int64(18)\
+ let expected = "Projection: person.first_name, MAX(person.age)\
+ \n Filter: MAX(person.age) < Int64(100)\
+ \n Aggregate: groupBy=[[person.first_name]], aggr=[[MAX(person.age)]]\
+ \n Filter: person.id > Int64(5) AND person.age > Int64(18)\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3209,9 +3209,9 @@ mod tests {
FROM person
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) > Int64(2) AND #person.first_name = Utf8(\"M\")\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.age)]]\
+ let expected = "Projection: person.first_name AS fn, MAX(person.age)\
+ \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";
quick_test(sql, expected);
}
@@ -3223,9 +3223,9 @@ mod tests {
FROM person
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) > 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)]]\
+ let expected = "Projection: person.first_name AS fn, MAX(person.age) AS max_age\
+ \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";
quick_test(sql, expected);
}
@@ -3236,9 +3236,9 @@ mod tests {
FROM person
GROUP BY first_name
HAVING MAX(age) > 100";
- let expected = "Projection: #person.first_name, #MAX(person.age)\
- \n Filter: #MAX(person.age) > Int64(100)\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.age)]]\
+ let expected = "Projection: person.first_name, MAX(person.age)\
+ \n Filter: MAX(person.age) > Int64(100)\
+ \n Aggregate: groupBy=[[person.first_name]], aggr=[[MAX(person.age)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3252,8 +3252,8 @@ mod tests {
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
"Plan(\"HAVING clause references non-aggregate values: \
- Expression #person.last_name could not be resolved from available columns: \
- #person.first_name, #MAX(person.age)\")",
+ Expression person.last_name could not be resolved from available columns: \
+ person.first_name, MAX(person.age)\")",
format!("{:?}", err)
);
}
@@ -3264,9 +3264,9 @@ mod tests {
FROM person
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) > Int64(100) AND #MAX(person.age) < Int64(200)\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.age)]]\
+ let expected = "Projection: person.first_name, MAX(person.age)\
+ \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";
quick_test(sql, expected);
}
@@ -3277,9 +3277,9 @@ mod tests {
FROM person
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) > Int64(100) AND #MIN(person.id) < Int64(50)\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.age), MIN(#person.id)]]\
+ let expected = "Projection: person.first_name, MAX(person.age)\
+ \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";
quick_test(sql, expected);
}
@@ -3291,9 +3291,9 @@ mod tests {
FROM person
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) > Int64(100)\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.age)]]\
+ let expected = "Projection: person.first_name, MAX(person.age) AS max_age\
+ \n Filter: MAX(person.age) > Int64(100)\
+ \n Aggregate: groupBy=[[person.first_name]], aggr=[[MAX(person.age)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3306,9 +3306,9 @@ mod tests {
GROUP BY first_name
HAVING max_age_plus_one > 100";
let expected =
- "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)]]\
+ "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";
quick_test(sql, expected);
}
@@ -3320,9 +3320,9 @@ mod tests {
FROM person
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) > 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))]]\
+ let expected = "Projection: person.first_name, MAX(person.age)\
+ \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";
quick_test(sql, expected);
}
@@ -3333,9 +3333,9 @@ mod tests {
FROM person
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) > Int64(100) AND #COUNT(UInt8(1)) < Int64(50)\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.age), COUNT(UInt8(1))]]\
+ let expected = "Projection: person.first_name, MAX(person.age)\
+ \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";
quick_test(sql, expected);
}
@@ -3343,7 +3343,7 @@ mod tests {
#[test]
fn select_binary_expr() {
let sql = "SELECT age + salary from person";
- let expected = "Projection: #person.age + #person.salary\
+ let expected = "Projection: person.age + person.salary\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3351,7 +3351,7 @@ mod tests {
#[test]
fn select_binary_expr_nested() {
let sql = "SELECT (age + salary)/2 from person";
- let expected = "Projection: #person.age + #person.salary / Int64(2)\
+ let expected = "Projection: person.age + person.salary / Int64(2)\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3360,16 +3360,16 @@ mod tests {
fn select_wildcard_with_groupby() {
quick_test(
r#"SELECT * FROM person GROUP BY id, first_name, last_name, age, state, salary, birth_date, "πŸ˜€""#,
- "Projection: #person.id, #person.first_name, #person.last_name, #person.age, #person.state, #person.salary, #person.birth_date, #person.πŸ˜€\
- \n Aggregate: groupBy=[[#person.id, #person.first_name, #person.last_name, #person.age, #person.state, #person.salary, #person.birth_date, #person.πŸ˜€]], aggr=[[]]\
+ "Projection: person.id, person.first_name, person.last_name, person.age, person.state, person.salary, person.birth_date, person.πŸ˜€\
+ \n Aggregate: groupBy=[[person.id, person.first_name, person.last_name, person.age, person.state, person.salary, person.birth_date, person.πŸ˜€]], aggr=[[]]\
\n TableScan: person",
);
quick_test(
"SELECT * FROM (SELECT first_name, last_name FROM person) AS a GROUP BY first_name, last_name",
- "Projection: #a.first_name, #a.last_name\
- \n Aggregate: groupBy=[[#a.first_name, #a.last_name]], aggr=[[]]\
- \n Projection: #a.first_name, #a.last_name, alias=a\
- \n Projection: #person.first_name, #person.last_name, alias=a\
+ "Projection: a.first_name, a.last_name\
+ \n Aggregate: groupBy=[[a.first_name, a.last_name]], aggr=[[]]\
+ \n Projection: a.first_name, a.last_name, alias=a\
+ \n Projection: person.first_name, person.last_name, alias=a\
\n TableScan: person",
);
}
@@ -3378,8 +3378,8 @@ mod tests {
fn select_simple_aggregate() {
quick_test(
"SELECT MIN(age) FROM person",
- "Projection: #MIN(person.age)\
- \n Aggregate: groupBy=[[]], aggr=[[MIN(#person.age)]]\
+ "Projection: MIN(person.age)\
+ \n Aggregate: groupBy=[[]], aggr=[[MIN(person.age)]]\
\n TableScan: person",
);
}
@@ -3388,8 +3388,8 @@ mod tests {
fn test_sum_aggregate() {
quick_test(
"SELECT SUM(age) from person",
- "Projection: #SUM(person.age)\
- \n Aggregate: groupBy=[[]], aggr=[[SUM(#person.age)]]\
+ "Projection: SUM(person.age)\
+ \n Aggregate: groupBy=[[]], aggr=[[SUM(person.age)]]\
\n TableScan: person",
);
}
@@ -3406,7 +3406,7 @@ mod tests {
let sql = "SELECT MIN(age), MIN(age) FROM person";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- r##"Plan("Projections require unique expression names but the expression \"MIN(#person.age)\" at position 0 and \"MIN(#person.age)\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
+ r##"Plan("Projections require unique expression names but the expression \"MIN(person.age)\" at position 0 and \"MIN(person.age)\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
format!("{:?}", err)
);
}
@@ -3415,8 +3415,8 @@ mod tests {
fn select_simple_aggregate_repeated_aggregate_with_single_alias() {
quick_test(
"SELECT MIN(age), MIN(age) AS a FROM person",
- "Projection: #MIN(person.age), #MIN(person.age) AS a\
- \n Aggregate: groupBy=[[]], aggr=[[MIN(#person.age)]]\
+ "Projection: MIN(person.age), MIN(person.age) AS a\
+ \n Aggregate: groupBy=[[]], aggr=[[MIN(person.age)]]\
\n TableScan: person",
);
}
@@ -3425,8 +3425,8 @@ mod tests {
fn select_simple_aggregate_repeated_aggregate_with_unique_aliases() {
quick_test(
"SELECT MIN(age) AS a, MIN(age) AS b FROM person",
- "Projection: #MIN(person.age) AS a, #MIN(person.age) AS b\
- \n Aggregate: groupBy=[[]], aggr=[[MIN(#person.age)]]\
+ "Projection: MIN(person.age) AS a, MIN(person.age) AS b\
+ \n Aggregate: groupBy=[[]], aggr=[[MIN(person.age)]]\
\n TableScan: person",
);
}
@@ -3435,9 +3435,9 @@ mod tests {
fn select_from_typed_string_values() {
quick_test(
"SELECT col1, col2 FROM (VALUES (TIMESTAMP '2021-06-10 17:01:00Z', DATE '2004-04-09')) as t (col1, col2)",
- "Projection: #t.col1, #t.col2\
- \n Projection: #t.column1 AS col1, #t.column2 AS col2, alias=t\
- \n Projection: #column1, #column2, alias=t\
+ "Projection: t.col1, t.col2\
+ \n Projection: t.column1 AS col1, t.column2 AS col2, alias=t\
+ \n Projection: column1, column2, alias=t\
\n Values: (CAST(Utf8(\"2021-06-10 17:01:00Z\") AS Timestamp(Nanosecond, None)), CAST(Utf8(\"2004-04-09\") AS Date32))",
);
}
@@ -3447,7 +3447,7 @@ mod tests {
let sql = "SELECT MIN(age) AS a, MIN(age) AS a FROM person";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- r##"Plan("Projections require unique expression names but the expression \"MIN(#person.age) AS a\" at position 0 and \"MIN(#person.age) AS a\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
+ r##"Plan("Projections require unique expression names but the expression \"MIN(person.age) AS a\" at position 0 and \"MIN(person.age) AS a\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
format!("{:?}", err)
);
}
@@ -3456,8 +3456,8 @@ mod tests {
fn select_simple_aggregate_with_groupby() {
quick_test(
"SELECT state, MIN(age), MAX(age) FROM person GROUP BY state",
- "Projection: #person.state, #MIN(person.age), #MAX(person.age)\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[MIN(#person.age), MAX(#person.age)]]\
+ "Projection: person.state, MIN(person.age), MAX(person.age)\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[MIN(person.age), MAX(person.age)]]\
\n TableScan: person",
);
}
@@ -3466,8 +3466,8 @@ mod tests {
fn select_simple_aggregate_with_groupby_with_aliases() {
quick_test(
"SELECT state AS a, MIN(age) AS b FROM person GROUP BY state",
- "Projection: #person.state AS a, #MIN(person.age) AS b\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[MIN(#person.age)]]\
+ "Projection: person.state AS a, MIN(person.age) AS b\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[MIN(person.age)]]\
\n TableScan: person",
);
}
@@ -3477,7 +3477,7 @@ mod tests {
let sql = "SELECT state AS a, MIN(age) AS a FROM person GROUP BY state";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- r##"Plan("Projections require unique expression names but the expression \"#person.state AS a\" at position 0 and \"MIN(#person.age) AS a\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
+ r##"Plan("Projections require unique expression names but the expression \"person.state AS a\" at position 0 and \"MIN(person.age) AS a\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
format!("{:?}", err)
);
}
@@ -3486,8 +3486,8 @@ mod tests {
fn select_simple_aggregate_with_groupby_column_unselected() {
quick_test(
"SELECT MIN(age), MAX(age) FROM person GROUP BY state",
- "Projection: #MIN(person.age), #MAX(person.age)\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[MIN(#person.age), MAX(#person.age)]]\
+ "Projection: MIN(person.age), MAX(person.age)\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[MIN(person.age), MAX(person.age)]]\
\n TableScan: person",
);
}
@@ -3544,8 +3544,8 @@ mod tests {
fn select_simple_aggregate_with_groupby_and_column_is_in_aggregate_and_groupby() {
quick_test(
"SELECT MAX(first_name) FROM person GROUP BY first_name",
- "Projection: #MAX(person.first_name)\
- \n Aggregate: groupBy=[[#person.first_name]], aggr=[[MAX(#person.first_name)]]\
+ "Projection: MAX(person.first_name)\
+ \n Aggregate: groupBy=[[person.first_name]], aggr=[[MAX(person.first_name)]]\
\n TableScan: person",
);
}
@@ -3554,14 +3554,14 @@ mod tests {
fn select_simple_aggregate_with_groupby_can_use_positions() {
quick_test(
"SELECT state, age AS b, COUNT(1) FROM person GROUP BY 1, 2",
- "Projection: #person.state, #person.age AS b, #COUNT(UInt8(1))\
- \n Aggregate: groupBy=[[#person.state, #person.age]], aggr=[[COUNT(UInt8(1))]]\
+ "Projection: person.state, person.age AS b, COUNT(UInt8(1))\
+ \n Aggregate: groupBy=[[person.state, person.age]], aggr=[[COUNT(UInt8(1))]]\
\n TableScan: person",
);
quick_test(
"SELECT state, age AS b, COUNT(1) FROM person GROUP BY 2, 1",
- "Projection: #person.state, #person.age AS b, #COUNT(UInt8(1))\
- \n Aggregate: groupBy=[[#person.age, #person.state]], aggr=[[COUNT(UInt8(1))]]\
+ "Projection: person.state, person.age AS b, COUNT(UInt8(1))\
+ \n Aggregate: groupBy=[[person.age, person.state]], aggr=[[COUNT(UInt8(1))]]\
\n TableScan: person",
);
}
@@ -3571,14 +3571,14 @@ mod tests {
let sql = "SELECT state, MIN(age) FROM person GROUP BY 0";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- "Plan(\"Projection references non-aggregate values: Expression #person.state could not be resolved from available columns: #Int64(0), #MIN(person.age)\")",
+ "Plan(\"Projection references non-aggregate values: Expression person.state could not be resolved from available columns: Int64(0), MIN(person.age)\")",
format!("{:?}", err)
);
let sql2 = "SELECT state, MIN(age) FROM person GROUP BY 5";
let err2 = logical_plan(sql2).expect_err("query should have failed");
assert_eq!(
- "Plan(\"Projection references non-aggregate values: Expression #person.state could not be resolved from available columns: #Int64(5), #MIN(person.age)\")",
+ "Plan(\"Projection references non-aggregate values: Expression person.state could not be resolved from available columns: Int64(5), MIN(person.age)\")",
format!("{:?}", err2)
);
}
@@ -3587,8 +3587,8 @@ mod tests {
fn select_simple_aggregate_with_groupby_can_use_alias() {
quick_test(
"SELECT state AS a, MIN(age) AS b FROM person GROUP BY a",
- "Projection: #person.state AS a, #MIN(person.age) AS b\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[MIN(#person.age)]]\
+ "Projection: person.state AS a, MIN(person.age) AS b\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[MIN(person.age)]]\
\n TableScan: person",
);
}
@@ -3598,7 +3598,7 @@ mod tests {
let sql = "SELECT state, MIN(age), MIN(age) FROM person GROUP BY state";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- r##"Plan("Projections require unique expression names but the expression \"MIN(#person.age)\" at position 1 and \"MIN(#person.age)\" at position 2 have the same name. Consider aliasing (\"AS\") one of them.")"##,
+ r##"Plan("Projections require unique expression names but the expression \"MIN(person.age)\" at position 1 and \"MIN(person.age)\" at position 2 have the same name. Consider aliasing (\"AS\") one of them.")"##,
format!("{:?}", err)
);
}
@@ -3607,8 +3607,8 @@ mod tests {
fn select_simple_aggregate_with_groupby_aggregate_repeated_and_one_has_alias() {
quick_test(
"SELECT state, MIN(age), MIN(age) AS ma FROM person GROUP BY state",
- "Projection: #person.state, #MIN(person.age), #MIN(person.age) AS ma\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[MIN(#person.age)]]\
+ "Projection: person.state, MIN(person.age), MIN(person.age) AS ma\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[MIN(person.age)]]\
\n TableScan: person",
)
}
@@ -3617,8 +3617,8 @@ mod tests {
fn select_simple_aggregate_with_groupby_non_column_expression_unselected() {
quick_test(
"SELECT MIN(first_name) FROM person GROUP BY age + 1",
- "Projection: #MIN(person.first_name)\
- \n Aggregate: groupBy=[[#person.age + Int64(1)]], aggr=[[MIN(#person.first_name)]]\
+ "Projection: MIN(person.first_name)\
+ \n Aggregate: groupBy=[[person.age + Int64(1)]], aggr=[[MIN(person.first_name)]]\
\n TableScan: person",
);
}
@@ -3628,14 +3628,14 @@ mod tests {
) {
quick_test(
"SELECT age + 1, MIN(first_name) FROM person GROUP BY age + 1",
- "Projection: #person.age + Int64(1), #MIN(person.first_name)\
- \n Aggregate: groupBy=[[#person.age + 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",
);
quick_test(
"SELECT MIN(first_name), age + 1 FROM person GROUP BY age + 1",
- "Projection: #MIN(person.first_name), #person.age + Int64(1)\
- \n Aggregate: groupBy=[[#person.age + 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",
);
}
@@ -3645,8 +3645,8 @@ mod tests {
{
quick_test(
"SELECT ((age + 1) / 2) * (age + 1), MIN(first_name) FROM person GROUP BY age + 1",
- "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)]]\
+ "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",
);
}
@@ -3659,7 +3659,7 @@ mod tests {
"SELECT ((age + 1) / 2) * (age + 9), MIN(first_name) FROM person GROUP BY age + 1";
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
- "Plan(\"Projection references non-aggregate values: Expression #person.age could not be resolved from available columns: #person.age + Int64(1), #MIN(person.first_name)\")",
+ "Plan(\"Projection references non-aggregate values: Expression person.age could not be resolved from available columns: person.age + Int64(1), MIN(person.first_name)\")",
format!("{:?}", err)
);
}
@@ -3669,7 +3669,7 @@ mod tests {
) {
let sql = "SELECT age, MIN(first_name) FROM person GROUP BY age + 1";
let err = logical_plan(sql).expect_err("query should have failed");
- assert_eq!("Plan(\"Projection references non-aggregate values: Expression #person.age could not be resolved from available columns: #person.age + Int64(1), #MIN(person.first_name)\")",
+ assert_eq!("Plan(\"Projection references non-aggregate values: Expression person.age could not be resolved from available columns: person.age + Int64(1), MIN(person.first_name)\")",
format!("{:?}", err)
);
}
@@ -3678,8 +3678,8 @@ 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) < Int64(10)\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[MIN(#person.age)]]\
+ "Projection: person.state, MIN(person.age) < Int64(10)\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[MIN(person.age)]]\
\n TableScan: person",
);
}
@@ -3688,8 +3688,8 @@ 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 + Int64(1), #MAX(person.first_name)\
- \n Aggregate: groupBy=[[#person.age]], aggr=[[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",
);
}
@@ -3698,8 +3698,8 @@ mod tests {
fn select_aggregate_compounded_with_groupby_column() {
quick_test(
"SELECT age + MIN(salary) FROM person GROUP BY age",
- "Projection: #person.age + #MIN(person.salary)\
- \n Aggregate: groupBy=[[#person.age]], aggr=[[MIN(#person.salary)]]\
+ "Projection: person.age + MIN(person.salary)\
+ \n Aggregate: groupBy=[[person.age]], aggr=[[MIN(person.salary)]]\
\n TableScan: person",
);
}
@@ -3708,8 +3708,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 + Int64(1))\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[MIN(#person.age + Int64(1))]]\
+ "Projection: person.state, MIN(person.age + Int64(1))\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[MIN(person.age + Int64(1))]]\
\n TableScan: person",
);
}
@@ -3718,7 +3718,7 @@ mod tests {
fn test_wildcard() {
quick_test(
"SELECT * from person",
- "Projection: #person.id, #person.first_name, #person.last_name, #person.age, #person.state, #person.salary, #person.birth_date, #person.πŸ˜€\
+ "Projection: person.id, person.first_name, person.last_name, person.age, person.state, person.salary, person.birth_date, person.πŸ˜€\
\n TableScan: person",
);
}
@@ -3726,7 +3726,7 @@ mod tests {
#[test]
fn select_count_one() {
let sql = "SELECT COUNT(1) FROM person";
- let expected = "Projection: #COUNT(UInt8(1))\
+ let expected = "Projection: COUNT(UInt8(1))\
\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
\n TableScan: person";
quick_test(sql, expected);
@@ -3735,8 +3735,8 @@ mod tests {
#[test]
fn select_count_column() {
let sql = "SELECT COUNT(id) FROM person";
- let expected = "Projection: #COUNT(person.id)\
- \n Aggregate: groupBy=[[]], aggr=[[COUNT(#person.id)]]\
+ let expected = "Projection: COUNT(person.id)\
+ \n Aggregate: groupBy=[[]], aggr=[[COUNT(person.id)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3744,8 +3744,8 @@ mod tests {
#[test]
fn select_approx_median() {
let sql = "SELECT approx_median(age) FROM person";
- let expected = "Projection: #APPROXMEDIAN(person.age)\
- \n Aggregate: groupBy=[[]], aggr=[[APPROXMEDIAN(#person.age)]]\
+ let expected = "Projection: APPROXMEDIAN(person.age)\
+ \n Aggregate: groupBy=[[]], aggr=[[APPROXMEDIAN(person.age)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3753,7 +3753,7 @@ mod tests {
#[test]
fn select_scalar_func() {
let sql = "SELECT sqrt(age) FROM person";
- let expected = "Projection: sqrt(#person.age)\
+ let expected = "Projection: sqrt(person.age)\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3761,7 +3761,7 @@ mod tests {
#[test]
fn select_aliased_scalar_func() {
let sql = "SELECT sqrt(person.age) AS square_people FROM person";
- let expected = "Projection: sqrt(#person.age) AS square_people\
+ let expected = "Projection: sqrt(person.age) AS square_people\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3770,8 +3770,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 / #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)\
+ 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";
quick_test(sql, expected);
}
@@ -3779,8 +3779,8 @@ mod tests {
#[test]
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 > Float64(-0.1) AND (- #aggregate_test_100.c4) > Int64(0)\
+ let expected = "Projection: aggregate_test_100.c3\
+ \n Filter: aggregate_test_100.c3 > Float64(-0.1) AND (- aggregate_test_100.c4) > Int64(0)\
\n TableScan: aggregate_test_100";
quick_test(sql, expected);
}
@@ -3788,8 +3788,8 @@ mod tests {
#[test]
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 > Float64(0.1) AND #aggregate_test_100.c4 > Int64(0)\
+ let expected = "Projection: aggregate_test_100.c3\
+ \n Filter: aggregate_test_100.c3 > Float64(0.1) AND aggregate_test_100.c4 > Int64(0)\
\n TableScan: aggregate_test_100";
quick_test(sql, expected);
}
@@ -3797,8 +3797,8 @@ mod tests {
#[test]
fn select_order_by_index() {
let sql = "SELECT id FROM person ORDER BY 1";
- let expected = "Sort: #person.id ASC NULLS LAST\
- \n Projection: #person.id\
+ let expected = "Sort: person.id ASC NULLS LAST\
+ \n Projection: person.id\
\n TableScan: person";
quick_test(sql, expected);
@@ -3807,8 +3807,8 @@ mod tests {
#[test]
fn select_order_by_multiple_index() {
let sql = "SELECT id, state, age FROM person ORDER BY 1, 3";
- let expected = "Sort: #person.id ASC NULLS LAST, #person.age ASC NULLS LAST\
- \n Projection: #person.id, #person.state, #person.age\
+ let expected = "Sort: person.id ASC NULLS LAST, person.age ASC NULLS LAST\
+ \n Projection: person.id, person.state, person.age\
\n TableScan: person";
quick_test(sql, expected);
@@ -3837,8 +3837,8 @@ mod tests {
#[test]
fn select_order_by() {
let sql = "SELECT id FROM person ORDER BY id";
- let expected = "Sort: #person.id ASC NULLS LAST\
- \n Projection: #person.id\
+ let expected = "Sort: person.id ASC NULLS LAST\
+ \n Projection: person.id\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3846,8 +3846,8 @@ mod tests {
#[test]
fn select_order_by_desc() {
let sql = "SELECT id FROM person ORDER BY id DESC";
- let expected = "Sort: #person.id DESC NULLS FIRST\
- \n Projection: #person.id\
+ let expected = "Sort: person.id DESC NULLS FIRST\
+ \n Projection: person.id\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -3856,15 +3856,15 @@ mod tests {
fn select_order_by_nulls_last() {
quick_test(
"SELECT id FROM person ORDER BY id DESC NULLS LAST",
- "Sort: #person.id DESC NULLS LAST\
- \n Projection: #person.id\
+ "Sort: person.id DESC NULLS LAST\
+ \n Projection: person.id\
\n TableScan: person",
);
quick_test(
"SELECT id FROM person ORDER BY id NULLS LAST",
- "Sort: #person.id ASC NULLS LAST\
- \n Projection: #person.id\
+ "Sort: person.id ASC NULLS LAST\
+ \n Projection: person.id\
\n TableScan: person",
);
}
@@ -3872,8 +3872,8 @@ mod tests {
#[test]
fn select_group_by() {
let sql = "SELECT state FROM person GROUP BY state";
- let expected = "Projection: #person.state\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[]]\
+ let expected = "Projection: person.state\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[]]\
\n TableScan: person";
quick_test(sql, expected);
@@ -3882,8 +3882,8 @@ mod tests {
#[test]
fn select_group_by_columns_not_in_select() {
let sql = "SELECT MAX(age) FROM person GROUP BY state";
- let expected = "Projection: #MAX(person.age)\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[MAX(#person.age)]]\
+ let expected = "Projection: MAX(person.age)\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[MAX(person.age)]]\
\n TableScan: person";
quick_test(sql, expected);
@@ -3892,8 +3892,8 @@ mod tests {
#[test]
fn select_group_by_count_star() {
let sql = "SELECT state, COUNT(*) FROM person GROUP BY state";
- let expected = "Projection: #person.state, #COUNT(UInt8(1))\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[COUNT(UInt8(1))]]\
+ let expected = "Projection: person.state, COUNT(UInt8(1))\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[COUNT(UInt8(1))]]\
\n TableScan: person";
quick_test(sql, expected);
@@ -3903,8 +3903,8 @@ mod tests {
fn select_group_by_needs_projection() {
let sql = "SELECT COUNT(state), state FROM person GROUP BY state";
let expected = "\
- Projection: #COUNT(person.state), #person.state\
- \n Aggregate: groupBy=[[#person.state]], aggr=[[COUNT(#person.state)]]\
+ Projection: COUNT(person.state), person.state\
+ \n Aggregate: groupBy=[[person.state]], aggr=[[COUNT(person.state)]]\
\n TableScan: person";
quick_test(sql, expected);
@@ -3913,8 +3913,8 @@ mod tests {
#[test]
fn select_7480_1() {
let sql = "SELECT c1, MIN(c12) FROM aggregate_test_100 GROUP BY c1, c13";
- let expected = "Projection: #aggregate_test_100.c1, #MIN(aggregate_test_100.c12)\
- \n Aggregate: groupBy=[[#aggregate_test_100.c1, #aggregate_test_100.c13]], aggr=[[MIN(#aggregate_test_100.c12)]]\
+ let expected = "Projection: aggregate_test_100.c1, MIN(aggregate_test_100.c12)\
+ \n Aggregate: groupBy=[[aggregate_test_100.c1, aggregate_test_100.c13]], aggr=[[MIN(aggregate_test_100.c12)]]\
\n TableScan: aggregate_test_100";
quick_test(sql, expected);
}
@@ -3925,8 +3925,8 @@ mod tests {
let err = logical_plan(sql).expect_err("query should have failed");
assert_eq!(
"Plan(\"Projection references non-aggregate values: \
- Expression #aggregate_test_100.c13 could not be resolved from available columns: \
- #aggregate_test_100.c1, #MIN(aggregate_test_100.c12)\")",
+ Expression aggregate_test_100.c13 could not be resolved from available columns: \
+ aggregate_test_100.c1, MIN(aggregate_test_100.c12)\")",
format!("{:?}", err)
);
}
@@ -3976,8 +3976,8 @@ mod tests {
FROM person \
JOIN orders \
ON id = customer_id";
- let expected = "Projection: #person.id, #orders.order_id\
- \n Inner Join: #person.id = #orders.customer_id\
+ let expected = "Projection: person.id, orders.order_id\
+ \n Inner Join: person.id = orders.customer_id\
\n TableScan: person\
\n TableScan: orders";
quick_test(sql, expected);
@@ -3989,8 +3989,8 @@ mod tests {
FROM person \
JOIN orders \
ON id = customer_id AND order_id > 1 ";
- let expected = "Projection: #person.id, #orders.order_id\
- \n Inner Join: #person.id = #orders.customer_id Filter: #orders.order_id > Int64(1)\
+ let expected = "Projection: person.id, orders.order_id\
+ \n Inner Join: person.id = orders.customer_id Filter: orders.order_id > Int64(1)\
\n TableScan: person\
\n TableScan: orders";
@@ -4003,8 +4003,8 @@ mod tests {
FROM person \
LEFT JOIN orders \
ON id = customer_id AND order_id > 1 AND age < 30";
- let expected = "Projection: #person.id, #orders.order_id\
- \n Left Join: #person.id = #orders.customer_id Filter: #orders.order_id > Int64(1) AND #person.age < Int64(30)\
+ let expected = "Projection: person.id, orders.order_id\
+ \n Left Join: person.id = orders.customer_id Filter: orders.order_id > Int64(1) AND person.age < Int64(30)\
\n TableScan: person\
\n TableScan: orders";
quick_test(sql, expected);
@@ -4016,8 +4016,8 @@ mod tests {
FROM person \
RIGHT JOIN orders \
ON id = customer_id AND id > 1 AND order_id < 100";
- let expected = "Projection: #person.id, #orders.order_id\
- \n Right Join: #person.id = #orders.customer_id Filter: #person.id > Int64(1) AND #orders.order_id < Int64(100)\
+ let expected = "Projection: person.id, orders.order_id\
+ \n Right Join: person.id = orders.customer_id Filter: person.id > Int64(1) AND orders.order_id < Int64(100)\
\n TableScan: person\
\n TableScan: orders";
quick_test(sql, expected);
@@ -4029,8 +4029,8 @@ mod tests {
FROM person \
FULL JOIN orders \
ON id = customer_id AND id > 1 AND order_id < 100";
- let expected = "Projection: #person.id, #orders.order_id\
- \n Full Join: #person.id = #orders.customer_id Filter: #person.id > Int64(1) AND #orders.order_id < Int64(100)\
+ let expected = "Projection: person.id, orders.order_id\
+ \n Full Join: person.id = orders.customer_id Filter: person.id > Int64(1) AND orders.order_id < Int64(100)\
\n TableScan: person\
\n TableScan: orders";
quick_test(sql, expected);
@@ -4042,8 +4042,8 @@ mod tests {
FROM person \
JOIN orders \
ON person.id = orders.customer_id";
- let expected = "Projection: #person.id, #orders.order_id\
- \n Inner Join: #person.id = #orders.customer_id\
+ let expected = "Projection: person.id, orders.order_id\
+ \n Inner Join: person.id = orders.customer_id\
\n TableScan: person\
\n TableScan: orders";
quick_test(sql, expected);
@@ -4055,8 +4055,8 @@ mod tests {
FROM person \
JOIN person as person2 \
USING (id)";
- let expected = "Projection: #person.first_name, #person.id\
- \n Inner Join: Using #person.id = #person2.id\
+ let expected = "Projection: person.first_name, person.id\
+ \n Inner Join: Using person.id = person2.id\
\n TableScan: person\
\n SubqueryAlias: person2\
\n TableScan: person";
@@ -4069,8 +4069,8 @@ mod tests {
FROM lineitem \
JOIN lineitem as lineitem2 \
USING (l_item_id)";
- let expected = "Projection: #lineitem.l_item_id, #lineitem.l_description, #lineitem.price, #lineitem2.l_description, #lineitem2.price\
- \n Inner Join: Using #lineitem.l_item_id = #lineitem2.l_item_id\
+ let expected = "Projection: lineitem.l_item_id, lineitem.l_description, lineitem.price, lineitem2.l_description, lineitem2.price\
+ \n Inner Join: Using lineitem.l_item_id = lineitem2.l_item_id\
\n TableScan: lineitem\
\n SubqueryAlias: lineitem2\
\n TableScan: lineitem";
@@ -4083,10 +4083,9 @@ mod tests {
FROM person \
JOIN orders ON id = customer_id \
JOIN lineitem ON o_item_id = l_item_id";
- let expected =
- "Projection: #person.id, #orders.order_id, #lineitem.l_description\
- \n Inner Join: #orders.o_item_id = #lineitem.l_item_id\
- \n Inner Join: #person.id = #orders.customer_id\
+ let expected = "Projection: person.id, orders.order_id, lineitem.l_description\
+ \n Inner Join: orders.o_item_id = lineitem.l_item_id\
+ \n Inner Join: person.id = orders.customer_id\
\n TableScan: person\
\n TableScan: orders\
\n TableScan: lineitem";
@@ -4098,8 +4097,8 @@ mod tests {
let sql = "SELECT order_id \
FROM orders \
WHERE delivered = false OR delivered = true";
- let expected = "Projection: #orders.order_id\
- \n Filter: #orders.delivered = Boolean(false) OR #orders.delivered = Boolean(true)\
+ let expected = "Projection: orders.order_id\
+ \n Filter: orders.delivered = Boolean(false) OR orders.delivered = Boolean(true)\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4110,9 +4109,9 @@ mod tests {
let expected = "\
Distinct:\
\n Union\
- \n Projection: #orders.order_id\
+ \n Projection: orders.order_id\
\n TableScan: orders\
- \n Projection: #orders.order_id\
+ \n Projection: orders.order_id\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4121,9 +4120,9 @@ mod tests {
fn union_all() {
let sql = "SELECT order_id from orders UNION ALL SELECT order_id FROM orders";
let expected = "Union\
- \n Projection: #orders.order_id\
+ \n Projection: orders.order_id\
\n TableScan: orders\
- \n Projection: #orders.order_id\
+ \n Projection: orders.order_id\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4135,13 +4134,13 @@ mod tests {
UNION ALL SELECT order_id FROM orders
UNION ALL SELECT order_id FROM orders";
let expected = "Union\
- \n Projection: #orders.order_id\
+ \n Projection: orders.order_id\
\n TableScan: orders\
- \n Projection: #orders.order_id\
+ \n Projection: orders.order_id\
\n TableScan: orders\
- \n Projection: #orders.order_id\
+ \n Projection: orders.order_id\
\n TableScan: orders\
- \n Projection: #orders.order_id\
+ \n Projection: orders.order_id\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4150,9 +4149,9 @@ mod tests {
fn union_with_different_column_names() {
let sql = "SELECT order_id from orders UNION ALL SELECT customer_id FROM orders";
let expected = "Union\
- \n Projection: #orders.order_id\
+ \n Projection: orders.order_id\
\n TableScan: orders\
- \n Projection: #orders.customer_id\
+ \n Projection: orders.customer_id\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4228,16 +4227,16 @@ mod tests {
#[test]
fn sorted_union_with_different_types_and_group_by() {
let sql = "SELECT a FROM (select 1 a) x GROUP BY 1 UNION ALL (SELECT a FROM (select 1.1 a) x GROUP BY 1) ORDER BY 1";
- let expected = "Sort: #a ASC NULLS LAST\
+ let expected = "Sort: a ASC NULLS LAST\
\n Union\
- \n Projection: CAST(#x.a AS Float64) AS a\
- \n Aggregate: groupBy=[[#x.a]], aggr=[[]]\
- \n Projection: #x.a, alias=x\
+ \n Projection: CAST(x.a AS Float64) AS a\
+ \n Aggregate: groupBy=[[x.a]], aggr=[[]]\
+ \n Projection: x.a, alias=x\
\n Projection: Int64(1) AS a, alias=x\
\n EmptyRelation\
- \n Projection: #x.a\
- \n Aggregate: groupBy=[[#x.a]], aggr=[[]]\
- \n Projection: #x.a, alias=x\
+ \n Projection: x.a\
+ \n Aggregate: groupBy=[[x.a]], aggr=[[]]\
+ \n Projection: x.a, alias=x\
\n Projection: Float64(1.1) AS a, alias=x\
\n EmptyRelation";
quick_test(sql, expected);
@@ -4247,14 +4246,14 @@ mod tests {
fn union_with_binary_expr_and_cast() {
let sql = "SELECT cast(0.0 + a as integer) FROM (select 1 a) x GROUP BY 1 UNION ALL (SELECT 2.1 + a FROM (select 1 a) x GROUP BY 1)";
let expected = "Union\
- \n Projection: CAST(#Float64(0) + x.a AS Float64) AS Float64(0) + x.a\
- \n Aggregate: groupBy=[[CAST(Float64(0) + #x.a AS Int32)]], aggr=[[]]\
- \n Projection: #x.a, alias=x\
+ \n Projection: CAST(Float64(0) + x.a AS Float64) AS Float64(0) + x.a\
+ \n Aggregate: groupBy=[[CAST(Float64(0) + x.a AS Int32)]], aggr=[[]]\
+ \n Projection: x.a, alias=x\
\n Projection: Int64(1) AS a, alias=x\
\n EmptyRelation\
- \n Projection: #Float64(2.1) + x.a\
- \n Aggregate: groupBy=[[Float64(2.1) + #x.a]], aggr=[[]]\
- \n Projection: #x.a, alias=x\
+ \n Projection: Float64(2.1) + x.a\
+ \n Aggregate: groupBy=[[Float64(2.1) + x.a]], aggr=[[]]\
+ \n Projection: x.a, alias=x\
\n Projection: Int64(1) AS a, alias=x\
\n EmptyRelation";
quick_test(sql, expected);
@@ -4264,14 +4263,14 @@ mod tests {
fn union_with_aliases() {
let sql = "SELECT a as a1 FROM (select 1 a) x GROUP BY 1 UNION ALL (SELECT a as a1 FROM (select 1.1 a) x GROUP BY 1)";
let expected = "Union\
- \n Projection: CAST(#x.a AS Float64) AS a1\
- \n Aggregate: groupBy=[[#x.a]], aggr=[[]]\
- \n Projection: #x.a, alias=x\
+ \n Projection: CAST(x.a AS Float64) AS a1\
+ \n Aggregate: groupBy=[[x.a]], aggr=[[]]\
+ \n Projection: x.a, alias=x\
\n Projection: Int64(1) AS a, alias=x\
\n EmptyRelation\
- \n Projection: #x.a AS a1\
- \n Aggregate: groupBy=[[#x.a]], aggr=[[]]\
- \n Projection: #x.a, alias=x\
+ \n Projection: x.a AS a1\
+ \n Aggregate: groupBy=[[x.a]], aggr=[[]]\
+ \n Projection: x.a, alias=x\
\n Projection: Float64(1.1) AS a, alias=x\
\n EmptyRelation";
quick_test(sql, expected);
@@ -4291,8 +4290,8 @@ mod tests {
fn empty_over() {
let sql = "SELECT order_id, MAX(order_id) OVER () from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.order_id)\
- \n WindowAggr: windowExpr=[[MAX(#orders.order_id)]]\
+ Projection: orders.order_id, MAX(orders.order_id)\
+ \n WindowAggr: windowExpr=[[MAX(orders.order_id)]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4301,8 +4300,8 @@ mod tests {
fn empty_over_with_alias() {
let sql = "SELECT order_id oid, MAX(order_id) OVER () max_oid from orders";
let expected = "\
- Projection: #orders.order_id AS oid, #MAX(orders.order_id) AS max_oid\
- \n WindowAggr: windowExpr=[[MAX(#orders.order_id)]]\
+ Projection: orders.order_id AS oid, MAX(orders.order_id) AS max_oid\
+ \n WindowAggr: windowExpr=[[MAX(orders.order_id)]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4311,8 +4310,8 @@ mod tests {
fn empty_over_dup_with_alias() {
let sql = "SELECT order_id oid, MAX(order_id) OVER () max_oid, MAX(order_id) OVER () max_oid_dup from orders";
let expected = "\
- Projection: #orders.order_id AS oid, #MAX(orders.order_id) AS max_oid, #MAX(orders.order_id) AS max_oid_dup\
- \n WindowAggr: windowExpr=[[MAX(#orders.order_id)]]\
+ Projection: orders.order_id AS oid, MAX(orders.order_id) AS max_oid, MAX(orders.order_id) AS max_oid_dup\
+ \n WindowAggr: windowExpr=[[MAX(orders.order_id)]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4321,9 +4320,9 @@ mod tests {
fn empty_over_dup_with_different_sort() {
let sql = "SELECT order_id oid, MAX(order_id) OVER (), MAX(order_id) OVER (ORDER BY order_id) from orders";
let expected = "\
- Projection: #orders.order_id AS oid, #MAX(orders.order_id), #MAX(orders.order_id) ORDER BY [#orders.order_id ASC NULLS LAST]\
- \n WindowAggr: windowExpr=[[MAX(#orders.order_id)]]\
- \n WindowAggr: windowExpr=[[MAX(#orders.order_id) ORDER BY [#orders.order_id ASC NULLS LAST]]]\
+ Projection: orders.order_id AS oid, MAX(orders.order_id), MAX(orders.order_id) ORDER BY [orders.order_id ASC NULLS LAST]\
+ \n WindowAggr: windowExpr=[[MAX(orders.order_id)]]\
+ \n WindowAggr: windowExpr=[[MAX(orders.order_id) ORDER BY [orders.order_id ASC NULLS LAST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4332,8 +4331,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 * Float64(1.1))\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty * 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";
quick_test(sql, expected);
}
@@ -4343,8 +4342,8 @@ mod tests {
let sql =
"SELECT order_id, MAX(qty) OVER (), min(qty) over (), aVg(qty) OVER () from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty), #MIN(orders.qty), #AVG(orders.qty)\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty), MIN(#orders.qty), AVG(#orders.qty)]]\
+ Projection: orders.order_id, MAX(orders.qty), MIN(orders.qty), AVG(orders.qty)\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty), MIN(orders.qty), AVG(orders.qty)]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4362,8 +4361,8 @@ mod tests {
fn over_partition_by() {
let sql = "SELECT order_id, MAX(qty) OVER (PARTITION BY order_id) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) PARTITION BY [#orders.order_id]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) PARTITION BY [#orders.order_id]]]\
+ Projection: orders.order_id, MAX(orders.qty) PARTITION BY [orders.order_id]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) PARTITION BY [orders.order_id]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4384,9 +4383,9 @@ mod tests {
fn over_order_by() {
let sql = "SELECT order_id, MAX(qty) OVER (ORDER BY order_id), MIN(qty) OVER (ORDER BY order_id DESC) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST], #MIN(orders.qty) ORDER BY [#orders.order_id DESC NULLS FIRST]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST]]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY [#orders.order_id DESC NULLS FIRST]]]\
+ Projection: orders.order_id, MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST], MIN(orders.qty) ORDER BY [orders.order_id DESC NULLS FIRST]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST]]]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) ORDER BY [orders.order_id DESC NULLS FIRST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4395,9 +4394,9 @@ mod tests {
fn over_order_by_with_window_frame_double_end() {
let sql = "SELECT order_id, MAX(qty) OVER (ORDER BY order_id ROWS BETWEEN 3 PRECEDING and 3 FOLLOWING), MIN(qty) OVER (ORDER BY order_id DESC) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST] ROWS BETWEEN 3 PRECEDING AND 3 FOLLOWING, #MIN(orders.qty) ORDER BY [#orders.order_id DESC NULLS FIRST]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST] ROWS BETWEEN 3 PRECEDING AND 3 FOLLOWING]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY [#orders.order_id DESC NULLS FIRST]]]\
+ Projection: orders.order_id, MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST] ROWS BETWEEN 3 PRECEDING AND 3 FOLLOWING, MIN(orders.qty) ORDER BY [orders.order_id DESC NULLS FIRST]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST] ROWS BETWEEN 3 PRECEDING AND 3 FOLLOWING]]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) ORDER BY [orders.order_id DESC NULLS FIRST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4406,9 +4405,9 @@ mod tests {
fn over_order_by_with_window_frame_single_end() {
let sql = "SELECT order_id, MAX(qty) OVER (ORDER BY order_id ROWS 3 PRECEDING), MIN(qty) OVER (ORDER BY order_id DESC) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST] ROWS BETWEEN 3 PRECEDING AND CURRENT ROW, #MIN(orders.qty) ORDER BY [#orders.order_id DESC NULLS FIRST]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST] ROWS BETWEEN 3 PRECEDING AND CURRENT ROW]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY [#orders.order_id DESC NULLS FIRST]]]\
+ Projection: orders.order_id, MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST] ROWS BETWEEN 3 PRECEDING AND CURRENT ROW, MIN(orders.qty) ORDER BY [orders.order_id DESC NULLS FIRST]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST] ROWS BETWEEN 3 PRECEDING AND CURRENT ROW]]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) ORDER BY [orders.order_id DESC NULLS FIRST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4439,9 +4438,9 @@ mod tests {
fn over_order_by_with_window_frame_single_end_groups() {
let sql = "SELECT order_id, MAX(qty) OVER (ORDER BY order_id GROUPS 3 PRECEDING), MIN(qty) OVER (ORDER BY order_id DESC) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST] GROUPS BETWEEN 3 PRECEDING AND CURRENT ROW, #MIN(orders.qty) ORDER BY [#orders.order_id DESC NULLS FIRST]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST] GROUPS BETWEEN 3 PRECEDING AND CURRENT ROW]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY [#orders.order_id DESC NULLS FIRST]]]\
+ Projection: orders.order_id, MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST] GROUPS BETWEEN 3 PRECEDING AND CURRENT ROW, MIN(orders.qty) ORDER BY [orders.order_id DESC NULLS FIRST]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST] GROUPS BETWEEN 3 PRECEDING AND CURRENT ROW]]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) ORDER BY [orders.order_id DESC NULLS FIRST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4462,9 +4461,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 LAST], #MIN(orders.qty) ORDER BY [#orders.order_id + Int64(1) ASC NULLS LAST]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST]]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY [#orders.order_id + Int64(1) ASC NULLS LAST]]]\
+ Projection: orders.order_id, MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST], MIN(orders.qty) ORDER BY [orders.order_id + Int64(1) ASC NULLS LAST]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST]]]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) ORDER BY [orders.order_id + Int64(1) ASC NULLS LAST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4486,10 +4485,10 @@ mod tests {
fn over_order_by_sort_keys_sorting() {
let sql = "SELECT order_id, MAX(qty) OVER (ORDER BY qty, order_id), SUM(qty) OVER (), MIN(qty) OVER (ORDER BY order_id, qty) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) ORDER BY [#orders.qty ASC NULLS LAST, #orders.order_id ASC NULLS LAST], #SUM(orders.qty), #MIN(orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST, #orders.qty ASC NULLS LAST]\
- \n WindowAggr: windowExpr=[[SUM(#orders.qty)]]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) ORDER BY [#orders.qty ASC NULLS LAST, #orders.order_id ASC NULLS LAST]]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST, #orders.qty ASC NULLS LAST]]]\
+ Projection: orders.order_id, MAX(orders.qty) ORDER BY [orders.qty ASC NULLS LAST, orders.order_id ASC NULLS LAST], SUM(orders.qty), MIN(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST, orders.qty ASC NULLS LAST]\
+ \n WindowAggr: windowExpr=[[SUM(orders.qty)]]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) ORDER BY [orders.qty ASC NULLS LAST, orders.order_id ASC NULLS LAST]]]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST, orders.qty ASC NULLS LAST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4511,10 +4510,10 @@ mod tests {
fn over_order_by_sort_keys_sorting_prefix_compacting() {
let sql = "SELECT order_id, MAX(qty) OVER (ORDER BY order_id), SUM(qty) OVER (), MIN(qty) OVER (ORDER BY order_id, qty) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST], #SUM(orders.qty), #MIN(orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST, #orders.qty ASC NULLS LAST]\
- \n WindowAggr: windowExpr=[[SUM(#orders.qty)]]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST]]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST, #orders.qty ASC NULLS LAST]]]\
+ Projection: orders.order_id, MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST], SUM(orders.qty), MIN(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST, orders.qty ASC NULLS LAST]\
+ \n WindowAggr: windowExpr=[[SUM(orders.qty)]]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST]]]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST, orders.qty ASC NULLS LAST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4539,11 +4538,11 @@ mod tests {
fn over_order_by_sort_keys_sorting_global_order_compacting() {
let sql = "SELECT order_id, MAX(qty) OVER (ORDER BY qty, order_id), SUM(qty) OVER (), MIN(qty) OVER (ORDER BY order_id, qty) from orders ORDER BY order_id";
let expected = "\
- Sort: #orders.order_id ASC NULLS LAST\
- \n Projection: #orders.order_id, #MAX(orders.qty) ORDER BY [#orders.qty ASC NULLS LAST, #orders.order_id ASC NULLS LAST], #SUM(orders.qty), #MIN(orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST, #orders.qty ASC NULLS LAST]\
- \n WindowAggr: windowExpr=[[SUM(#orders.qty)]]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) ORDER BY [#orders.qty ASC NULLS LAST, #orders.order_id ASC NULLS LAST]]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) ORDER BY [#orders.order_id ASC NULLS LAST, #orders.qty ASC NULLS LAST]]]\
+ Sort: orders.order_id ASC NULLS LAST\
+ \n Projection: orders.order_id, MAX(orders.qty) ORDER BY [orders.qty ASC NULLS LAST, orders.order_id ASC NULLS LAST], SUM(orders.qty), MIN(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST, orders.qty ASC NULLS LAST]\
+ \n WindowAggr: windowExpr=[[SUM(orders.qty)]]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) ORDER BY [orders.qty ASC NULLS LAST, orders.order_id ASC NULLS LAST]]]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) ORDER BY [orders.order_id ASC NULLS LAST, orders.qty ASC NULLS LAST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4562,8 +4561,8 @@ mod tests {
let sql =
"SELECT order_id, MAX(qty) OVER (PARTITION BY order_id ORDER BY qty) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) PARTITION BY [#orders.order_id] ORDER BY [#orders.qty ASC NULLS LAST]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) PARTITION BY [#orders.order_id] ORDER BY [#orders.qty ASC NULLS LAST]]]\
+ Projection: orders.order_id, MAX(orders.qty) PARTITION BY [orders.order_id] ORDER BY [orders.qty ASC NULLS LAST]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) PARTITION BY [orders.order_id] ORDER BY [orders.qty ASC NULLS LAST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4582,8 +4581,8 @@ mod tests {
let sql =
"SELECT order_id, MAX(qty) OVER (PARTITION BY order_id, qty ORDER BY qty) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) PARTITION BY [#orders.order_id, #orders.qty] ORDER BY [#orders.qty ASC NULLS LAST]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) PARTITION BY [#orders.order_id, #orders.qty] ORDER BY [#orders.qty ASC NULLS LAST]]]\
+ Projection: orders.order_id, MAX(orders.qty) PARTITION BY [orders.order_id, orders.qty] ORDER BY [orders.qty ASC NULLS LAST]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) PARTITION BY [orders.order_id, orders.qty] ORDER BY [orders.qty ASC NULLS LAST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4605,9 +4604,9 @@ mod tests {
let sql =
"SELECT order_id, MAX(qty) OVER (PARTITION BY order_id, qty ORDER BY qty), MIN(qty) OVER (PARTITION BY qty ORDER BY order_id) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) PARTITION BY [#orders.order_id, #orders.qty] ORDER BY [#orders.qty ASC NULLS LAST], #MIN(orders.qty) PARTITION BY [#orders.qty] ORDER BY [#orders.order_id ASC NULLS LAST]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) PARTITION BY [#orders.qty] ORDER BY [#orders.order_id ASC NULLS LAST]]]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) PARTITION BY [#orders.order_id, #orders.qty] ORDER BY [#orders.qty ASC NULLS LAST]]]\
+ Projection: orders.order_id, MAX(orders.qty) PARTITION BY [orders.order_id, orders.qty] ORDER BY [orders.qty ASC NULLS LAST], MIN(orders.qty) PARTITION BY [orders.qty] ORDER BY [orders.order_id ASC NULLS LAST]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) PARTITION BY [orders.qty] ORDER BY [orders.order_id ASC NULLS LAST]]]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) PARTITION BY [orders.order_id, orders.qty] ORDER BY [orders.qty ASC NULLS LAST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4628,9 +4627,9 @@ mod tests {
let sql =
"SELECT order_id, MAX(qty) OVER (PARTITION BY order_id ORDER BY qty), MIN(qty) OVER (PARTITION BY order_id, qty ORDER BY price) from orders";
let expected = "\
- Projection: #orders.order_id, #MAX(orders.qty) PARTITION BY [#orders.order_id] ORDER BY [#orders.qty ASC NULLS LAST], #MIN(orders.qty) PARTITION BY [#orders.order_id, #orders.qty] ORDER BY [#orders.price ASC NULLS LAST]\
- \n WindowAggr: windowExpr=[[MAX(#orders.qty) PARTITION BY [#orders.order_id] ORDER BY [#orders.qty ASC NULLS LAST]]]\
- \n WindowAggr: windowExpr=[[MIN(#orders.qty) PARTITION BY [#orders.order_id, #orders.qty] ORDER BY [#orders.price ASC NULLS LAST]]]\
+ Projection: orders.order_id, MAX(orders.qty) PARTITION BY [orders.order_id] ORDER BY [orders.qty ASC NULLS LAST], MIN(orders.qty) PARTITION BY [orders.order_id, orders.qty] ORDER BY [orders.price ASC NULLS LAST]\
+ \n WindowAggr: windowExpr=[[MAX(orders.qty) PARTITION BY [orders.order_id] ORDER BY [orders.qty ASC NULLS LAST]]]\
+ \n WindowAggr: windowExpr=[[MIN(orders.qty) PARTITION BY [orders.order_id, orders.qty] ORDER BY [orders.price ASC NULLS LAST]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4640,8 +4639,8 @@ mod tests {
let sql =
"SELECT order_id, APPROX_MEDIAN(qty) OVER(PARTITION BY order_id) from orders";
let expected = "\
- Projection: #orders.order_id, #APPROXMEDIAN(orders.qty) PARTITION BY [#orders.order_id]\
- \n WindowAggr: windowExpr=[[APPROXMEDIAN(#orders.qty) PARTITION BY [#orders.order_id]]]\
+ Projection: orders.order_id, APPROXMEDIAN(orders.qty) PARTITION BY [orders.order_id]\
+ \n WindowAggr: windowExpr=[[APPROXMEDIAN(orders.qty) PARTITION BY [orders.order_id]]]\
\n TableScan: orders";
quick_test(sql, expected);
}
@@ -4666,7 +4665,7 @@ mod tests {
#[test]
fn select_multibyte_column() {
let sql = r#"SELECT "πŸ˜€" FROM person"#;
- let expected = "Projection: #person.πŸ˜€\
+ let expected = "Projection: person.πŸ˜€\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -4790,7 +4789,7 @@ mod tests {
#[test]
fn select_partially_qualified_column() {
let sql = r#"SELECT person.first_name FROM public.person"#;
- let expected = "Projection: #public.person.first_name\
+ let expected = "Projection: public.person.first_name\
\n TableScan: public.person";
quick_test(sql, expected);
}
@@ -4798,9 +4797,9 @@ mod tests {
#[test]
fn cross_join_to_inner_join() {
let sql = "select person.id from person, orders, lineitem where person.id = lineitem.l_item_id and orders.o_item_id = lineitem.l_description;";
- let expected = "Projection: #person.id\
- \n Inner Join: #lineitem.l_description = #orders.o_item_id\
- \n Inner Join: #person.id = #lineitem.l_item_id\
+ let expected = "Projection: person.id\
+ \n Inner Join: lineitem.l_description = orders.o_item_id\
+ \n Inner Join: person.id = lineitem.l_item_id\
\n TableScan: person\
\n TableScan: lineitem\
\n TableScan: orders";
@@ -4810,8 +4809,8 @@ mod tests {
#[test]
fn cross_join_not_to_inner_join() {
let sql = "select person.id from person, orders, lineitem where person.id = person.age;";
- let expected = "Projection: #person.id\
- \n Filter: #person.id = #person.age\
+ let expected = "Projection: person.id\
+ \n Filter: person.id = person.age\
\n CrossJoin:\
\n CrossJoin:\
\n TableScan: person\
@@ -4823,8 +4822,8 @@ mod tests {
#[test]
fn join_with_aliases() {
let sql = "select peeps.id, folks.first_name from person as peeps join person as folks on peeps.id = folks.id";
- let expected = "Projection: #peeps.id, #folks.first_name\
- \n Inner Join: #peeps.id = #folks.id\
+ let expected = "Projection: peeps.id, folks.first_name\
+ \n Inner Join: peeps.id = folks.id\
\n SubqueryAlias: peeps\
\n TableScan: person\
\n SubqueryAlias: folks\
@@ -4843,7 +4842,7 @@ mod tests {
#[test]
fn date_plus_interval_in_projection() {
let sql = "select t_date32 + interval '5 days' FROM test";
- let expected = "Projection: #test.t_date32 + IntervalDayTime(\"21474836480\")\
+ let expected = "Projection: test.t_date32 + IntervalDayTime(\"21474836480\")\
\n TableScan: test";
quick_test(sql, expected);
}
@@ -4855,8 +4854,8 @@ mod tests {
BETWEEN cast('1999-12-31' as date) \
AND cast('1999-12-31' as date) + interval '30 days'";
let expected =
- "Projection: #test.t_date64\
- \n Filter: #test.t_date64 BETWEEN CAST(Utf8(\"1999-12-31\") AS Date32) AND CAST(Utf8(\"1999-12-31\") AS Date32) + IntervalDayTime(\"128849018880\")\
+ "Projection: test.t_date64\
+ \n Filter: test.t_date64 BETWEEN CAST(Utf8(\"1999-12-31\") AS Date32) AND CAST(Utf8(\"1999-12-31\") AS Date32) + IntervalDayTime(\"128849018880\")\
\n TableScan: test";
quick_test(sql, expected);
}
@@ -4868,11 +4867,11 @@ mod tests {
WHERE last_name = p.last_name \
AND state = p.state)";
- let expected = "Projection: #p.id\
+ let expected = "Projection: p.id\
\n Filter: EXISTS (<subquery>)\
\n Subquery:\
- \n Projection: #person.first_name\
- \n Filter: #person.last_name = #p.last_name AND #person.state = #p.state\
+ \n Projection: person.first_name\
+ \n Filter: person.last_name = p.last_name AND person.state = p.state\
\n TableScan: person\
\n SubqueryAlias: p\
\n TableScan: person";
@@ -4889,16 +4888,16 @@ mod tests {
AND person.last_name = p.last_name \
AND person.state = p.state)";
- let expected = "Projection: #person.id\
+ let expected = "Projection: person.id\
\n Filter: EXISTS (<subquery>)\
\n Subquery:\
- \n Projection: #person.first_name\
- \n Filter: #person.last_name = #p.last_name AND #person.state = #p.state\
- \n Inner Join: #person.id = #p2.id\
+ \n Projection: person.first_name\
+ \n Filter: person.last_name = p.last_name AND person.state = p.state\
+ \n Inner Join: person.id = p2.id\
\n TableScan: person\
\n SubqueryAlias: p2\
\n TableScan: person\
- \n Inner Join: #person.id = #p.id\
+ \n Inner Join: person.id = p.id\
\n TableScan: person\
\n SubqueryAlias: p\
\n TableScan: person";
@@ -4912,11 +4911,11 @@ mod tests {
WHERE last_name = p.last_name \
AND state = p.state)";
- let expected = "Projection: #p.id\
+ let expected = "Projection: p.id\
\n Filter: EXISTS (<subquery>)\
\n Subquery:\
- \n Projection: #person.id, #person.first_name, #person.last_name, #person.age, #person.state, #person.salary, #person.birth_date, #person.πŸ˜€\
- \n Filter: #person.last_name = #p.last_name AND #person.state = #p.state\
+ \n Projection: person.id, person.first_name, person.last_name, person.age, person.state, person.salary, person.birth_date, person.πŸ˜€\
+ \n Filter: person.last_name = p.last_name AND person.state = p.state\
\n TableScan: person\
\n SubqueryAlias: p\
\n TableScan: person";
@@ -4928,10 +4927,10 @@ mod tests {
let sql = "SELECT id FROM person p WHERE id IN \
(SELECT id FROM person)";
- let expected = "Projection: #p.id\
- \n Filter: #p.id IN (<subquery>)\
+ let expected = "Projection: p.id\
+ \n Filter: p.id IN (<subquery>)\
\n Subquery:\
- \n Projection: #person.id\
+ \n Projection: person.id\
\n TableScan: person\
\n SubqueryAlias: p\
\n TableScan: person";
@@ -4943,11 +4942,11 @@ mod tests {
let sql = "SELECT id FROM person p WHERE id NOT IN \
(SELECT id FROM person WHERE last_name = p.last_name AND state = 'CO')";
- let expected = "Projection: #p.id\
- \n Filter: #p.id NOT IN (<subquery>)\
+ let expected = "Projection: p.id\
+ \n Filter: p.id NOT IN (<subquery>)\
\n Subquery:\
- \n Projection: #person.id\
- \n Filter: #person.last_name = #p.last_name AND #person.state = Utf8(\"CO\")\
+ \n Projection: person.id\
+ \n Filter: person.last_name = p.last_name AND person.state = Utf8(\"CO\")\
\n TableScan: person\
\n SubqueryAlias: p\
\n TableScan: person";
@@ -4958,11 +4957,11 @@ mod tests {
fn scalar_subquery() {
let sql = "SELECT p.id, (SELECT MAX(id) FROM person WHERE last_name = p.last_name) FROM person p";
- let expected = "Projection: #p.id, (<subquery>)\
+ let expected = "Projection: p.id, (<subquery>)\
\n Subquery:\
- \n Projection: #MAX(person.id)\
- \n Aggregate: groupBy=[[]], aggr=[[MAX(#person.id)]]\
- \n Filter: #person.last_name = #p.last_name\
+ \n Projection: MAX(person.id)\
+ \n Aggregate: groupBy=[[]], aggr=[[MAX(person.id)]]\
+ \n Filter: person.last_name = p.last_name\
\n TableScan: person\
\n SubqueryAlias: p\
\n TableScan: person";
@@ -4979,13 +4978,13 @@ mod tests {
WHERE j2_id = j1_id \
AND j1_id = j3_id)";
- let expected = "Projection: #j1.j1_string, #j2.j2_string\
- \n Filter: #j1.j1_id = #j2.j2_id - Int64(1) AND #j2.j2_id < (<subquery>)\
+ let expected = "Projection: j1.j1_string, j2.j2_string\
+ \n Filter: j1.j1_id = j2.j2_id - Int64(1) AND j2.j2_id < (<subquery>)\
\n Subquery:\
- \n Projection: #COUNT(UInt8(1))\
+ \n Projection: COUNT(UInt8(1))\
\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
- \n Filter: #j2.j2_id = #j1.j1_id\
- \n Inner Join: #j1.j1_id = #j3.j3_id\
+ \n Filter: j2.j2_id = j1.j1_id\
+ \n Inner Join: j1.j1_id = j3.j3_id\
\n TableScan: j1\
\n TableScan: j3\
\n CrossJoin:\
@@ -5001,12 +5000,12 @@ mod tests {
cte AS (SELECT * FROM person) \
SELECT * FROM person WHERE EXISTS (SELECT * FROM cte WHERE id = person.id)";
- let expected = "Projection: #person.id, #person.first_name, #person.last_name, #person.age, #person.state, #person.salary, #person.birth_date, #person.πŸ˜€\
+ let expected = "Projection: person.id, person.first_name, person.last_name, person.age, person.state, person.salary, person.birth_date, person.πŸ˜€\
\n Filter: EXISTS (<subquery>)\
\n Subquery:\
- \n Projection: #cte.id, #cte.first_name, #cte.last_name, #cte.age, #cte.state, #cte.salary, #cte.birth_date, #cte.πŸ˜€\
- \n Filter: #cte.id = #person.id\
- \n Projection: #person.id, #person.first_name, #person.last_name, #person.age, #person.state, #person.salary, #person.birth_date, #person.πŸ˜€, alias=cte\
+ \n Projection: cte.id, cte.first_name, cte.last_name, cte.age, cte.state, cte.salary, cte.birth_date, cte.πŸ˜€\
+ \n Filter: cte.id = person.id\
+ \n Projection: person.id, person.first_name, person.last_name, person.age, person.state, person.salary, person.birth_date, person.πŸ˜€, alias=cte\
\n TableScan: person\
\n TableScan: person";
@@ -5016,8 +5015,8 @@ mod tests {
#[test]
fn aggregate_with_rollup() {
let sql = "SELECT id, state, age, COUNT(*) FROM person GROUP BY id, ROLLUP (state, age)";
- let expected = "Projection: #person.id, #person.state, #person.age, #COUNT(UInt8(1))\
- \n Aggregate: groupBy=[[#person.id, ROLLUP (#person.state, #person.age)]], aggr=[[COUNT(UInt8(1))]]\
+ let expected = "Projection: person.id, person.state, person.age, COUNT(UInt8(1))\
+ \n Aggregate: groupBy=[[person.id, ROLLUP (person.state, person.age)]], aggr=[[COUNT(UInt8(1))]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -5026,8 +5025,8 @@ mod tests {
fn aggregate_with_rollup_with_grouping() {
let sql = "SELECT id, state, age, grouping(state), grouping(age), grouping(state) + grouping(age), COUNT(*) \
FROM person GROUP BY id, ROLLUP (state, age)";
- let expected = "Projection: #person.id, #person.state, #person.age, #GROUPING(person.state), #GROUPING(person.age), #GROUPING(person.state) + #GROUPING(person.age), #COUNT(UInt8(1))\
- \n Aggregate: groupBy=[[#person.id, ROLLUP (#person.state, #person.age)]], aggr=[[GROUPING(#person.state), GROUPING(#person.age), COUNT(UInt8(1))]]\
+ let expected = "Projection: person.id, person.state, person.age, GROUPING(person.state), GROUPING(person.age), GROUPING(person.state) + GROUPING(person.age), COUNT(UInt8(1))\
+ \n Aggregate: groupBy=[[person.id, ROLLUP (person.state, person.age)]], aggr=[[GROUPING(person.state), GROUPING(person.age), COUNT(UInt8(1))]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -5047,9 +5046,9 @@ mod tests {
from
person
group by rollup(state, last_name)";
- let expected = "Projection: #SUM(person.age) AS total_sum, #person.state, #person.last_name, #GROUPING(person.state) + #GROUPING(person.last_name) AS x, #RANK() PARTITION BY [#GROUPING(person.state) + #GROUPING(person.last_name), CASE WHEN #GROUPING(person.last_name) = Int64(0) THEN #person.state END] ORDER BY [#SUM(person.age) DESC NULLS FIRST] AS the_rank\
- \n WindowAggr: windowExpr=[[RANK() PARTITION BY [#GROUPING(person.state) + #GROUPING(person.last_name), CASE WHEN #GROUPING(person.last_name) = Int64(0) THEN #person.state END] ORDER BY [#SUM(person.age) DESC NULLS FIRST]]]\
- \n Aggregate: groupBy=[[ROLLUP (#person.state, #person.last_name)]], aggr=[[SUM(#person.age), GROUPING(#person.state), GROUPING(#person.last_name)]]\
+ let expected = "Projection: SUM(person.age) AS total_sum, person.state, person.last_name, GROUPING(person.state) + GROUPING(person.last_name) AS x, RANK() PARTITION BY [GROUPING(person.state) + GROUPING(person.last_name), CASE WHEN GROUPING(person.last_name) = Int64(0) THEN person.state END] ORDER BY [SUM(person.age) DESC NULLS FIRST] AS the_rank\
+ \n WindowAggr: windowExpr=[[RANK() PARTITION BY [GROUPING(person.state) + GROUPING(person.last_name), CASE WHEN GROUPING(person.last_name) = Int64(0) THEN person.state END] ORDER BY [SUM(person.age) DESC NULLS FIRST]]]\
+ \n Aggregate: groupBy=[[ROLLUP (person.state, person.last_name)]], aggr=[[SUM(person.age), GROUPING(person.state), GROUPING(person.last_name)]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -5058,8 +5057,8 @@ mod tests {
fn aggregate_with_cube() {
let sql =
"SELECT id, state, age, COUNT(*) FROM person GROUP BY id, CUBE (state, age)";
- let expected = "Projection: #person.id, #person.state, #person.age, #COUNT(UInt8(1))\
- \n Aggregate: groupBy=[[#person.id, CUBE (#person.state, #person.age)]], aggr=[[COUNT(UInt8(1))]]\
+ let expected = "Projection: person.id, person.state, person.age, COUNT(UInt8(1))\
+ \n Aggregate: groupBy=[[person.id, CUBE (person.state, person.age)]], aggr=[[COUNT(UInt8(1))]]\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -5067,7 +5066,7 @@ mod tests {
#[test]
fn round_decimal() {
let sql = "SELECT round(price/3, 2) FROM test_decimal";
- let expected = "Projection: round(#test_decimal.price / Int64(3), Int64(2))\
+ let expected = "Projection: round(test_decimal.price / Int64(3), Int64(2))\
\n TableScan: test_decimal";
quick_test(sql, expected);
}
@@ -5085,8 +5084,8 @@ mod tests {
let sql = "SELECT id, order_id \
FROM person \
JOIN orders ON id = customer_id OR person.age > 30";
- let expected = "Projection: #person.id, #orders.order_id\
- \n Filter: #person.id = #orders.customer_id OR #person.age > Int64(30)\
+ let expected = "Projection: person.id, orders.order_id\
+ \n Filter: person.id = orders.customer_id OR person.age > Int64(30)\
\n CrossJoin:\
\n TableScan: person\
\n TableScan: orders";
@@ -5098,8 +5097,8 @@ mod tests {
let sql = "SELECT id, order_id \
FROM person \
JOIN orders ON id = customer_id AND (person.age > 30 OR person.last_name = 'X')";
- let expected = "Projection: #person.id, #orders.order_id\
- \n Inner Join: #person.id = #orders.customer_id Filter: #person.age > Int64(30) OR #person.last_name = Utf8(\"X\")\
+ let expected = "Projection: person.id, orders.order_id\
+ \n Inner Join: person.id = orders.customer_id Filter: person.age > Int64(30) OR person.last_name = Utf8(\"X\")\
\n TableScan: person\
\n TableScan: orders";
quick_test(sql, expected);
@@ -5110,8 +5109,8 @@ mod tests {
let dialect = &HiveDialect {};
let sql = "SELECT SUM(age) FILTER (WHERE age > 4) FROM person";
let plan = logical_plan_with_dialect(sql, dialect)?;
- let expected = "Projection: #SUM(person.age) FILTER (WHERE #age > Int64(4))\
- \n Aggregate: groupBy=[[]], aggr=[[SUM(#person.age) FILTER (WHERE #age > Int64(4))]]\
+ let expected = "Projection: SUM(person.age) FILTER (WHERE age > Int64(4))\
+ \n Aggregate: groupBy=[[]], aggr=[[SUM(person.age) FILTER (WHERE age > Int64(4))]]\
\n TableScan: person".to_string();
assert_eq!(expected, format!("{}", plan.display_indent()));
Ok(())
@@ -5123,10 +5122,10 @@ mod tests {
// This query was failing with:
// SchemaError(FieldNotFound { qualifier: Some("p"), name: "state", valid_fields: Some(["z", "q"]) })
let sql = "select p.state z, sum(age) q from person p group by p.state order by p.state";
- let expected = "Projection: #z, #q\
- \n Sort: #p.state ASC NULLS LAST\
- \n Projection: #p.state AS z, #SUM(p.age) AS q, #p.state\
- \n Aggregate: groupBy=[[#p.state]], aggr=[[SUM(#p.age)]]\
+ let expected = "Projection: z, q\
+ \n Sort: p.state ASC NULLS LAST\
+ \n Projection: p.state AS z, SUM(p.age) AS q, p.state\
+ \n Aggregate: groupBy=[[p.state]], aggr=[[SUM(p.age)]]\
\n SubqueryAlias: p\
\n TableScan: person";
quick_test(sql, expected);
@@ -5136,8 +5135,8 @@ mod tests {
fn test_zero_offset_with_limit() {
let sql = "select id from person where person.id > 100 LIMIT 5 OFFSET 0;";
let expected = "Limit: skip=0, fetch=5\
- \n Projection: #person.id\
- \n Filter: #person.id > Int64(100)\
+ \n Projection: person.id\
+ \n Filter: person.id > Int64(100)\
\n TableScan: person";
quick_test(sql, expected);
@@ -5150,8 +5149,8 @@ mod tests {
fn test_offset_no_limit() {
let sql = "SELECT id FROM person WHERE person.id > 100 OFFSET 5;";
let expected = "Limit: skip=5, fetch=None\
- \n Projection: #person.id\
- \n Filter: #person.id > Int64(100)\
+ \n Projection: person.id\
+ \n Filter: person.id > Int64(100)\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -5160,8 +5159,8 @@ mod tests {
fn test_offset_after_limit() {
let sql = "select id from person where person.id > 100 LIMIT 5 OFFSET 3;";
let expected = "Limit: skip=3, fetch=5\
- \n Projection: #person.id\
- \n Filter: #person.id > Int64(100)\
+ \n Projection: person.id\
+ \n Filter: person.id > Int64(100)\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -5170,8 +5169,8 @@ mod tests {
fn test_offset_before_limit() {
let sql = "select id from person where person.id > 100 OFFSET 3 LIMIT 5;";
let expected = "Limit: skip=3, fetch=5\
- \n Projection: #person.id\
- \n Filter: #person.id > Int64(100)\
+ \n Projection: person.id\
+ \n Filter: person.id > Int64(100)\
\n TableScan: person";
quick_test(sql, expected);
}
@@ -5179,8 +5178,8 @@ mod tests {
#[test]
fn test_distribute_by() {
let sql = "select id from person distribute by state";
- let expected = "Repartition: DistributeBy(#state)\
- \n Projection: #person.id\
+ let expected = "Repartition: DistributeBy(state)\
+ \n Projection: person.id\
\n TableScan: person";
quick_test(sql, expected);
}