| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE html |
| PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| |
| <meta name="copyright" content="(C) Copyright 2025" /> |
| <meta name="DC.rights.owner" content="(C) Copyright 2025" /> |
| <meta name="DC.Type" content="concept" /> |
| <meta name="DC.Title" content="Impala Aggregate Functions" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_functions.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_appx_median.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_avg.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_count.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_group_concat.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_max.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_min.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_ndv.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_stddev.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_sum.html" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_variance.html" /> |
| <meta name="prodname" content="Impala" /> |
| <meta name="prodname" content="Impala" /> |
| <meta name="version" content="Impala 3.4.x" /> |
| <meta name="version" content="Impala 3.4.x" /> |
| <meta name="DC.Format" content="XHTML" /> |
| <meta name="DC.Identifier" content="aggregate_functions" /> |
| <link rel="stylesheet" type="text/css" href="../commonltr.css" /> |
| <title>Impala Aggregate Functions</title> |
| </head> |
| <body id="aggregate_functions"> |
| |
| |
| <h1 class="title topictitle1" id="ariaid-title1">Impala Aggregate Functions</h1> |
| |
| |
| |
| |
| <div class="body conbody"> |
| |
| <p class="p"> |
| Aggregate functions are a special category with different rules. These functions |
| calculate a return value across all the items in a result set, so they require a |
| <code class="ph codeph">FROM</code> clause in the query: |
| </p> |
| |
| |
| <pre class="pre codeblock"><code>select count(product_id) from product_catalog; |
| select max(height), avg(height) from census_data where age > 20; |
| </code></pre> |
| |
| <p class="p"> |
| Aggregate functions also ignore <code class="ph codeph">NULL</code> values rather than returning a |
| <code class="ph codeph">NULL</code> result. For example, if some rows have <code class="ph codeph">NULL</code> for a |
| particular column, those rows are ignored when computing the <code class="ph codeph">AVG()</code> for |
| that column. Likewise, specifying <code class="ph codeph">COUNT(<var class="keyword varname">col_name</var>)</code> in |
| a query counts only those rows where <var class="keyword varname">col_name</var> contains a |
| non-<code class="ph codeph">NULL</code> value. |
| </p> |
| |
| |
| <p class="p toc"></p> |
| |
| </div> |
| |
| <div class="related-links"> |
| <ul class="ullinks"> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_appx_median.html">APPX_MEDIAN Function</a></strong><br /> |
| </li> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_avg.html">AVG Function</a></strong><br /> |
| </li> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_count.html">COUNT Function</a></strong><br /> |
| </li> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_group_concat.html">GROUP_CONCAT Function</a></strong><br /> |
| </li> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_max.html">MAX Function</a></strong><br /> |
| </li> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_min.html">MIN Function</a></strong><br /> |
| </li> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_ndv.html">NDV Function</a></strong><br /> |
| </li> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_stddev.html">STDDEV, STDDEV_SAMP, STDDEV_POP Functions</a></strong><br /> |
| </li> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_sum.html">SUM Function</a></strong><br /> |
| </li> |
| <li class="link ulchildlink"><strong><a href="../topics/impala_variance.html">VARIANCE, VARIANCE_SAMP, VARIANCE_POP, VAR_SAMP, VAR_POP Functions</a></strong><br /> |
| </li> |
| </ul> |
| |
| <div class="familylinks"> |
| <div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../topics/impala_functions.html">Impala Built-In Functions</a></div> |
| </div> |
| </div></body> |
| </html> |