Apache DataFusion SQL Query Engine
Make binary operator formatting consistent between logical and physical plans (#3331)
Andy Groveb175f9a48d29
diff --git a/datafusion/core/src/execution/context.rs b/datafusion/core/src/execution/context.rsindex c5dcb7a595..194699ae33 100644--- a/datafusion/core/src/execution/context.rs+++ b/datafusion/core/src/execution/context.rs@@ -1872,11 +1872,11 @@ mod tests {.await?;let expected = vec![- "+----------------------+------------------------+------------------------+",- "| @@version | @name | @integer Plus Int64(1) |",- "+----------------------+------------------------+------------------------+",- "| system-var-@@version | user-defined-var-@name | 42 |",- "+----------------------+------------------------+------------------------+",+ "+----------------------+------------------------+---------------------+",+ "| @@version | @name | @integer + Int64(1) |",+ "+----------------------+------------------------+---------------------+",+ "| system-var-@@version | user-defined-var-@name | 42 |",+ "+----------------------+------------------------+---------------------+",];assert_batches_eq!(expected, &results);diff --git a/datafusion/core/src/physical_plan/planner.rs b/datafusion/core/src/physical_plan/planner.rsindex f727306ad1..8d7e0e9e48 100644--- a/datafusion/core/src/physical_plan/planner.rs+++ b/datafusion/core/src/physical_plan/planner.rs@@ -108,7 +108,7 @@ fn create_physical_name(e: &Expr, is_first_expr: bool) -> Result<String> {Expr::BinaryExpr { left, op, right } => {let left = create_physical_name(left, false)?;let right = create_physical_name(right, false)?;- Ok(format!("{} {:?} {}", left, op, right))+ Ok(format!("{} {} {}", left, op, right))}Expr::Case {expr,diff --git a/datafusion/core/tests/sql/aggregates.rs b/datafusion/core/tests/sql/aggregates.rsindex 9be41afa26..7e0e785da8 100644--- a/datafusion/core/tests/sql/aggregates.rs+++ b/datafusion/core/tests/sql/aggregates.rs@@ -1815,11 +1815,11 @@ async fn aggregate_avg_add() -> Result<()> {assert_eq!(results.len(), 1);let expected = vec![- "+--------------+----------------------------+----------------------------+----------------------------+",- "| AVG(test.c1) | AVG(test.c1) Plus Int64(1) | AVG(test.c1) Plus Int64(2) | Int64(1) Plus AVG(test.c1) |",- "+--------------+----------------------------+----------------------------+----------------------------+",- "| 1.5 | 2.5 | 3.5 | 2.5 |",- "+--------------+----------------------------+----------------------------+----------------------------+",+ "+--------------+-------------------------+-------------------------+-------------------------+",+ "| AVG(test.c1) | AVG(test.c1) + Int64(1) | AVG(test.c1) + Int64(2) | Int64(1) + AVG(test.c1) |",+ "+--------------+-------------------------+-------------------------+-------------------------+",+ "| 1.5 | 2.5 | 3.5 | 2.5 |",+ "+--------------+-------------------------+-------------------------+-------------------------+",];assert_batches_sorted_eq!(expected, &results);diff --git a/datafusion/core/tests/sql/decimal.rs b/datafusion/core/tests/sql/decimal.rsindex 9b16ca5346..8ded8752df 100644--- a/datafusion/core/tests/sql/decimal.rs+++ b/datafusion/core/tests/sql/decimal.rs@@ -376,25 +376,25 @@ async fn decimal_arithmetic_op() -> Result<()> {actual[0].schema().field(0).data_type());let expected = vec![- "+---------------------------------+",- "| decimal_simple.c1 Plus Int64(1) |",- "+---------------------------------+",- "| 1.000010 |",- "| 1.000020 |",- "| 1.000020 |",- "| 1.000030 |",- "| 1.000030 |",- "| 1.000030 |",- "| 1.000040 |",- "| 1.000040 |",- "| 1.000040 |",- "| 1.000040 |",- "| 1.000050 |",- "| 1.000050 |",- "| 1.000050 |",- "| 1.000050 |",- "| 1.000050 |",- "+---------------------------------+",+ "+------------------------------+",+ "| decimal_simple.c1 + Int64(1) |",+ "+------------------------------+",+ "| 1.000010 |",+ "| 1.000020 |",+ "| 1.000020 |",+ "| 1.000030 |",+ "| 1.000030 |",+ "| 1.000030 |",+ "| 1.000040 |",+ "| 1.000040 |",+ "| 1.000040 |",+ "| 1.000040 |",+ "| 1.000050 |",+ "| 1.000050 |",+ "| 1.000050 |",+ "| 1.000050 |",+ "| 1.000050 |",+ "+------------------------------+",];assert_batches_eq!(expected, &actual);// array decimal(10,6) + array decimal(12,7) => decimal(13,7)@@ -405,25 +405,25 @@ async fn decimal_arithmetic_op() -> Result<()> {actual[0].schema().field(0).data_type());let expected = vec![- "+------------------------------------------+",- "| decimal_simple.c1 Plus decimal_simple.c5 |",- "+------------------------------------------+",- "| 0.0000240 |",- "| 0.0000450 |",- "| 0.0000390 |",- "| 0.0000620 |",- "| 0.0000650 |",- "| 0.0000410 |",- "| 0.0000840 |",- "| 0.0000800 |",- "| 0.0000800 |",- "| 0.0000840 |",- "| 0.0001020 |",- "| 0.0001280 |",- "| 0.0000830 |",- "| 0.0001180 |",- "| 0.0001500 |",- "+------------------------------------------+",+ "+---------------------------------------+",+ "| decimal_simple.c1 + decimal_simple.c5 |",+ "+---------------------------------------+",+ "| 0.0000240 |",+ "| 0.0000450 |",+ "| 0.0000390 |",+ "| 0.0000620 |",+ "| 0.0000650 |",+ "| 0.0000410 |",+ "| 0.0000840 |",+ "| 0.0000800 |",+ "| 0.0000800 |",+ "| 0.0000840 |",+ "| 0.0001020 |",+ "| 0.0001280 |",+ "| 0.0000830 |",+ "| 0.0001180 |",+ "| 0.0001500 |",+ "+---------------------------------------+",];assert_batches_eq!(expected, &actual);// subtract@@ -434,25 +434,25 @@ async fn decimal_arithmetic_op() -> Result<()> {actual[0].schema().field(0).data_type());let expected = vec![- "+----------------------------------+",- "| decimal_simple.c1 Minus Int64(1) |",- "+----------------------------------+",- "| -0.999990 |",- "| -0.999980 |",- "| -0.999980 |",- "| -0.999970 |",- "| -0.999970 |",- "| -0.999970 |",- "| -0.999960 |",- "| -0.999960 |",- "| -0.999960 |",- "| -0.999960 |",- "| -0.999950 |",- "| -0.999950 |",- "| -0.999950 |",- "| -0.999950 |",- "| -0.999950 |",- "+----------------------------------+",+ "+------------------------------+",+ "| decimal_simple.c1 - Int64(1) |",+ "+------------------------------+",+ "| -0.999990 |",+ "| -0.999980 |",+ "| -0.999980 |",+ "| -0.999970 |",+ "| -0.999970 |",+ "| -0.999970 |",+ "| -0.999960 |",+ "| -0.999960 |",+ "| -0.999960 |",+ "| -0.999960 |",+ "| -0.999950 |",+ "| -0.999950 |",+ "| -0.999950 |",+ "| -0.999950 |",+ "| -0.999950 |",+ "+------------------------------+",];assert_batches_eq!(expected, &actual);@@ -463,25 +463,25 @@ async fn decimal_arithmetic_op() -> Result<()> {actual[0].schema().field(0).data_type());let expected = vec![- "+-------------------------------------------+",- "| decimal_simple.c1 Minus decimal_simple.c5 |",- "+-------------------------------------------+",- "| -0.0000040 |",- "| -0.0000050 |",- "| 0.0000010 |",- "| -0.0000020 |",- "| -0.0000050 |",- "| 0.0000190 |",- "| -0.0000040 |",- "| 0.0000000 |",- "| 0.0000000 |",- "| -0.0000040 |",- "| -0.0000020 |",- "| -0.0000280 |",- "| 0.0000170 |",- "| -0.0000180 |",- "| -0.0000500 |",- "+-------------------------------------------+",+ "+---------------------------------------+",+ "| decimal_simple.c1 - decimal_simple.c5 |",+ "+---------------------------------------+",+ "| -0.0000040 |",+ "| -0.0000050 |",+ "| 0.0000010 |",+ "| -0.0000020 |",+ "| -0.0000050 |",+ "| 0.0000190 |",+ "| -0.0000040 |",+ "| 0.0000000 |",+ "| 0.0000000 |",+ "| -0.0000040 |",+ "| -0.0000020 |",+ "| -0.0000280 |",+ "| 0.0000170 |",+ "| -0.0000180 |",+ "| -0.0000500 |",+ "+---------------------------------------+",];assert_batches_eq!(expected, &actual);// multiply@@ -492,25 +492,25 @@ async fn decimal_arithmetic_op() -> Result<()> {actual[0].schema().field(0).data_type());let expected = vec![- "+--------------------------------------+",- "| decimal_simple.c1 Multiply Int64(20) |",- "+--------------------------------------+",- "| 0.000200 |",- "| 0.000400 |",- "| 0.000400 |",- "| 0.000600 |",- "| 0.000600 |",- "| 0.000600 |",- "| 0.000800 |",- "| 0.000800 |",- "| 0.000800 |",- "| 0.000800 |",- "| 0.001000 |",- "| 0.001000 |",- "| 0.001000 |",- "| 0.001000 |",- "| 0.001000 |",- "+--------------------------------------+",+ "+-------------------------------+",+ "| decimal_simple.c1 * Int64(20) |",+ "+-------------------------------+",+ "| 0.000200 |",+ "| 0.000400 |",+ "| 0.000400 |",+ "| 0.000600 |",+ "| 0.000600 |",+ "| 0.000600 |",+ "| 0.000800 |",+ "| 0.000800 |",+ "| 0.000800 |",+ "| 0.000800 |",+ "| 0.001000 |",+ "| 0.001000 |",+ "| 0.001000 |",+ "| 0.001000 |",+ "| 0.001000 |",+ "+-------------------------------+",];assert_batches_eq!(expected, &actual);@@ -521,25 +521,25 @@ async fn decimal_arithmetic_op() -> Result<()> {actual[0].schema().field(0).data_type());let expected = vec![- "+----------------------------------------------+",- "| decimal_simple.c1 Multiply decimal_simple.c5 |",- "+----------------------------------------------+",- "| 0.0000000001400 |",- "| 0.0000000005000 |",- "| 0.0000000003800 |",- "| 0.0000000009600 |",- "| 0.0000000010500 |",- "| 0.0000000003300 |",- "| 0.0000000017600 |",- "| 0.0000000016000 |",- "| 0.0000000016000 |",- "| 0.0000000017600 |",- "| 0.0000000026000 |",- "| 0.0000000039000 |",- "| 0.0000000016500 |",- "| 0.0000000034000 |",- "| 0.0000000050000 |",- "+----------------------------------------------+",+ "+---------------------------------------+",+ "| decimal_simple.c1 * decimal_simple.c5 |",+ "+---------------------------------------+",+ "| 0.0000000001400 |",+ "| 0.0000000005000 |",+ "| 0.0000000003800 |",+ "| 0.0000000009600 |",+ "| 0.0000000010500 |",+ "| 0.0000000003300 |",+ "| 0.0000000017600 |",+ "| 0.0000000016000 |",+ "| 0.0000000016000 |",+ "| 0.0000000017600 |",+ "| 0.0000000026000 |",+ "| 0.0000000039000 |",+ "| 0.0000000016500 |",+ "| 0.0000000034000 |",+ "| 0.0000000050000 |",+ "+---------------------------------------+",];assert_batches_eq!(expected, &actual);// divide@@ -579,25 +579,25 @@ async fn decimal_arithmetic_op() -> Result<()> {actual[0].schema().field(0).data_type());let expected = vec![- "+--------------------------------------------+",- "| decimal_simple.c1 Divide decimal_simple.c5 |",- "+--------------------------------------------+",- "| 0.7142857142857143296 |",- "| 0.8000000000000000000 |",- "| 1.0526315789473683456 |",- "| 0.9375000000000000000 |",- "| 0.8571428571428571136 |",- "| 2.7272727272727269376 |",- "| 0.9090909090909090816 |",- "| 1.0000000000000000000 |",- "| 1.0000000000000000000 |",- "| 0.9090909090909090816 |",- "| 0.9615384615384614912 |",- "| 0.6410256410256410624 |",- "| 1.5151515151515152384 |",- "| 0.7352941176470588416 |",- "| 0.5000000000000000000 |",- "+--------------------------------------------+",+ "+---------------------------------------+",+ "| decimal_simple.c1 / decimal_simple.c5 |",+ "+---------------------------------------+",+ "| 0.7142857142857143296 |",+ "| 0.8000000000000000000 |",+ "| 1.0526315789473683456 |",+ "| 0.9375000000000000000 |",+ "| 0.8571428571428571136 |",+ "| 2.7272727272727269376 |",+ "| 0.9090909090909090816 |",+ "| 1.0000000000000000000 |",+ "| 1.0000000000000000000 |",+ "| 0.9090909090909090816 |",+ "| 0.9615384615384614912 |",+ "| 0.6410256410256410624 |",+ "| 1.5151515151515152384 |",+ "| 0.7352941176470588416 |",+ "| 0.5000000000000000000 |",+ "+---------------------------------------+",];assert_batches_eq!(expected, &actual);@@ -638,25 +638,25 @@ async fn decimal_arithmetic_op() -> Result<()> {actual[0].schema().field(0).data_type());let expected = vec![- "+--------------------------------------------+",- "| decimal_simple.c1 Modulo decimal_simple.c5 |",- "+--------------------------------------------+",- "| 0.0000100 |",- "| 0.0000200 |",- "| 0.0000010 |",- "| 0.0000300 |",- "| 0.0000300 |",- "| 0.0000080 |",- "| 0.0000400 |",- "| 0.0000000 |",- "| 0.0000000 |",- "| 0.0000400 |",- "| 0.0000500 |",- "| 0.0000500 |",- "| 0.0000170 |",- "| 0.0000500 |",- "| 0.0000500 |",- "+--------------------------------------------+",+ "+---------------------------------------+",+ "| decimal_simple.c1 % decimal_simple.c5 |",+ "+---------------------------------------+",+ "| 0.0000100 |",+ "| 0.0000200 |",+ "| 0.0000010 |",+ "| 0.0000300 |",+ "| 0.0000300 |",+ "| 0.0000080 |",+ "| 0.0000400 |",+ "| 0.0000000 |",+ "| 0.0000000 |",+ "| 0.0000400 |",+ "| 0.0000500 |",+ "| 0.0000500 |",+ "| 0.0000170 |",+ "| 0.0000500 |",+ "| 0.0000500 |",+ "+---------------------------------------+",];assert_batches_eq!(expected, &actual);diff --git a/datafusion/core/tests/sql/expr.rs b/datafusion/core/tests/sql/expr.rsindex f5dbd96613..0c59724bd6 100644--- a/datafusion/core/tests/sql/expr.rs+++ b/datafusion/core/tests/sql/expr.rs@@ -561,14 +561,14 @@ async fn query_scalar_minus_array() -> Result<()> {let sql = "SELECT 4 - c1 FROM test";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+------------------------+",- "| Int64(4) Minus test.c1 |",- "+------------------------+",- "| 4 |",- "| 3 |",- "| |",- "| 1 |",- "+------------------------+",+ "+--------------------+",+ "| Int64(4) - test.c1 |",+ "+--------------------+",+ "| 4 |",+ "| 3 |",+ "| |",+ "| 1 |",+ "+--------------------+",];assert_batches_eq!(expected, &actual);Ok(())diff --git a/datafusion/core/tests/sql/functions.rs b/datafusion/core/tests/sql/functions.rsindex e780e7e0f8..e7bcb24c74 100644--- a/datafusion/core/tests/sql/functions.rs+++ b/datafusion/core/tests/sql/functions.rs@@ -333,14 +333,14 @@ async fn coalesce_mul_with_default_value() -> Result<()> {let sql = "SELECT COALESCE(c1 * c2, 0) FROM test";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+---------------------------------------------+",- "| coalesce(test.c1 Multiply test.c2,Int64(0)) |",- "+---------------------------------------------+",- "| 2 |",- "| 0 |",- "| 0 |",- "| 0 |",- "+---------------------------------------------+",+ "+--------------------------------------+",+ "| coalesce(test.c1 * test.c2,Int64(0)) |",+ "+--------------------------------------+",+ "| 2 |",+ "| 0 |",+ "| 0 |",+ "| 0 |",+ "+--------------------------------------+",];assert_batches_eq!(expected, &actual);Ok(())diff --git a/datafusion/core/tests/sql/select.rs b/datafusion/core/tests/sql/select.rsindex fc1eee2af4..41554ab3c7 100644--- a/datafusion/core/tests/sql/select.rs+++ b/datafusion/core/tests/sql/select.rs@@ -478,14 +478,14 @@ async fn use_between_expression_in_select_query() -> Result<()> {let actual = execute_to_batches(&ctx, sql).await;// Expect field name to be correctly converted for expr, low and high.let expected = vec![- "+--------------------------------------------------------------------+",- "| abs(test.c1) BETWEEN Int64(0) AND log(test.c1 Multiply Int64(100)) |",- "+--------------------------------------------------------------------+",- "| true |",- "| true |",- "| false |",- "| false |",- "+--------------------------------------------------------------------+",+ "+-------------------------------------------------------------+",+ "| abs(test.c1) BETWEEN Int64(0) AND log(test.c1 * Int64(100)) |",+ "+-------------------------------------------------------------+",+ "| true |",+ "| true |",+ "| false |",+ "| false |",+ "+-------------------------------------------------------------+",];assert_batches_eq!(expected, &actual);@@ -1204,11 +1204,11 @@ async fn unprojected_filter() {let results = df.collect().await.unwrap();let expected = vec![- "+--------------------------+",- "| ?table?.i Plus ?table?.i |",- "+--------------------------+",- "| 6 |",- "+--------------------------+",+ "+-----------------------+",+ "| ?table?.i + ?table?.i |",+ "+-----------------------+",+ "| 6 |",+ "+-----------------------+",];assert_batches_sorted_eq!(expected, &results);}diff --git a/datafusion/core/tests/sql/timestamp.rs b/datafusion/core/tests/sql/timestamp.rsindex fab0dbf1db..82f98cf993 100644--- a/datafusion/core/tests/sql/timestamp.rs+++ b/datafusion/core/tests/sql/timestamp.rs@@ -564,19 +564,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+---------------------+-------------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+---------------------+-------------------------+--------------------------+",- "| 2020-09-08 13:42:29 | 2020-09-08 13:42:29.190 | true |",- "| 2020-09-08 13:42:29 | 2020-09-08 12:42:29.190 | false |",- "| 2020-09-08 13:42:29 | 2020-09-08 11:42:29.190 | false |",- "| 2020-09-08 12:42:29 | 2020-09-08 13:42:29.190 | false |",- "| 2020-09-08 12:42:29 | 2020-09-08 12:42:29.190 | true |",- "| 2020-09-08 12:42:29 | 2020-09-08 11:42:29.190 | false |",- "| 2020-09-08 11:42:29 | 2020-09-08 13:42:29.190 | false |",- "| 2020-09-08 11:42:29 | 2020-09-08 12:42:29.190 | false |",- "| 2020-09-08 11:42:29 | 2020-09-08 11:42:29.190 | true |",- "+---------------------+-------------------------+--------------------------+",+ "+---------------------+-------------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+---------------------+-------------------------+-------------------------+",+ "| 2020-09-08 13:42:29 | 2020-09-08 13:42:29.190 | true |",+ "| 2020-09-08 13:42:29 | 2020-09-08 12:42:29.190 | false |",+ "| 2020-09-08 13:42:29 | 2020-09-08 11:42:29.190 | false |",+ "| 2020-09-08 12:42:29 | 2020-09-08 13:42:29.190 | false |",+ "| 2020-09-08 12:42:29 | 2020-09-08 12:42:29.190 | true |",+ "| 2020-09-08 12:42:29 | 2020-09-08 11:42:29.190 | false |",+ "| 2020-09-08 11:42:29 | 2020-09-08 13:42:29.190 | false |",+ "| 2020-09-08 11:42:29 | 2020-09-08 12:42:29.190 | false |",+ "| 2020-09-08 11:42:29 | 2020-09-08 11:42:29.190 | true |",+ "+---------------------+-------------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -591,19 +591,20 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+---------------------+----------------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+---------------------+----------------------------+--------------------------+",- "| 2020-09-08 13:42:29 | 2020-09-08 13:42:29.190855 | true |",- "| 2020-09-08 13:42:29 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 13:42:29 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 12:42:29 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 12:42:29 | 2020-09-08 12:42:29.190855 | true |",- "| 2020-09-08 12:42:29 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 11:42:29 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 11:42:29 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 11:42:29 | 2020-09-08 11:42:29.190855 | true |",- "+---------------------+----------------------------+--------------------------+",+ "+---------------------+----------------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+---------------------+----------------------------+-------------------------+",+ "| 2020-09-08 13:42:29 | 2020-09-08 13:42:29.190855 | true |",+ "| 2020-09-08 13:42:29 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 13:42:29 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 12:42:29 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 12:42:29 | 2020-09-08 12:42:29.190855 | true |",+ "| 2020-09-08 12:42:29 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 11:42:29 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 11:42:29 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 11:42:29 | 2020-09-08 11:42:29.190855 | true |",+ "+---------------------+----------------------------+-------------------------+",+];assert_batches_eq!(expected, &actual);}@@ -618,19 +619,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+---------------------+----------------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+---------------------+----------------------------+--------------------------+",- "| 2020-09-08 13:42:29 | 2020-09-08 13:42:29.190855 | true |",- "| 2020-09-08 13:42:29 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 13:42:29 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 12:42:29 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 12:42:29 | 2020-09-08 12:42:29.190855 | true |",- "| 2020-09-08 12:42:29 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 11:42:29 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 11:42:29 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 11:42:29 | 2020-09-08 11:42:29.190855 | true |",- "+---------------------+----------------------------+--------------------------+",+ "+---------------------+----------------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+---------------------+----------------------------+-------------------------+",+ "| 2020-09-08 13:42:29 | 2020-09-08 13:42:29.190855 | true |",+ "| 2020-09-08 13:42:29 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 13:42:29 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 12:42:29 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 12:42:29 | 2020-09-08 12:42:29.190855 | true |",+ "| 2020-09-08 12:42:29 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 11:42:29 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 11:42:29 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 11:42:29 | 2020-09-08 11:42:29.190855 | true |",+ "+---------------------+----------------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -645,19 +646,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+-------------------------+---------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+-------------------------+---------------------+--------------------------+",- "| 2020-09-08 13:42:29.190 | 2020-09-08 13:42:29 | true |",- "| 2020-09-08 13:42:29.190 | 2020-09-08 12:42:29 | false |",- "| 2020-09-08 13:42:29.190 | 2020-09-08 11:42:29 | false |",- "| 2020-09-08 12:42:29.190 | 2020-09-08 13:42:29 | false |",- "| 2020-09-08 12:42:29.190 | 2020-09-08 12:42:29 | true |",- "| 2020-09-08 12:42:29.190 | 2020-09-08 11:42:29 | false |",- "| 2020-09-08 11:42:29.190 | 2020-09-08 13:42:29 | false |",- "| 2020-09-08 11:42:29.190 | 2020-09-08 12:42:29 | false |",- "| 2020-09-08 11:42:29.190 | 2020-09-08 11:42:29 | true |",- "+-------------------------+---------------------+--------------------------+",+ "+-------------------------+---------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+-------------------------+---------------------+-------------------------+",+ "| 2020-09-08 13:42:29.190 | 2020-09-08 13:42:29 | true |",+ "| 2020-09-08 13:42:29.190 | 2020-09-08 12:42:29 | false |",+ "| 2020-09-08 13:42:29.190 | 2020-09-08 11:42:29 | false |",+ "| 2020-09-08 12:42:29.190 | 2020-09-08 13:42:29 | false |",+ "| 2020-09-08 12:42:29.190 | 2020-09-08 12:42:29 | true |",+ "| 2020-09-08 12:42:29.190 | 2020-09-08 11:42:29 | false |",+ "| 2020-09-08 11:42:29.190 | 2020-09-08 13:42:29 | false |",+ "| 2020-09-08 11:42:29.190 | 2020-09-08 12:42:29 | false |",+ "| 2020-09-08 11:42:29.190 | 2020-09-08 11:42:29 | true |",+ "+-------------------------+---------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -672,19 +673,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+-------------------------+----------------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+-------------------------+----------------------------+--------------------------+",- "| 2020-09-08 13:42:29.190 | 2020-09-08 13:42:29.190855 | true |",- "| 2020-09-08 13:42:29.190 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 13:42:29.190 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 12:42:29.190 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 12:42:29.190 | 2020-09-08 12:42:29.190855 | true |",- "| 2020-09-08 12:42:29.190 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190 | 2020-09-08 11:42:29.190855 | true |",- "+-------------------------+----------------------------+--------------------------+",+ "+-------------------------+----------------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+-------------------------+----------------------------+-------------------------+",+ "| 2020-09-08 13:42:29.190 | 2020-09-08 13:42:29.190855 | true |",+ "| 2020-09-08 13:42:29.190 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 13:42:29.190 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 12:42:29.190 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 12:42:29.190 | 2020-09-08 12:42:29.190855 | true |",+ "| 2020-09-08 12:42:29.190 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190 | 2020-09-08 11:42:29.190855 | true |",+ "+-------------------------+----------------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -699,19 +700,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+-------------------------+----------------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+-------------------------+----------------------------+--------------------------+",- "| 2020-09-08 13:42:29.190 | 2020-09-08 13:42:29.190855 | true |",- "| 2020-09-08 13:42:29.190 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 13:42:29.190 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 12:42:29.190 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 12:42:29.190 | 2020-09-08 12:42:29.190855 | true |",- "| 2020-09-08 12:42:29.190 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190 | 2020-09-08 11:42:29.190855 | true |",- "+-------------------------+----------------------------+--------------------------+",+ "+-------------------------+----------------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+-------------------------+----------------------------+-------------------------+",+ "| 2020-09-08 13:42:29.190 | 2020-09-08 13:42:29.190855 | true |",+ "| 2020-09-08 13:42:29.190 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 13:42:29.190 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 12:42:29.190 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 12:42:29.190 | 2020-09-08 12:42:29.190855 | true |",+ "| 2020-09-08 12:42:29.190 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190 | 2020-09-08 11:42:29.190855 | true |",+ "+-------------------------+----------------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -726,19 +727,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+---------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+----------------------------+---------------------+--------------------------+",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29 | true |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29 | false |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29 | true |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29 | true |",- "+----------------------------+---------------------+--------------------------+",+ "+----------------------------+---------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+----------------------------+---------------------+-------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29 | true |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29 | false |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29 | true |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29 | true |",+ "+----------------------------+---------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -753,19 +754,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+-------------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+----------------------------+-------------------------+--------------------------+",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.190 | true |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29.190 | false |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29.190 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29.190 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.190 | true |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29.190 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29.190 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29.190 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.190 | true |",- "+----------------------------+-------------------------+--------------------------+",+ "+----------------------------+-------------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+----------------------------+-------------------------+-------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.190 | true |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29.190 | false |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29.190 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29.190 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.190 | true |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29.190 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29.190 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29.190 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.190 | true |",+ "+----------------------------+-------------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -780,19 +781,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+----------------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+----------------------------+----------------------------+--------------------------+",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.190855 | true |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.190855 | true |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.190855 | true |",- "+----------------------------+----------------------------+--------------------------+",+ "+----------------------------+----------------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+----------------------------+----------------------------+-------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.190855 | true |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.190855 | true |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.190855 | true |",+ "+----------------------------+----------------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -807,19 +808,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+---------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+----------------------------+---------------------+--------------------------+",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29 | true |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29 | false |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29 | true |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29 | true |",- "+----------------------------+---------------------+--------------------------+",+ "+----------------------------+---------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+----------------------------+---------------------+-------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29 | true |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29 | false |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29 | true |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29 | true |",+ "+----------------------------+---------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -834,19 +835,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+-------------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+----------------------------+-------------------------+--------------------------+",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.190 | true |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29.190 | false |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29.190 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29.190 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.190 | true |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29.190 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29.190 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29.190 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.190 | true |",- "+----------------------------+-------------------------+--------------------------+",+ "+----------------------------+-------------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+----------------------------+-------------------------+-------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.190 | true |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29.190 | false |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29.190 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29.190 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.190 | true |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29.190 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29.190 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29.190 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.190 | true |",+ "+----------------------------+-------------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -861,19 +862,19 @@ async fn timestamp_coercion() -> Result<()> {let sql = "SELECT table_a.ts, table_b.ts, table_a.ts = table_b.ts FROM table_a, table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+----------------------------+--------------------------+",- "| ts | ts | table_a.ts Eq table_b.ts |",- "+----------------------------+----------------------------+--------------------------+",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.190855 | true |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.190855 | true |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29.190855 | false |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.190855 | true |",- "+----------------------------+----------------------------+--------------------------+",+ "+----------------------------+----------------------------+-------------------------+",+ "| ts | ts | table_a.ts = table_b.ts |",+ "+----------------------------+----------------------------+-------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.190855 | true |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.190855 | true |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 11:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 13:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 12:42:29.190855 | false |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.190855 | true |",+ "+----------------------------+----------------------------+-------------------------+",];assert_batches_eq!(expected, &actual);}@@ -1451,52 +1452,52 @@ async fn timestamp_array_add_interval() -> Result<()> {let sql = "SELECT ts, ts - INTERVAL '8' MILLISECONDS FROM table_a";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+---------------------------------------+",- "| ts | table_a.ts Minus IntervalDayTime(\"8\") |",- "+----------------------------+---------------------------------------+",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.182855 |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.182855 |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.182855 |",- "+----------------------------+---------------------------------------+",+ "+----------------------------+-----------------------------------+",+ "| ts | table_a.ts - IntervalDayTime(\"8\") |",+ "+----------------------------+-----------------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:29.182855 |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:29.182855 |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:29.182855 |",+ "+----------------------------+-----------------------------------+",];assert_batches_eq!(expected, &actual);let sql = "SELECT ts, ts + INTERVAL '1' SECOND FROM table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+-----------------------------------------+",- "| ts | table_b.ts Plus IntervalDayTime(\"1000\") |",- "+----------------------------+-----------------------------------------+",- "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:30.190855 |",- "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:30.190855 |",- "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:30.190855 |",- "+----------------------------+-----------------------------------------+",+ "+----------------------------+--------------------------------------+",+ "| ts | table_b.ts + IntervalDayTime(\"1000\") |",+ "+----------------------------+--------------------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2020-09-08 13:42:30.190855 |",+ "| 2020-09-08 12:42:29.190855 | 2020-09-08 12:42:30.190855 |",+ "| 2020-09-08 11:42:29.190855 | 2020-09-08 11:42:30.190855 |",+ "+----------------------------+--------------------------------------+",];assert_batches_eq!(expected, &actual);let sql = "SELECT ts, ts + INTERVAL '2' MONTH FROM table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+----------------------------------------+",- "| ts | table_b.ts Plus IntervalYearMonth(\"2\") |",- "+----------------------------+----------------------------------------+",- "| 2020-09-08 13:42:29.190855 | 2020-11-08 13:42:29.190855 |",- "| 2020-09-08 12:42:29.190855 | 2020-11-08 12:42:29.190855 |",- "| 2020-09-08 11:42:29.190855 | 2020-11-08 11:42:29.190855 |",- "+----------------------------+----------------------------------------+",+ "+----------------------------+-------------------------------------+",+ "| ts | table_b.ts + IntervalYearMonth(\"2\") |",+ "+----------------------------+-------------------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2020-11-08 13:42:29.190855 |",+ "| 2020-09-08 12:42:29.190855 | 2020-11-08 12:42:29.190855 |",+ "| 2020-09-08 11:42:29.190855 | 2020-11-08 11:42:29.190855 |",+ "+----------------------------+-------------------------------------+",];assert_batches_eq!(expected, &actual);let sql = "SELECT ts, ts - INTERVAL '16' YEAR FROM table_b";let actual = execute_to_batches(&ctx, sql).await;let expected = vec![- "+----------------------------+-------------------------------------------+",- "| ts | table_b.ts Minus IntervalYearMonth(\"192\") |",- "+----------------------------+-------------------------------------------+",- "| 2020-09-08 13:42:29.190855 | 2004-09-08 13:42:29.190855 |",- "| 2020-09-08 12:42:29.190855 | 2004-09-08 12:42:29.190855 |",- "| 2020-09-08 11:42:29.190855 | 2004-09-08 11:42:29.190855 |",- "+----------------------------+-------------------------------------------+",+ "+----------------------------+---------------------------------------+",+ "| ts | table_b.ts - IntervalYearMonth(\"192\") |",+ "+----------------------------+---------------------------------------+",+ "| 2020-09-08 13:42:29.190855 | 2004-09-08 13:42:29.190855 |",+ "| 2020-09-08 12:42:29.190855 | 2004-09-08 12:42:29.190855 |",+ "| 2020-09-08 11:42:29.190855 | 2004-09-08 11:42:29.190855 |",+ "+----------------------------+---------------------------------------+",];assert_batches_eq!(expected, &actual);Ok(())diff --git a/datafusion/core/tests/sql/window.rs b/datafusion/core/tests/sql/window.rsindex baaaee3431..1c909fa712 100644--- a/datafusion/core/tests/sql/window.rs+++ b/datafusion/core/tests/sql/window.rs@@ -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) Minus 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(())