This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 7a4e60acc3 Publish built docs triggered by
f4e519f9df9ab5972638d3f2743da01887a52668
7a4e60acc3 is described below
commit 7a4e60acc36d83525ee14bd5e581977ca8dde27f
Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Aug 3 11:18:43 2024 +0000
Publish built docs triggered by f4e519f9df9ab5972638d3f2743da01887a52668
---
.../aggregate_function.rs | 156 ---------------------
_sources/user-guide/dataframe.md.txt | 1 +
_sources/user-guide/example-usage.md.txt | 2 +
contributor-guide/howtos.html | 2 +-
searchindex.js | 2 +-
user-guide/dataframe.html | 1 +
user-guide/example-usage.html | 2 +
7 files changed, 8 insertions(+), 158 deletions(-)
diff --git a/_downloads/f9718f9b04809de030b1693c73858f19/aggregate_function.rs
b/_downloads/f9718f9b04809de030b1693c73858f19/aggregate_function.rs
deleted file mode 100644
index 4037e3c5db..0000000000
--- a/_downloads/f9718f9b04809de030b1693c73858f19/aggregate_function.rs
+++ /dev/null
@@ -1,156 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-//! Aggregate function module contains all built-in aggregate functions
definitions
-
-use std::{fmt, str::FromStr};
-
-use crate::utils;
-use crate::{type_coercion::aggregates::*, Signature, Volatility};
-
-use arrow::datatypes::DataType;
-use datafusion_common::{plan_datafusion_err, plan_err, DataFusionError,
Result};
-
-use strum_macros::EnumIter;
-
-/// Enum of all built-in aggregate functions
-// Contributor's guide for adding new aggregate functions
-//
https://datafusion.apache.org/contributor-guide/index.html#how-to-add-a-new-aggregate-function
-#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Hash, EnumIter)]
-pub enum AggregateFunction {
- /// Minimum
- Min,
- /// Maximum
- Max,
-}
-
-impl AggregateFunction {
- pub fn name(&self) -> &str {
- use AggregateFunction::*;
- match self {
- Min => "MIN",
- Max => "MAX",
- }
- }
-}
-
-impl fmt::Display for AggregateFunction {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}", self.name())
- }
-}
-
-impl FromStr for AggregateFunction {
- type Err = DataFusionError;
- fn from_str(name: &str) -> Result<AggregateFunction> {
- Ok(match name {
- // general
- "max" => AggregateFunction::Max,
- "min" => AggregateFunction::Min,
- _ => {
- return plan_err!("There is no built-in function named {name}");
- }
- })
- }
-}
-
-impl AggregateFunction {
- /// Returns the datatype of the aggregate function given its argument types
- ///
- /// This is used to get the returned data type for aggregate expr.
- pub fn return_type(
- &self,
- input_expr_types: &[DataType],
- _input_expr_nullable: &[bool],
- ) -> Result<DataType> {
- // Note that this function *must* return the same type that the
respective physical expression returns
- // or the execution panics.
-
- let coerced_data_types = coerce_types(self, input_expr_types,
&self.signature())
- // original errors are all related to wrong function signature
- // aggregate them for better error message
- .map_err(|_| {
- plan_datafusion_err!(
- "{}",
- utils::generate_signature_error_msg(
- &format!("{self}"),
- self.signature(),
- input_expr_types,
- )
- )
- })?;
-
- match self {
- AggregateFunction::Max | AggregateFunction::Min => {
- // For min and max agg function, the returned type is same as
input type.
- // The coerced_data_types is same with input_types.
- Ok(coerced_data_types[0].clone())
- }
- }
- }
-
- /// Returns if the return type of the aggregate function is nullable given
its argument
- /// nullability
- pub fn nullable(&self) -> Result<bool> {
- match self {
- AggregateFunction::Max | AggregateFunction::Min => Ok(true),
- }
- }
-}
-
-impl AggregateFunction {
- /// the signatures supported by the function `fun`.
- pub fn signature(&self) -> Signature {
- // note: the physical expression must accept the type returned by this
function or the execution panics.
- match self {
- AggregateFunction::Min | AggregateFunction::Max => {
- let valid = STRINGS
- .iter()
- .chain(NUMERICS.iter())
- .chain(TIMESTAMPS.iter())
- .chain(DATES.iter())
- .chain(TIMES.iter())
- .chain(BINARYS.iter())
- .cloned()
- .collect::<Vec<_>>();
- Signature::uniform(1, valid, Volatility::Immutable)
- }
- }
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- use strum::IntoEnumIterator;
-
- #[test]
- // Test for AggregateFunction's Display and from_str() implementations.
- // For each variant in AggregateFunction, it converts the variant to a
string
- // and then back to a variant. The test asserts that the original variant
and
- // the reconstructed variant are the same. This assertion is also
necessary for
- // function suggestion. See
https://github.com/apache/datafusion/issues/8082
- fn test_display_and_from_str() {
- for func_original in AggregateFunction::iter() {
- let func_name = func_original.to_string();
- let func_from_str =
-
AggregateFunction::from_str(func_name.to_lowercase().as_str()).unwrap();
- assert_eq!(func_from_str, func_original);
- }
- }
-}
diff --git a/_sources/user-guide/dataframe.md.txt
b/_sources/user-guide/dataframe.md.txt
index c3d0b6c2d6..96be1bb9e2 100644
--- a/_sources/user-guide/dataframe.md.txt
+++ b/_sources/user-guide/dataframe.md.txt
@@ -53,6 +53,7 @@ Here is a minimal example showing the execution of a query
using the DataFrame A
```rust
use datafusion::prelude::*;
use datafusion::error::Result;
+use datafusion::functions_aggregate::expr_fn::min;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/_sources/user-guide/example-usage.md.txt
b/_sources/user-guide/example-usage.md.txt
index 813dbb1bc0..6108315f39 100644
--- a/_sources/user-guide/example-usage.md.txt
+++ b/_sources/user-guide/example-usage.md.txt
@@ -60,6 +60,7 @@ library guide for more information on the SQL API.
```rust
use datafusion::prelude::*;
+use datafusion::functions_aggregate::expr_fn::min;
#[tokio::main]
async fn main() -> datafusion::error::Result<()> {
@@ -148,6 +149,7 @@ async fn main() -> datafusion::error::Result<()> {
```rust
use datafusion::prelude::*;
+use datafusion::functions_aggregate::expr_fn::min;
#[tokio::main]
async fn main() -> datafusion::error::Result<()> {
diff --git a/contributor-guide/howtos.html b/contributor-guide/howtos.html
index c2febe785d..300a7cb52f 100644
--- a/contributor-guide/howtos.html
+++ b/contributor-guide/howtos.html
@@ -608,7 +608,7 @@ users to enable or disable the new module as
desired.</p></li>
<p>Below is a checklist of what you need to do to add a new aggregate function
to DataFusion:</p>
<ul class="simple">
<li><p>Add the actual implementation of an <code class="docutils literal
notranslate"><span class="pre">Accumulator</span></code> and <code
class="docutils literal notranslate"><span
class="pre">AggregateExpr</span></code>:</p></li>
-<li><p>In <a class="reference download internal" download=""
href="../_downloads/f9718f9b04809de030b1693c73858f19/aggregate_function.rs"><span
class="xref download myst">datafusion/expr/src</span></a>, add:</p>
+<li><p>In <a class="reference internal"
href="#../../../datafusion/expr/src/aggregate_function.rs"><span class="xref
myst">datafusion/expr/src</span></a>, add:</p>
<ul>
<li><p>a new variant to <code class="docutils literal notranslate"><span
class="pre">AggregateFunction</span></code></p></li>
<li><p>a new entry to <code class="docutils literal notranslate"><span
class="pre">FromStr</span></code> with the name of the function as called by
SQL</p></li>
diff --git a/searchindex.js b/searchindex.js
index d076147804..8ffff30007 100644
--- a/searchindex.js
+++ b/searchindex.js
@@ -1 +1 @@
-Search.setIndex({"alltitles": {"!=": [[44, "op-neq"]], "!~": [[44,
"op-re-not-match"]], "!~*": [[44, "op-re-not-match-i"]], "!~~": [[44, "id18"]],
"!~~*": [[44, "id19"]], "#": [[44, "op-bit-xor"]], "%": [[44, "op-modulo"]],
"&": [[44, "op-bit-and"]], "(relation, name) tuples in logical fields and
logical columns are unique": [[9,
"relation-name-tuples-in-logical-fields-and-logical-columns-are-unique"]], "*":
[[44, "op-multiply"]], "+": [[44, "op-plus"]], "-": [[44, "op-minus"]], "/":
[[4 [...]
\ No newline at end of file
+Search.setIndex({"alltitles": {"!=": [[44, "op-neq"]], "!~": [[44,
"op-re-not-match"]], "!~*": [[44, "op-re-not-match-i"]], "!~~": [[44, "id18"]],
"!~~*": [[44, "id19"]], "#": [[44, "op-bit-xor"]], "%": [[44, "op-modulo"]],
"&": [[44, "op-bit-and"]], "(relation, name) tuples in logical fields and
logical columns are unique": [[9,
"relation-name-tuples-in-logical-fields-and-logical-columns-are-unique"]], "*":
[[44, "op-multiply"]], "+": [[44, "op-plus"]], "-": [[44, "op-minus"]], "/":
[[4 [...]
\ No newline at end of file
diff --git a/user-guide/dataframe.html b/user-guide/dataframe.html
index 01ba9fb5ef..5ff6ce53d9 100644
--- a/user-guide/dataframe.html
+++ b/user-guide/dataframe.html
@@ -556,6 +556,7 @@ the following statement.</p>
<p>Here is a minimal example showing the execution of a query using the
DataFrame API.</p>
<div class="highlight-rust notranslate"><div
class="highlight"><pre><span></span><span class="k">use</span><span class="w">
</span><span class="n">datafusion</span><span class="p">::</span><span
class="n">prelude</span><span class="p">::</span><span class="o">*</span><span
class="p">;</span>
<span class="k">use</span><span class="w"> </span><span
class="n">datafusion</span><span class="p">::</span><span
class="n">error</span><span class="p">::</span><span
class="nb">Result</span><span class="p">;</span>
+<span class="k">use</span><span class="w"> </span><span
class="n">datafusion</span><span class="p">::</span><span
class="n">functions_aggregate</span><span class="p">::</span><span
class="n">expr_fn</span><span class="p">::</span><span
class="n">min</span><span class="p">;</span>
<span class="cp">#[tokio::main]</span>
<span class="k">async</span><span class="w"> </span><span
class="k">fn</span><span class="w"> </span><span class="nf">main</span><span
class="p">()</span><span class="w"> </span><span class="p">-></span><span
class="w"> </span><span class="nb">Result</span><span
class="o"><</span><span class="p">()</span><span class="o">></span><span
class="w"> </span><span class="p">{</span>
diff --git a/user-guide/example-usage.html b/user-guide/example-usage.html
index 2c8066ca1f..939ad7e1ee 100644
--- a/user-guide/example-usage.html
+++ b/user-guide/example-usage.html
@@ -607,6 +607,7 @@ library guide for more information on the SQL API.</p>
<section id="use-the-dataframe-api-to-process-data-stored-in-a-csv">
<h2>Use the DataFrame API to process data stored in a CSV<a class="headerlink"
href="#use-the-dataframe-api-to-process-data-stored-in-a-csv" title="Link to
this heading">¶</a></h2>
<div class="highlight-rust notranslate"><div
class="highlight"><pre><span></span><span class="k">use</span><span class="w">
</span><span class="n">datafusion</span><span class="p">::</span><span
class="n">prelude</span><span class="p">::</span><span class="o">*</span><span
class="p">;</span>
+<span class="k">use</span><span class="w"> </span><span
class="n">datafusion</span><span class="p">::</span><span
class="n">functions_aggregate</span><span class="p">::</span><span
class="n">expr_fn</span><span class="p">::</span><span
class="n">min</span><span class="p">;</span>
<span class="cp">#[tokio::main]</span>
<span class="k">async</span><span class="w"> </span><span
class="k">fn</span><span class="w"> </span><span class="nf">main</span><span
class="p">()</span><span class="w"> </span><span class="p">-></span><span
class="w"> </span><span class="nc">datafusion</span><span
class="p">::</span><span class="n">error</span><span class="p">::</span><span
class="nb">Result</span><span class="o"><</span><span
class="p">()</span><span class="o">></span><span class="w"> </span><span
class="p">{</span>
@@ -684,6 +685,7 @@ unexpectedly.</p>
<section id="id2">
<h2>Use the DataFrame API to process data stored in a CSV:<a
class="headerlink" href="#id2" title="Link to this heading">¶</a></h2>
<div class="highlight-rust notranslate"><div
class="highlight"><pre><span></span><span class="k">use</span><span class="w">
</span><span class="n">datafusion</span><span class="p">::</span><span
class="n">prelude</span><span class="p">::</span><span class="o">*</span><span
class="p">;</span>
+<span class="k">use</span><span class="w"> </span><span
class="n">datafusion</span><span class="p">::</span><span
class="n">functions_aggregate</span><span class="p">::</span><span
class="n">expr_fn</span><span class="p">::</span><span
class="n">min</span><span class="p">;</span>
<span class="cp">#[tokio::main]</span>
<span class="k">async</span><span class="w"> </span><span
class="k">fn</span><span class="w"> </span><span class="nf">main</span><span
class="p">()</span><span class="w"> </span><span class="p">-></span><span
class="w"> </span><span class="nc">datafusion</span><span
class="p">::</span><span class="n">error</span><span class="p">::</span><span
class="nb">Result</span><span class="o"><</span><span
class="p">()</span><span class="o">></span><span class="w"> </span><span
class="p">{</span>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]