blob: 0af7efbc2989da8f304e06478aa3504b4521d6de [file] [log] [blame]
<!DOCTYPE html>
<html lang="en" data-content_root="" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>Compute Functions &#8212; Apache Arrow v17.0.0.dev52</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "light";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=8d27b9dea8ad943066ae" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=8d27b9dea8ad943066ae" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=8d27b9dea8ad943066ae" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.1/css/all.min.css?digest=8d27b9dea8ad943066ae" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.1/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.1/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.1/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css" />
<link rel="stylesheet" type="text/css" href="../_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css" />
<link rel="stylesheet" type="text/css" href="../_static/theme_overrides.css" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=8d27b9dea8ad943066ae" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="../_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/sphinx_highlight.js"></script>
<script src="../_static/clipboard.min.js"></script>
<script src="../_static/copybutton.js"></script>
<script src="../_static/design-tabs.js"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'cpp/compute';</script>
<script>
DOCUMENTATION_OPTIONS.theme_version = '0.15.2';
DOCUMENTATION_OPTIONS.theme_switcher_json_url = '/docs/_static/versions.json';
DOCUMENTATION_OPTIONS.theme_switcher_version_match = 'dev/';
DOCUMENTATION_OPTIONS.show_version_warning_banner = true;
</script>
<link rel="canonical" href="https://arrow.apache.org/docs/cpp/compute.html" />
<link rel="icon" href="../_static/favicon.ico"/>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="The Gandiva Expression Compiler" href="gandiva.html" />
<link rel="prev" title="Tabular Data" href="tables.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
/* We explicitly disable cookie tracking to avoid privacy issues */
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.apache.org/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '20']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<a id="pst-skip-link" class="skip-link" href="#main-content">Skip to main content</a>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>
Back to top
</button>
<input type="checkbox"
class="sidebar-toggle"
name="__primary"
id="__primary"/>
<label class="overlay overlay-primary" for="__primary"></label>
<input type="checkbox"
class="sidebar-toggle"
name="__secondary"
id="__secondary"/>
<label class="overlay overlay-secondary" for="__secondary"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search the docs ..."
aria-label="Search the docs ..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar">
<div class="bd-header__inner bd-page-width">
<label class="sidebar-toggle primary-toggle" for="__primary">
<span class="fa-solid fa-bars"></span>
</label>
<div class="col-lg-3 navbar-header-items__start">
<div class="navbar-item">
<a class="navbar-brand logo" href="../index.html">
<img src="../_static/arrow.png" class="logo__image only-light" alt="Apache Arrow v17.0.0.dev52 - Home"/>
<script>document.write(`<img src="../_static/arrow-dark.png" class="logo__image only-dark" alt="Apache Arrow v17.0.0.dev52 - Home"/>`);</script>
</a></div>
</div>
<div class="col-lg-9 navbar-header-items">
<div class="me-auto navbar-header-items__center">
<div class="navbar-item">
<nav class="navbar-nav">
<ul class="bd-navbar-elements navbar-nav">
<li class="nav-item">
<a class="nav-link nav-internal" href="../format/index.html">
Specifications
</a>
</li>
<li class="nav-item">
<a class="nav-link nav-internal" href="../developers/index.html">
Development
</a>
</li>
<li class="nav-item dropdown">
<button class="btn dropdown-toggle nav-item" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-controls="pst-nav-more-links">
Implementations
</button>
<ul id="pst-nav-more-links" class="dropdown-menu">
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../c_glib/index.html">
C/GLib
</a>
</li>
<li class="nav-item current active">
<a class="nav-link dropdown-item nav-internal" href="index.html">
C++
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://github.com/apache/arrow/blob/main/csharp/README.md">
C#
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://pkg.go.dev/github.com/apache/arrow/go/v17">
Go
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../java/index.html">
Java
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../js/index.html">
JavaScript
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/julia/">
Julia
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://github.com/apache/arrow/blob/main/matlab/README.md">
MATLAB
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/nanoarrow/">
nanoarrow
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../python/index.html">
Python
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../r/index.html">
R
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://github.com/apache/arrow/blob/main/ruby/README.md">
Ruby
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://docs.rs/crate/arrow/">
Rust
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../status.html">
Implementation Status
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/cookbook/cpp/">
C++ cookbook
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/cookbook/java/">
Java cookbook
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/cookbook/py/">
Python cookbook
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/cookbook/r/">
R cookbook
</a>
</li>
</ul>
</li>
</ul>
</nav></div>
</div>
<div class="navbar-header-items__end">
<div class="navbar-item navbar-persistent--container">
<script>
document.write(`
<button class="btn navbar-btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script>
</div>
<div class="navbar-item">
<script>
document.write(`
<div class="version-switcher__container dropdown">
<button id="pst-version-switcher-button-2"
type="button"
class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle"
data-bs-toggle="dropdown"
aria-haspopup="listbox"
aria-controls="pst-version-switcher-list-2"
aria-label="Version switcher list"
>
Choose version <!-- this text may get changed later by javascript -->
<span class="caret"></span>
</button>
<div id="pst-version-switcher-list-2"
class="version-switcher__menu dropdown-menu list-group-flush py-0"
role="listbox" aria-labelledby="pst-version-switcher-button-2">
<!-- dropdown will be populated by javascript on page load -->
</div>
</div>
`);
</script></div>
<div class="navbar-item">
<script>
document.write(`
<button class="btn btn-sm navbar-btn theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="theme-switch nav-link" data-mode="light"><i class="fa-solid fa-sun fa-lg"></i></span>
<span class="theme-switch nav-link" data-mode="dark"><i class="fa-solid fa-moon fa-lg"></i></span>
<span class="theme-switch nav-link" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg"></i></span>
</button>
`);
</script></div>
<div class="navbar-item"><ul class="navbar-icon-links navbar-nav"
aria-label="Icon Links">
<li class="nav-item">
<a href="https://github.com/apache/arrow" title="GitHub" class="nav-link" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><span><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i></span>
<span class="sr-only">GitHub</span></a>
</li>
<li class="nav-item">
<a href="https://twitter.com/ApacheArrow" title="X" class="nav-link" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><span><i class="fa-brands fa-square-x-twitter fa-lg" aria-hidden="true"></i></span>
<span class="sr-only">X</span></a>
</li>
</ul></div>
</div>
</div>
<div class="navbar-persistent--mobile">
<script>
document.write(`
<button class="btn navbar-btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script>
</div>
<label class="sidebar-toggle secondary-toggle" for="__secondary" tabindex="0">
<span class="fa-solid fa-outdent"></span>
</label>
</div>
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
<div class="sidebar-header-items__center">
<div class="navbar-item">
<nav class="navbar-nav">
<ul class="bd-navbar-elements navbar-nav">
<li class="nav-item">
<a class="nav-link nav-internal" href="../format/index.html">
Specifications
</a>
</li>
<li class="nav-item">
<a class="nav-link nav-internal" href="../developers/index.html">
Development
</a>
</li>
<li class="nav-item dropdown">
<button class="btn dropdown-toggle nav-item" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-controls="pst-nav-more-links-2">
Implementations
</button>
<ul id="pst-nav-more-links-2" class="dropdown-menu">
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../c_glib/index.html">
C/GLib
</a>
</li>
<li class="nav-item current active">
<a class="nav-link dropdown-item nav-internal" href="index.html">
C++
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://github.com/apache/arrow/blob/main/csharp/README.md">
C#
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://pkg.go.dev/github.com/apache/arrow/go/v17">
Go
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../java/index.html">
Java
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../js/index.html">
JavaScript
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/julia/">
Julia
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://github.com/apache/arrow/blob/main/matlab/README.md">
MATLAB
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/nanoarrow/">
nanoarrow
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../python/index.html">
Python
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../r/index.html">
R
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://github.com/apache/arrow/blob/main/ruby/README.md">
Ruby
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://docs.rs/crate/arrow/">
Rust
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-internal" href="../status.html">
Implementation Status
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/cookbook/cpp/">
C++ cookbook
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/cookbook/java/">
Java cookbook
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/cookbook/py/">
Python cookbook
</a>
</li>
<li class="nav-item">
<a class="nav-link dropdown-item nav-external" href="https://arrow.apache.org/cookbook/r/">
R cookbook
</a>
</li>
</ul>
</li>
</ul>
</nav></div>
</div>
<div class="sidebar-header-items__end">
<div class="navbar-item">
<script>
document.write(`
<div class="version-switcher__container dropdown">
<button id="pst-version-switcher-button-3"
type="button"
class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle"
data-bs-toggle="dropdown"
aria-haspopup="listbox"
aria-controls="pst-version-switcher-list-3"
aria-label="Version switcher list"
>
Choose version <!-- this text may get changed later by javascript -->
<span class="caret"></span>
</button>
<div id="pst-version-switcher-list-3"
class="version-switcher__menu dropdown-menu list-group-flush py-0"
role="listbox" aria-labelledby="pst-version-switcher-button-3">
<!-- dropdown will be populated by javascript on page load -->
</div>
</div>
`);
</script></div>
<div class="navbar-item">
<script>
document.write(`
<button class="btn btn-sm navbar-btn theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="theme-switch nav-link" data-mode="light"><i class="fa-solid fa-sun fa-lg"></i></span>
<span class="theme-switch nav-link" data-mode="dark"><i class="fa-solid fa-moon fa-lg"></i></span>
<span class="theme-switch nav-link" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg"></i></span>
</button>
`);
</script></div>
<div class="navbar-item"><ul class="navbar-icon-links navbar-nav"
aria-label="Icon Links">
<li class="nav-item">
<a href="https://github.com/apache/arrow" title="GitHub" class="nav-link" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><span><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i></span>
<span class="sr-only">GitHub</span></a>
</li>
<li class="nav-item">
<a href="https://twitter.com/ApacheArrow" title="X" class="nav-link" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><span><i class="fa-brands fa-square-x-twitter fa-lg" aria-hidden="true"></i></span>
<span class="sr-only">X</span></a>
</li>
</ul></div>
</div>
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<nav class="bd-docs-nav bd-links"
aria-label="Section Navigation">
<p class="bd-links__title" role="heading" aria-level="1">Section Navigation</p>
<div class="bd-toc-item navbar-nav"><ul class="current nav bd-sidenav">
<li class="toctree-l1 has-children"><a class="reference internal" href="getting_started.html">Getting Started</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-1"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="build_system.html">Using Arrow C++ in your own project</a></li>
<li class="toctree-l2"><a class="reference internal" href="conventions.html">Conventions</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorials/basic_arrow.html">Basic Arrow Data Structures</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorials/io_tutorial.html">Arrow File I/O</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorials/compute_tutorial.html">Arrow Compute</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorials/datasets_tutorial.html">Arrow Datasets</a></li>
</ul>
</li>
<li class="toctree-l1 current active has-children"><a class="reference internal" href="user_guide.html">User Guide</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="overview.html">High-Level Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html">Memory Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.html">Arrays</a></li>
<li class="toctree-l2"><a class="reference internal" href="datatypes.html">Data Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="tables.html">Tabular Data</a></li>
<li class="toctree-l2 current active"><a class="current reference internal" href="#">Compute Functions</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="gandiva.html">The Gandiva Expression Compiler</a><input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-3"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="gandiva/expr_projector_filter.html">Gandiva Expression, Projector, and Filter</a></li>
<li class="toctree-l3"><a class="reference internal" href="gandiva/external_func.html">Gandiva External Functions Development Guide</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="streaming_execution.html">Acero: A C++ streaming execution engine</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="acero/overview.html">Acero Overview</a></li>
<li class="toctree-l3"><a class="reference internal" href="acero/user_guide.html">Acero User’s Guide</a></li>
<li class="toctree-l3"><a class="reference internal" href="acero/substrait.html">Using Acero with Substrait</a></li>
<li class="toctree-l3"><a class="reference internal" href="acero/developer_guide.html">Developer’s Guide</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="io.html">Input / output and filesystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="ipc.html">Reading and writing the Arrow IPC format</a></li>
<li class="toctree-l2"><a class="reference internal" href="orc.html">Reading and Writing ORC files</a></li>
<li class="toctree-l2"><a class="reference internal" href="parquet.html">Reading and writing Parquet files</a></li>
<li class="toctree-l2"><a class="reference internal" href="csv.html">Reading and Writing CSV files</a></li>
<li class="toctree-l2"><a class="reference internal" href="json.html">Reading JSON files</a></li>
<li class="toctree-l2"><a class="reference internal" href="dataset.html">Tabular Datasets</a></li>
<li class="toctree-l2"><a class="reference internal" href="flight.html">Arrow Flight RPC</a></li>
<li class="toctree-l2"><a class="reference internal" href="gdb.html">Debugging code using Arrow</a></li>
<li class="toctree-l2"><a class="reference internal" href="threading.html">Thread Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="opentelemetry.html">OpenTelemetry</a></li>
<li class="toctree-l2"><a class="reference internal" href="env_vars.html">Environment Variables</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="examples/index.html">Examples</a><input class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-5"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="examples/cmake_minimal_build.html">Minimal build using CMake</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/compute_and_write_example.html">Compute and Write CSV Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/dataset_documentation_example.html">Arrow Datasets example</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/dataset_skyhook_scan_example.html">Arrow Skyhook example</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/row_columnar_conversion.html">Row to columnar conversion</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/tuple_range_conversion.html">std::tuple-like ranges to Arrow</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/converting_recordbatch_to_tensor.html">Converting RecordBatch to Tensor</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="api.html">API Reference</a><input class="toctree-checkbox" id="toctree-checkbox-6" name="toctree-checkbox-6" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-6"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="api/support.html">Programming Support</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/memory.html">Memory (management)</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/thread.html">Thread (management)</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/datatype.html">Data Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/array.html">Arrays</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/scalar.html">Scalars</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/builder.html">Array Builders</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/table.html">Two-dimensional Datasets</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/c_abi.html">C Interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/compute.html">Compute Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/acero.html">Streaming Execution (Acero)</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/gandiva.html">Gandiva Expression Compiler</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/tensor.html">Tensors</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/utilities.html">Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/async.html">Asynchronous programming</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/io.html">Input / output</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/ipc.html">Arrow IPC</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/formats.html">File Formats</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/cuda.html">CUDA support</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/flight.html">Arrow Flight RPC</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/flightsql.html">Arrow Flight SQL</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/filesystem.html">Filesystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/dataset.html">Dataset</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference external" href="https://arrow.apache.org/cookbook/cpp/">C++ cookbook</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main">
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item">
<nav aria-label="Breadcrumb">
<ul class="bd-breadcrumbs">
<li class="breadcrumb-item breadcrumb-home">
<a href="../index.html" class="nav-link" aria-label="Home">
<i class="fa-solid fa-home"></i>
</a>
</li>
<li class="breadcrumb-item"><a href="index.html" class="nav-link">C++ Implementation</a></li>
<li class="breadcrumb-item"><a href="user_guide.html" class="nav-link">User Guide</a></li>
<li class="breadcrumb-item active" aria-current="page">Compute Functions</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section id="compute-functions">
<span id="compute-cpp"></span><h1>Compute Functions<a class="headerlink" href="#compute-functions" title="Permalink to this heading">#</a></h1>
<section id="the-generic-compute-api">
<h2>The generic Compute API<a class="headerlink" href="#the-generic-compute-api" title="Permalink to this heading">#</a></h2>
<section id="functions-and-function-registry">
<h3>Functions and function registry<a class="headerlink" href="#functions-and-function-registry" title="Permalink to this heading">#</a></h3>
<p>Functions represent compute operations over inputs of possibly varying
types. Internally, a function is implemented by one or several
“kernels”, depending on the concrete input types (for example, a function
adding values from two inputs can have different kernels depending on
whether the inputs are integral or floating-point).</p>
<p>Functions are stored in a global <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16FunctionRegistryE" title="arrow::compute::FunctionRegistry"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">FunctionRegistry</span></code></a> where
they can be looked up by name.</p>
</section>
<section id="input-shapes">
<h3>Input shapes<a class="headerlink" href="#input-shapes" title="Permalink to this heading">#</a></h3>
<p>Computation inputs are represented as a general <a class="reference internal" href="api/compute.html#_CPPv4N5arrow5DatumE" title="arrow::Datum"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">Datum</span></code></a> class,
which is a tagged union of several shapes of data such as <a class="reference internal" href="api/scalar.html#_CPPv4N5arrow6ScalarE" title="arrow::Scalar"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">Scalar</span></code></a>,
<a class="reference internal" href="api/array.html#_CPPv4N5arrow5ArrayE" title="arrow::Array"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">Array</span></code></a> and <a class="reference internal" href="api/array.html#_CPPv4N5arrow12ChunkedArrayE" title="arrow::ChunkedArray"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">ChunkedArray</span></code></a>. Many compute functions support
both array (chunked or not) and scalar inputs, however some will mandate
particular input types. For example, while <code class="docutils literal notranslate"><span class="pre">array_sort_indices</span></code> requires its
first and only input to be an array, the generalized <code class="docutils literal notranslate"><span class="pre">sort_indices</span></code>
function accepts an array, chunked array, record batch or table.</p>
</section>
<section id="invoking-functions">
<span id="invoking-compute-functions"></span><h3>Invoking functions<a class="headerlink" href="#invoking-functions" title="Permalink to this heading">#</a></h3>
<p>Compute functions can be invoked by name using
<code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">arrow::compute::CallFunction()</span></code>:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">arrow</span><span class="o">::</span><span class="n">Array</span><span class="o">&gt;</span><span class="w"> </span><span class="n">numbers_array</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">...;</span>
<span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">arrow</span><span class="o">::</span><span class="n">Scalar</span><span class="o">&gt;</span><span class="w"> </span><span class="n">increment</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">...;</span>
<span class="n">arrow</span><span class="o">::</span><span class="n">Datum</span><span class="w"> </span><span class="n">incremented_datum</span><span class="p">;</span>
<span class="n">ARROW_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">incremented_datum</span><span class="p">,</span>
<span class="w"> </span><span class="n">arrow</span><span class="o">::</span><span class="n">compute</span><span class="o">::</span><span class="n">CallFunction</span><span class="p">(</span><span class="s">&quot;add&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="n">numbers_array</span><span class="p">,</span><span class="w"> </span><span class="n">increment</span><span class="p">}));</span>
<span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">Array</span><span class="o">&gt;</span><span class="w"> </span><span class="n">incremented_array</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">incremented_datum</span><span class="p">).</span><span class="n">make_array</span><span class="p">();</span>
</pre></div>
</div>
<p>(note this example uses implicit conversion from <code class="docutils literal notranslate"><span class="pre">std::shared_ptr&lt;Array&gt;</span></code>
to <code class="docutils literal notranslate"><span class="pre">Datum</span></code>)</p>
<p>Many compute functions are also available directly as concrete APIs, here
<code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">arrow::compute::Add()</span></code>:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">arrow</span><span class="o">::</span><span class="n">Array</span><span class="o">&gt;</span><span class="w"> </span><span class="n">numbers_array</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">...;</span>
<span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">arrow</span><span class="o">::</span><span class="n">Scalar</span><span class="o">&gt;</span><span class="w"> </span><span class="n">increment</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">...;</span>
<span class="n">arrow</span><span class="o">::</span><span class="n">Datum</span><span class="w"> </span><span class="n">incremented_datum</span><span class="p">;</span>
<span class="n">ARROW_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">incremented_datum</span><span class="p">,</span>
<span class="w"> </span><span class="n">arrow</span><span class="o">::</span><span class="n">compute</span><span class="o">::</span><span class="n">Add</span><span class="p">(</span><span class="n">numbers_array</span><span class="p">,</span><span class="w"> </span><span class="n">increment</span><span class="p">));</span>
<span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">Array</span><span class="o">&gt;</span><span class="w"> </span><span class="n">incremented_array</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">incremented_datum</span><span class="p">).</span><span class="n">make_array</span><span class="p">();</span>
</pre></div>
</div>
<p>Some functions accept or require an options structure that determines the
exact semantics of the function:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">ScalarAggregateOptions</span><span class="w"> </span><span class="n">scalar_aggregate_options</span><span class="p">;</span>
<span class="n">scalar_aggregate_options</span><span class="p">.</span><span class="n">skip_nulls</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">false</span><span class="p">;</span>
<span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">arrow</span><span class="o">::</span><span class="n">Array</span><span class="o">&gt;</span><span class="w"> </span><span class="n">array</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">...;</span>
<span class="n">arrow</span><span class="o">::</span><span class="n">Datum</span><span class="w"> </span><span class="n">min_max</span><span class="p">;</span>
<span class="n">ARROW_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">min_max</span><span class="p">,</span>
<span class="w"> </span><span class="n">arrow</span><span class="o">::</span><span class="n">compute</span><span class="o">::</span><span class="n">CallFunction</span><span class="p">(</span><span class="s">&quot;min_max&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="n">array</span><span class="p">},</span>
<span class="w"> </span><span class="o">&amp;</span><span class="n">scalar_aggregate_options</span><span class="p">));</span>
<span class="c1">// Unpack struct scalar result (a two-field {&quot;min&quot;, &quot;max&quot;} scalar)</span>
<span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">arrow</span><span class="o">::</span><span class="n">Scalar</span><span class="o">&gt;</span><span class="w"> </span><span class="n">min_value</span><span class="p">,</span><span class="w"> </span><span class="n">max_value</span><span class="p">;</span>
<span class="n">min_value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">min_max</span><span class="p">.</span><span class="n">scalar_as</span><span class="o">&lt;</span><span class="n">arrow</span><span class="o">::</span><span class="n">StructScalar</span><span class="o">&gt;</span><span class="p">().</span><span class="n">value</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
<span class="n">max_value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">min_max</span><span class="p">.</span><span class="n">scalar_as</span><span class="o">&lt;</span><span class="n">arrow</span><span class="o">::</span><span class="n">StructScalar</span><span class="o">&gt;</span><span class="p">().</span><span class="n">value</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
</pre></div>
</div>
<p>However, <a class="reference internal" href="#grouped-aggregations-group-by"><span class="std std-ref">Grouped Aggregations</span></a> are
not invocable via <code class="docutils literal notranslate"><span class="pre">CallFunction</span></code>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="api/compute.html"><span class="doc">Compute API reference</span></a></p>
</div>
</section>
</section>
<section id="implicit-casts">
<h2>Implicit casts<a class="headerlink" href="#implicit-casts" title="Permalink to this heading">#</a></h2>
<p>Functions may require conversion of their arguments before execution if a
kernel does not match the argument types precisely. For example comparison
of dictionary encoded arrays is not directly supported by any kernel, but an
implicit cast can be made allowing comparison against the decoded array.</p>
<p>Each function may define implicit cast behaviour as appropriate. For example
comparison and arithmetic kernels require identically typed arguments, and
support execution against differing numeric types by promoting their arguments
to numeric type which can accommodate any value from either input.</p>
<section id="common-numeric-type">
<span id="id1"></span><h3>Common numeric type<a class="headerlink" href="#common-numeric-type" title="Permalink to this heading">#</a></h3>
<p>The common numeric type of a set of input numeric types is the smallest numeric
type which can accommodate any value of any input. If any input is a floating
point type the common numeric type is the widest floating point type among the
inputs. Otherwise the common numeric type is integral and is signed if any input
is signed. For example:</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Input types</p></th>
<th class="head"><p>Common numeric type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>int32, int32</p></td>
<td><p>int32</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>int16, int32</p></td>
<td><p>int32</p></td>
<td><p>Max width is 32, promote LHS to int32</p></td>
</tr>
<tr class="row-even"><td><p>uint16, int32</p></td>
<td><p>int32</p></td>
<td><p>One input signed, override unsigned</p></td>
</tr>
<tr class="row-odd"><td><p>uint32, int32</p></td>
<td><p>int64</p></td>
<td><p>Widen to accommodate range of uint32</p></td>
</tr>
<tr class="row-even"><td><p>uint16, uint32</p></td>
<td><p>uint32</p></td>
<td><p>All inputs unsigned, maintain unsigned</p></td>
</tr>
<tr class="row-odd"><td><p>int16, uint32</p></td>
<td><p>int64</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>uint64, int16</p></td>
<td><p>int64</p></td>
<td><p>int64 cannot accommodate all uint64 values</p></td>
</tr>
<tr class="row-odd"><td><p>float32, int32</p></td>
<td><p>float32</p></td>
<td><p>Promote RHS to float32</p></td>
</tr>
<tr class="row-even"><td><p>float32, float64</p></td>
<td><p>float64</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>float32, int64</p></td>
<td><p>float32</p></td>
<td><p>int64 is wider, still promotes to float32</p></td>
</tr>
</tbody>
</table>
<p>In particular, note that comparing a <code class="docutils literal notranslate"><span class="pre">uint64</span></code> column to an <code class="docutils literal notranslate"><span class="pre">int16</span></code> column
may emit an error if one of the <code class="docutils literal notranslate"><span class="pre">uint64</span></code> values cannot be expressed as the
common type <code class="docutils literal notranslate"><span class="pre">int64</span></code> (for example, <code class="docutils literal notranslate"><span class="pre">2</span> <span class="pre">**</span> <span class="pre">63</span></code>).</p>
</section>
</section>
<section id="available-functions">
<span id="compute-function-list"></span><h2>Available functions<a class="headerlink" href="#available-functions" title="Permalink to this heading">#</a></h2>
<section id="type-categories">
<h3>Type categories<a class="headerlink" href="#type-categories" title="Permalink to this heading">#</a></h3>
<p>To avoid exhaustively listing supported types, the tables below use a number
of general type categories:</p>
<ul class="simple">
<li><p>“Numeric”: Integer types (Int8, etc.) and Floating-point types (Float32,
Float64, sometimes Float16). Some functions also accept Decimal128 and
Decimal256 input.</p></li>
<li><p>“Temporal”: Date types (Date32, Date64), Time types (Time32, Time64),
Timestamp, Duration, Interval.</p></li>
<li><p>“Binary-like”: Binary, LargeBinary, sometimes also FixedSizeBinary.</p></li>
<li><p>“String-like”: String, LargeString.</p></li>
<li><p>“List-like”: List, LargeList, sometimes also FixedSizeList.</p></li>
<li><p>“Nested”: List-likes (including FixedSizeList), Struct, Union, and
related types like Map.</p></li>
</ul>
<p>If you are unsure whether a function supports a concrete input type, we
recommend you try it out. Unsupported input types return a <code class="docutils literal notranslate"><span class="pre">TypeError</span></code>
<a class="reference internal" href="api/support.html#_CPPv4N5arrow6StatusE" title="arrow::Status"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">Status</span></code></a>.</p>
</section>
<section id="aggregations">
<span id="aggregation-option-list"></span><h3>Aggregations<a class="headerlink" href="#aggregations" title="Permalink to this heading">#</a></h3>
<p>Scalar aggregations operate on a (chunked) array or scalar value and reduce
the input to a single output value.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>all</p></td>
<td><p>Unary</p></td>
<td><p>Boolean</p></td>
<td><p>Scalar Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>any</p></td>
<td><p>Unary</p></td>
<td><p>Boolean</p></td>
<td><p>Scalar Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>approximate_median</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Scalar Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>count</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>Scalar Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12CountOptionsE" title="arrow::compute::CountOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CountOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>count_all</p></td>
<td><p>Nullary</p></td>
<td></td>
<td><p>Scalar Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>count_distinct</p></td>
<td><p>Unary</p></td>
<td><p>Non-nested types</p></td>
<td><p>Scalar Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12CountOptionsE" title="arrow::compute::CountOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CountOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>first</p></td>
<td><p>Unary</p></td>
<td><p>Numeric, Binary</p></td>
<td><p>Scalar Input type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(11)</p></td>
</tr>
<tr class="row-odd"><td><p>first_last</p></td>
<td><p>Unary</p></td>
<td><p>Numeric, Binary</p></td>
<td><p>Scalar Struct</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(11)</p></td>
</tr>
<tr class="row-even"><td><p>index</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>Scalar Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12IndexOptionsE" title="arrow::compute::IndexOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">IndexOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>last</p></td>
<td><p>Unary</p></td>
<td><p>Numeric, Binary</p></td>
<td><p>Scalar Input type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(11)</p></td>
</tr>
<tr class="row-even"><td><p>max</p></td>
<td><p>Unary</p></td>
<td><p>Non-nested types</p></td>
<td><p>Scalar Input type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>mean</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Scalar Decimal/Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-even"><td><p>min</p></td>
<td><p>Unary</p></td>
<td><p>Non-nested types</p></td>
<td><p>Scalar Input type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>min_max</p></td>
<td><p>Unary</p></td>
<td><p>Non-nested types</p></td>
<td><p>Scalar Struct</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(5)</p></td>
</tr>
<tr class="row-even"><td><p>mode</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Struct</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11ModeOptionsE" title="arrow::compute::ModeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ModeOptions</span></code></a></p></td>
<td><p>(6)</p></td>
</tr>
<tr class="row-odd"><td><p>product</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Scalar Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(7)</p></td>
</tr>
<tr class="row-even"><td><p>quantile</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Scalar Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15QuantileOptionsE" title="arrow::compute::QuantileOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">QuantileOptions</span></code></a></p></td>
<td><p>(8)</p></td>
</tr>
<tr class="row-odd"><td><p>stddev</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Scalar Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15VarianceOptionsE" title="arrow::compute::VarianceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">VarianceOptions</span></code></a></p></td>
<td><p>(9)</p></td>
</tr>
<tr class="row-even"><td><p>sum</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Scalar Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(7)</p></td>
</tr>
<tr class="row-odd"><td><p>tdigest</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute14TDigestOptionsE" title="arrow::compute::TDigestOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TDigestOptions</span></code></a></p></td>
<td><p>(10)</p></td>
</tr>
<tr class="row-even"><td><p>variance</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Scalar Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15VarianceOptionsE" title="arrow::compute::VarianceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">VarianceOptions</span></code></a></p></td>
<td><p>(9)</p></td>
</tr>
</tbody>
</table>
<ul>
<li><p>(1) If null values are taken into account, by setting the
ScalarAggregateOptions parameter skip_nulls = false, then <a class="reference external" href="https://en.wikipedia.org/wiki/Three-valued_logic#Kleene_and_Priest_logics">Kleene logic</a>
logic is applied. The min_count option is not respected.</p></li>
<li><p>(2) CountMode controls whether only non-null values are counted (the
default), only null values are counted, or all values are counted.</p></li>
<li><p>(3) Returns -1 if the value is not found. The index of a null value
is always -1, regardless of whether there are nulls in the input.</p></li>
<li><p>(4) For decimal inputs, the resulting decimal will have the same
precision and scale. The result is rounded away from zero.</p></li>
<li><p>(5) Output is a <code class="docutils literal notranslate"><span class="pre">{&quot;min&quot;:</span> <span class="pre">input</span> <span class="pre">type,</span> <span class="pre">&quot;max&quot;:</span> <span class="pre">input</span> <span class="pre">type}</span></code> Struct.</p>
<p>Of the interval types, only the month interval is supported, as the day-time
and month-day-nano types are not sortable.</p>
</li>
<li><p>(6) Output is an array of <code class="docutils literal notranslate"><span class="pre">{&quot;mode&quot;:</span> <span class="pre">input</span> <span class="pre">type,</span> <span class="pre">&quot;count&quot;:</span> <span class="pre">Int64}</span></code> Struct.
It contains the <em>N</em> most common elements in the input, in descending
order, where <em>N</em> is given in <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11ModeOptions1nE" title="arrow::compute::ModeOptions::n"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ModeOptions::n</span></code></a>.
If two values have the same count, the smallest one comes first.
Note that the output can have less than <em>N</em> elements if the input has
less than <em>N</em> distinct values.</p></li>
<li><p>(7) Output is Int64, UInt64, Float64, or Decimal128/256, depending on the
input type.</p></li>
<li><p>(8) Output is Float64 or input type, depending on QuantileOptions.</p></li>
<li><p>(9) Decimal arguments are cast to Float64 first.</p></li>
<li><p>(10) tdigest/t-digest computes approximate quantiles, and so only needs a
fixed amount of memory. See the <a class="reference external" href="https://github.com/tdunning/t-digest">reference implementation</a> for details.</p></li>
<li><p>(11) Result is based on the ordering of input data</p>
<p>Decimal arguments are cast to Float64 first.</p>
</li>
</ul>
<section id="grouped-aggregations-group-by">
<span id="id2"></span><h4>Grouped Aggregations (“group by”)<a class="headerlink" href="#grouped-aggregations-group-by" title="Permalink to this heading">#</a></h4>
<p>Grouped aggregations are not directly invokable, but are used as part of a
SQL-style “group by” operation. Like scalar aggregations, grouped aggregations
reduce multiple input values to a single output value. Instead of aggregating
all values of the input, however, grouped aggregations partition the input
values on some set of “key” columns, then aggregate each group individually,
emitting one output value per input group.</p>
<p>As an example, for the following table:</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Column <code class="docutils literal notranslate"><span class="pre">key</span></code></p></th>
<th class="head"><p>Column <code class="docutils literal notranslate"><span class="pre">x</span></code></p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>“a”</p></td>
<td><p>2</p></td>
</tr>
<tr class="row-odd"><td><p>“a”</p></td>
<td><p>5</p></td>
</tr>
<tr class="row-even"><td><p>“b”</p></td>
<td><p>null</p></td>
</tr>
<tr class="row-odd"><td><p>“b”</p></td>
<td><p>null</p></td>
</tr>
<tr class="row-even"><td><p>null</p></td>
<td><p>null</p></td>
</tr>
<tr class="row-odd"><td><p>null</p></td>
<td><p>9</p></td>
</tr>
</tbody>
</table>
<p>we can compute a sum of the column <code class="docutils literal notranslate"><span class="pre">x</span></code>, grouped on the column <code class="docutils literal notranslate"><span class="pre">key</span></code>.
This gives us three groups, with the following results. Note that null is
treated as a distinct key value.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Column <code class="docutils literal notranslate"><span class="pre">key</span></code></p></th>
<th class="head"><p>Column <code class="docutils literal notranslate"><span class="pre">sum(x)</span></code></p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>“a”</p></td>
<td><p>7</p></td>
</tr>
<tr class="row-odd"><td><p>“b”</p></td>
<td><p>null</p></td>
</tr>
<tr class="row-even"><td><p>null</p></td>
<td><p>9</p></td>
</tr>
</tbody>
</table>
<p>The supported aggregation functions are as follows. All function names are
prefixed with <code class="docutils literal notranslate"><span class="pre">hash_</span></code>, which differentiates them from their scalar
equivalents above and reflects how they are implemented internally.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>hash_all</p></td>
<td><p>Unary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>hash_any</p></td>
<td><p>Unary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>hash_approximate_median</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>hash_count</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12CountOptionsE" title="arrow::compute::CountOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CountOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>hash_count_all</p></td>
<td><p>Nullary</p></td>
<td></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>hash_count_distinct</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12CountOptionsE" title="arrow::compute::CountOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CountOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>hash_distinct</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>List of input type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12CountOptionsE" title="arrow::compute::CountOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CountOptions</span></code></a></p></td>
<td><p>(2) (3)</p></td>
</tr>
<tr class="row-odd"><td><p>hash_first</p></td>
<td><p>Unary</p></td>
<td><p>Numeric, Binary</p></td>
<td><p>Input type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(10)</p></td>
</tr>
<tr class="row-even"><td><p>hash_first_last</p></td>
<td><p>Unary</p></td>
<td><p>Numeric, Binary</p></td>
<td><p>Struct</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(10)</p></td>
</tr>
<tr class="row-odd"><td><p>hash_last</p></td>
<td><p>Unary</p></td>
<td><p>Numeric, Binary</p></td>
<td><p>Input type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(10)</p></td>
</tr>
<tr class="row-even"><td><p>hash_list</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>List of input type</p></td>
<td></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>hash_max</p></td>
<td><p>Unary</p></td>
<td><p>Non-nested, non-binary/string-like</p></td>
<td><p>Input type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>hash_mean</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Decimal/Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-odd"><td><p>hash_min</p></td>
<td><p>Unary</p></td>
<td><p>Non-nested, non-binary/string-like</p></td>
<td><p>Input type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>hash_min_max</p></td>
<td><p>Unary</p></td>
<td><p>Non-nested types</p></td>
<td><p>Struct</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(5)</p></td>
</tr>
<tr class="row-odd"><td><p>hash_one</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>Input type</p></td>
<td></td>
<td><p>(6)</p></td>
</tr>
<tr class="row-even"><td><p>hash_product</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(7)</p></td>
</tr>
<tr class="row-odd"><td><p>hash_stddev</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15VarianceOptionsE" title="arrow::compute::VarianceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">VarianceOptions</span></code></a></p></td>
<td><p>(8)</p></td>
</tr>
<tr class="row-even"><td><p>hash_sum</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptionsE" title="arrow::compute::ScalarAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ScalarAggregateOptions</span></code></a></p></td>
<td><p>(7)</p></td>
</tr>
<tr class="row-odd"><td><p>hash_tdigest</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>FixedSizeList[Float64]</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute14TDigestOptionsE" title="arrow::compute::TDigestOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TDigestOptions</span></code></a></p></td>
<td><p>(9)</p></td>
</tr>
<tr class="row-even"><td><p>hash_variance</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15VarianceOptionsE" title="arrow::compute::VarianceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">VarianceOptions</span></code></a></p></td>
<td><p>(8)</p></td>
</tr>
</tbody>
</table>
<ul>
<li><p>(1) If null values are taken into account, by setting the
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22ScalarAggregateOptions10skip_nullsE" title="arrow::compute::ScalarAggregateOptions::skip_nulls"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ScalarAggregateOptions::skip_nulls</span></code></a> to false, then <a class="reference external" href="https://en.wikipedia.org/wiki/Three-valued_logic#Kleene_and_Priest_logics">Kleene logic</a>
logic is applied. The min_count option is not respected.</p></li>
<li><p>(2) CountMode controls whether only non-null values are counted
(the default), only null values are counted, or all values are
counted. For hash_distinct, it instead controls whether null values
are emitted. This never affects the grouping keys, only group values
(i.e. you may get a group where the key is null).</p></li>
<li><p>(3) <code class="docutils literal notranslate"><span class="pre">hash_distinct</span></code> and <code class="docutils literal notranslate"><span class="pre">hash_list</span></code> gather the grouped values
into a list array.</p></li>
<li><p>(4) For decimal inputs, the resulting decimal will have the same
precision and scale. The result is rounded away from zero.</p></li>
<li><p>(5) Output is a <code class="docutils literal notranslate"><span class="pre">{&quot;min&quot;:</span> <span class="pre">input</span> <span class="pre">type,</span> <span class="pre">&quot;max&quot;:</span> <span class="pre">input</span> <span class="pre">type}</span></code> Struct array.</p>
<p>Of the interval types, only the month interval is supported, as the day-time
and month-day-nano types are not sortable.</p>
</li>
<li><p>(6) <code class="docutils literal notranslate"><span class="pre">hash_one</span></code> returns one arbitrary value from the input for each
group. The function is biased towards non-null values: if there is at least
one non-null value for a certain group, that value is returned, and only if
all the values are <code class="docutils literal notranslate"><span class="pre">null</span></code> for the group will the function return <code class="docutils literal notranslate"><span class="pre">null</span></code>.</p></li>
<li><p>(7) Output is Int64, UInt64, Float64, or Decimal128/256, depending on the
input type.</p></li>
<li><p>(8) Decimal arguments are cast to Float64 first.</p></li>
<li><p>(9) T-digest computes approximate quantiles, and so only needs a
fixed amount of memory. See the <a class="reference external" href="https://github.com/tdunning/t-digest">reference implementation</a> for details.</p></li>
<li><p>(10) Result is based on ordering of the input data.</p>
<p>Decimal arguments are cast to Float64 first.</p>
</li>
</ul>
</section>
</section>
<section id="element-wise-scalar-functions">
<h3>Element-wise (“scalar”) functions<a class="headerlink" href="#element-wise-scalar-functions" title="Permalink to this heading">#</a></h3>
<p>All element-wise functions accept both arrays and scalars as input. The
semantics for unary functions are as follow:</p>
<ul class="simple">
<li><p>scalar inputs produce a scalar output</p></li>
<li><p>array inputs produce an array output</p></li>
</ul>
<p>Binary functions have the following semantics (which is sometimes called
“broadcasting” in other systems such as NumPy):</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">(scalar,</span> <span class="pre">scalar)</span></code> inputs produce a scalar output</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">(array,</span> <span class="pre">array)</span></code> inputs produce an array output (and both inputs must
be of the same length)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">(scalar,</span> <span class="pre">array)</span></code> and <code class="docutils literal notranslate"><span class="pre">(array,</span> <span class="pre">scalar)</span></code> produce an array output.
The scalar input is handled as if it were an array of the same length N
as the other input, with the same value repeated N times.</p></li>
</ul>
<section id="arithmetic-functions">
<h4>Arithmetic functions<a class="headerlink" href="#arithmetic-functions" title="Permalink to this heading">#</a></h4>
<p>These functions expect inputs of numeric type and apply a given arithmetic
operation to each element(s) gathered from the input(s). If any of the
input element(s) is null, the corresponding output element is null.
For binary functions, input(s) will be cast to the
<a class="reference internal" href="#common-numeric-type"><span class="std std-ref">common numeric type</span></a>
(and dictionary decoded, if applicable) before the operation is applied.</p>
<p>The default variant of these functions does not detect overflow (the result
then typically wraps around). Most functions are also available in an
overflow-checking variant, suffixed <code class="docutils literal notranslate"><span class="pre">_checked</span></code>, which returns
an <code class="docutils literal notranslate"><span class="pre">Invalid</span></code> <a class="reference internal" href="api/support.html#_CPPv4N5arrow6StatusE" title="arrow::Status"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">Status</span></code></a> when overflow is detected.</p>
<p>For functions which support decimal inputs (currently <code class="docutils literal notranslate"><span class="pre">add</span></code>, <code class="docutils literal notranslate"><span class="pre">subtract</span></code>,
<code class="docutils literal notranslate"><span class="pre">multiply</span></code>, and <code class="docutils literal notranslate"><span class="pre">divide</span></code> and their checked variants), decimals of different
precisions/scales will be promoted appropriately. Mixed decimal and
floating-point arguments will cast all arguments to floating-point, while mixed
decimal and integer arguments will cast all arguments to decimals.
Mixed time resolution temporal inputs will be cast to finest input resolution.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>abs</p></td>
<td><p>Unary</p></td>
<td><p>Numeric/Duration</p></td>
<td><p>Numeric/Duration</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>abs_checked</p></td>
<td><p>Unary</p></td>
<td><p>Numeric/Duration</p></td>
<td><p>Numeric/Duration</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>add</p></td>
<td><p>Binary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>add_checked</p></td>
<td><p>Binary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>divide</p></td>
<td><p>Binary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>divide_checked</p></td>
<td><p>Binary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>exp</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Float32/Float64</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>multiply</p></td>
<td><p>Binary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>multiply_checked</p></td>
<td><p>Binary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>negate</p></td>
<td><p>Unary</p></td>
<td><p>Numeric/Duration</p></td>
<td><p>Numeric/Duration</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>negate_checked</p></td>
<td><p>Unary</p></td>
<td><p>Signed Numeric/Duration</p></td>
<td><p>Signed Numeric/Duration</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>power</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>power_checked</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>sign</p></td>
<td><p>Unary</p></td>
<td><p>Numeric/Duration</p></td>
<td><p>Int8/Float32/Float64</p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>sqrt</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>sqrt_checked</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>subtract</p></td>
<td><p>Binary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>subtract_checked</p></td>
<td><p>Binary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>(1)</p></td>
</tr>
</tbody>
</table>
<ul>
<li><p>(1) Precision and scale of computed DECIMAL results</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Operation</p></th>
<th class="head"><p>Result precision and scale</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><div class="line-block">
<div class="line">add</div>
<div class="line">subtract</div>
</div>
</td>
<td><div class="line-block">
<div class="line">scale = max(s1, s2)</div>
<div class="line">precision = max(p1-s1, p2-s2) + 1 + scale</div>
</div>
</td>
</tr>
<tr class="row-odd"><td><p>multiply</p></td>
<td><div class="line-block">
<div class="line">scale = s1 + s2</div>
<div class="line">precision = p1 + p2 + 1</div>
</div>
</td>
</tr>
<tr class="row-even"><td><p>divide</p></td>
<td><div class="line-block">
<div class="line">scale = max(4, s1 + p2 - s2 + 1)</div>
<div class="line">precision = p1 - s1 + s2 + scale</div>
</div>
</td>
</tr>
</tbody>
</table>
<p>It’s compatible with Redshift’s decimal promotion rules. All decimal digits
are preserved for <cite>add</cite>, <cite>subtract</cite> and <cite>multiply</cite> operations. The result
precision of <cite>divide</cite> is at least the sum of precisions of both operands with
enough scale kept. Error is returned if the result precision is beyond the
decimal value range.</p>
</li>
<li><p>(2) Output is any of (-1,1) for nonzero inputs and 0 for zero input. NaN
values return NaN. Integral and decimal values return signedness as Int8 and
floating-point values return it with the same type as the input values.</p></li>
</ul>
</section>
<section id="bit-wise-functions">
<h4>Bit-wise functions<a class="headerlink" href="#bit-wise-functions" title="Permalink to this heading">#</a></h4>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>bit_wise_and</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
</tr>
<tr class="row-odd"><td><p>bit_wise_not</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
</tr>
<tr class="row-even"><td><p>bit_wise_or</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
</tr>
<tr class="row-odd"><td><p>bit_wise_xor</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
</tr>
<tr class="row-even"><td><p>shift_left</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
</tr>
<tr class="row-odd"><td><p>shift_left_checked</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric (1)</p></td>
</tr>
<tr class="row-even"><td><p>shift_right</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
</tr>
<tr class="row-odd"><td><p>shift_right_checked</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric (1)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) An error is emitted if the shift amount (i.e. the second input) is
out of bounds for the data type. However, an overflow when shifting the
first input is not error (truncated bits are silently discarded).</p></li>
</ul>
</section>
<section id="rounding-functions">
<h4>Rounding functions<a class="headerlink" href="#rounding-functions" title="Permalink to this heading">#</a></h4>
<p>Rounding functions displace numeric inputs to an approximate value with a simpler
representation based on the rounding criterion.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ceil</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>floor</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-even"><td><p>round</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Input Type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12RoundOptionsE" title="arrow::compute::RoundOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RoundOptions</span></code></a></p></td>
<td><p>(1)(2)</p></td>
</tr>
<tr class="row-odd"><td><p>round_to_multiple</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Input Type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22RoundToMultipleOptionsE" title="arrow::compute::RoundToMultipleOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RoundToMultipleOptions</span></code></a></p></td>
<td><p>(1)(3)</p></td>
</tr>
<tr class="row-even"><td><p>round_binary</p></td>
<td><p>Binary</p></td>
<td><p>Numeric</p></td>
<td><p>Input Type</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute18RoundBinaryOptionsE" title="arrow::compute::RoundBinaryOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RoundBinaryOptions</span></code></a></p></td>
<td><p>(1)(4)</p></td>
</tr>
<tr class="row-odd"><td><p>trunc</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) By default rounding functions change a value to the nearest
integer using HALF_TO_EVEN to resolve ties. Options are available to control
the rounding criterion. All <code class="docutils literal notranslate"><span class="pre">round</span></code> functions have the
<code class="docutils literal notranslate"><span class="pre">round_mode</span></code> option to set the rounding mode.</p></li>
<li><p>(2) Round to a number of digits where the <code class="docutils literal notranslate"><span class="pre">ndigits</span></code> option of
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12RoundOptionsE" title="arrow::compute::RoundOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RoundOptions</span></code></a> specifies the rounding precision in terms of number
of digits. A negative value corresponds to digits in the non-fractional
part. For example, -2 corresponds to rounding to the nearest multiple of
100 (zeroing the ones and tens digits). Default value of <code class="docutils literal notranslate"><span class="pre">ndigits</span></code> is 0
which rounds to the nearest integer. For integer inputs a non-negative
<code class="docutils literal notranslate"><span class="pre">ndigits</span></code> value is ignored and the input is returned unchanged. For integer
inputs, if <code class="docutils literal notranslate"><span class="pre">-ndigits</span></code> is larger than the maximum number of digits the
input type can hold, an error is returned.</p></li>
<li><p>(3) Round to a multiple where the <code class="docutils literal notranslate"><span class="pre">multiple</span></code> option of
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute22RoundToMultipleOptionsE" title="arrow::compute::RoundToMultipleOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RoundToMultipleOptions</span></code></a> specifies the rounding scale. The rounding
multiple has to be a positive value and can be casted to input type.
For example, 100 corresponds to rounding to the nearest multiple of 100
(zeroing the ones and tens digits). Default value of <code class="docutils literal notranslate"><span class="pre">multiple</span></code> is 1 which
rounds to the nearest integer.</p></li>
<li><p>(4) Round the first input to multiple of the second input. The rounding
multiple has to be a positive value and can be casted to the first input type.
For example, 100 corresponds to rounding to the nearest multiple of 100
(zeroing the ones and tens digits).</p></li>
</ul>
<p>For <code class="docutils literal notranslate"><span class="pre">round</span></code> functions, the following rounding modes are available.
Tie-breaking modes are prefixed with HALF and round non-ties to the nearest integer.
The example values are given for default values of <code class="docutils literal notranslate"><span class="pre">ndigits</span></code> and <code class="docutils literal notranslate"><span class="pre">multiple</span></code>.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p><code class="docutils literal notranslate"><span class="pre">round_mode</span></code></p></th>
<th class="head"><p>Operation performed</p></th>
<th class="head"><p>Example values</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>DOWN</p></td>
<td><p>Round to nearest integer less than or equal in magnitude;
also known as <code class="docutils literal notranslate"><span class="pre">floor(x)</span></code></p></td>
<td><p>3.2 -&gt; 3, 3.7 -&gt; 3,
-3.2 -&gt; -4, -3.7 -&gt; -4</p></td>
</tr>
<tr class="row-odd"><td><p>UP</p></td>
<td><p>Round to nearest integer greater than or equal in magnitude;
also known as <code class="docutils literal notranslate"><span class="pre">ceil(x)</span></code></p></td>
<td><p>3.2 -&gt; 4, 3.7 -&gt; 4,
-3.2 -&gt; -3, -3.7 -&gt; -3</p></td>
</tr>
<tr class="row-even"><td><p>TOWARDS_ZERO</p></td>
<td><p>Get the integral part without fractional digits;
also known as <code class="docutils literal notranslate"><span class="pre">trunc(x)</span></code></p></td>
<td><p>3.2 -&gt; 3, 3.7 -&gt; 3,
-3.2 -&gt; -3, -3.7 -&gt; -3</p></td>
</tr>
<tr class="row-odd"><td><p>TOWARDS_INFINITY</p></td>
<td><p>Round negative values with <code class="docutils literal notranslate"><span class="pre">DOWN</span></code> rule,
round positive values with <code class="docutils literal notranslate"><span class="pre">UP</span></code> rule</p></td>
<td><p>3.2 -&gt; 4, 3.7 -&gt; 4,
-3.2 -&gt; -4, -3.7 -&gt; -4</p></td>
</tr>
<tr class="row-even"><td><p>HALF_DOWN</p></td>
<td><p>Round ties with <code class="docutils literal notranslate"><span class="pre">DOWN</span></code> rule</p></td>
<td><p>3.5 -&gt; 3, 4.5 -&gt; 4,
-3.5 -&gt; -4, -4.5 -&gt; -5</p></td>
</tr>
<tr class="row-odd"><td><p>HALF_UP</p></td>
<td><p>Round ties with <code class="docutils literal notranslate"><span class="pre">UP</span></code> rule</p></td>
<td><p>3.5 -&gt; 4, 4.5 -&gt; 5,
-3.5 -&gt; -3, -4.5 -&gt; -4</p></td>
</tr>
<tr class="row-even"><td><p>HALF_TOWARDS_ZERO</p></td>
<td><p>Round ties with <code class="docutils literal notranslate"><span class="pre">TOWARDS_ZERO</span></code> rule</p></td>
<td><p>3.5 -&gt; 3, 4.5 -&gt; 4,
-3.5 -&gt; -3, -4.5 -&gt; -4</p></td>
</tr>
<tr class="row-odd"><td><p>HALF_TOWARDS_INFINITY</p></td>
<td><p>Round ties with <code class="docutils literal notranslate"><span class="pre">TOWARDS_INFINITY</span></code> rule</p></td>
<td><p>3.5 -&gt; 4, 4.5 -&gt; 5,
-3.5 -&gt; -4, -4.5 -&gt; -5</p></td>
</tr>
<tr class="row-even"><td><p>HALF_TO_EVEN</p></td>
<td><p>Round ties to nearest even integer</p></td>
<td><p>3.5 -&gt; 4, 4.5 -&gt; 4,
-3.5 -&gt; -4, -4.5 -&gt; -4</p></td>
</tr>
<tr class="row-odd"><td><p>HALF_TO_ODD</p></td>
<td><p>Round ties to nearest odd integer</p></td>
<td><p>3.5 -&gt; 3, 4.5 -&gt; 5,
-3.5 -&gt; -3, -4.5 -&gt; -5</p></td>
</tr>
</tbody>
</table>
<p>The following table gives examples of how <code class="docutils literal notranslate"><span class="pre">ndigits</span></code> (for the <code class="docutils literal notranslate"><span class="pre">round</span></code>
and <code class="docutils literal notranslate"><span class="pre">round_binary</span></code> functions) and <code class="docutils literal notranslate"><span class="pre">multiple</span></code> (for <code class="docutils literal notranslate"><span class="pre">round_to_multiple</span></code>)
influence the operation performed, respectively.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Round <code class="docutils literal notranslate"><span class="pre">multiple</span></code></p></th>
<th class="head"><p>Round <code class="docutils literal notranslate"><span class="pre">ndigits</span></code></p></th>
<th class="head"><p>Operation performed</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>1</p></td>
<td><p>0</p></td>
<td><p>Round to integer</p></td>
</tr>
<tr class="row-odd"><td><p>0.001</p></td>
<td><p>3</p></td>
<td><p>Round to 3 decimal places</p></td>
</tr>
<tr class="row-even"><td><p>10</p></td>
<td><p>-1</p></td>
<td><p>Round to multiple of 10</p></td>
</tr>
<tr class="row-odd"><td><p>2</p></td>
<td><p>NA</p></td>
<td><p>Round to multiple of 2</p></td>
</tr>
</tbody>
</table>
</section>
<section id="logarithmic-functions">
<h4>Logarithmic functions<a class="headerlink" href="#logarithmic-functions" title="Permalink to this heading">#</a></h4>
<p>Logarithmic functions are also supported, and also offer <code class="docutils literal notranslate"><span class="pre">_checked</span></code>
variants that check for domain errors if needed.</p>
<p>Decimal values are accepted, but are cast to Float64 first.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ln</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>ln_checked</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-even"><td><p>log10</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>log10_checked</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-even"><td><p>log1p</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>log1p_checked</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-even"><td><p>log2</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>log2_checked</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-even"><td><p>logb</p></td>
<td><p>Binary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>logb_checked</p></td>
<td><p>Binary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
</tbody>
</table>
</section>
<section id="trigonometric-functions">
<h4>Trigonometric functions<a class="headerlink" href="#trigonometric-functions" title="Permalink to this heading">#</a></h4>
<p>Trigonometric functions are also supported, and also offer <code class="docutils literal notranslate"><span class="pre">_checked</span></code>
variants that check for domain errors if needed.</p>
<p>Decimal values are accepted, but are cast to Float64 first.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>acos</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>acos_checked</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-even"><td><p>asin</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>asin_checked</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-even"><td><p>atan</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>atan2</p></td>
<td><p>Binary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-even"><td><p>cos</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>cos_checked</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-even"><td><p>sin</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>sin_checked</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-even"><td><p>tan</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
<tr class="row-odd"><td><p>tan_checked</p></td>
<td><p>Unary</p></td>
<td><p>Float32/Float64/Decimal</p></td>
<td><p>Float32/Float64</p></td>
</tr>
</tbody>
</table>
</section>
<section id="comparisons">
<h4>Comparisons<a class="headerlink" href="#comparisons" title="Permalink to this heading">#</a></h4>
<p>These functions expect two inputs of numeric type (in which case they will be
cast to the <a class="reference internal" href="#common-numeric-type"><span class="std std-ref">common numeric type</span></a> before comparison),
or two inputs of Binary- or String-like types, or two inputs of Temporal types.
If any input is dictionary encoded it will be expanded for the purposes of
comparison. If any of the input elements in a pair is null, the corresponding
output element is null. Decimal arguments will be promoted in the same way as
for <code class="docutils literal notranslate"><span class="pre">add</span></code> and <code class="docutils literal notranslate"><span class="pre">subtract</span></code>.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function names</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>equal</p></td>
<td><p>Binary</p></td>
<td><p>Numeric, Temporal, Binary- and String-like</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-odd"><td><p>greater</p></td>
<td><p>Binary</p></td>
<td><p>Numeric, Temporal, Binary- and String-like</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-even"><td><p>greater_equal</p></td>
<td><p>Binary</p></td>
<td><p>Numeric, Temporal, Binary- and String-like</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-odd"><td><p>less</p></td>
<td><p>Binary</p></td>
<td><p>Numeric, Temporal, Binary- and String-like</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-even"><td><p>less_equal</p></td>
<td><p>Binary</p></td>
<td><p>Numeric, Temporal, Binary- and String-like</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-odd"><td><p>not_equal</p></td>
<td><p>Binary</p></td>
<td><p>Numeric, Temporal, Binary- and String-like</p></td>
<td><p>Boolean</p></td>
</tr>
</tbody>
</table>
<p>These functions take any number of inputs of numeric type (in which case they
will be cast to the <a class="reference internal" href="#common-numeric-type"><span class="std std-ref">common numeric type</span></a> before
comparison) or of temporal types. If any input is dictionary encoded it will be
expanded for the purposes of comparison.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function names</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>max_element_wise</p></td>
<td><p>Varargs</p></td>
<td><p>Numeric, Temporal, Binary- and String-like</p></td>
<td><p>Numeric or Temporal</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute27ElementWiseAggregateOptionsE" title="arrow::compute::ElementWiseAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ElementWiseAggregateOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>min_element_wise</p></td>
<td><p>Varargs</p></td>
<td><p>Numeric, Temporal, Binary- and String-like</p></td>
<td><p>Numeric or Temporal</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute27ElementWiseAggregateOptionsE" title="arrow::compute::ElementWiseAggregateOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ElementWiseAggregateOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) By default, nulls are skipped (but the kernel can be configured to propagate nulls).
For floating point values, NaN will be taken over null but not over any other value.
For binary- and string-like values, only identical type parameters are supported.</p></li>
</ul>
</section>
<section id="logical-functions">
<h4>Logical functions<a class="headerlink" href="#logical-functions" title="Permalink to this heading">#</a></h4>
<p>The normal behaviour for these functions is to emit a null if any of the
inputs is null (similar to the semantics of <code class="docutils literal notranslate"><span class="pre">NaN</span></code> in floating-point
computations).</p>
<p>Some of them are also available in a <a class="reference external" href="https://en.wikipedia.org/wiki/Three-valued_logic#Kleene_and_Priest_logics">Kleene logic</a> variant (suffixed
<code class="docutils literal notranslate"><span class="pre">_kleene</span></code>) where null is taken to mean “undefined”. This is the
interpretation of null used in SQL systems as well as R and Julia,
for example.</p>
<p>For the Kleene logic variants, therefore:</p>
<ul class="simple">
<li><p>“true AND null”, “null AND true” give “null” (the result is undefined)</p></li>
<li><p>“true OR null”, “null OR true” give “true”</p></li>
<li><p>“false AND null”, “null AND false” give “false”</p></li>
<li><p>“false OR null”, “null OR false” give “null” (the result is undefined)</p></li>
</ul>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>and</p></td>
<td><p>Binary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-odd"><td><p>and_kleene</p></td>
<td><p>Binary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-even"><td><p>and_not</p></td>
<td><p>Binary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-odd"><td><p>and_not_kleene</p></td>
<td><p>Binary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-even"><td><p>invert</p></td>
<td><p>Unary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-odd"><td><p>or</p></td>
<td><p>Binary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-even"><td><p>or_kleene</p></td>
<td><p>Binary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
</tr>
<tr class="row-odd"><td><p>xor</p></td>
<td><p>Binary</p></td>
<td><p>Boolean</p></td>
<td><p>Boolean</p></td>
</tr>
</tbody>
</table>
</section>
<section id="string-predicates">
<h4>String predicates<a class="headerlink" href="#string-predicates" title="Permalink to this heading">#</a></h4>
<p>These functions classify the input string elements according to their character
contents. An empty string element emits false in the output. For ASCII
variants of the functions (prefixed <code class="docutils literal notranslate"><span class="pre">ascii_</span></code>), a string element with non-ASCII
characters emits false in the output.</p>
<p>The first set of functions operates on a character-per-character basis,
and emit true in the output if the input contains only characters of a
given class:</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Matched character class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ascii_is_alnum</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Alphanumeric ASCII</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>ascii_is_alpha</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Alphabetic ASCII</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>ascii_is_decimal</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Decimal ASCII</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>ascii_is_lower</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Lowercase ASCII</p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>ascii_is_printable</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Printable ASCII</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>ascii_is_space</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Whitespace ASCII</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>ascii_is_upper</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Uppercase ASCII</p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_is_alnum</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Alphanumeric Unicode</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>utf8_is_alpha</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Alphabetic Unicode</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>utf8_is_decimal</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Decimal Unicode</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>utf8_is_digit</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Unicode digit</p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_is_lower</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Lowercase Unicode</p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>utf8_is_numeric</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Numeric Unicode</p></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_is_printable</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Printable Unicode</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>utf8_is_space</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Whitespace Unicode</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>utf8_is_upper</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>Uppercase Unicode</p></td>
<td><p>(2)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Also matches all numeric ASCII characters and all ASCII digits.</p></li>
<li><p>(2) Non-cased characters, such as punctuation, do not match.</p></li>
<li><p>(3) This is currently the same as <code class="docutils literal notranslate"><span class="pre">utf8_is_decimal</span></code>.</p></li>
<li><p>(4) Unlike <code class="docutils literal notranslate"><span class="pre">utf8_is_decimal</span></code>, non-decimal numeric characters also match.</p></li>
</ul>
<p>The second set of functions also consider the character order in a string
element:</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ascii_is_title</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_is_title</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>(1)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Output is true iff the input string element is title-cased, i.e. any
word starts with an uppercase character, followed by lowercase characters.
Word boundaries are defined by non-cased characters.</p></li>
</ul>
<p>The third set of functions examines string elements on a byte-per-byte basis:</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>string_is_ascii</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Boolean</p></td>
<td><p>(1)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Output is true iff the input string element contains only ASCII characters,
i.e. only bytes in [0, 127].</p></li>
</ul>
</section>
<section id="string-transforms">
<h4>String transforms<a class="headerlink" href="#string-transforms" title="Permalink to this heading">#</a></h4>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ascii_capitalize</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>ascii_lower</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>ascii_reverse</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-odd"><td><p>ascii_swapcase</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>ascii_title</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>ascii_upper</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>binary_length</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Int32 or Int64</p></td>
<td></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>binary_repeat</p></td>
<td><p>Binary</p></td>
<td><p>Binary/String (Arg 0); Integral (Arg 1)</p></td>
<td><p>Binary- or String-like</p></td>
<td></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-even"><td><p>binary_replace_slice</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Binary- or String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute19ReplaceSliceOptionsE" title="arrow::compute::ReplaceSliceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ReplaceSliceOptions</span></code></a></p></td>
<td><p>(5)</p></td>
</tr>
<tr class="row-odd"><td><p>binary_reverse</p></td>
<td><p>Unary</p></td>
<td><p>Binary</p></td>
<td><p>Binary</p></td>
<td></td>
<td><p>(6)</p></td>
</tr>
<tr class="row-even"><td><p>replace_substring</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute23ReplaceSubstringOptionsE" title="arrow::compute::ReplaceSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ReplaceSubstringOptions</span></code></a></p></td>
<td><p>(7)</p></td>
</tr>
<tr class="row-odd"><td><p>replace_substring_regex</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute23ReplaceSubstringOptionsE" title="arrow::compute::ReplaceSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ReplaceSubstringOptions</span></code></a></p></td>
<td><p>(8)</p></td>
</tr>
<tr class="row-even"><td><p>utf8_capitalize</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(9)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_length</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Int32 or Int64</p></td>
<td></td>
<td><p>(10)</p></td>
</tr>
<tr class="row-even"><td><p>utf8_lower</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(9)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_replace_slice</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute19ReplaceSliceOptionsE" title="arrow::compute::ReplaceSliceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ReplaceSliceOptions</span></code></a></p></td>
<td><p>(7)</p></td>
</tr>
<tr class="row-even"><td><p>utf8_reverse</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(11)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_swapcase</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(9)</p></td>
</tr>
<tr class="row-even"><td><p>utf8_title</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(9)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_upper</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(9)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Each ASCII character in the input is converted to lowercase or
uppercase. Non-ASCII characters are left untouched.</p></li>
<li><p>(2) ASCII input is reversed to the output. If non-ASCII characters
are present, <code class="docutils literal notranslate"><span class="pre">Invalid</span></code> <a class="reference internal" href="api/support.html#_CPPv4N5arrow6StatusE" title="arrow::Status"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">Status</span></code></a> will be returned.</p></li>
<li><p>(3) Output is the physical length in bytes of each input element. Output
type is Int32 for Binary/String, Int64 for LargeBinary/LargeString.</p></li>
<li><p>(4) Repeat the input binary string a given number of times.</p></li>
<li><p>(5) Replace the slice of the substring from <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute19ReplaceSliceOptions5startE" title="arrow::compute::ReplaceSliceOptions::start"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ReplaceSliceOptions::start</span></code></a>
(inclusive) to <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute19ReplaceSliceOptions4stopE" title="arrow::compute::ReplaceSliceOptions::stop"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ReplaceSliceOptions::stop</span></code></a> (exclusive) by
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute23ReplaceSubstringOptions11replacementE" title="arrow::compute::ReplaceSubstringOptions::replacement"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ReplaceSubstringOptions::replacement</span></code></a>. The binary kernel measures the
slice in bytes, while the UTF8 kernel measures the slice in codeunits.</p></li>
<li><p>(6) Perform a byte-level reverse.</p></li>
<li><p>(7) Replace non-overlapping substrings that match to
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute23ReplaceSubstringOptions7patternE" title="arrow::compute::ReplaceSubstringOptions::pattern"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ReplaceSubstringOptions::pattern</span></code></a> by
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute23ReplaceSubstringOptions11replacementE" title="arrow::compute::ReplaceSubstringOptions::replacement"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ReplaceSubstringOptions::replacement</span></code></a>. If
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute23ReplaceSubstringOptions16max_replacementsE" title="arrow::compute::ReplaceSubstringOptions::max_replacements"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ReplaceSubstringOptions::max_replacements</span></code></a> != -1, it determines the
maximum number of replacements made, counting from the left.</p></li>
<li><p>(8) Replace non-overlapping substrings that match to the regular expression
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute23ReplaceSubstringOptions7patternE" title="arrow::compute::ReplaceSubstringOptions::pattern"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ReplaceSubstringOptions::pattern</span></code></a> by
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute23ReplaceSubstringOptions11replacementE" title="arrow::compute::ReplaceSubstringOptions::replacement"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ReplaceSubstringOptions::replacement</span></code></a>, using the Google RE2 library. If
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute23ReplaceSubstringOptions16max_replacementsE" title="arrow::compute::ReplaceSubstringOptions::max_replacements"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">ReplaceSubstringOptions::max_replacements</span></code></a> != -1, it determines the
maximum number of replacements made, counting from the left. Note that if the
pattern contains groups, backreferencing can be used.</p></li>
<li><p>(9) Each UTF8-encoded character in the input is converted to lowercase or
uppercase.</p></li>
<li><p>(10) Output is the number of characters (not bytes) of each input element.
Output type is Int32 for String, Int64 for LargeString.</p></li>
<li><p>(11) Each UTF8-encoded code unit is written in reverse order to the output.
If the input is not valid UTF8, then the output is undefined (but the size of output
buffers will be preserved).</p></li>
</ul>
</section>
<section id="string-padding">
<h4>String padding<a class="headerlink" href="#string-padding" title="Permalink to this heading">#</a></h4>
<p>These functions append/prepend a given padding byte (ASCII) or codepoint (UTF8) in
order to center (center), right-align (lpad), or left-align (rpad) a string.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ascii_center</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute10PadOptionsE" title="arrow::compute::PadOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PadOptions</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p>ascii_lpad</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute10PadOptionsE" title="arrow::compute::PadOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PadOptions</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p>ascii_rpad</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute10PadOptionsE" title="arrow::compute::PadOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PadOptions</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p>utf8_center</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute10PadOptionsE" title="arrow::compute::PadOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PadOptions</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p>utf8_lpad</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute10PadOptionsE" title="arrow::compute::PadOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PadOptions</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p>utf8_rpad</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute10PadOptionsE" title="arrow::compute::PadOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PadOptions</span></code></a></p></td>
</tr>
</tbody>
</table>
</section>
<section id="string-trimming">
<h4>String trimming<a class="headerlink" href="#string-trimming" title="Permalink to this heading">#</a></h4>
<p>These functions trim off characters on both sides (trim), or the left (ltrim) or right side (rtrim).</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ascii_ltrim</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TrimOptionsE" title="arrow::compute::TrimOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TrimOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>ascii_ltrim_whitespace</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>ascii_rtrim</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TrimOptionsE" title="arrow::compute::TrimOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TrimOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>ascii_rtrim_whitespace</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>ascii_trim</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TrimOptionsE" title="arrow::compute::TrimOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TrimOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>ascii_trim_whitespace</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>utf8_ltrim</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TrimOptionsE" title="arrow::compute::TrimOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TrimOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_ltrim_whitespace</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-even"><td><p>utf8_rtrim</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TrimOptionsE" title="arrow::compute::TrimOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TrimOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_rtrim_whitespace</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-even"><td><p>utf8_trim</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TrimOptionsE" title="arrow::compute::TrimOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TrimOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_trim_whitespace</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(4)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Only characters specified in <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TrimOptions10charactersE" title="arrow::compute::TrimOptions::characters"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">TrimOptions::characters</span></code></a> will be
trimmed off. Both the input string and the <cite>characters</cite> argument are
interpreted as ASCII characters.</p></li>
<li><p>(2) Only trim off ASCII whitespace characters (<code class="docutils literal notranslate"><span class="pre">'\t'</span></code>, <code class="docutils literal notranslate"><span class="pre">'\n'</span></code>, <code class="docutils literal notranslate"><span class="pre">'\v'</span></code>,
<code class="docutils literal notranslate"><span class="pre">'\f'</span></code>, <code class="docutils literal notranslate"><span class="pre">'\r'</span></code> and <code class="docutils literal notranslate"><span class="pre">'</span> <span class="pre">'</span></code>).</p></li>
<li><p>(3) Only characters specified in <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TrimOptions10charactersE" title="arrow::compute::TrimOptions::characters"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">TrimOptions::characters</span></code></a> will be
trimmed off.</p></li>
<li><p>(4) Only trim off Unicode whitespace characters.</p></li>
</ul>
</section>
<section id="string-splitting">
<h4>String splitting<a class="headerlink" href="#string-splitting" title="Permalink to this heading">#</a></h4>
<p>These functions split strings into lists of strings. All kernels can optionally
be configured with a <code class="docutils literal notranslate"><span class="pre">max_splits</span></code> and a <code class="docutils literal notranslate"><span class="pre">reverse</span></code> parameter, where
<code class="docutils literal notranslate"><span class="pre">max_splits</span> <span class="pre">==</span> <span class="pre">-1</span></code> means no limit (the default). When <code class="docutils literal notranslate"><span class="pre">reverse</span></code> is true,
the splitting is done starting from the end of the string; this is only relevant
when a positive <code class="docutils literal notranslate"><span class="pre">max_splits</span></code> is given.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ascii_split_whitespace</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>List-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12SplitOptionsE" title="arrow::compute::SplitOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SplitOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>split_pattern</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>List-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute19SplitPatternOptionsE" title="arrow::compute::SplitPatternOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SplitPatternOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>split_pattern_regex</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>List-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute19SplitPatternOptionsE" title="arrow::compute::SplitPatternOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SplitPatternOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_split_whitespace</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>List-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12SplitOptionsE" title="arrow::compute::SplitOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SplitOptions</span></code></a></p></td>
<td><p>(4)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) A non-zero length sequence of ASCII defined whitespace bytes
(<code class="docutils literal notranslate"><span class="pre">'\t'</span></code>, <code class="docutils literal notranslate"><span class="pre">'\n'</span></code>, <code class="docutils literal notranslate"><span class="pre">'\v'</span></code>, <code class="docutils literal notranslate"><span class="pre">'\f'</span></code>, <code class="docutils literal notranslate"><span class="pre">'\r'</span></code> and <code class="docutils literal notranslate"><span class="pre">'</span> <span class="pre">'</span></code>) is seen
as separator.</p></li>
<li><p>(2) The string is split when an exact pattern is found (the pattern itself
is not included in the output).</p></li>
<li><p>(3) The string is split when a regex match is found (the matched
substring itself is not included in the output).</p></li>
<li><p>(4) A non-zero length sequence of Unicode defined whitespace codepoints
is seen as separator.</p></li>
</ul>
</section>
<section id="string-component-extraction">
<h4>String component extraction<a class="headerlink" href="#string-component-extraction" title="Permalink to this heading">#</a></h4>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>extract_regex</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Struct</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute19ExtractRegexOptionsE" title="arrow::compute::ExtractRegexOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ExtractRegexOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Extract substrings defined by a regular expression using the Google RE2
library. The output struct field names refer to the named capture groups,
e.g. ‘letter’ and ‘digit’ for the regular expression
<code class="docutils literal notranslate"><span class="pre">(?P&lt;letter&gt;[ab])(?P&lt;digit&gt;\\d)</span></code>.</p></li>
</ul>
</section>
<section id="string-joining">
<h4>String joining<a class="headerlink" href="#string-joining" title="Permalink to this heading">#</a></h4>
<p>These functions do the inverse of string splitting.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input type 1</p></th>
<th class="head"><p>Input type 2</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>binary_join</p></td>
<td><p>Binary</p></td>
<td><p>List of Binary- or String-like</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>binary_join_element_wise</p></td>
<td><p>Varargs</p></td>
<td><p>Binary- or String-like (varargs)</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Binary- or String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11JoinOptionsE" title="arrow::compute::JoinOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">JoinOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) The first input must be an array, while the second can be a scalar or array.
Each list of values in the first input is joined using each second input
as separator. If any input list is null or contains a null, the corresponding
output will be null.</p></li>
<li><p>(2) All arguments are concatenated element-wise, with the last argument treated
as the separator (scalars are recycled in either case). Null separators emit
null. If any other argument is null, by default the corresponding output will be
null, but it can instead either be skipped or replaced with a given string.</p></li>
</ul>
</section>
<section id="string-slicing">
<h4>String Slicing<a class="headerlink" href="#string-slicing" title="Permalink to this heading">#</a></h4>
<p>This function transforms each sequence of the array to a subsequence, according
to start and stop indices, and a non-zero step (defaulting to 1). Slicing
semantics follow Python slicing semantics: the start index is inclusive,
the stop index exclusive; if the step is negative, the sequence is followed
in reverse order.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>binary_slice</p></td>
<td><p>Unary</p></td>
<td><p>Binary-like</p></td>
<td><p>Binary-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12SliceOptionsE" title="arrow::compute::SliceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SliceOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>utf8_slice_codeunits</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>String-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12SliceOptionsE" title="arrow::compute::SliceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SliceOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Slice string into a substring defined by (<code class="docutils literal notranslate"><span class="pre">start</span></code>, <code class="docutils literal notranslate"><span class="pre">stop</span></code>, <code class="docutils literal notranslate"><span class="pre">step</span></code>)
as given by <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12SliceOptionsE" title="arrow::compute::SliceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SliceOptions</span></code></a> where <code class="docutils literal notranslate"><span class="pre">start</span></code> and <code class="docutils literal notranslate"><span class="pre">stop</span></code> are measured
in bytes. Null inputs emit null.</p></li>
<li><p>(2) Slice string into a substring defined by (<code class="docutils literal notranslate"><span class="pre">start</span></code>, <code class="docutils literal notranslate"><span class="pre">stop</span></code>, <code class="docutils literal notranslate"><span class="pre">step</span></code>)
as given by <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute12SliceOptionsE" title="arrow::compute::SliceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SliceOptions</span></code></a> where <code class="docutils literal notranslate"><span class="pre">start</span></code> and <code class="docutils literal notranslate"><span class="pre">stop</span></code> are measured
in codeunits. Null inputs emit null.</p></li>
</ul>
</section>
<section id="containment-tests">
<h4>Containment tests<a class="headerlink" href="#containment-tests" title="Permalink to this heading">#</a></h4>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>count_substring</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Int32 or Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptionsE" title="arrow::compute::MatchSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MatchSubstringOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>count_substring_regex</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Int32 or Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptionsE" title="arrow::compute::MatchSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MatchSubstringOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>ends_with</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptionsE" title="arrow::compute::MatchSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MatchSubstringOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-odd"><td><p>find_substring</p></td>
<td><p>Unary</p></td>
<td><p>Binary- and String-like</p></td>
<td><p>Int32 or Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptionsE" title="arrow::compute::MatchSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MatchSubstringOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-even"><td><p>find_substring_regex</p></td>
<td><p>Unary</p></td>
<td><p>Binary- and String-like</p></td>
<td><p>Int32 or Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptionsE" title="arrow::compute::MatchSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MatchSubstringOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>index_in</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Null, Numeric, Temporal,
Binary- and String-like</p></td>
<td><p>Int32</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16SetLookupOptionsE" title="arrow::compute::SetLookupOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SetLookupOptions</span></code></a></p></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-even"><td><p>is_in</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Null, Numeric, Temporal,
Binary- and String-like</p></td>
<td><p>Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16SetLookupOptionsE" title="arrow::compute::SetLookupOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SetLookupOptions</span></code></a></p></td>
<td><p>(5)</p></td>
</tr>
<tr class="row-odd"><td><p>match_like</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptionsE" title="arrow::compute::MatchSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MatchSubstringOptions</span></code></a></p></td>
<td><p>(6)</p></td>
</tr>
<tr class="row-even"><td><p>match_substring</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptionsE" title="arrow::compute::MatchSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MatchSubstringOptions</span></code></a></p></td>
<td><p>(7)</p></td>
</tr>
<tr class="row-odd"><td><p>match_substring_regex</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptionsE" title="arrow::compute::MatchSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MatchSubstringOptions</span></code></a></p></td>
<td><p>(8)</p></td>
</tr>
<tr class="row-even"><td><p>starts_with</p></td>
<td><p>Unary</p></td>
<td><p>Binary- or String-like</p></td>
<td><p>Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptionsE" title="arrow::compute::MatchSubstringOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MatchSubstringOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Output is the number of occurrences of
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptions7patternE" title="arrow::compute::MatchSubstringOptions::pattern"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">MatchSubstringOptions::pattern</span></code></a> in the corresponding input
string. Output type is Int32 for Binary/String, Int64
for LargeBinary/LargeString.</p></li>
<li><p>(2) Output is true iff <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptions7patternE" title="arrow::compute::MatchSubstringOptions::pattern"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">MatchSubstringOptions::pattern</span></code></a>
is a suffix/prefix of the corresponding input.</p></li>
<li><p>(3) Output is the index of the first occurrence of
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptions7patternE" title="arrow::compute::MatchSubstringOptions::pattern"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">MatchSubstringOptions::pattern</span></code></a> in the corresponding input
string, otherwise -1. Output type is Int32 for Binary/String, Int64
for LargeBinary/LargeString.</p></li>
<li><p>(4) Output is the index of the corresponding input element in
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16SetLookupOptions9value_setE" title="arrow::compute::SetLookupOptions::value_set"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">SetLookupOptions::value_set</span></code></a>, if found there. Otherwise,
output is null.</p></li>
<li><p>(5) Output is true iff the corresponding input element is equal to one
of the elements in <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16SetLookupOptions9value_setE" title="arrow::compute::SetLookupOptions::value_set"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">SetLookupOptions::value_set</span></code></a>.</p></li>
<li><p>(6) Output is true iff the SQL-style LIKE pattern
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptions7patternE" title="arrow::compute::MatchSubstringOptions::pattern"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">MatchSubstringOptions::pattern</span></code></a> fully matches the
corresponding input element. That is, <code class="docutils literal notranslate"><span class="pre">%</span></code> will match any number of
characters, <code class="docutils literal notranslate"><span class="pre">_</span></code> will match exactly one character, and any other
character matches itself. To match a literal percent sign or
underscore, precede the character with a backslash.</p></li>
<li><p>(7) Output is true iff <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptions7patternE" title="arrow::compute::MatchSubstringOptions::pattern"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">MatchSubstringOptions::pattern</span></code></a>
is a substring of the corresponding input element.</p></li>
<li><p>(8) Output is true iff <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21MatchSubstringOptions7patternE" title="arrow::compute::MatchSubstringOptions::pattern"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">MatchSubstringOptions::pattern</span></code></a>
matches the corresponding input element at any position.</p></li>
</ul>
</section>
<section id="categorizations">
<h4>Categorizations<a class="headerlink" href="#categorizations" title="Permalink to this heading">#</a></h4>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>is_finite</p></td>
<td><p>Unary</p></td>
<td><p>Null, Numeric</p></td>
<td><p>Boolean</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>is_inf</p></td>
<td><p>Unary</p></td>
<td><p>Null, Numeric</p></td>
<td><p>Boolean</p></td>
<td></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>is_nan</p></td>
<td><p>Unary</p></td>
<td><p>Null, Numeric</p></td>
<td><p>Boolean</p></td>
<td></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>is_null</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>Boolean</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11NullOptionsE" title="arrow::compute::NullOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">NullOptions</span></code></a></p></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-even"><td><p>is_valid</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>Boolean</p></td>
<td></td>
<td><p>(5)</p></td>
</tr>
<tr class="row-odd"><td><p>true_unless_null</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><p>Boolean</p></td>
<td></td>
<td><p>(6)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Output is true iff the corresponding input element is finite (neither Infinity,
-Infinity, nor NaN). Hence, for Decimal and integer inputs this always returns true.</p></li>
<li><p>(2) Output is true iff the corresponding input element is Infinity/-Infinity.
Hence, for Decimal and integer inputs this always returns false.</p></li>
<li><p>(3) Output is true iff the corresponding input element is NaN.
Hence, for Decimal and integer inputs this always returns false.</p></li>
<li><p>(4) Output is true iff the corresponding input element is null. NaN values
can also be considered null by setting <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11NullOptions11nan_is_nullE" title="arrow::compute::NullOptions::nan_is_null"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">NullOptions::nan_is_null</span></code></a>.</p></li>
<li><p>(5) Output is true iff the corresponding input element is non-null, else false.</p></li>
<li><dl class="simple">
<dt>(6) Output is true iff the corresponding input element is non-null, else null.</dt><dd><p>Mostly intended for expression simplification/guarantees.</p>
</dd>
</dl>
</li>
</ul>
</section>
<section id="selecting-multiplexing">
<span id="cpp-compute-scalar-selections"></span><h4>Selecting / multiplexing<a class="headerlink" href="#selecting-multiplexing" title="Permalink to this heading">#</a></h4>
<p>For each “row” of input values, these functions emit one of the input values,
depending on a condition.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>case_when</p></td>
<td><p>Varargs</p></td>
<td><p>Struct of Boolean (Arg 0), Any (rest)</p></td>
<td><p>Input type</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>choose</p></td>
<td><p>Varargs</p></td>
<td><p>Integral (Arg 0), Fixed-width/Binary-like (rest)</p></td>
<td><p>Input type</p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>coalesce</p></td>
<td><p>Varargs</p></td>
<td><p>Any</p></td>
<td><p>Input type</p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>if_else</p></td>
<td><p>Ternary</p></td>
<td><p>Boolean (Arg 0), Any (rest)</p></td>
<td><p>Input type</p></td>
<td><p>(4)</p></td>
</tr>
</tbody>
</table>
<ul>
<li><p>(1) This function acts like a SQL “case when” statement or switch-case. The
input is a “condition” value, which is a struct of Booleans, followed by the
values for each “branch”. There must be either exactly one value argument for
each child of the condition struct, or one more value argument than children
(in which case we have an “else” or “default” value). The output is of the
same type as the value inputs; each row will be the corresponding value from
the first value datum for which the corresponding Boolean is true, or the
corresponding value from the “default” input, or null otherwise.</p>
<p>Note that currently, while all types are supported, dictionaries will be
unpacked.</p>
</li>
<li><p>(2) The first input must be an integral type. The rest of the arguments can be
any type, but must all be the same type or promotable to a common type. Each
value of the first input (the ‘index’) is used as a zero-based index into the
remaining arguments (i.e. index 0 is the second argument, index 1 is the third
argument, etc.), and the value of the output for that row will be the
corresponding value of the selected input at that row. If the index is null,
then the output will also be null.</p></li>
<li><p>(3) Each row of the output will be the corresponding value of the first
input which is non-null for that row, otherwise null.</p></li>
<li><p>(4) First input must be a Boolean scalar or array. Second and third inputs
could be scalars or arrays and must be of the same type. Output is an array
(or scalar if all inputs are scalar) of the same type as the second/ third
input. If the nulls present on the first input, they will be promoted to the
output, otherwise nulls will be chosen based on the first input values.</p>
<p>Also see: <a class="reference internal" href="#cpp-compute-vector-structural-transforms"><span class="std std-ref">replace_with_mask</span></a>.</p>
</li>
</ul>
</section>
<section id="structural-transforms">
<h4>Structural transforms<a class="headerlink" href="#structural-transforms" title="Permalink to this heading">#</a></h4>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>list_value_length</p></td>
<td><p>Unary</p></td>
<td><p>List-like</p></td>
<td><p>Int32 or Int64</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>make_struct</p></td>
<td><p>Varargs</p></td>
<td><p>Any</p></td>
<td><p>Struct</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17MakeStructOptionsE" title="arrow::compute::MakeStructOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MakeStructOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Each output element is the length of the corresponding input element
(null if input is null). Output type is Int32 for List and FixedSizeList,
Int64 for LargeList.</p></li>
<li><p>(2) The output struct’s field types are the types of its arguments. The
field names are specified using an instance of <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17MakeStructOptionsE" title="arrow::compute::MakeStructOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MakeStructOptions</span></code></a>.
The output shape will be scalar if all inputs are scalar, otherwise any
scalars will be broadcast to arrays.</p></li>
</ul>
</section>
<section id="conversions">
<h4>Conversions<a class="headerlink" href="#conversions" title="Permalink to this heading">#</a></h4>
<p>A general conversion function named <code class="docutils literal notranslate"><span class="pre">cast</span></code> is provided which accepts a large
number of input and output types. The type to cast to can be passed in a
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11CastOptionsE" title="arrow::compute::CastOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CastOptions</span></code></a> instance. As an alternative, the same service is
provided by a concrete function <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">Cast()</span></code>.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ceil_temporal</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Temporal</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute20RoundTemporalOptionsE" title="arrow::compute::RoundTemporalOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RoundTemporalOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>floor_temporal</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Temporal</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute20RoundTemporalOptionsE" title="arrow::compute::RoundTemporalOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RoundTemporalOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>round_temporal</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Temporal</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute20RoundTemporalOptionsE" title="arrow::compute::RoundTemporalOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RoundTemporalOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>cast</p></td>
<td><p>Unary</p></td>
<td><p>Many</p></td>
<td><p>Variable</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11CastOptionsE" title="arrow::compute::CastOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CastOptions</span></code></a></p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>strftime</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>String</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15StrftimeOptionsE" title="arrow::compute::StrftimeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">StrftimeOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>strptime</p></td>
<td><p>Unary</p></td>
<td><p>String-like</p></td>
<td><p>Timestamp</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15StrptimeOptionsE" title="arrow::compute::StrptimeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">StrptimeOptions</span></code></a></p></td>
<td></td>
</tr>
</tbody>
</table>
<p>The conversions available with <code class="docutils literal notranslate"><span class="pre">cast</span></code> are listed below. In all cases, a
null input value is converted into a null output value.</p>
<ul class="simple">
<li><p>(1) Output precision of <code class="docutils literal notranslate"><span class="pre">%S</span></code> (seconds) flag depends on the input timestamp
precision. Timestamps with second precision are represented as integers while
milliseconds, microsecond and nanoseconds are represented as fixed floating
point numbers with 3, 6 and 9 decimal places respectively. To obtain integer
seconds, cast to timestamp with second resolution.
The character for the decimal point is localized according to the locale.
See <a class="reference external" href="https://howardhinnant.github.io/date/date.html#to_stream_formatting">detailed formatting documentation</a> for descriptions of other flags.</p></li>
</ul>
<p><strong>Truth value extraction</strong></p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Input type</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Binary- and String-like</p></td>
<td><p>Boolean</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>Numeric</p></td>
<td><p>Boolean</p></td>
<td><p>(2)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Output is true iff the corresponding input value has non-zero length.</p></li>
<li><p>(2) Output is true iff the corresponding input value is non-zero.</p></li>
</ul>
<p><strong>Same-kind conversion</strong></p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Input type</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Int32</p></td>
<td><p>32-bit Temporal</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>Int64</p></td>
<td><p>64-bit Temporal</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>(Large)Binary</p></td>
<td><p>(Large)String</p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-odd"><td><p>(Large)String</p></td>
<td><p>(Large)Binary</p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-even"><td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td><p>(4) (5)</p></td>
</tr>
<tr class="row-odd"><td><p>32-bit Temporal</p></td>
<td><p>Int32</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>64-bit Temporal</p></td>
<td><p>Int64</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>Temporal</p></td>
<td><p>Temporal</p></td>
<td><p>(4) (5)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) No-operation cast: the raw values are kept identical, only
the type is changed.</p></li>
<li><p>(2) Validates the contents if <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11CastOptions18allow_invalid_utf8E" title="arrow::compute::CastOptions::allow_invalid_utf8"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">CastOptions::allow_invalid_utf8</span></code></a>
is false.</p></li>
<li><p>(3) No-operation cast: only the type is changed.</p></li>
<li><p>(4) Overflow and truncation checks are enabled depending on
the given <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11CastOptionsE" title="arrow::compute::CastOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CastOptions</span></code></a>.</p></li>
<li><p>(5) Not all such casts have been implemented.</p></li>
</ul>
<p><strong>String representations</strong></p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Input type</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Boolean</p></td>
<td><p>String-like</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Numeric</p></td>
<td><p>String-like</p></td>
<td></td>
</tr>
</tbody>
</table>
<p><strong>Generic conversions</strong></p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Input type</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Dictionary</p></td>
<td><p>Dictionary value type</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>Extension</p></td>
<td><p>Extension storage type</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Struct</p></td>
<td><p>Struct</p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-odd"><td><p>List-like</p></td>
<td><p>List-like</p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-even"><td><p>Map</p></td>
<td><p>Map or List of two-field struct</p></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-odd"><td><p>Null</p></td>
<td><p>Any</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Any</p></td>
<td><p>Extension</p></td>
<td><p>(5)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) The dictionary indices are unchanged, the dictionary values are
cast from the input value type to the output value type (if a conversion
is available).</p></li>
<li><p>(2) The field names of the output type must be the same or a subset of the
field names of the input type; they also must have the same order. Casting to
a subset of field names “selects” those fields such that each output field
matches the data of the input field with the same name.</p></li>
<li><p>(3) The list offsets are unchanged, the list values are cast from the
input value type to the output value type (if a conversion is
available).</p></li>
<li><p>(4) Offsets are unchanged, the keys and values are cast from respective input
to output types (if a conversion is available). If output type is a list of
struct, the key field is output as the first field and the value field the
second field, regardless of field names chosen.</p></li>
<li><p>(5) Any input type that can be cast to the resulting extension’s storage type.
This excludes extension types, unless being cast to the same extension type.</p></li>
</ul>
</section>
<section id="temporal-component-extraction">
<h4>Temporal component extraction<a class="headerlink" href="#temporal-component-extraction" title="Permalink to this heading">#</a></h4>
<p>These functions extract datetime components (year, month, day, etc) from temporal types.
For timestamps inputs with non-empty timezone, localized timestamp components will be returned.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>day</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>day_of_week</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16DayOfWeekOptionsE" title="arrow::compute::DayOfWeekOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">DayOfWeekOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>day_of_year</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>hour</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp, Time</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-even"><td><p>is_dst</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp</p></td>
<td><p>Boolean</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>iso_week</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>iso_year</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-odd"><td><p>iso_calendar</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Struct</p></td>
<td></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-even"><td><p>is_leap_year</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp, Date</p></td>
<td><p>Boolean</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>microsecond</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp, Time</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-even"><td><p>millisecond</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp, Time</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>minute</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp, Time</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-even"><td><p>month</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>nanosecond</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp, Time</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-even"><td><p>quarter</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>second</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp, Time</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-even"><td><p>subsecond</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp, Time</p></td>
<td><p>Float64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>us_week</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-even"><td><p>us_year</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-odd"><td><p>week</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp</p></td>
<td><p>Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11WeekOptionsE" title="arrow::compute::WeekOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">WeekOptions</span></code></a></p></td>
<td><p>(5)</p></td>
</tr>
<tr class="row-even"><td><p>year</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>year_month_day</p></td>
<td><p>Unary</p></td>
<td><p>Temporal</p></td>
<td><p>Struct</p></td>
<td></td>
<td><p>(6)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Outputs the number of the day of the week. By default week begins on Monday
represented by 0 and ends on Sunday represented by 6. Day numbering can start with 0 or 1 based on
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16DayOfWeekOptions15count_from_zeroE" title="arrow::compute::DayOfWeekOptions::count_from_zero"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">DayOfWeekOptions::count_from_zero</span></code></a> parameter. <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16DayOfWeekOptions10week_startE" title="arrow::compute::DayOfWeekOptions::week_start"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">DayOfWeekOptions::week_start</span></code></a> can be
used to set the starting day of the week using ISO convention (Monday=1, Sunday=7).
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16DayOfWeekOptions10week_startE" title="arrow::compute::DayOfWeekOptions::week_start"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">DayOfWeekOptions::week_start</span></code></a> parameter is not affected by <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16DayOfWeekOptions15count_from_zeroE" title="arrow::compute::DayOfWeekOptions::count_from_zero"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">DayOfWeekOptions::count_from_zero</span></code></a>.</p></li>
<li><p>(2) First ISO week has the majority (4 or more) of it’s days in January. ISO year
starts with the first ISO week. ISO week starts on Monday.
See <a class="reference external" href="https://en.wikipedia.org/wiki/ISO_week_date#First_week">ISO 8601 week date definition</a> for more details.</p></li>
<li><p>(3) Output is a <code class="docutils literal notranslate"><span class="pre">{&quot;iso_year&quot;:</span> <span class="pre">output</span> <span class="pre">type,</span> <span class="pre">&quot;iso_week&quot;:</span> <span class="pre">output</span> <span class="pre">type,</span> <span class="pre">&quot;iso_day_of_week&quot;:</span>&#160; <span class="pre">output</span> <span class="pre">type}</span></code> Struct.</p></li>
<li><p>(4) First US week has the majority (4 or more) of its days in January. US year
starts with the first US week. US week starts on Sunday.</p></li>
<li><p>(5) Returns week number allowing for setting several parameters.
If <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11WeekOptions18week_starts_mondayE" title="arrow::compute::WeekOptions::week_starts_monday"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">WeekOptions::week_starts_monday</span></code></a> is true, the week starts with Monday, else Sunday if false.
If <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11WeekOptions15count_from_zeroE" title="arrow::compute::WeekOptions::count_from_zero"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">WeekOptions::count_from_zero</span></code></a> is true, dates from the current year that fall into the last ISO week
of the previous year are numbered as week 0, else week 52 or 53 if false.
If <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11WeekOptions27first_week_is_fully_in_yearE" title="arrow::compute::WeekOptions::first_week_is_fully_in_year"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">WeekOptions::first_week_is_fully_in_year</span></code></a> is true, the first week (week 1) must fully be in January;
else if false, a week that begins on December 29, 30, or 31 is considered the first week of the new year.</p></li>
<li><p>(6) Output is a <code class="docutils literal notranslate"><span class="pre">{&quot;year&quot;:</span> <span class="pre">int64(),</span> <span class="pre">&quot;month&quot;:</span> <span class="pre">int64(),</span> <span class="pre">&quot;day&quot;:</span> <span class="pre">int64()}</span></code> Struct.</p></li>
</ul>
</section>
<section id="temporal-difference">
<h4>Temporal difference<a class="headerlink" href="#temporal-difference" title="Permalink to this heading">#</a></h4>
<p>These functions compute the difference between two timestamps in the
specified unit. The difference is determined by the number of
boundaries crossed, not the span of time. For example, the difference
in days between 23:59:59 on one day and 00:00:01 on the next day is
one day (since midnight was crossed), not zero days (even though less
than 24 hours elapsed). Additionally, if the timestamp has a defined
timezone, the difference is calculated in the local timezone. For
instance, the difference in years between “2019-12-31 18:00:00-0500”
and “2019-12-31 23:00:00-0500” is zero years, because the local year
is the same, even though the UTC years would be different.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>day_time_interval_between</p></td>
<td><p>Binary</p></td>
<td><p>Temporal</p></td>
<td><p>DayTime interval</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>days_between</p></td>
<td><p>Binary</p></td>
<td><p>Timestamp, Date</p></td>
<td><p>Int64</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>hours_between</p></td>
<td><p>Binary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>microseconds_between</p></td>
<td><p>Binary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>milliseconds_between</p></td>
<td><p>Binary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>minutes_between</p></td>
<td><p>Binary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>month_day_nano_interval_between</p></td>
<td><p>Binary</p></td>
<td><p>Temporal</p></td>
<td><p>MonthDayNano interval</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>month_interval_between</p></td>
<td><p>Binary</p></td>
<td><p>Timestamp, Date</p></td>
<td><p>Month interval</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>nanoseconds_between</p></td>
<td><p>Binary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>quarters_between</p></td>
<td><p>Binary</p></td>
<td><p>Timestamp, Date</p></td>
<td><p>Int64</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>seconds_between</p></td>
<td><p>Binary</p></td>
<td><p>Temporal</p></td>
<td><p>Int64</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>weeks_between</p></td>
<td><p>Binary</p></td>
<td><p>Timestamp, Date</p></td>
<td><p>Int64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16DayOfWeekOptionsE" title="arrow::compute::DayOfWeekOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">DayOfWeekOptions</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p>years_between</p></td>
<td><p>Binary</p></td>
<td><p>Timestamp, Date</p></td>
<td><p>Int64</p></td>
<td></td>
</tr>
</tbody>
</table>
</section>
<section id="timezone-handling">
<h4>Timezone handling<a class="headerlink" href="#timezone-handling" title="Permalink to this heading">#</a></h4>
<p><cite>assume_timezone</cite> function is meant to be used when an external system produces
“timezone-naive” timestamps which need to be converted to “timezone-aware”
timestamps (see for example the <a class="reference external" href="https://docs.python.org/3/library/datetime.html#aware-and-naive-objects">definition</a>
in the Python documentation).</p>
<p>Input timestamps are assumed to be relative to the timezone given in
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21AssumeTimezoneOptions8timezoneE" title="arrow::compute::AssumeTimezoneOptions::timezone"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">AssumeTimezoneOptions::timezone</span></code></a>. They are converted to
UTC-relative timestamps with the timezone metadata set to the above value.
An error is returned if the timestamps already have the timezone metadata set.</p>
<p><cite>local_timestamp</cite> function converts UTC-relative timestamps to local “timezone-naive”
timestamps. The timezone is taken from the timezone metadata of the input
timestamps. This function is the inverse of <cite>assume_timezone</cite>. Please note:
<strong>all temporal functions already operate on timestamps as if they were in local
time of the metadata provided timezone</strong>. Using <cite>local_timestamp</cite> is only meant to be
used when an external system expects local timestamps.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>assume_timezone</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp</p></td>
<td><p>Timestamp</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21AssumeTimezoneOptionsE" title="arrow::compute::AssumeTimezoneOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">AssumeTimezoneOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>local_timestamp</p></td>
<td><p>Unary</p></td>
<td><p>Timestamp</p></td>
<td><p>Timestamp</p></td>
<td></td>
<td><p>(2)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) In addition to the timezone value, <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute21AssumeTimezoneOptionsE" title="arrow::compute::AssumeTimezoneOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">AssumeTimezoneOptions</span></code></a>
allows choosing the behaviour when a timestamp is ambiguous or nonexistent
in the given timezone (because of DST shifts).</p></li>
</ul>
</section>
<section id="random-number-generation">
<h4>Random number generation<a class="headerlink" href="#random-number-generation" title="Permalink to this heading">#</a></h4>
<p>This function generates an array of uniformly-distributed double-precision numbers
in range [0, 1). The options provide the length of the output and the algorithm for
generating the random numbers, using either a seed or a system-provided, platform-specific
random generator.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>random</p></td>
<td><p>Nullary</p></td>
<td><p>Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute13RandomOptionsE" title="arrow::compute::RandomOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RandomOptions</span></code></a></p></td>
</tr>
</tbody>
</table>
</section>
</section>
<section id="array-wise-vector-functions">
<h3>Array-wise (“vector”) functions<a class="headerlink" href="#array-wise-vector-functions" title="Permalink to this heading">#</a></h3>
<section id="cumulative-functions">
<h4>Cumulative Functions<a class="headerlink" href="#cumulative-functions" title="Permalink to this heading">#</a></h4>
<p>Cumulative functions are vector functions that perform a running accumulation on
their input using a given binary associative operation with an identity element
(a monoid) and output an array containing the corresponding intermediate running
values. The input is expected to be of numeric type. By default these functions
do not detect overflow. They are also available in an overflow-checking variant,
suffixed <code class="docutils literal notranslate"><span class="pre">_checked</span></code>, which returns an <code class="docutils literal notranslate"><span class="pre">Invalid</span></code> <a class="reference internal" href="api/support.html#_CPPv4N5arrow6StatusE" title="arrow::Status"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">Status</span></code></a> when
overflow is detected.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>cumulative_sum</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptionsE" title="arrow::compute::CumulativeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CumulativeOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>cumulative_sum_checked</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptionsE" title="arrow::compute::CumulativeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CumulativeOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>cumulative_prod</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptionsE" title="arrow::compute::CumulativeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CumulativeOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>cumulative_prod_checked</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptionsE" title="arrow::compute::CumulativeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CumulativeOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>cumulative_max</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptionsE" title="arrow::compute::CumulativeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CumulativeOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>cumulative_min</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Numeric</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptionsE" title="arrow::compute::CumulativeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CumulativeOptions</span></code></a></p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>cumulative_mean</p></td>
<td><p>Unary</p></td>
<td><p>Numeric</p></td>
<td><p>Float64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptionsE" title="arrow::compute::CumulativeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">CumulativeOptions</span></code></a></p></td>
<td><p>(1) (2)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) CumulativeOptions has two optional parameters. The first parameter
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptions5startE" title="arrow::compute::CumulativeOptions::start"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">CumulativeOptions::start</span></code></a> is a starting value for the running
accumulation. It has a default value of 0 for <cite>sum</cite>, 1 for <cite>prod</cite>, min of
input type for <cite>max</cite>, and max of input type for <cite>min</cite>. Specified values of
<code class="docutils literal notranslate"><span class="pre">start</span></code> must be castable to the input type. The second parameter
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptions10skip_nullsE" title="arrow::compute::CumulativeOptions::skip_nulls"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">CumulativeOptions::skip_nulls</span></code></a> is a boolean. When set to
false (the default), the first encountered null is propagated. When set to
true, each null in the input produces a corresponding null in the output and
doesn’t affect the accumulation forward.</p></li>
<li><p>(2) <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute17CumulativeOptions5startE" title="arrow::compute::CumulativeOptions::start"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">CumulativeOptions::start</span></code></a> is ignored.</p></li>
</ul>
</section>
<section id="associative-transforms">
<h4>Associative transforms<a class="headerlink" href="#associative-transforms" title="Permalink to this heading">#</a></h4>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>dictionary_encode</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Null, Numeric,
Temporal, Binary- and String-like</p></td>
<td><p>Dictionary</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>unique</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Null, Numeric,
Temporal, Binary- and String-like</p></td>
<td><p>Input type</p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>value_counts</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Null, Numeric,
Temporal, Binary- and String-like</p></td>
<td><p>Input type</p></td>
<td><p>(3)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Output is <code class="docutils literal notranslate"><span class="pre">Dictionary(Int32,</span> <span class="pre">input</span> <span class="pre">type)</span></code>. It is a no-op if input is
already a Dictionary array.</p></li>
<li><p>(2) Duplicates are removed from the output while the original order is
maintained.</p></li>
<li><p>(3) Output is a <code class="docutils literal notranslate"><span class="pre">{&quot;values&quot;:</span> <span class="pre">input</span> <span class="pre">type,</span> <span class="pre">&quot;counts&quot;:</span> <span class="pre">Int64}</span></code> Struct.
Each output element corresponds to a unique value in the input, along
with the number of times this value has appeared.</p></li>
</ul>
</section>
<section id="selections">
<h4>Selections<a class="headerlink" href="#selections" title="Permalink to this heading">#</a></h4>
<p>These functions select and return a subset of their input.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input type 1</p></th>
<th class="head"><p>Input type 2</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>array_filter</p></td>
<td><p>Binary</p></td>
<td><p>Any</p></td>
<td><p>Boolean</p></td>
<td><p>Input type 1</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute13FilterOptionsE" title="arrow::compute::FilterOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">FilterOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-odd"><td><p>array_take</p></td>
<td><p>Binary</p></td>
<td><p>Any</p></td>
<td><p>Integer</p></td>
<td><p>Input type 1</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TakeOptionsE" title="arrow::compute::TakeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TakeOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-even"><td><p>drop_null</p></td>
<td><p>Unary</p></td>
<td><p>Any</p></td>
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><p>Input type 1</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>filter</p></td>
<td><p>Binary</p></td>
<td><p>Any</p></td>
<td><p>Boolean</p></td>
<td><p>Input type 1</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute13FilterOptionsE" title="arrow::compute::FilterOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">FilterOptions</span></code></a></p></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>take</p></td>
<td><p>Binary</p></td>
<td><p>Any</p></td>
<td><p>Integer</p></td>
<td><p>Input type 1</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11TakeOptionsE" title="arrow::compute::TakeOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">TakeOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Each element in the input is appended to the output iff it is non-null.
If the input is a record batch or table, any null value in a column drops
the entire row.</p></li>
<li><p>(2) Each element in input 1 (the values) is appended to the output iff
the corresponding element in input 2 (the filter) is true. How
nulls in the filter are handled can be configured using FilterOptions.</p></li>
<li><p>(3) For each element <em>i</em> in input 2 (the indices), the <em>i</em>’th element
in input 1 (the values) is appended to the output.</p></li>
</ul>
</section>
<section id="id4">
<h4>Containment tests<a class="headerlink" href="#id4" title="Permalink to this heading">#</a></h4>
<p>This function returns the indices at which array elements are non-null and non-zero.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>indices_nonzero</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Null, Numeric, Decimal</p></td>
<td><p>UInt64</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</section>
<section id="sorts-and-partitions">
<h4>Sorts and partitions<a class="headerlink" href="#sorts-and-partitions" title="Permalink to this heading">#</a></h4>
<p>By default, in these functions, nulls are considered greater than any other value
(they will be sorted or partitioned at the end of the array). Floating-point
NaN values are considered greater than any other non-null value, but smaller
than nulls. This behaviour can be changed using the <code class="docutils literal notranslate"><span class="pre">null_placement</span></code> setting
in the respective option classes.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Binary- and String-like inputs are ordered lexicographically as bytestrings,
even for String types.</p>
</div>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>array_sort_indices</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Numeric, Temporal, Binary- and String-like</p></td>
<td><p>UInt64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16ArraySortOptionsE" title="arrow::compute::ArraySortOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ArraySortOptions</span></code></a></p></td>
<td><p>(1) (2)</p></td>
</tr>
<tr class="row-odd"><td><p>partition_nth_indices</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Numeric, Temporal, Binary- and String-like</p></td>
<td><p>UInt64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute19PartitionNthOptionsE" title="arrow::compute::PartitionNthOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PartitionNthOptions</span></code></a></p></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-even"><td><p>rank</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Numeric, Temporal, Binary- and String-like</p></td>
<td><p>UInt64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11RankOptionsE" title="arrow::compute::RankOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">RankOptions</span></code></a></p></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-odd"><td><p>select_k_unstable</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Numeric, Temporal, Binary- and String-like</p></td>
<td><p>UInt64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute14SelectKOptionsE" title="arrow::compute::SelectKOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SelectKOptions</span></code></a></p></td>
<td><p>(5) (6)</p></td>
</tr>
<tr class="row-even"><td><p>sort_indices</p></td>
<td><p>Unary</p></td>
<td><p>Boolean, Numeric, Temporal, Binary- and String-like</p></td>
<td><p>UInt64</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute11SortOptionsE" title="arrow::compute::SortOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">SortOptions</span></code></a></p></td>
<td><p>(1) (5)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) The output is an array of indices into the input, that define a
stable sort of the input.</p></li>
<li><p>(2) The input must be an array. The default order is ascending.</p></li>
<li><p>(3) The output is an array of indices into the input array, that define
a partial non-stable sort such that the <em>N</em>’th index points to the <em>N</em>’th
element in sorted order, and all indices before the <em>N</em>’th point to
elements less or equal to elements at or after the <em>N</em>’th (similar to
<code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">std::nth_element()</span></code>). <em>N</em> is given in
<a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute19PartitionNthOptions5pivotE" title="arrow::compute::PartitionNthOptions::pivot"><code class="xref cpp cpp-member docutils literal notranslate"><span class="pre">PartitionNthOptions::pivot</span></code></a>.</p></li>
<li><p>(4) The output is a one-based numerical array of ranks</p></li>
<li><p>(5) The input can be an array, chunked array, record batch or
table. If the input is a record batch or table, one or more sort
keys must be specified.</p></li>
<li><p>(6) The output is an array of indices into the input, that define a
non-stable sort of the input.</p></li>
</ul>
</section>
<section id="cpp-compute-vector-structural-transforms">
<span id="id5"></span><h4>Structural transforms<a class="headerlink" href="#cpp-compute-vector-structural-transforms" title="Permalink to this heading">#</a></h4>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>list_element</p></td>
<td><p>Binary</p></td>
<td><p>List-like (Arg 0), Integral (Arg 1)</p></td>
<td><p>List value type</p></td>
<td></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>list_flatten</p></td>
<td><p>Unary</p></td>
<td><p>List-like</p></td>
<td><p>List value type</p></td>
<td></td>
<td><p>(2)</p></td>
</tr>
<tr class="row-even"><td><p>list_parent_indices</p></td>
<td><p>Unary</p></td>
<td><p>List-like</p></td>
<td><p>Int64</p></td>
<td></td>
<td><p>(3)</p></td>
</tr>
<tr class="row-odd"><td><p>list_slice</p></td>
<td><p>Unary</p></td>
<td><p>List-like</p></td>
<td><p>List-like</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16ListSliceOptionsE" title="arrow::compute::ListSliceOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">ListSliceOptions</span></code></a></p></td>
<td><p>(4)</p></td>
</tr>
<tr class="row-even"><td><p>map_lookup</p></td>
<td><p>Unary</p></td>
<td><p>Map</p></td>
<td><p>Computed</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute16MapLookupOptionsE" title="arrow::compute::MapLookupOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">MapLookupOptions</span></code></a></p></td>
<td><p>(5)</p></td>
</tr>
<tr class="row-odd"><td><p>struct_field</p></td>
<td><p>Unary</p></td>
<td><p>Struct or Union</p></td>
<td><p>Computed</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute18StructFieldOptionsE" title="arrow::compute::StructFieldOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">StructFieldOptions</span></code></a></p></td>
<td><p>(6)</p></td>
</tr>
</tbody>
</table>
<ul>
<li><p>(1) Output is an array of the same length as the input list array. The
output values are the values at the specified index of each child list.</p></li>
<li><p>(2) The top level of nesting is removed: all values in the list child array,
including nulls, are appended to the output. However, nulls in the parent
list array are discarded.</p></li>
<li><p>(3) For each value in the list child array, the index at which it is found
in the list array is appended to the output. Nulls in the parent list array
are discarded.</p></li>
<li><p>(4) For each list element, compute the slice of that list element, then
return another list-like array of those slices. Can return either a
fixed or variable size list-like array, as determined by options provided.</p></li>
<li><p>(5) Extract either the <code class="docutils literal notranslate"><span class="pre">FIRST</span></code>, <code class="docutils literal notranslate"><span class="pre">LAST</span></code> or <code class="docutils literal notranslate"><span class="pre">ALL</span></code> items from a
map whose key match the given query key passed via options.
The output type is an Array of items for the <code class="docutils literal notranslate"><span class="pre">FIRST</span></code>/<code class="docutils literal notranslate"><span class="pre">LAST</span></code> options
and an Array of List of items for the <code class="docutils literal notranslate"><span class="pre">ALL</span></code> option.</p></li>
<li><p>(6) Extract a child value based on a sequence of indices passed in
the options. The validity bitmap of the result will be the
intersection of all intermediate validity bitmaps. For example, for
an array with type <code class="docutils literal notranslate"><span class="pre">struct&lt;a:</span> <span class="pre">int32,</span> <span class="pre">b:</span> <span class="pre">struct&lt;c:</span> <span class="pre">int64,</span> <span class="pre">d:</span>
<span class="pre">float64&gt;&gt;</span></code>:</p>
<ul class="simple">
<li><p>An empty sequence of indices yields the original value unchanged.</p></li>
<li><p>The index <code class="docutils literal notranslate"><span class="pre">0</span></code> yields an array of type <code class="docutils literal notranslate"><span class="pre">int32</span></code> whose validity
bitmap is the intersection of the bitmap for the outermost struct
and the bitmap for the child <code class="docutils literal notranslate"><span class="pre">a</span></code>.</p></li>
<li><p>The index <code class="docutils literal notranslate"><span class="pre">1,</span> <span class="pre">1</span></code> yields an array of type <code class="docutils literal notranslate"><span class="pre">float64</span></code> whose
validity bitmap is the intersection of the bitmaps for the
outermost struct, for struct <code class="docutils literal notranslate"><span class="pre">b</span></code>, and for the child <code class="docutils literal notranslate"><span class="pre">d</span></code>.</p></li>
</ul>
<p>For unions, a validity bitmap is synthesized based on the type
codes. Also, the index is always the child index and not a type code.
Hence for array with type <code class="docutils literal notranslate"><span class="pre">sparse_union&lt;2:</span> <span class="pre">int32,</span> <span class="pre">7:</span> <span class="pre">utf8&gt;</span></code>:</p>
<ul class="simple">
<li><p>The index <code class="docutils literal notranslate"><span class="pre">0</span></code> yields an array of type <code class="docutils literal notranslate"><span class="pre">int32</span></code>, which is valid
at an index <em>n</em> if and only if the child array <code class="docutils literal notranslate"><span class="pre">a</span></code> is valid at
index <em>n</em> and the type code at index <em>n</em> is 2.</p></li>
<li><p>The indices <code class="docutils literal notranslate"><span class="pre">2</span></code> and <code class="docutils literal notranslate"><span class="pre">7</span></code> are invalid.</p></li>
</ul>
</li>
</ul>
<p>These functions create a copy of the first input with some elements
replaced, based on the remaining inputs.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input type 1</p></th>
<th class="head"><p>Input type 2</p></th>
<th class="head"><p>Input type 3</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>fill_null_backward</p></td>
<td><p>Unary</p></td>
<td><p>Fixed-width or binary</p></td>
<td><p>N/A</p></td>
<td><p>N/A</p></td>
<td><p>N/A</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-odd"><td><p>fill_null_forward</p></td>
<td><p>Unary</p></td>
<td><p>Fixed-width or binary</p></td>
<td><p>N/A</p></td>
<td><p>N/A</p></td>
<td><p>N/A</p></td>
<td><p>(1)</p></td>
</tr>
<tr class="row-even"><td><p>replace_with_mask</p></td>
<td><p>Ternary</p></td>
<td><p>Fixed-width or binary</p></td>
<td><p>Boolean</p></td>
<td><p>Input type 1</p></td>
<td><p>Input type 1</p></td>
<td><p>(2)</p></td>
</tr>
</tbody>
</table>
<ul>
<li><p>(1) Valid values are carried forward/backward to fill null values.</p></li>
<li><p>(2) Each element in input 1 for which the corresponding Boolean in input 2
is true is replaced with the next value from input 3. A null in input 2
results in a corresponding null in the output.</p>
<p>Also see: <a class="reference internal" href="#cpp-compute-scalar-selections"><span class="std std-ref">if_else</span></a>.</p>
</li>
</ul>
</section>
<section id="pairwise-functions">
<h4>Pairwise functions<a class="headerlink" href="#pairwise-functions" title="Permalink to this heading">#</a></h4>
<p>Pairwise functions are unary vector functions that perform a binary operation on
a pair of elements in the input array, typically on adjacent elements. The n-th
output is computed by applying the binary operation to the n-th and (n-p)-th inputs,
where p is the period. The default period is 1, in which case the binary
operation is applied to adjacent pairs of inputs. The period can also be
negative, in which case the n-th output is computed by applying the binary
operation to the n-th and (n+abs(p))-th inputs.</p>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p>Function name</p></th>
<th class="head"><p>Arity</p></th>
<th class="head"><p>Input types</p></th>
<th class="head"><p>Output type</p></th>
<th class="head"><p>Options class</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>pairwise_diff</p></td>
<td><p>Unary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15PairwiseOptionsE" title="arrow::compute::PairwiseOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PairwiseOptions</span></code></a></p></td>
<td><p>(1)(2)</p></td>
</tr>
<tr class="row-odd"><td><p>pairwise_diff_checked</p></td>
<td><p>Unary</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p>Numeric/Temporal</p></td>
<td><p><a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15PairwiseOptionsE" title="arrow::compute::PairwiseOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PairwiseOptions</span></code></a></p></td>
<td><p>(1)(3)</p></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li><p>(1) Computes the first order difference of an array, It internally calls
the scalar function <code class="docutils literal notranslate"><span class="pre">Subtract</span></code> (or the checked variant) to compute
differences, so its behavior and supported types are the same as
<code class="docutils literal notranslate"><span class="pre">Subtract</span></code>. The period can be specified in <a class="reference internal" href="api/compute.html#_CPPv4N5arrow7compute15PairwiseOptionsE" title="arrow::compute::PairwiseOptions"><code class="xref cpp cpp-struct docutils literal notranslate"><span class="pre">PairwiseOptions</span></code></a>.</p></li>
<li><p>(2) Wraps around the result when overflow is detected.</p></li>
<li><p>(3) Returns an <code class="docutils literal notranslate"><span class="pre">Invalid</span></code> <a class="reference internal" href="api/support.html#_CPPv4N5arrow6StatusE" title="arrow::Status"><code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">Status</span></code></a> when overflow is detected.</p></li>
</ul>
</section>
</section>
</section>
</section>
</article>
<footer class="prev-next-footer">
<div class="prev-next-area">
<a class="left-prev"
href="tables.html"
title="previous page">
<i class="fa-solid fa-angle-left"></i>
<div class="prev-next-info">
<p class="prev-next-subtitle">previous</p>
<p class="prev-next-title">Tabular Data</p>
</div>
</a>
<a class="right-next"
href="gandiva.html"
title="next page">
<div class="prev-next-info">
<p class="prev-next-subtitle">next</p>
<p class="prev-next-title">The Gandiva Expression Compiler</p>
</div>
<i class="fa-solid fa-angle-right"></i>
</a>
</div>
</footer>
</div>
<div class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">
<div class="sidebar-secondary-item">
<div
id="pst-page-navigation-heading-2"
class="page-toc tocsection onthispage">
<i class="fa-solid fa-list"></i> On this page
</div>
<nav class="bd-toc-nav page-toc" aria-labelledby="pst-page-navigation-heading-2">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#the-generic-compute-api">The generic Compute API</a><ul class="visible nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#functions-and-function-registry">Functions and function registry</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#input-shapes">Input shapes</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#invoking-functions">Invoking functions</a></li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#implicit-casts">Implicit casts</a><ul class="visible nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#common-numeric-type">Common numeric type</a></li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#available-functions">Available functions</a><ul class="visible nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#type-categories">Type categories</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#aggregations">Aggregations</a><ul class="nav section-nav flex-column">
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#grouped-aggregations-group-by">Grouped Aggregations (“group by”)</a></li>
</ul>
</li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#element-wise-scalar-functions">Element-wise (“scalar”) functions</a><ul class="nav section-nav flex-column">
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#arithmetic-functions">Arithmetic functions</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#bit-wise-functions">Bit-wise functions</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#rounding-functions">Rounding functions</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#logarithmic-functions">Logarithmic functions</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#trigonometric-functions">Trigonometric functions</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#comparisons">Comparisons</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#logical-functions">Logical functions</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#string-predicates">String predicates</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#string-transforms">String transforms</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#string-padding">String padding</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#string-trimming">String trimming</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#string-splitting">String splitting</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#string-component-extraction">String component extraction</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#string-joining">String joining</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#string-slicing">String Slicing</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#containment-tests">Containment tests</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#categorizations">Categorizations</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#selecting-multiplexing">Selecting / multiplexing</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#structural-transforms">Structural transforms</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#conversions">Conversions</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#temporal-component-extraction">Temporal component extraction</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#temporal-difference">Temporal difference</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#timezone-handling">Timezone handling</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#random-number-generation">Random number generation</a></li>
</ul>
</li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#array-wise-vector-functions">Array-wise (“vector”) functions</a><ul class="nav section-nav flex-column">
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#cumulative-functions">Cumulative Functions</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#associative-transforms">Associative transforms</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#selections">Selections</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#id4">Containment tests</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#sorts-and-partitions">Sorts and partitions</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#cpp-compute-vector-structural-transforms">Structural transforms</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#pairwise-functions">Pairwise functions</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</nav></div>
<div class="sidebar-secondary-item">
<div class="tocsection editthispage">
<a href="https://github.com/apache/arrow/edit/main/docs/source/cpp/compute.rst">
<i class="fa-solid fa-pencil"></i>
Edit on GitHub
</a>
</div>
</div>
</div></div>
</div>
<footer class="bd-footer-content">
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=8d27b9dea8ad943066ae"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae"></script>
<footer class="bd-footer">
<div class="bd-footer__inner bd-page-width">
<div class="footer-items__start">
<div class="footer-item">
<p class="copyright">
© Copyright 2016-2024 Apache Software Foundation.
Apache Arrow, Arrow, Apache, the Apache feather logo, and the Apache Arrow project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.
<br/>
</p>
</div>
<div class="footer-item">
<p class="sphinx-version">
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 6.2.0.
<br/>
</p>
</div>
</div>
<div class="footer-items__end">
<div class="footer-item">
<p class="theme-version">
Built with the <a href="https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html">PyData Sphinx Theme</a> 0.15.2.
</p></div>
</div>
</div>
</footer>
</body>
</html>