You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/08/24 13:15:48 UTC
(datafusion) 01/01: chore: fix the remaining malformed example tables in function docs (#24596)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-24596-6cc34421e76e2df78d263c844ea2ece7470c9386
in repository https://gitbox.apache.org/repos/asf/datafusion.git
commit 3dc98540f5d33926d6ab0f56b5e2b637532c10c6
Author: Advit Arora <ad...@gmail.com>
AuthorDate: Mon Aug 24 13:15:25 2026 +0000
chore: fix the remaining malformed example tables in function docs (#24596)
## Which issue does this PR close?
- Part of #24209.
## Rationale for this change
The scalar functions page still has tables whose rows don't line up with
their borders, including the `arrow_field` example the issue links:
```
+-------------------------------------------------------------+
| arrow_field(Int64(1)) |
+-------------------------------------------------------------+
| {name: lit, data_type: Int64, nullable: false, metadata: {}} |
+-------------------------------------------------------------+
```
The data row is 64 wide, the borders are 63. These tables are
hand-written inside `sql_example` literals and `print_functions_docs`
copies them onto the page verbatim.
## What changes are included in this PR?
Padding and border widths on 32 tables across 24 sources in `functions`,
`functions-nested` and `functions-aggregate`, plus the regenerated
`scalar_functions.md` and `aggregate_functions.md`. No cell content
changed, except `nvl`, which has a stray backslash welded to a border
(`+---------------------+\`) that reaches the page as-is. That's
removed.
The aggregate page is in scope again after #24503 because that pass was
equalising widths, and `first_value`'s row was already the right width
with an unpadded cell, so it went through untouched.
I did these by hand rather than scripting them: `round`'s table had a
17-wide row against a 16-wide border where the correct width is 18, so
neither line could just be widened to match the other.
Boxes 2 to 4 of the issue are a separate change. The check box 1 asks
for is a follow-up to this.
## Are these changes tested?
No test. Nothing in the repo reads a `sql_example` body yet, which is
what box 1 is for. `./dev/update_function_docs.sh` reproduces all three
generated pages byte for byte, so `config-docs-check` is green, and fmt,
prettier and clippy are clean on the three crates.
## Are there any user-facing changes?
The rendered docs pages only.
---
datafusion/functions-aggregate/src/first_last.rs | 10 +-
datafusion/functions-nested/src/array_avg.rs | 8 +-
datafusion/functions-nested/src/array_filter.rs | 8 +-
datafusion/functions-nested/src/array_has.rs | 8 +-
datafusion/functions-nested/src/array_normalize.rs | 8 +-
datafusion/functions-nested/src/array_scale.rs | 8 +-
datafusion/functions-nested/src/array_sum.rs | 8 +-
datafusion/functions-nested/src/array_transform.rs | 10 +-
datafusion/functions-nested/src/cosine_distance.rs | 8 +-
datafusion/functions-nested/src/except.rs | 20 +-
datafusion/functions-nested/src/extract.rs | 10 +-
datafusion/functions-nested/src/inner_product.rs | 8 +-
datafusion/functions-nested/src/position.rs | 8 +-
datafusion/functions-nested/src/range.rs | 10 +-
datafusion/functions-nested/src/remove.rs | 24 +--
datafusion/functions-nested/src/string.rs | 10 +-
datafusion/functions/src/core/arrow_field.rs | 8 +-
datafusion/functions/src/core/arrow_metadata.rs | 10 +-
datafusion/functions/src/core/nvl.rs | 2 +-
datafusion/functions/src/core/with_metadata.rs | 12 +-
datafusion/functions/src/datetime/date_trunc.rs | 16 +-
datafusion/functions/src/datetime/to_date.rs | 16 +-
datafusion/functions/src/datetime/to_timestamp.rs | 2 +-
datafusion/functions/src/math/round.rs | 10 +-
docs/source/user-guide/sql/aggregate_functions.md | 10 +-
docs/source/user-guide/sql/scalar_functions.md | 232 ++++++++++-----------
26 files changed, 242 insertions(+), 242 deletions(-)
diff --git a/datafusion/functions-aggregate/src/first_last.rs b/datafusion/functions-aggregate/src/first_last.rs
index fbabdbcbb2..d36ea5d630 100644
--- a/datafusion/functions-aggregate/src/first_last.rs
+++ b/datafusion/functions-aggregate/src/first_last.rs
@@ -242,11 +242,11 @@ fn groups_accumulator_supported(args: &AccumulatorArgs) -> bool {
syntax_example = "first_value(expression [ORDER BY expression])",
sql_example = r#"```sql
> SELECT first_value(column_name ORDER BY other_column) FROM table_name;
-+-----------------------------------------------+
-| first_value(column_name ORDER BY other_column)|
-+-----------------------------------------------+
-| first_element |
-+-----------------------------------------------+
++------------------------------------------------+
+| first_value(column_name ORDER BY other_column) |
++------------------------------------------------+
+| first_element |
++------------------------------------------------+
```"#,
standard_argument(name = "expression",)
)]
diff --git a/datafusion/functions-nested/src/array_avg.rs b/datafusion/functions-nested/src/array_avg.rs
index 8133d3cac8..15c021b3d2 100644
--- a/datafusion/functions-nested/src/array_avg.rs
+++ b/datafusion/functions-nested/src/array_avg.rs
@@ -48,11 +48,11 @@ make_udf_expr_and_func!(
syntax_example = "array_avg(array)",
sql_example = r#"```sql
> select array_avg([1.0, 2.0, 3.0]);
-+----------------------------+
++--------------------------------+
| array_avg(List([1.0,2.0,3.0])) |
-+----------------------------+
-| 2.0 |
-+----------------------------+
++--------------------------------+
+| 2.0 |
++--------------------------------+
```"#,
argument(
name = "array",
diff --git a/datafusion/functions-nested/src/array_filter.rs b/datafusion/functions-nested/src/array_filter.rs
index 3439699433..f8af0d165c 100644
--- a/datafusion/functions-nested/src/array_filter.rs
+++ b/datafusion/functions-nested/src/array_filter.rs
@@ -54,11 +54,11 @@ make_higher_order_function_expr_and_func!(
syntax_example = "array_filter(array, x -> x > 2)",
sql_example = r#"```sql
> select array_filter([1, 2, 3, 4, 5], x -> x > 2);
-+--------------------------------------------+
++-------------------------------------------+
| array_filter([1, 2, 3, 4, 5], x -> x > 2) |
-+--------------------------------------------+
-| [3, 4, 5] |
-+--------------------------------------------+
++-------------------------------------------+
+| [3, 4, 5] |
++-------------------------------------------+
```"#,
argument(
name = "array",
diff --git a/datafusion/functions-nested/src/array_has.rs b/datafusion/functions-nested/src/array_has.rs
index bb3c2dd13f..9ae521b401 100644
--- a/datafusion/functions-nested/src/array_has.rs
+++ b/datafusion/functions-nested/src/array_has.rs
@@ -1066,11 +1066,11 @@ impl ScalarUDFImpl for ArrayHasAll {
syntax_example = "array_has_any(array1, array2)",
sql_example = r#"```sql
> select array_has_any([1, 2, 3], [3, 4]);
-+------------------------------------------+
++-------------------------------------------+
| array_has_any(List([1,2,3]), List([3,4])) |
-+------------------------------------------+
-| true |
-+------------------------------------------+
++-------------------------------------------+
+| true |
++-------------------------------------------+
```"#,
argument(
name = "array1",
diff --git a/datafusion/functions-nested/src/array_normalize.rs b/datafusion/functions-nested/src/array_normalize.rs
index f7da07e5f6..8f4342cd83 100644
--- a/datafusion/functions-nested/src/array_normalize.rs
+++ b/datafusion/functions-nested/src/array_normalize.rs
@@ -51,11 +51,11 @@ make_udf_expr_and_func!(
syntax_example = "array_normalize(array)",
sql_example = r#"```sql
> select array_normalize([3.0, 4.0]);
-+-----------------------------+
++----------------------------------+
| array_normalize(List([3.0,4.0])) |
-+-----------------------------+
-| [0.6, 0.8] |
-+-----------------------------+
++----------------------------------+
+| [0.6, 0.8] |
++----------------------------------+
```"#,
argument(
name = "array",
diff --git a/datafusion/functions-nested/src/array_scale.rs b/datafusion/functions-nested/src/array_scale.rs
index a6be910d20..5b9130e9f0 100644
--- a/datafusion/functions-nested/src/array_scale.rs
+++ b/datafusion/functions-nested/src/array_scale.rs
@@ -49,11 +49,11 @@ make_udf_expr_and_func!(
syntax_example = "array_scale(array, scalar)",
sql_example = r#"```sql
> select array_scale([1.0, 2.0, 3.0], 2.0);
-+----------------------------------+
++-----------------------------------------------+
| array_scale(List([1.0,2.0,3.0]),Float64(2.0)) |
-+----------------------------------+
-| [2.0, 4.0, 6.0] |
-+----------------------------------+
++-----------------------------------------------+
+| [2.0, 4.0, 6.0] |
++-----------------------------------------------+
```"#,
argument(
name = "array",
diff --git a/datafusion/functions-nested/src/array_sum.rs b/datafusion/functions-nested/src/array_sum.rs
index d115355f5c..4d90c7d4f3 100644
--- a/datafusion/functions-nested/src/array_sum.rs
+++ b/datafusion/functions-nested/src/array_sum.rs
@@ -48,11 +48,11 @@ make_udf_expr_and_func!(
syntax_example = "array_sum(array)",
sql_example = r#"```sql
> select array_sum([1.0, 2.0, 3.0]);
-+----------------------------+
++--------------------------------+
| array_sum(List([1.0,2.0,3.0])) |
-+----------------------------+
-| 6.0 |
-+----------------------------+
++--------------------------------+
+| 6.0 |
++--------------------------------+
```"#,
argument(
name = "array",
diff --git a/datafusion/functions-nested/src/array_transform.rs b/datafusion/functions-nested/src/array_transform.rs
index e07952722e..ecf8620f4f 100644
--- a/datafusion/functions-nested/src/array_transform.rs
+++ b/datafusion/functions-nested/src/array_transform.rs
@@ -53,11 +53,11 @@ make_higher_order_function_expr_and_func!(
syntax_example = "array_transform(array, lambda)",
sql_example = r#"```sql
> select array_transform([1, 2, 3, 4, 5], x -> x*2);
-+-------------------------------------------+
-| array_transform([1, 2, 3, 4, 5], x -> x*2) |
-+-------------------------------------------+
-| [2, 4, 6, 8, 10] |
-+-------------------------------------------+
++--------------------------------------------+
+| array_transform([1, 2, 3, 4, 5], x -> x*2) |
++--------------------------------------------+
+| [2, 4, 6, 8, 10] |
++--------------------------------------------+
```"#,
argument(
name = "array",
diff --git a/datafusion/functions-nested/src/cosine_distance.rs b/datafusion/functions-nested/src/cosine_distance.rs
index 3358560750..56ca071234 100644
--- a/datafusion/functions-nested/src/cosine_distance.rs
+++ b/datafusion/functions-nested/src/cosine_distance.rs
@@ -50,11 +50,11 @@ make_udf_expr_and_func!(
syntax_example = "cosine_distance(array1, array2)",
sql_example = r#"```sql
> select cosine_distance([1.0, 0.0], [0.0, 1.0]);
-+-----------------------------------------------+
++--------------------------------------------------+
| cosine_distance(List([1.0,0.0]),List([0.0,1.0])) |
-+-----------------------------------------------+
-| 1.0 |
-+-----------------------------------------------+
++--------------------------------------------------+
+| 1.0 |
++--------------------------------------------------+
```"#,
argument(
name = "array1",
diff --git a/datafusion/functions-nested/src/except.rs b/datafusion/functions-nested/src/except.rs
index dbf815c0ec..737a3122bb 100644
--- a/datafusion/functions-nested/src/except.rs
+++ b/datafusion/functions-nested/src/except.rs
@@ -51,17 +51,17 @@ make_udf_expr_and_func!(
syntax_example = "array_except(array1, array2)",
sql_example = r#"```sql
> select array_except([1, 2, 3, 4], [5, 6, 3, 4]);
-+----------------------------------------------------+
-| array_except([1, 2, 3, 4], [5, 6, 3, 4]); |
-+----------------------------------------------------+
-| [1, 2] |
-+----------------------------------------------------+
++-------------------------------------------+
+| array_except([1, 2, 3, 4], [5, 6, 3, 4]); |
++-------------------------------------------+
+| [1, 2] |
++-------------------------------------------+
> select array_except([1, 2, 3, 4], [3, 4, 5, 6]);
-+----------------------------------------------------+
-| array_except([1, 2, 3, 4], [3, 4, 5, 6]); |
-+----------------------------------------------------+
-| [1, 2] |
-+----------------------------------------------------+
++-------------------------------------------+
+| array_except([1, 2, 3, 4], [3, 4, 5, 6]); |
++-------------------------------------------+
+| [1, 2] |
++-------------------------------------------+
```"#,
argument(
name = "array1",
diff --git a/datafusion/functions-nested/src/extract.rs b/datafusion/functions-nested/src/extract.rs
index cb7a316b28..52023e83bd 100644
--- a/datafusion/functions-nested/src/extract.rs
+++ b/datafusion/functions-nested/src/extract.rs
@@ -801,11 +801,11 @@ where
syntax_example = "array_pop_front(array)",
sql_example = r#"```sql
> select array_pop_front([1, 2, 3]);
-+-------------------------------+
++--------------------------------+
| array_pop_front(List([1,2,3])) |
-+-------------------------------+
-| [2, 3] |
-+-------------------------------+
++--------------------------------+
+| [2, 3] |
++--------------------------------+
```"#,
argument(
name = "array",
@@ -985,7 +985,7 @@ where
syntax_example = "array_any_value(array)",
sql_example = r#"```sql
> select array_any_value([NULL, 1, 2, 3]);
-+-------------------------------+
++-------------------------------------+
| array_any_value(List([NULL,1,2,3])) |
+-------------------------------------+
| 1 |
diff --git a/datafusion/functions-nested/src/inner_product.rs b/datafusion/functions-nested/src/inner_product.rs
index 8d8c565663..da8ea0a1d0 100644
--- a/datafusion/functions-nested/src/inner_product.rs
+++ b/datafusion/functions-nested/src/inner_product.rs
@@ -50,11 +50,11 @@ make_udf_expr_and_func!(
syntax_example = "inner_product(array1, array2)",
sql_example = r#"```sql
> select inner_product([1.0, 2.0, 3.0], [4.0, 5.0, 6.0]);
-+-------------------------------------------------------+
++--------------------------------------------------------+
| inner_product(List([1.0,2.0,3.0]),List([4.0,5.0,6.0])) |
-+-------------------------------------------------------+
-| 32.0 |
-+-------------------------------------------------------+
++--------------------------------------------------------+
+| 32.0 |
++--------------------------------------------------------+
```"#,
argument(
name = "array1",
diff --git a/datafusion/functions-nested/src/position.rs b/datafusion/functions-nested/src/position.rs
index 2a0134b4b9..f677cfb497 100644
--- a/datafusion/functions-nested/src/position.rs
+++ b/datafusion/functions-nested/src/position.rs
@@ -65,11 +65,11 @@ make_udf_expr_and_func!(
| 2 |
+----------------------------------------------+
> select array_position([1, 2, 2, 3, 1, 4], 2, 3);
-+----------------------------------------------------+
++--------------------------------------------------------+
| array_position(List([1,2,2,3,1,4]),Int64(2), Int64(3)) |
-+----------------------------------------------------+
-| 3 |
-+----------------------------------------------------+
++--------------------------------------------------------+
+| 3 |
++--------------------------------------------------------+
```"#,
argument(
name = "array",
diff --git a/datafusion/functions-nested/src/range.rs b/datafusion/functions-nested/src/range.rs
index 0a02a8b7bb..787886f795 100644
--- a/datafusion/functions-nested/src/range.rs
+++ b/datafusion/functions-nested/src/range.rs
@@ -80,11 +80,11 @@ make_udf_expr_and_func!(
range(start, stop[, step])",
sql_example = r#"```sql
> select range(2, 10, 3);
-+-----------------------------------+
-| range(Int64(2),Int64(10),Int64(3))|
-+-----------------------------------+
-| [2, 5, 8] |
-+-----------------------------------+
++------------------------------------+
+| range(Int64(2),Int64(10),Int64(3)) |
++------------------------------------+
+| [2, 5, 8] |
++------------------------------------+
> select range(DATE '1992-09-01', DATE '1993-03-01', INTERVAL '1' MONTH);
+--------------------------------------------------------------------------+
diff --git a/datafusion/functions-nested/src/remove.rs b/datafusion/functions-nested/src/remove.rs
index b87f04cbfb..fa4127c17c 100644
--- a/datafusion/functions-nested/src/remove.rs
+++ b/datafusion/functions-nested/src/remove.rs
@@ -57,11 +57,11 @@ make_udf_expr_and_func!(
+----------------------------------------------+
> select array_remove([1, 2, NULL, 2, 4], 2);
-+---------------------------------------------------+
++---------------------------------------------+
| array_remove(List([1,2,NULL,2,4]),Int64(2)) |
-+---------------------------------------------------+
-| [1, NULL, 2, 4] |
-+---------------------------------------------------+
++---------------------------------------------+
+| [1, NULL, 2, 4] |
++---------------------------------------------+
```"#,
argument(
name = "array",
@@ -167,11 +167,11 @@ make_udf_expr_and_func!(
+---------------------------------------------------------+
> select array_remove_n([1, 2, NULL, 2, 4], 2, 2);
-+----------------------------------------------------------+
++--------------------------------------------------------+
| array_remove_n(List([1,2,NULL,2,4]),Int64(2),Int64(2)) |
-+----------------------------------------------------------+
-| [1, NULL, 4] |
-+----------------------------------------------------------+
++--------------------------------------------------------+
+| [1, NULL, 4] |
++--------------------------------------------------------+
```"#,
argument(
name = "array",
@@ -296,11 +296,11 @@ make_udf_expr_and_func!(
+--------------------------------------------------+
> select array_remove_all([1, 2, NULL, 2, 4], 2);
-+-----------------------------------------------------+
++-------------------------------------------------+
| array_remove_all(List([1,2,NULL,2,4]),Int64(2)) |
-+-----------------------------------------------------+
-| [1, NULL, 4] |
-+-----------------------------------------------------+
++-------------------------------------------------+
+| [1, NULL, 4] |
++-------------------------------------------------+
```"#,
argument(
name = "array",
diff --git a/datafusion/functions-nested/src/string.rs b/datafusion/functions-nested/src/string.rs
index b76736672c..6d03e1cd9c 100644
--- a/datafusion/functions-nested/src/string.rs
+++ b/datafusion/functions-nested/src/string.rs
@@ -170,16 +170,16 @@ make_udf_expr_and_func!(
sql_example = r#"```sql
> select string_to_array('abc##def', '##');
+-----------------------------------+
-| string_to_array(Utf8('abc##def')) |
+| string_to_array(Utf8('abc##def')) |
+-----------------------------------+
| ['abc', 'def'] |
+-----------------------------------+
> select string_to_array('abc def', ' ', 'def');
-+---------------------------------------------+
++----------------------------------------------------------+
| string_to_array(Utf8('abc def'), Utf8(' '), Utf8('def')) |
-+---------------------------------------------+
-| ['abc', NULL] |
-+---------------------------------------------+
++----------------------------------------------------------+
+| ['abc', NULL] |
++----------------------------------------------------------+
```"#,
argument(name = "str", description = "String expression to split."),
argument(name = "delimiter", description = "Delimiter string to split on."),
diff --git a/datafusion/functions/src/core/arrow_field.rs b/datafusion/functions/src/core/arrow_field.rs
index dce7cff42b..50da43a166 100644
--- a/datafusion/functions/src/core/arrow_field.rs
+++ b/datafusion/functions/src/core/arrow_field.rs
@@ -33,11 +33,11 @@ use std::sync::Arc;
syntax_example = "arrow_field(expression)",
sql_example = r#"```sql
> select arrow_field(1);
-+-------------------------------------------------------------+
-| arrow_field(Int64(1)) |
-+-------------------------------------------------------------+
++--------------------------------------------------------------+
+| arrow_field(Int64(1)) |
++--------------------------------------------------------------+
| {name: lit, data_type: Int64, nullable: false, metadata: {}} |
-+-------------------------------------------------------------+
++--------------------------------------------------------------+
> select arrow_field(1)['data_type'];
+-----------------------------------+
diff --git a/datafusion/functions/src/core/arrow_metadata.rs b/datafusion/functions/src/core/arrow_metadata.rs
index 72983b47e2..acaaa6eff5 100644
--- a/datafusion/functions/src/core/arrow_metadata.rs
+++ b/datafusion/functions/src/core/arrow_metadata.rs
@@ -38,11 +38,11 @@ use std::sync::Arc;
| {k: v} |
+----------------------------+
> select arrow_metadata(col, 'k') from table;
-+-------------------------------+
-| arrow_metadata(table.col, 'k')|
-+-------------------------------+
-| v |
-+-------------------------------+
++--------------------------------+
+| arrow_metadata(table.col, 'k') |
++--------------------------------+
+| v |
++--------------------------------+
```"#,
argument(
name = "expression",
diff --git a/datafusion/functions/src/core/nvl.rs b/datafusion/functions/src/core/nvl.rs
index 3b73dd0165..1516f12ed9 100644
--- a/datafusion/functions/src/core/nvl.rs
+++ b/datafusion/functions/src/core/nvl.rs
@@ -35,7 +35,7 @@ use datafusion_macros::user_doc;
| nvl(NULL,Utf8("a")) |
+---------------------+
| a |
-+---------------------+\
++---------------------+
> select nvl('b', 'a');
+--------------------------+
| nvl(Utf8("b"),Utf8("a")) |
diff --git a/datafusion/functions/src/core/with_metadata.rs b/datafusion/functions/src/core/with_metadata.rs
index 481ed713ed..a86fb88f38 100644
--- a/datafusion/functions/src/core/with_metadata.rs
+++ b/datafusion/functions/src/core/with_metadata.rs
@@ -29,15 +29,15 @@ use datafusion_macros::user_doc;
syntax_example = "with_metadata(expression, key1, value1[, key2, value2, ...])",
sql_example = r#"```sql
> select arrow_metadata(with_metadata(column1, 'unit', 'ms'), 'unit') from (values (1));
-+---------------------------------------------------------------+
++-----------------------------------------------------------------------------+
| arrow_metadata(with_metadata(column1,Utf8("unit"),Utf8("ms")),Utf8("unit")) |
-+---------------------------------------------------------------+
-| ms |
-+---------------------------------------------------------------+
++-----------------------------------------------------------------------------+
+| ms |
++-----------------------------------------------------------------------------+
> select arrow_metadata(with_metadata(column1, 'unit', 'ms', 'source', 'sensor')) from (values (1));
-+--------------------------+
++----------------------------+
| {source: sensor, unit: ms} |
-+--------------------------+
++----------------------------+
```"#,
argument(
name = "expression",
diff --git a/datafusion/functions/src/datetime/date_trunc.rs b/datafusion/functions/src/datetime/date_trunc.rs
index b05f0f46e1..0c73a06c3b 100644
--- a/datafusion/functions/src/datetime/date_trunc.rs
+++ b/datafusion/functions/src/datetime/date_trunc.rs
@@ -187,17 +187,17 @@ impl fmt::Display for DateTruncGranularity {
),
sql_example = r#"```sql
> SELECT date_trunc('month', '2024-05-15T10:30:00');
-+-----------------------------------------------+
++-------------------------------------------------------+
| date_trunc(Utf8("month"),Utf8("2024-05-15T10:30:00")) |
-+-----------------------------------------------+
-| 2024-05-01T00:00:00 |
-+-----------------------------------------------+
++-------------------------------------------------------+
+| 2024-05-01T00:00:00 |
++-------------------------------------------------------+
> SELECT date_trunc('hour', '2024-05-15T10:30:00');
-+----------------------------------------------+
++------------------------------------------------------+
| date_trunc(Utf8("hour"),Utf8("2024-05-15T10:30:00")) |
-+----------------------------------------------+
-| 2024-05-15T10:00:00 |
-+----------------------------------------------+
++------------------------------------------------------+
+| 2024-05-15T10:00:00 |
++------------------------------------------------------+
```"#
)]
#[derive(Debug, PartialEq, Eq, Hash)]
diff --git a/datafusion/functions/src/datetime/to_date.rs b/datafusion/functions/src/datetime/to_date.rs
index 668c6ce029..3c4c780b10 100644
--- a/datafusion/functions/src/datetime/to_date.rs
+++ b/datafusion/functions/src/datetime/to_date.rs
@@ -41,17 +41,17 @@ Note: `to_date` returns Date32, which represents its values as the number of day
syntax_example = "to_date(expression[, format1, ..., format_n])",
sql_example = r#"```sql
> select to_date('2023-01-31');
-+-------------------------------+
++-----------------------------+
| to_date(Utf8("2023-01-31")) |
-+-------------------------------+
-| 2023-01-31 |
-+-------------------------------+
++-----------------------------+
+| 2023-01-31 |
++-----------------------------+
> select to_date('2023/01/31', '%Y-%m-%d', '%Y/%m/%d');
-+---------------------------------------------------------------------+
++---------------------------------------------------------------+
| to_date(Utf8("2023/01/31"),Utf8("%Y-%m-%d"),Utf8("%Y/%m/%d")) |
-+---------------------------------------------------------------------+
-| 2023-01-31 |
-+---------------------------------------------------------------------+
++---------------------------------------------------------------+
+| 2023-01-31 |
++---------------------------------------------------------------+
```
Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/builtin_functions/date_time.rs)
diff --git a/datafusion/functions/src/datetime/to_timestamp.rs b/datafusion/functions/src/datetime/to_timestamp.rs
index a858d8dad4..fe7e1b31fc 100644
--- a/datafusion/functions/src/datetime/to_timestamp.rs
+++ b/datafusion/functions/src/datetime/to_timestamp.rs
@@ -271,7 +271,7 @@ The time zone can be a value like +00:00, 'Europe/London' etc.
| to_timestamp_nanos(Utf8("03:59:00.123456789 05-17-2023"),Utf8("%c"),Utf8("%+"),Utf8("%H:%M:%S%.f %m-%d-%Y")) |
+--------------------------------------------------------------------------------------------------------------+
| 2023-05-17T03:59:00.123456789 |
-+---------------------------------------------------------------------------------------------------------------+
++--------------------------------------------------------------------------------------------------------------+
```
Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/builtin_functions/date_time.rs)
"#,
diff --git a/datafusion/functions/src/math/round.rs b/datafusion/functions/src/math/round.rs
index 120b07f4eb..02c808a4d3 100644
--- a/datafusion/functions/src/math/round.rs
+++ b/datafusion/functions/src/math/round.rs
@@ -162,11 +162,11 @@ fn decimal_places_from_scalar(scalar: &ScalarValue) -> Result<i32> {
),
sql_example = r#"```sql
> SELECT round(3.14159);
-+--------------+
-| round(3.14159)|
-+--------------+
-| 3.0 |
-+--------------+
++----------------+
+| round(3.14159) |
++----------------+
+| 3.0 |
++----------------+
```"#
)]
#[derive(Debug, PartialEq, Eq, Hash)]
diff --git a/docs/source/user-guide/sql/aggregate_functions.md b/docs/source/user-guide/sql/aggregate_functions.md
index 12508ab149..4569a8850c 100644
--- a/docs/source/user-guide/sql/aggregate_functions.md
+++ b/docs/source/user-guide/sql/aggregate_functions.md
@@ -314,11 +314,11 @@ first_value(expression [ORDER BY expression])
```sql
> SELECT first_value(column_name ORDER BY other_column) FROM table_name;
-+-----------------------------------------------+
-| first_value(column_name ORDER BY other_column)|
-+-----------------------------------------------+
-| first_element |
-+-----------------------------------------------+
++------------------------------------------------+
+| first_value(column_name ORDER BY other_column) |
++------------------------------------------------+
+| first_element |
++------------------------------------------------+
```
### `grouping`
diff --git a/docs/source/user-guide/sql/scalar_functions.md b/docs/source/user-guide/sql/scalar_functions.md
index 644d42935e..44e697569a 100644
--- a/docs/source/user-guide/sql/scalar_functions.md
+++ b/docs/source/user-guide/sql/scalar_functions.md
@@ -785,11 +785,11 @@ round(numeric_expression[, decimal_places])
```sql
> SELECT round(3.14159);
-+--------------+
-| round(3.14159)|
-+--------------+
-| 3.0 |
-+--------------+
++----------------+
+| round(3.14159) |
++----------------+
+| 3.0 |
++----------------+
```
### `signum`
@@ -1085,7 +1085,7 @@ nvl(expression1, expression2)
| nvl(NULL,Utf8("a")) |
+---------------------+
| a |
-+---------------------+\
++---------------------+
> select nvl('b', 'a');
+--------------------------+
| nvl(Utf8("b"),Utf8("a")) |
@@ -2632,17 +2632,17 @@ date_trunc(precision, expression)
```sql
> SELECT date_trunc('month', '2024-05-15T10:30:00');
-+-----------------------------------------------+
++-------------------------------------------------------+
| date_trunc(Utf8("month"),Utf8("2024-05-15T10:30:00")) |
-+-----------------------------------------------+
-| 2024-05-01T00:00:00 |
-+-----------------------------------------------+
++-------------------------------------------------------+
+| 2024-05-01T00:00:00 |
++-------------------------------------------------------+
> SELECT date_trunc('hour', '2024-05-15T10:30:00');
-+----------------------------------------------+
++------------------------------------------------------+
| date_trunc(Utf8("hour"),Utf8("2024-05-15T10:30:00")) |
-+----------------------------------------------+
-| 2024-05-15T10:00:00 |
-+----------------------------------------------+
++------------------------------------------------------+
+| 2024-05-15T10:00:00 |
++------------------------------------------------------+
```
#### Aliases
@@ -2836,17 +2836,17 @@ to_date(expression[, format1, ..., format_n])
```sql
> select to_date('2023-01-31');
-+-------------------------------+
++-----------------------------+
| to_date(Utf8("2023-01-31")) |
-+-------------------------------+
-| 2023-01-31 |
-+-------------------------------+
++-----------------------------+
+| 2023-01-31 |
++-----------------------------+
> select to_date('2023/01/31', '%Y-%m-%d', '%Y/%m/%d');
-+---------------------------------------------------------------------+
++---------------------------------------------------------------+
| to_date(Utf8("2023/01/31"),Utf8("%Y-%m-%d"),Utf8("%Y/%m/%d")) |
-+---------------------------------------------------------------------+
-| 2023-01-31 |
-+---------------------------------------------------------------------+
++---------------------------------------------------------------+
+| 2023-01-31 |
++---------------------------------------------------------------+
```
Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/builtin_functions/date_time.rs)
@@ -3137,7 +3137,7 @@ to_timestamp_nanos(expression[, ..., format_n])
| to_timestamp_nanos(Utf8("03:59:00.123456789 05-17-2023"),Utf8("%c"),Utf8("%+"),Utf8("%H:%M:%S%.f %m-%d-%Y")) |
+--------------------------------------------------------------------------------------------------------------+
| 2023-05-17T03:59:00.123456789 |
-+---------------------------------------------------------------------------------------------------------------+
++--------------------------------------------------------------------------------------------------------------+
```
Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/builtin_functions/date_time.rs)
@@ -3428,7 +3428,7 @@ array_any_value(array)
```sql
> select array_any_value([NULL, 1, 2, 3]);
-+-------------------------------+
++-------------------------------------+
| array_any_value(List([NULL,1,2,3])) |
+-------------------------------------+
| 1 |
@@ -3485,11 +3485,11 @@ array_avg(array)
```sql
> select array_avg([1.0, 2.0, 3.0]);
-+----------------------------+
++--------------------------------+
| array_avg(List([1.0,2.0,3.0])) |
-+----------------------------+
-| 2.0 |
-+----------------------------+
++--------------------------------+
+| 2.0 |
++--------------------------------+
```
#### Aliases
@@ -3694,17 +3694,17 @@ array_except(array1, array2)
```sql
> select array_except([1, 2, 3, 4], [5, 6, 3, 4]);
-+----------------------------------------------------+
-| array_except([1, 2, 3, 4], [5, 6, 3, 4]); |
-+----------------------------------------------------+
-| [1, 2] |
-+----------------------------------------------------+
++-------------------------------------------+
+| array_except([1, 2, 3, 4], [5, 6, 3, 4]); |
++-------------------------------------------+
+| [1, 2] |
++-------------------------------------------+
> select array_except([1, 2, 3, 4], [3, 4, 5, 6]);
-+----------------------------------------------------+
-| array_except([1, 2, 3, 4], [3, 4, 5, 6]); |
-+----------------------------------------------------+
-| [1, 2] |
-+----------------------------------------------------+
++-------------------------------------------+
+| array_except([1, 2, 3, 4], [3, 4, 5, 6]); |
++-------------------------------------------+
+| [1, 2] |
++-------------------------------------------+
```
#### Aliases
@@ -3732,11 +3732,11 @@ array_filter(array, x -> x > 2)
```sql
> select array_filter([1, 2, 3, 4, 5], x -> x > 2);
-+--------------------------------------------+
++-------------------------------------------+
| array_filter([1, 2, 3, 4, 5], x -> x > 2) |
-+--------------------------------------------+
-| [3, 4, 5] |
-+--------------------------------------------+
++-------------------------------------------+
+| [3, 4, 5] |
++-------------------------------------------+
```
#### Aliases
@@ -3846,11 +3846,11 @@ array_has_any(array1, array2)
```sql
> select array_has_any([1, 2, 3], [3, 4]);
-+------------------------------------------+
++-------------------------------------------+
| array_has_any(List([1,2,3]), List([3,4])) |
-+------------------------------------------+
-| true |
-+------------------------------------------+
++-------------------------------------------+
+| true |
++-------------------------------------------+
```
#### Aliases
@@ -4021,11 +4021,11 @@ array_normalize(array)
```sql
> select array_normalize([3.0, 4.0]);
-+-----------------------------+
++----------------------------------+
| array_normalize(List([3.0,4.0])) |
-+-----------------------------+
-| [0.6, 0.8] |
-+-----------------------------+
++----------------------------------+
+| [0.6, 0.8] |
++----------------------------------+
```
#### Aliases
@@ -4075,11 +4075,11 @@ array_pop_front(array)
```sql
> select array_pop_front([1, 2, 3]);
-+-------------------------------+
++--------------------------------+
| array_pop_front(List([1,2,3])) |
-+-------------------------------+
-| [2, 3] |
-+-------------------------------+
++--------------------------------+
+| [2, 3] |
++--------------------------------+
```
#### Aliases
@@ -4110,11 +4110,11 @@ array_position(array, element[, index])
| 2 |
+----------------------------------------------+
> select array_position([1, 2, 2, 3, 1, 4], 2, 3);
-+----------------------------------------------------+
++--------------------------------------------------------+
| array_position(List([1,2,2,3,1,4]),Int64(2), Int64(3)) |
-+----------------------------------------------------+
-| 3 |
-+----------------------------------------------------+
++--------------------------------------------------------+
+| 3 |
++--------------------------------------------------------+
```
#### Aliases
@@ -4240,11 +4240,11 @@ array_remove(array, element)
+----------------------------------------------+
> select array_remove([1, 2, NULL, 2, 4], 2);
-+---------------------------------------------------+
++---------------------------------------------+
| array_remove(List([1,2,NULL,2,4]),Int64(2)) |
-+---------------------------------------------------+
-| [1, NULL, 2, 4] |
-+---------------------------------------------------+
++---------------------------------------------+
+| [1, NULL, 2, 4] |
++---------------------------------------------+
```
#### Aliases
@@ -4275,11 +4275,11 @@ array_remove_all(array, element)
+--------------------------------------------------+
> select array_remove_all([1, 2, NULL, 2, 4], 2);
-+-----------------------------------------------------+
++-------------------------------------------------+
| array_remove_all(List([1,2,NULL,2,4]),Int64(2)) |
-+-----------------------------------------------------+
-| [1, NULL, 4] |
-+-----------------------------------------------------+
++-------------------------------------------------+
+| [1, NULL, 4] |
++-------------------------------------------------+
```
#### Aliases
@@ -4311,11 +4311,11 @@ array_remove_n(array, element, max)
+---------------------------------------------------------+
> select array_remove_n([1, 2, NULL, 2, 4], 2, 2);
-+----------------------------------------------------------+
++--------------------------------------------------------+
| array_remove_n(List([1,2,NULL,2,4]),Int64(2),Int64(2)) |
-+----------------------------------------------------------+
-| [1, NULL, 4] |
-+----------------------------------------------------------+
++--------------------------------------------------------+
+| [1, NULL, 4] |
++--------------------------------------------------------+
```
#### Aliases
@@ -4517,11 +4517,11 @@ array_scale(array, scalar)
```sql
> select array_scale([1.0, 2.0, 3.0], 2.0);
-+----------------------------------+
++-----------------------------------------------+
| array_scale(List([1.0,2.0,3.0]),Float64(2.0)) |
-+----------------------------------+
-| [2.0, 4.0, 6.0] |
-+----------------------------------+
++-----------------------------------------------+
+| [2.0, 4.0, 6.0] |
++-----------------------------------------------+
```
#### Aliases
@@ -4637,11 +4637,11 @@ array_sum(array)
```sql
> select array_sum([1.0, 2.0, 3.0]);
-+----------------------------+
++--------------------------------+
| array_sum(List([1.0,2.0,3.0])) |
-+----------------------------+
-| 6.0 |
-+----------------------------+
++--------------------------------+
+| 6.0 |
++--------------------------------+
```
#### Aliases
@@ -4696,11 +4696,11 @@ array_transform(array, lambda)
```sql
> select array_transform([1, 2, 3, 4, 5], x -> x*2);
-+-------------------------------------------+
-| array_transform([1, 2, 3, 4, 5], x -> x*2) |
-+-------------------------------------------+
-| [2, 4, 6, 8, 10] |
-+-------------------------------------------+
++--------------------------------------------+
+| array_transform([1, 2, 3, 4, 5], x -> x*2) |
++--------------------------------------------+
+| [2, 4, 6, 8, 10] |
++--------------------------------------------+
```
#### Aliases
@@ -4819,11 +4819,11 @@ cosine_distance(array1, array2)
```sql
> select cosine_distance([1.0, 0.0], [0.0, 1.0]);
-+-----------------------------------------------+
++--------------------------------------------------+
| cosine_distance(List([1.0,0.0]),List([0.0,1.0])) |
-+-----------------------------------------------+
-| 1.0 |
-+-----------------------------------------------+
++--------------------------------------------------+
+| 1.0 |
++--------------------------------------------------+
```
### `dot_product`
@@ -4929,11 +4929,11 @@ inner_product(array1, array2)
```sql
> select inner_product([1.0, 2.0, 3.0], [4.0, 5.0, 6.0]);
-+-------------------------------------------------------+
++--------------------------------------------------------+
| inner_product(List([1.0,2.0,3.0]),List([4.0,5.0,6.0])) |
-+-------------------------------------------------------+
-| 32.0 |
-+-------------------------------------------------------+
++--------------------------------------------------------+
+| 32.0 |
++--------------------------------------------------------+
```
#### Aliases
@@ -5206,11 +5206,11 @@ range(start, stop[, step])
```sql
> select range(2, 10, 3);
-+-----------------------------------+
-| range(Int64(2),Int64(10),Int64(3))|
-+-----------------------------------+
-| [2, 5, 8] |
-+-----------------------------------+
++------------------------------------+
+| range(Int64(2),Int64(10),Int64(3)) |
++------------------------------------+
+| [2, 5, 8] |
++------------------------------------+
> select range(DATE '1992-09-01', DATE '1993-03-01', INTERVAL '1' MONTH);
+--------------------------------------------------------------------------+
@@ -5239,16 +5239,16 @@ string_to_array(str, delimiter[, null_str])
```sql
> select string_to_array('abc##def', '##');
+-----------------------------------+
-| string_to_array(Utf8('abc##def')) |
+| string_to_array(Utf8('abc##def')) |
+-----------------------------------+
| ['abc', 'def'] |
+-----------------------------------+
> select string_to_array('abc def', ' ', 'def');
-+---------------------------------------------+
++----------------------------------------------------------+
| string_to_array(Utf8('abc def'), Utf8(' '), Utf8('def')) |
-+---------------------------------------------+
-| ['abc', NULL] |
-+---------------------------------------------+
++----------------------------------------------------------+
+| ['abc', NULL] |
++----------------------------------------------------------+
```
#### Aliases
@@ -5818,11 +5818,11 @@ arrow_field(expression)
```sql
> select arrow_field(1);
-+-------------------------------------------------------------+
-| arrow_field(Int64(1)) |
-+-------------------------------------------------------------+
++--------------------------------------------------------------+
+| arrow_field(Int64(1)) |
++--------------------------------------------------------------+
| {name: lit, data_type: Int64, nullable: false, metadata: {}} |
-+-------------------------------------------------------------+
++--------------------------------------------------------------+
> select arrow_field(1)['data_type'];
+-----------------------------------+
@@ -5855,11 +5855,11 @@ arrow_metadata(expression[, key])
| {k: v} |
+----------------------------+
> select arrow_metadata(col, 'k') from table;
-+-------------------------------+
-| arrow_metadata(table.col, 'k')|
-+-------------------------------+
-| v |
-+-------------------------------+
++--------------------------------+
+| arrow_metadata(table.col, 'k') |
++--------------------------------+
+| v |
++--------------------------------+
```
### `arrow_try_cast`
@@ -6098,13 +6098,13 @@ with_metadata(expression, key1, value1[, key2, value2, ...])
```sql
> select arrow_metadata(with_metadata(column1, 'unit', 'ms'), 'unit') from (values (1));
-+---------------------------------------------------------------+
++-----------------------------------------------------------------------------+
| arrow_metadata(with_metadata(column1,Utf8("unit"),Utf8("ms")),Utf8("unit")) |
-+---------------------------------------------------------------+
-| ms |
-+---------------------------------------------------------------+
++-----------------------------------------------------------------------------+
+| ms |
++-----------------------------------------------------------------------------+
> select arrow_metadata(with_metadata(column1, 'unit', 'ms', 'source', 'sensor')) from (values (1));
-+--------------------------+
++----------------------------+
| {source: sensor, unit: ms} |
-+--------------------------+
++----------------------------+
```
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org