blob: 44d67403a28eb66c5d1bb11e7507aa52e5a33f63 [file] [log] [blame]
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-querying/sql-functions">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v2.4.1">
<title data-rh="true">All Druid SQL functions | Apache® Druid</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" name="twitter:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" property="og:url" content="https://druid.apache.org/docs/27.0.0/querying/sql-functions"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="All Druid SQL functions | Apache® Druid"><meta data-rh="true" name="description" content="&lt;!--"><meta data-rh="true" property="og:description" content="&lt;!--"><link data-rh="true" rel="icon" href="/img/favicon.png"><link data-rh="true" rel="canonical" href="https://druid.apache.org/docs/27.0.0/querying/sql-functions"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/27.0.0/querying/sql-functions" hreflang="en"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/27.0.0/querying/sql-functions" hreflang="x-default"><link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131010415-1"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-131010415-1",{})</script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script><link rel="stylesheet" href="/assets/css/styles.f80751b3.css">
<link rel="preload" href="/assets/js/runtime~main.5371e784.js" as="script">
<link rel="preload" href="/assets/js/main.832012d1.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedImage_ToTc themedImage--light_HNdA"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedImage_ToTc themedImage--dark_i4oU"></div></a></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/technology">Technology</a><a class="navbar__item navbar__link" href="/use-cases">Use Cases</a><a class="navbar__item navbar__link" href="/druid-powered">Powered By</a><a class="navbar__item navbar__link" href="/docs/27.0.0/design/">Docs</a><a class="navbar__item navbar__link" href="/community/">Community</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">Apache®</a><ul class="dropdown__menu"><li><a href="https://www.apache.org/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Foundation<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://apachecon.com/?ref=druid.apache.org" target="_blank" rel="noopener noreferrer" class="dropdown__link">Events<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/licenses/" target="_blank" rel="noopener noreferrer" class="dropdown__link">License<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Thanks<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/security/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Security<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Sponsorship<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><a class="navbar__item navbar__link" href="/downloads/">Download</a><div class="searchBox_ZlJk"><div class="navbar__search"><span aria-label="expand searchbar" role="button" class="search-icon" tabindex="0"></span><input type="search" id="search_input_react" placeholder="Loading..." aria-label="Search" class="navbar__search-input search-bar" disabled=""></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/design/">Getting started</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/tutorials/tutorial-msq-extern">Tutorials</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/design/architecture">Design</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/ingestion/">Ingestion</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/data-management/">Data management</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/docs/27.0.0/querying/sql">Querying</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/docs/27.0.0/querying/sql">Druid SQL</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql">Overview and syntax</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/query-deep-storage">Query from deep storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-data-types">SQL data types</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-operators">Operators</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-scalar">Scalar functions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-aggregations">Aggregation functions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-array-functions">Array functions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string functions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-json-functions">JSON functions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/docs/27.0.0/querying/sql-functions">All functions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-query-context">SQL query context</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-metadata-tables">SQL metadata tables</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/sql-translation">SQL query translation</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/">Native queries</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/query-execution">Query execution</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/27.0.0/querying/troubleshooting">Troubleshooting</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/docs/27.0.0/querying/datasource">Concepts</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/docs/27.0.0/querying/timeseriesquery">Native query types</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/docs/27.0.0/querying/filters">Native query components</a></div></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/api-reference/">API reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/configuration/">Configuration</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/operations/web-console">Operations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/development/overview">Development</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/27.0.0/misc/papers-and-talks">Misc</a></div></li></ul></nav></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Querying</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Druid SQL</span><meta itemprop="position" content="2"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">All functions</span><meta itemprop="position" content="3"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>All Druid SQL functions</h1></header><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>info</div><div class="admonitionContent_S0QG"><p> Apache Druid supports two query languages: Druid SQL and <a href="/docs/27.0.0/querying/">native queries</a>.
This document describes the SQL language.</p></div></div><p>This page provides a reference of all Druid SQL functions in alphabetical order.
Click the linked function type for documentation on a particular function.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="abs">ABS<a href="#abs" class="hash-link" aria-label="Direct link to ABS" title="Direct link to ABS"></a></h2><p><code>ABS(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the absolute value of a numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="acos">ACOS<a href="#acos" class="hash-link" aria-label="Direct link to ACOS" title="Direct link to ACOS"></a></h2><p><code>ACOS(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the arc cosine of a numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="any_value">ANY_VALUE<a href="#any_value" class="hash-link" aria-label="Direct link to ANY_VALUE" title="Direct link to ANY_VALUE"></a></h2><p><code>ANY_VALUE(&lt;NUMERIC&gt;)</code></p><p><code>ANY_VALUE(&lt;BOOLEAN&gt;)</code></p><p><code>ANY_VALUE(&lt;CHARACTER&gt;, &lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns any value of the specified expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="approx_count_distinct">APPROX_COUNT_DISTINCT<a href="#approx_count_distinct" class="hash-link" aria-label="Direct link to APPROX_COUNT_DISTINCT" title="Direct link to APPROX_COUNT_DISTINCT"></a></h2><p><code>APPROX_COUNT_DISTINCT(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Counts distinct values of a regular column or a prebuilt sketch column.</p><p><code>APPROX_COUNT_DISTINCT_BUILTIN(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Counts distinct values of a string, numeric, or <code>hyperUnique</code> column using Druid&#x27;s built-in <code>cardinality</code> or <code>hyperUnique</code> aggregators.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="approx_count_distinct_ds_hll">APPROX_COUNT_DISTINCT_DS_HLL<a href="#approx_count_distinct_ds_hll" class="hash-link" aria-label="Direct link to APPROX_COUNT_DISTINCT_DS_HLL" title="Direct link to APPROX_COUNT_DISTINCT_DS_HLL"></a></h2><p><code>APPROX_COUNT_DISTINCT_DS_HLL(expr, [&lt;NUMERIC&gt;, &lt;CHARACTER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Counts distinct values of an HLL sketch column or a regular column.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="approx_count_distinct_ds_theta">APPROX_COUNT_DISTINCT_DS_THETA<a href="#approx_count_distinct_ds_theta" class="hash-link" aria-label="Direct link to APPROX_COUNT_DISTINCT_DS_THETA" title="Direct link to APPROX_COUNT_DISTINCT_DS_THETA"></a></h2><p><code>APPROX_COUNT_DISTINCT_DS_THETA(expr, [&lt;NUMERIC&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Counts distinct values of a Theta sketch column or a regular column.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="approx_quantile">APPROX_QUANTILE<a href="#approx_quantile" class="hash-link" aria-label="Direct link to APPROX_QUANTILE" title="Direct link to APPROX_QUANTILE"></a></h2><p><code>APPROX_QUANTILE(expr, &lt;NUMERIC&gt;, [&lt;NUMERIC&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Deprecated in favor of <code>APPROX_QUANTILE_DS</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="approx_quantile_ds">APPROX_QUANTILE_DS<a href="#approx_quantile_ds" class="hash-link" aria-label="Direct link to APPROX_QUANTILE_DS" title="Direct link to APPROX_QUANTILE_DS"></a></h2><p><code>APPROX_QUANTILE_DS(expr, &lt;NUMERIC&gt;, [&lt;NUMERIC&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Computes approximate quantiles on a Quantiles sketch column or a regular numeric column.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="approx_quantile_fixed_buckets">APPROX_QUANTILE_FIXED_BUCKETS<a href="#approx_quantile_fixed_buckets" class="hash-link" aria-label="Direct link to APPROX_QUANTILE_FIXED_BUCKETS" title="Direct link to APPROX_QUANTILE_FIXED_BUCKETS"></a></h2><p><code>APPROX_QUANTILE_FIXED_BUCKETS(expr, &lt;NUMERIC&gt;, &lt;NUMERIC&gt;, &lt;NUMERIC&gt;, &lt;NUMERIC&gt;, [&lt;CHARACTER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Computes approximate quantiles on fixed buckets histogram column or a regular numeric column.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array">ARRAY[]<a href="#array" class="hash-link" aria-label="Direct link to ARRAY[]" title="Direct link to ARRAY[]"></a></h2><p><code>ARRAY[expr1, expr2, ...]</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Constructs a SQL ARRAY literal from the expression arguments. The arguments must be of the same type.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_agg">ARRAY_AGG<a href="#array_agg" class="hash-link" aria-label="Direct link to ARRAY_AGG" title="Direct link to ARRAY_AGG"></a></h2><p><code>ARRAY_AGG([DISTINCT] expr, [&lt;NUMERIC&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns an array of all values of the specified expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_append">ARRAY_APPEND<a href="#array_append" class="hash-link" aria-label="Direct link to ARRAY_APPEND" title="Direct link to ARRAY_APPEND"></a></h2><p><code>ARRAY_APPEND(arr1, expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Appends <code>expr</code> to <code>arr</code>, the resulting array type determined by the type of <code>arr1</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_concat">ARRAY_CONCAT<a href="#array_concat" class="hash-link" aria-label="Direct link to ARRAY_CONCAT" title="Direct link to ARRAY_CONCAT"></a></h2><p><code>ARRAY_CONCAT(arr1, arr2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Concatenates <code>arr2</code> to <code>arr1</code>. The resulting array type is determined by the type of <code>arr1</code>.|</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_concat_agg">ARRAY_CONCAT_AGG<a href="#array_concat_agg" class="hash-link" aria-label="Direct link to ARRAY_CONCAT_AGG" title="Direct link to ARRAY_CONCAT_AGG"></a></h2><p><code>ARRAY_CONCAT_AGG([DISTINCT] expr, [&lt;NUMERIC&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Concatenates array inputs into a single array.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_contains">ARRAY_CONTAINS<a href="#array_contains" class="hash-link" aria-label="Direct link to ARRAY_CONTAINS" title="Direct link to ARRAY_CONTAINS"></a></h2><p><code>ARRAY_CONTAINS(arr, expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>If <code>expr</code> is a scalar type, returns 1 if <code>arr</code> contains <code>expr</code>. If <code>expr</code> is an array, returns 1 if <code>arr</code> contains all elements of <code>expr</code>. Otherwise returns 0.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_length">ARRAY_LENGTH<a href="#array_length" class="hash-link" aria-label="Direct link to ARRAY_LENGTH" title="Direct link to ARRAY_LENGTH"></a></h2><p><code>ARRAY_LENGTH(arr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Returns length of the array expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_offset">ARRAY_OFFSET<a href="#array_offset" class="hash-link" aria-label="Direct link to ARRAY_OFFSET" title="Direct link to ARRAY_OFFSET"></a></h2><p><code>ARRAY_OFFSET(arr, long)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Returns the array element at the 0-based index supplied, or null for an out of range index.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_offset_of">ARRAY_OFFSET_OF<a href="#array_offset_of" class="hash-link" aria-label="Direct link to ARRAY_OFFSET_OF" title="Direct link to ARRAY_OFFSET_OF"></a></h2><p><code>ARRAY_OFFSET_OF(arr, expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Returns the 0-based index of the first occurrence of <code>expr</code> in the array. If no matching elements exist in the array, returns <code>-1</code> or <code>null</code> if <code>druid.generic.useDefaultValueForNull=false</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_ordinal">ARRAY_ORDINAL<a href="#array_ordinal" class="hash-link" aria-label="Direct link to ARRAY_ORDINAL" title="Direct link to ARRAY_ORDINAL"></a></h2><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p><code>ARRAY_ORDINAL(arr, long)</code></p><p>Returns the array element at the 1-based index supplied, or null for an out of range index.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_ordinal_of">ARRAY_ORDINAL_OF<a href="#array_ordinal_of" class="hash-link" aria-label="Direct link to ARRAY_ORDINAL_OF" title="Direct link to ARRAY_ORDINAL_OF"></a></h2><p><code>ARRAY_ORDINAL_OF(arr, expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Returns the 1-based index of the first occurrence of <code>expr</code> in the array. If no matching elements exist in the array, returns <code>-1</code> or <code>null</code> if <code>druid.generic.useDefaultValueForNull=false</code>.|</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_overlap">ARRAY_OVERLAP<a href="#array_overlap" class="hash-link" aria-label="Direct link to ARRAY_OVERLAP" title="Direct link to ARRAY_OVERLAP"></a></h2><p><code>ARRAY_OVERLAP(arr1, arr2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Returns 1 if <code>arr1</code> and <code>arr2</code> have any elements in common, else 0.|</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_prepend">ARRAY_PREPEND<a href="#array_prepend" class="hash-link" aria-label="Direct link to ARRAY_PREPEND" title="Direct link to ARRAY_PREPEND"></a></h2><p><code>ARRAY_PREPEND(expr, arr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Prepends <code>expr</code> to <code>arr</code> at the beginning, the resulting array type determined by the type of <code>arr</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_slice">ARRAY_SLICE<a href="#array_slice" class="hash-link" aria-label="Direct link to ARRAY_SLICE" title="Direct link to ARRAY_SLICE"></a></h2><p><code>ARRAY_SLICE(arr, start, end)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Returns the subarray of <code>arr</code> from the 0-based index <code>start</code> (inclusive) to <code>end</code> (exclusive). Returns <code>null</code>, if <code>start</code> is less than 0, greater than length of <code>arr</code>, or greater than <code>end</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_to_mv">ARRAY_TO_MV<a href="#array_to_mv" class="hash-link" aria-label="Direct link to ARRAY_TO_MV" title="Direct link to ARRAY_TO_MV"></a></h2><p><code>ARRAY_TO_MV(arr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Converts an <code>ARRAY</code> of any type into a multi-value string <code>VARCHAR</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="array_to_string">ARRAY_TO_STRING<a href="#array_to_string" class="hash-link" aria-label="Direct link to ARRAY_TO_STRING" title="Direct link to ARRAY_TO_STRING"></a></h2><p><code>ARRAY_TO_STRING(arr, str)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Joins all elements of <code>arr</code> by the delimiter specified by <code>str</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="asin">ASIN<a href="#asin" class="hash-link" aria-label="Direct link to ASIN" title="Direct link to ASIN"></a></h2><p><code>ASIN(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the arc sine of a numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="atan">ATAN<a href="#atan" class="hash-link" aria-label="Direct link to ATAN" title="Direct link to ATAN"></a></h2><p><code>ATAN(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the arc tangent of a numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="atan2">ATAN2<a href="#atan2" class="hash-link" aria-label="Direct link to ATAN2" title="Direct link to ATAN2"></a></h2><p><code>ATAN2(&lt;NUMERIC&gt;, &lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the arc tangent of the two arguments.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="avg">AVG<a href="#avg" class="hash-link" aria-label="Direct link to AVG" title="Direct link to AVG"></a></h2><p><code>AVG(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Calculates the average of a set of values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bit_and">BIT_AND<a href="#bit_and" class="hash-link" aria-label="Direct link to BIT_AND" title="Direct link to BIT_AND"></a></h2><p><code>BIT_AND(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Performs a bitwise AND operation on all input values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bit_or">BIT_OR<a href="#bit_or" class="hash-link" aria-label="Direct link to BIT_OR" title="Direct link to BIT_OR"></a></h2><p><code>BIT_OR(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Performs a bitwise OR operation on all input values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bit_xor">BIT_XOR<a href="#bit_xor" class="hash-link" aria-label="Direct link to BIT_XOR" title="Direct link to BIT_XOR"></a></h2><p><code>BIT_XOR(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Performs a bitwise XOR operation on all input values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bitwise_and">BITWISE_AND<a href="#bitwise_and" class="hash-link" aria-label="Direct link to BITWISE_AND" title="Direct link to BITWISE_AND"></a></h2><p><code>BITWISE_AND(expr1, expr2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Returns the bitwise AND between the two expressions, that is, <code>expr1 &amp; expr2</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bitwise_complement">BITWISE_COMPLEMENT<a href="#bitwise_complement" class="hash-link" aria-label="Direct link to BITWISE_COMPLEMENT" title="Direct link to BITWISE_COMPLEMENT"></a></h2><p><code>BITWISE_COMPLEMENT(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Returns the bitwise NOT for the expression, that is, <code>~expr</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bitwise_convert_double_to_long_bits">BITWISE_CONVERT_DOUBLE_TO_LONG_BITS<a href="#bitwise_convert_double_to_long_bits" class="hash-link" aria-label="Direct link to BITWISE_CONVERT_DOUBLE_TO_LONG_BITS" title="Direct link to BITWISE_CONVERT_DOUBLE_TO_LONG_BITS"></a></h2><p><code>BITWISE_CONVERT_DOUBLE_TO_LONG_BITS(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Converts the bits of an IEEE 754 floating-point double value to a long.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bitwise_convert_long_bits_to_double">BITWISE_CONVERT_LONG_BITS_TO_DOUBLE<a href="#bitwise_convert_long_bits_to_double" class="hash-link" aria-label="Direct link to BITWISE_CONVERT_LONG_BITS_TO_DOUBLE" title="Direct link to BITWISE_CONVERT_LONG_BITS_TO_DOUBLE"></a></h2><p><code>BITWISE_CONVERT_LONG_BITS_TO_DOUBLE(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Converts a long to the IEEE 754 floating-point double specified by the bits stored in the long.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bitwise_or">BITWISE_OR<a href="#bitwise_or" class="hash-link" aria-label="Direct link to BITWISE_OR" title="Direct link to BITWISE_OR"></a></h2><p><code>BITWISE_OR(expr1, expr2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Returns the bitwise OR between the two expressions, that is, <code>expr1 | expr2</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bitwise_shift_left">BITWISE_SHIFT_LEFT<a href="#bitwise_shift_left" class="hash-link" aria-label="Direct link to BITWISE_SHIFT_LEFT" title="Direct link to BITWISE_SHIFT_LEFT"></a></h2><p><code>BITWISE_SHIFT_LEFT(expr1, expr2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Returns a bitwise left shift of expr1, that is, <code>expr1 &lt;&lt; expr2</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bitwise_shift_right">BITWISE_SHIFT_RIGHT<a href="#bitwise_shift_right" class="hash-link" aria-label="Direct link to BITWISE_SHIFT_RIGHT" title="Direct link to BITWISE_SHIFT_RIGHT"></a></h2><p><code>BITWISE_SHIFT_RIGHT(expr1, expr2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Returns a bitwise right shift of expr1, that is, <code>expr1 &gt;&gt; expr2</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bitwise_xor">BITWISE_XOR<a href="#bitwise_xor" class="hash-link" aria-label="Direct link to BITWISE_XOR" title="Direct link to BITWISE_XOR"></a></h2><p><code>BITWISE_XOR(expr1, expr2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Returns the bitwise exclusive OR between the two expressions, that is, <code>expr1 ^ expr2</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bloom_filter">BLOOM_FILTER<a href="#bloom_filter" class="hash-link" aria-label="Direct link to BLOOM_FILTER" title="Direct link to BLOOM_FILTER"></a></h2><p><code>BLOOM_FILTER(expr, &lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Computes a Bloom filter from values produced by the specified expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bloom_filter_test">BLOOM_FILTER_TEST<a href="#bloom_filter_test" class="hash-link" aria-label="Direct link to BLOOM_FILTER_TEST" title="Direct link to BLOOM_FILTER_TEST"></a></h2><p><code>BLOOM_FILTER_TEST(expr, &lt;STRING&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#other-scalar-functions">Scalar, other</a></p><p>Returns true if the expression is contained in a Base64-serialized Bloom filter.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="btrim">BTRIM<a href="#btrim" class="hash-link" aria-label="Direct link to BTRIM" title="Direct link to BTRIM"></a></h2><p><code>BTRIM(&lt;CHARACTER&gt;, [&lt;CHARACTER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Trims characters from both the leading and trailing ends of an expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="case">CASE<a href="#case" class="hash-link" aria-label="Direct link to CASE" title="Direct link to CASE"></a></h2><p><code>CASE expr WHEN value1 THEN result1 \[ WHEN value2 THEN result2 ... \] \[ ELSE resultN \] END</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#other-scalar-functions">Scalar, other</a></p><p>Returns a result based on a given condition.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cast">CAST<a href="#cast" class="hash-link" aria-label="Direct link to CAST" title="Direct link to CAST"></a></h2><p><code>CAST(value AS TYPE)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#other-scalar-functions">Scalar, other</a></p><p>Converts a value into the specified data type.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ceil-date-and-time">CEIL (date and time)<a href="#ceil-date-and-time" class="hash-link" aria-label="Direct link to CEIL (date and time)" title="Direct link to CEIL (date and time)"></a></h2><p><code>CEIL(&lt;TIMESTAMP&gt; TO &lt;TIME_UNIT&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Rounds up a timestamp by a given time unit.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ceil-numeric">CEIL (numeric)<a href="#ceil-numeric" class="hash-link" aria-label="Direct link to CEIL (numeric)" title="Direct link to CEIL (numeric)"></a></h2><p><code>CEIL(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the smallest integer value greater than or equal to the numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="char_length">CHAR_LENGTH<a href="#char_length" class="hash-link" aria-label="Direct link to CHAR_LENGTH" title="Direct link to CHAR_LENGTH"></a></h2><p><code>CHAR_LENGTH(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Alias for <a href="#length"><code>LENGTH</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="character_length">CHARACTER_LENGTH<a href="#character_length" class="hash-link" aria-label="Direct link to CHARACTER_LENGTH" title="Direct link to CHARACTER_LENGTH"></a></h2><p><code>CHARACTER_LENGTH(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Alias for <a href="#length"><code>LENGTH</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="coalesce">COALESCE<a href="#coalesce" class="hash-link" aria-label="Direct link to COALESCE" title="Direct link to COALESCE"></a></h2><p><code>COALESCE(expr, expr, ...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#other-scalar-functions">Scalar, other</a></p><p>Returns the first non-null value.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="concat">CONCAT<a href="#concat" class="hash-link" aria-label="Direct link to CONCAT" title="Direct link to CONCAT"></a></h2><p><code>CONCAT(expr, expr...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Concatenates a list of expressions.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="contains_string">CONTAINS_STRING<a href="#contains_string" class="hash-link" aria-label="Direct link to CONTAINS_STRING" title="Direct link to CONTAINS_STRING"></a></h2><p><code>CONTAINS_STRING(&lt;CHARACTER&gt;, &lt;CHARACTER&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Finds whether a string is in a given expression, case-sensitive.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cos">COS<a href="#cos" class="hash-link" aria-label="Direct link to COS" title="Direct link to COS"></a></h2><p><code>COS(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the trigonometric cosine of an angle expressed in radians.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cot">COT<a href="#cot" class="hash-link" aria-label="Direct link to COT" title="Direct link to COT"></a></h2><p><code>COT(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the trigonometric cotangent of an angle expressed in radians.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="count">COUNT<a href="#count" class="hash-link" aria-label="Direct link to COUNT" title="Direct link to COUNT"></a></h2><p><code>COUNT([DISTINCT] expr)</code></p><p><code>COUNT(*)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Counts the number of rows.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="current_date">CURRENT_DATE<a href="#current_date" class="hash-link" aria-label="Direct link to CURRENT_DATE" title="Direct link to CURRENT_DATE"></a></h2><p><code>CURRENT_DATE</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Returns the current date in the connection&#x27;s time zone.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="current_timestamp">CURRENT_TIMESTAMP<a href="#current_timestamp" class="hash-link" aria-label="Direct link to CURRENT_TIMESTAMP" title="Direct link to CURRENT_TIMESTAMP"></a></h2><p><code>CURRENT_TIMESTAMP</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Returns the current timestamp in the connection&#x27;s time zone.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="date_trunc">DATE_TRUNC<a href="#date_trunc" class="hash-link" aria-label="Direct link to DATE_TRUNC" title="Direct link to DATE_TRUNC"></a></h2><p><code>DATE_TRUNC(&lt;CHARACTER&gt;, &lt;TIMESTAMP&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Rounds down a timestamp by a given time unit.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="degrees">DEGREES<a href="#degrees" class="hash-link" aria-label="Direct link to DEGREES" title="Direct link to DEGREES"></a></h2><p><code>DEGREES(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Converts an angle from radians to degrees.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="div">DIV<a href="#div" class="hash-link" aria-label="Direct link to DIV" title="Direct link to DIV"></a></h2><p><code>DIV(x, y)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Returns the result of integer division of <code>x</code> by <code>y</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_cdf">DS_CDF<a href="#ds_cdf" class="hash-link" aria-label="Direct link to DS_CDF" title="Direct link to DS_CDF"></a></h2><p><code>DS_CDF(expr, splitPoint0, splitPoint1, ...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns a string representing an approximation to the Cumulative Distribution Function given the specified bin definition.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_get_quantile">DS_GET_QUANTILE<a href="#ds_get_quantile" class="hash-link" aria-label="Direct link to DS_GET_QUANTILE" title="Direct link to DS_GET_QUANTILE"></a></h2><p><code>DS_GET_QUANTILE(expr, fraction)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns the quantile estimate corresponding to <code>fraction</code> from a quantiles sketch.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_get_quantiles">DS_GET_QUANTILES<a href="#ds_get_quantiles" class="hash-link" aria-label="Direct link to DS_GET_QUANTILES" title="Direct link to DS_GET_QUANTILES"></a></h2><p><code>DS_GET_QUANTILES(expr, fraction0, fraction1, ...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns a string representing an array of quantile estimates corresponding to a list of fractions from a quantiles sketch.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_histogram">DS_HISTOGRAM<a href="#ds_histogram" class="hash-link" aria-label="Direct link to DS_HISTOGRAM" title="Direct link to DS_HISTOGRAM"></a></h2><p><code>DS_HISTOGRAM(expr, splitPoint0, splitPoint1, ...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns a string representing an approximation to the histogram given the specified bin definition.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_hll">DS_HLL<a href="#ds_hll" class="hash-link" aria-label="Direct link to DS_HLL" title="Direct link to DS_HLL"></a></h2><p><code>DS_HLL(expr, [lgK, tgtHllType])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Creates an HLL sketch on a column containing HLL sketches or a regular column.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_quantile_summary">DS_QUANTILE_SUMMARY<a href="#ds_quantile_summary" class="hash-link" aria-label="Direct link to DS_QUANTILE_SUMMARY" title="Direct link to DS_QUANTILE_SUMMARY"></a></h2><p><code>DS_QUANTILE_SUMMARY(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns a string summary of a quantiles sketch.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_quantiles_sketch">DS_QUANTILES_SKETCH<a href="#ds_quantiles_sketch" class="hash-link" aria-label="Direct link to DS_QUANTILES_SKETCH" title="Direct link to DS_QUANTILES_SKETCH"></a></h2><p><code>DS_QUANTILES_SKETCH(expr, [k])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Creates a Quantiles sketch on a column containing Quantiles sketches or a regular column.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_rank">DS_RANK<a href="#ds_rank" class="hash-link" aria-label="Direct link to DS_RANK" title="Direct link to DS_RANK"></a></h2><p><code>DS_RANK(expr, value)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns an approximate rank between 0 and 1 of a given value, in which the rank signifies the fraction of the distribution less than the given value.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_theta">DS_THETA<a href="#ds_theta" class="hash-link" aria-label="Direct link to DS_THETA" title="Direct link to DS_THETA"></a></h2><p><code>DS_THETA(expr, [size])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Creates a Theta sketch on a column containing Theta sketches or a regular column.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_tuple_doubles">DS_TUPLE_DOUBLES<a href="#ds_tuple_doubles" class="hash-link" aria-label="Direct link to DS_TUPLE_DOUBLES" title="Direct link to DS_TUPLE_DOUBLES"></a></h2><p><code>DS_TUPLE_DOUBLES(expr, [nominalEntries])</code></p><p><code>DS_TUPLE_DOUBLES(dimensionColumnExpr, metricColumnExpr, ..., [nominalEntries])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Creates a Tuple sketch which contains an array of double values as the Summary Object. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for <a href="/docs/27.0.0/development/extensions-core/datasketches-tuple">nominal entries</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_tuple_doubles_intersect">DS_TUPLE_DOUBLES_INTERSECT<a href="#ds_tuple_doubles_intersect" class="hash-link" aria-label="Direct link to DS_TUPLE_DOUBLES_INTERSECT" title="Direct link to DS_TUPLE_DOUBLES_INTERSECT"></a></h2><p><code>DS_TUPLE_DOUBLES_INTERSECT(expr, ..., [nominalEntries])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#tuple-sketch-functions">Scalar, sketch</a></p><p>Returns an intersection of Tuple sketches which each contain an array of double values as their Summary Objects. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for <a href="/docs/27.0.0/development/extensions-core/datasketches-tuple">nominal entries</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_tuple_doubles_metrics_sum_estimate">DS_TUPLE_DOUBLES_METRICS_SUM_ESTIMATE<a href="#ds_tuple_doubles_metrics_sum_estimate" class="hash-link" aria-label="Direct link to DS_TUPLE_DOUBLES_METRICS_SUM_ESTIMATE" title="Direct link to DS_TUPLE_DOUBLES_METRICS_SUM_ESTIMATE"></a></h2><p><code>DS_TUPLE_DOUBLES_METRICS_SUM_ESTIMATE(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#tuple-sketch-functions">Scalar, sketch</a></p><p>Computes approximate sums of the values contained within a Tuple sketch which contains an array of double values as the Summary Object.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_tuple_doubles_not">DS_TUPLE_DOUBLES_NOT<a href="#ds_tuple_doubles_not" class="hash-link" aria-label="Direct link to DS_TUPLE_DOUBLES_NOT" title="Direct link to DS_TUPLE_DOUBLES_NOT"></a></h2><p><code>DS_TUPLE_DOUBLES_NOT(expr, ..., [nominalEntries])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#tuple-sketch-functions">Scalar, sketch</a></p><p>Returns a set difference of Tuple sketches which each contain an array of double values as their Summary Objects. The values contained in the Summary Object are preserved as is. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for <a href="/docs/27.0.0/development/extensions-core/datasketches-tuple">nominal entries</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ds_tuple_doubles_union">DS_TUPLE_DOUBLES_UNION<a href="#ds_tuple_doubles_union" class="hash-link" aria-label="Direct link to DS_TUPLE_DOUBLES_UNION" title="Direct link to DS_TUPLE_DOUBLES_UNION"></a></h2><p><code>DS_TUPLE_DOUBLES_UNION(expr, ..., [nominalEntries])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#tuple-sketch-functions">Scalar, sketch</a></p><p>Returns a union of Tuple sketches which each contain an array of double values as their Summary Objects. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for <a href="/docs/27.0.0/development/extensions-core/datasketches-tuple">nominal entries</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="earliest">EARLIEST<a href="#earliest" class="hash-link" aria-label="Direct link to EARLIEST" title="Direct link to EARLIEST"></a></h2><p><code>EARLIEST(expr)</code></p><p><code>EARLIEST(expr, maxBytesPerString)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns the value of a numeric or string expression corresponding to the earliest <code>__time</code> value.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="earliest_by">EARLIEST_BY<a href="#earliest_by" class="hash-link" aria-label="Direct link to EARLIEST_BY" title="Direct link to EARLIEST_BY"></a></h2><p><code>EARLIEST_BY(expr, timestampExpr)</code></p><p><code>EARLIEST_BY(expr, timestampExpr, maxBytesPerString)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns the value of a numeric or string expression corresponding to the earliest time value from <code>timestampExpr</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="exp">EXP<a href="#exp" class="hash-link" aria-label="Direct link to EXP" title="Direct link to EXP"></a></h2><p><code>EXP(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates <em>e</em> raised to the power of the numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="extract">EXTRACT<a href="#extract" class="hash-link" aria-label="Direct link to EXTRACT" title="Direct link to EXTRACT"></a></h2><p><code>EXTRACT(&lt;TIME_UNIT&gt; FROM &lt;TIMESTAMP&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Extracts the value of some unit of the timestamp, optionally from a certain time zone, and returns the number.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="floor-date-and-time">FLOOR (date and time)<a href="#floor-date-and-time" class="hash-link" aria-label="Direct link to FLOOR (date and time)" title="Direct link to FLOOR (date and time)"></a></h2><p><code>FLOOR(&lt;TIMESTAMP&gt; TO &lt;TIME_UNIT&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Rounds down a timestamp by a given time unit.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="floor-numeric">FLOOR (numeric)<a href="#floor-numeric" class="hash-link" aria-label="Direct link to FLOOR (numeric)" title="Direct link to FLOOR (numeric)"></a></h2><p><code>FLOOR(&lt;NUMERIC&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the largest integer value less than or equal to the numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="greatest">GREATEST<a href="#greatest" class="hash-link" aria-label="Direct link to GREATEST" title="Direct link to GREATEST"></a></h2><p><code>GREATEST([expr1, ...])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#reduction-functions">Scalar, reduction</a></p><p>Returns the maximum value from the provided arguments.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="grouping">GROUPING<a href="#grouping" class="hash-link" aria-label="Direct link to GROUPING" title="Direct link to GROUPING"></a></h2><p><code>GROUPING(expr, expr...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns a number for each output row of a groupBy query, indicating whether the specified dimension is included for that row.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="hll_sketch_estimate">HLL_SKETCH_ESTIMATE<a href="#hll_sketch_estimate" class="hash-link" aria-label="Direct link to HLL_SKETCH_ESTIMATE" title="Direct link to HLL_SKETCH_ESTIMATE"></a></h2><p><code>HLL_SKETCH_ESTIMATE(expr, [round])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns the distinct count estimate from an HLL sketch.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="hll_sketch_estimate_with_error_bounds">HLL_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS<a href="#hll_sketch_estimate_with_error_bounds" class="hash-link" aria-label="Direct link to HLL_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS" title="Direct link to HLL_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS"></a></h2><p><code>HLL_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS(expr, [numStdDev])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns the distinct count estimate and error bounds from an HLL sketch.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="hll_sketch_to_string">HLL_SKETCH_TO_STRING<a href="#hll_sketch_to_string" class="hash-link" aria-label="Direct link to HLL_SKETCH_TO_STRING" title="Direct link to HLL_SKETCH_TO_STRING"></a></h2><p><code>HLL_SKETCH_TO_STRING(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns a human-readable string representation of an HLL sketch.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="hll_sketch_union">HLL_SKETCH_UNION<a href="#hll_sketch_union" class="hash-link" aria-label="Direct link to HLL_SKETCH_UNION" title="Direct link to HLL_SKETCH_UNION"></a></h2><p><code>HLL_SKETCH_UNION([lgK, tgtHllType], expr0, expr1, ...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns a union of HLL sketches.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="human_readable_binary_byte_format">HUMAN_READABLE_BINARY_BYTE_FORMAT<a href="#human_readable_binary_byte_format" class="hash-link" aria-label="Direct link to HUMAN_READABLE_BINARY_BYTE_FORMAT" title="Direct link to HUMAN_READABLE_BINARY_BYTE_FORMAT"></a></h2><p><code>HUMAN_READABLE_BINARY_BYTE_FORMAT(value[, precision])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Converts an integer byte size into human-readable IEC format.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="human_readable_decimal_byte_format">HUMAN_READABLE_DECIMAL_BYTE_FORMAT<a href="#human_readable_decimal_byte_format" class="hash-link" aria-label="Direct link to HUMAN_READABLE_DECIMAL_BYTE_FORMAT" title="Direct link to HUMAN_READABLE_DECIMAL_BYTE_FORMAT"></a></h2><p><code>HUMAN_READABLE_DECIMAL_BYTE_FORMAT(value[, precision])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Converts a byte size into human-readable SI format.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="human_readable_decimal_format">HUMAN_READABLE_DECIMAL_FORMAT<a href="#human_readable_decimal_format" class="hash-link" aria-label="Direct link to HUMAN_READABLE_DECIMAL_FORMAT" title="Direct link to HUMAN_READABLE_DECIMAL_FORMAT"></a></h2><p><code>HUMAN_READABLE_DECIMAL_FORMAT(value[, precision])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Converts a byte size into human-readable SI format with single-character units.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="icontains_string">ICONTAINS_STRING<a href="#icontains_string" class="hash-link" aria-label="Direct link to ICONTAINS_STRING" title="Direct link to ICONTAINS_STRING"></a></h2><p><code>ICONTAINS_STRING(&lt;expr&gt;, str)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Finds whether a string is in a given expression, case-insensitive.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ipv4_match">IPV4_MATCH<a href="#ipv4_match" class="hash-link" aria-label="Direct link to IPV4_MATCH" title="Direct link to IPV4_MATCH"></a></h2><p><code>IPV4_MATCH(address, subnet)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#ip-address-functions">Scalar, IP address</a></p><p>Returns true if the <code>address</code> belongs to the <code>subnet</code> literal, else false.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ipv4_parse">IPV4_PARSE<a href="#ipv4_parse" class="hash-link" aria-label="Direct link to IPV4_PARSE" title="Direct link to IPV4_PARSE"></a></h2><p><code>IPV4_PARSE(address)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#ip-address-functions">Scalar, IP address</a></p><p>Parses <code>address</code> into an IPv4 address stored as an integer.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ipv4_stringify">IPV4_STRINGIFY<a href="#ipv4_stringify" class="hash-link" aria-label="Direct link to IPV4_STRINGIFY" title="Direct link to IPV4_STRINGIFY"></a></h2><p><code>IPV4_STRINGIFY(address)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#ip-address-functions">Scalar, IP address</a></p><p>Converts <code>address</code> into an IPv4 address in dot-decimal notation.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="json_keys">JSON_KEYS<a href="#json_keys" class="hash-link" aria-label="Direct link to JSON_KEYS" title="Direct link to JSON_KEYS"></a></h2><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-json-functions">JSON</a></p><p><code>JSON_KEYS(expr, path)</code></p><p>Returns an array of field names from <code>expr</code> at the specified <code>path</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="json_object">JSON_OBJECT<a href="#json_object" class="hash-link" aria-label="Direct link to JSON_OBJECT" title="Direct link to JSON_OBJECT"></a></h2><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-json-functions">JSON</a></p><p><code>JSON_OBJECT(KEY expr1 VALUE expr2[, KEY expr3 VALUE expr4, ...])</code></p><p>Constructs a new <code>COMPLEX&lt;json&gt;</code> object. The <code>KEY</code> expressions must evaluate to string types. The <code>VALUE</code> expressions can be composed of any input type, including other <code>COMPLEX&lt;json&gt;</code> values. <code>JSON_OBJECT</code> can accept colon-separated key-value pairs. The following syntax is equivalent: <code>JSON_OBJECT(expr1:expr2[, expr3:expr4, ...])</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="json_paths">JSON_PATHS<a href="#json_paths" class="hash-link" aria-label="Direct link to JSON_PATHS" title="Direct link to JSON_PATHS"></a></h2><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-json-functions">JSON</a></p><p><code>JSON_PATHS(expr)</code></p><p>Returns an array of all paths which refer to literal values in <code>expr</code> in JSONPath format.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="json_query">JSON_QUERY<a href="#json_query" class="hash-link" aria-label="Direct link to JSON_QUERY" title="Direct link to JSON_QUERY"></a></h2><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-json-functions">JSON</a></p><p><code>JSON_QUERY(expr, path)</code></p><p>Extracts a <code>COMPLEX&lt;json&gt;</code> value from <code>expr</code>, at the specified <code>path</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="json_value">JSON_VALUE<a href="#json_value" class="hash-link" aria-label="Direct link to JSON_VALUE" title="Direct link to JSON_VALUE"></a></h2><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-json-functions">JSON</a></p><p><code>JSON_VALUE(expr, path [RETURNING sqlType])</code></p><p>Extracts a literal value from <code>expr</code> at the specified <code>path</code>. If you specify <code>RETURNING</code> and an SQL type name (such as <code>VARCHAR</code>, <code>BIGINT</code>, <code>DOUBLE</code>, etc) the function plans the query using the suggested type. Otherwise, it attempts to infer the type based on the context. If it can&#x27;t infer the type, it defaults to <code>VARCHAR</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="latest">LATEST<a href="#latest" class="hash-link" aria-label="Direct link to LATEST" title="Direct link to LATEST"></a></h2><p><code>LATEST(expr)</code></p><p><code>LATEST(expr, maxBytesPerString)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns the value of a numeric or string expression corresponding to the latest <code>__time</code> value.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="latest_by">LATEST_BY<a href="#latest_by" class="hash-link" aria-label="Direct link to LATEST_BY" title="Direct link to LATEST_BY"></a></h2><p><code>LATEST_BY(expr, timestampExpr)</code></p><p><code>LATEST_BY(expr, timestampExpr, maxBytesPerString)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns the value of a numeric or string expression corresponding to the latest time value from <code>timestampExpr</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="least">LEAST<a href="#least" class="hash-link" aria-label="Direct link to LEAST" title="Direct link to LEAST"></a></h2><p><code>LEAST([expr1, ...])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#reduction-functions">Scalar, reduction</a></p><p>Returns the minimum value from the provided arguments.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="left">LEFT<a href="#left" class="hash-link" aria-label="Direct link to LEFT" title="Direct link to LEFT"></a></h2><p><code>LEFT(expr, [length])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns the leftmost number of characters from an expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="length">LENGTH<a href="#length" class="hash-link" aria-label="Direct link to LENGTH" title="Direct link to LENGTH"></a></h2><p><code>LENGTH(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns the length of the expression in UTF-16 encoding.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ln">LN<a href="#ln" class="hash-link" aria-label="Direct link to LN" title="Direct link to LN"></a></h2><p><code>LN(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the natural logarithm of the numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="log10">LOG10<a href="#log10" class="hash-link" aria-label="Direct link to LOG10" title="Direct link to LOG10"></a></h2><p><code>LOG10(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the base-10 of the numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="lookup">LOOKUP<a href="#lookup" class="hash-link" aria-label="Direct link to LOOKUP" title="Direct link to LOOKUP"></a></h2><p><code>LOOKUP(&lt;CHARACTER&gt;, &lt;CHARACTER&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Looks up the expression in a registered query-time lookup table.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="lower">LOWER<a href="#lower" class="hash-link" aria-label="Direct link to LOWER" title="Direct link to LOWER"></a></h2><p><code>LOWER(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns the expression in lowercase.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="lpad">LPAD<a href="#lpad" class="hash-link" aria-label="Direct link to LPAD" title="Direct link to LPAD"></a></h2><p><code>LPAD(&lt;CHARACTER&gt;, &lt;INTEGER&gt;, [&lt;CHARACTER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns the leftmost number of characters from an expression, optionally padded with the given characters.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ltrim">LTRIM<a href="#ltrim" class="hash-link" aria-label="Direct link to LTRIM" title="Direct link to LTRIM"></a></h2><p><code>LTRIM(&lt;CHARACTER&gt;, [&lt;CHARACTER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Trims characters from the leading end of an expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="max">MAX<a href="#max" class="hash-link" aria-label="Direct link to MAX" title="Direct link to MAX"></a></h2><p><code>MAX(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns the maximum value of a set of values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="millis_to_timestamp">MILLIS_TO_TIMESTAMP<a href="#millis_to_timestamp" class="hash-link" aria-label="Direct link to MILLIS_TO_TIMESTAMP" title="Direct link to MILLIS_TO_TIMESTAMP"></a></h2><p><code>MILLIS_TO_TIMESTAMP(millis_expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Converts a number of milliseconds since epoch into a timestamp.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="min">MIN<a href="#min" class="hash-link" aria-label="Direct link to MIN" title="Direct link to MIN"></a></h2><p><code>MIN(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns the minimum value of a set of values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mod">MOD<a href="#mod" class="hash-link" aria-label="Direct link to MOD" title="Direct link to MOD"></a></h2><p><code>MOD(x, y)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates x modulo y, or the remainder of x divided by y.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_append">MV_APPEND<a href="#mv_append" class="hash-link" aria-label="Direct link to MV_APPEND" title="Direct link to MV_APPEND"></a></h2><p><code>MV_APPEND(arr1, expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Adds the expression to the end of the array.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_concat">MV_CONCAT<a href="#mv_concat" class="hash-link" aria-label="Direct link to MV_CONCAT" title="Direct link to MV_CONCAT"></a></h2><p><code>MV_CONCAT(arr1, arr2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Concatenates two arrays.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_contains">MV_CONTAINS<a href="#mv_contains" class="hash-link" aria-label="Direct link to MV_CONTAINS" title="Direct link to MV_CONTAINS"></a></h2><p><code>MV_CONTAINS(arr, expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Returns true if the expression is in the array, false otherwise.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_filter_none">MV_FILTER_NONE<a href="#mv_filter_none" class="hash-link" aria-label="Direct link to MV_FILTER_NONE" title="Direct link to MV_FILTER_NONE"></a></h2><p><code>MV_FILTER_NONE(expr, arr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Filters a multi-value expression to include no values contained in the array.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_filter_only">MV_FILTER_ONLY<a href="#mv_filter_only" class="hash-link" aria-label="Direct link to MV_FILTER_ONLY" title="Direct link to MV_FILTER_ONLY"></a></h2><p><code>MV_FILTER_ONLY(expr, arr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Filters a multi-value expression to include only values contained in the array.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_length">MV_LENGTH<a href="#mv_length" class="hash-link" aria-label="Direct link to MV_LENGTH" title="Direct link to MV_LENGTH"></a></h2><p><code>MV_LENGTH(arr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Returns the length of an array expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_offset">MV_OFFSET<a href="#mv_offset" class="hash-link" aria-label="Direct link to MV_OFFSET" title="Direct link to MV_OFFSET"></a></h2><p><code>MV_OFFSET(arr, long)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Returns the array element at the given zero-based index.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_offset_of">MV_OFFSET_OF<a href="#mv_offset_of" class="hash-link" aria-label="Direct link to MV_OFFSET_OF" title="Direct link to MV_OFFSET_OF"></a></h2><p><code>MV_OFFSET_OF(arr, expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Returns the zero-based index of the first occurrence of a given expression in the array.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_ordinal">MV_ORDINAL<a href="#mv_ordinal" class="hash-link" aria-label="Direct link to MV_ORDINAL" title="Direct link to MV_ORDINAL"></a></h2><p><code>MV_ORDINAL(arr, long)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Returns the array element at the given one-based index.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_ordinal_of">MV_ORDINAL_OF<a href="#mv_ordinal_of" class="hash-link" aria-label="Direct link to MV_ORDINAL_OF" title="Direct link to MV_ORDINAL_OF"></a></h2><p><code>MV_ORDINAL_OF(arr, expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Returns the one-based index of the first occurrence of a given expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_overlap">MV_OVERLAP<a href="#mv_overlap" class="hash-link" aria-label="Direct link to MV_OVERLAP" title="Direct link to MV_OVERLAP"></a></h2><p><code>MV_OVERLAP(arr1, arr2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Returns true if the two arrays have any elements in common, false otherwise.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_prepend">MV_PREPEND<a href="#mv_prepend" class="hash-link" aria-label="Direct link to MV_PREPEND" title="Direct link to MV_PREPEND"></a></h2><p><code>MV_PREPEND(expr, arr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Adds the expression to the beginning of the array.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_slice">MV_SLICE<a href="#mv_slice" class="hash-link" aria-label="Direct link to MV_SLICE" title="Direct link to MV_SLICE"></a></h2><p><code>MV_SLICE(arr, start, end)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Returns a slice of the array from the zero-based start and end indexes.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="mv_to_string">MV_TO_STRING<a href="#mv_to_string" class="hash-link" aria-label="Direct link to MV_TO_STRING" title="Direct link to MV_TO_STRING"></a></h2><p><code>MV_TO_STRING(arr, str)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Joins all elements of the array together by the given delimiter.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="nullif">NULLIF<a href="#nullif" class="hash-link" aria-label="Direct link to NULLIF" title="Direct link to NULLIF"></a></h2><p><code>NULLIF(value1, value2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#other-scalar-functions">Scalar, other</a></p><p>Returns NULL if two values are equal, else returns the first value.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="nvl">NVL<a href="#nvl" class="hash-link" aria-label="Direct link to NVL" title="Direct link to NVL"></a></h2><p><code>NVL(e1, e2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#other-scalar-functions">Scalar, other</a></p><p>Returns <code>e2</code> if <code>e1</code> is null, else returns <code>e1</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="parse_json">PARSE_JSON<a href="#parse_json" class="hash-link" aria-label="Direct link to PARSE_JSON" title="Direct link to PARSE_JSON"></a></h2><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-json-functions">JSON</a></p><p><code>PARSE_JSON(expr)</code></p><p>Parses <code>expr</code> into a <code>COMPLEX&lt;json&gt;</code> object. This operator deserializes JSON values when processing them, translating stringified JSON into a nested structure. If the input is not a <code>VARCHAR</code> or it is invalid JSON, this function will result in an error.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="parse_long">PARSE_LONG<a href="#parse_long" class="hash-link" aria-label="Direct link to PARSE_LONG" title="Direct link to PARSE_LONG"></a></h2><p><code>PARSE_LONG(&lt;CHARACTER&gt;, [&lt;INTEGER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Converts a string into a BIGINT with the given base or into a DECIMAL data type if the base is not specified.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="position">POSITION<a href="#position" class="hash-link" aria-label="Direct link to POSITION" title="Direct link to POSITION"></a></h2><p><code>POSITION(&lt;CHARACTER&gt; IN &lt;CHARACTER&gt; [FROM &lt;INTEGER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns the one-based index position of a substring within an expression, optionally starting from a given one-based index.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="power">POWER<a href="#power" class="hash-link" aria-label="Direct link to POWER" title="Direct link to POWER"></a></h2><p><code>POWER(expr, power)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates a numerical expression raised to the specified power.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="radians">RADIANS<a href="#radians" class="hash-link" aria-label="Direct link to RADIANS" title="Direct link to RADIANS"></a></h2><p><code>RADIANS(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Converts an angle from degrees to radians.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="regexp_extract">REGEXP_EXTRACT<a href="#regexp_extract" class="hash-link" aria-label="Direct link to REGEXP_EXTRACT" title="Direct link to REGEXP_EXTRACT"></a></h2><p><code>REGEXP_EXTRACT(&lt;CHARACTER&gt;, &lt;CHARACTER&gt;, [&lt;INTEGER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Applies a regular expression to the string expression and returns the _n_th match.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="regexp_like">REGEXP_LIKE<a href="#regexp_like" class="hash-link" aria-label="Direct link to REGEXP_LIKE" title="Direct link to REGEXP_LIKE"></a></h2><p><code>REGEXP_LIKE(&lt;CHARACTER&gt;, &lt;CHARACTER&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns true or false signifying whether the regular expression finds a match in the string expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="regexp_replace">REGEXP_REPLACE<a href="#regexp_replace" class="hash-link" aria-label="Direct link to REGEXP_REPLACE" title="Direct link to REGEXP_REPLACE"></a></h2><p><code>REGEXP_REPLACE(&lt;CHARACTER&gt;, &lt;CHARACTER&gt;, &lt;CHARACTER&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Replaces all occurrences of a regular expression in a string expression with a replacement string. The replacement
string may refer to capture groups using <code>$1</code>, <code>$2</code>, etc.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="repeat">REPEAT<a href="#repeat" class="hash-link" aria-label="Direct link to REPEAT" title="Direct link to REPEAT"></a></h2><p><code>REPEAT(&lt;CHARACTER&gt;, [&lt;INTEGER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Repeats the string expression an integer number of times.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="replace">REPLACE<a href="#replace" class="hash-link" aria-label="Direct link to REPLACE" title="Direct link to REPLACE"></a></h2><p><code>REPLACE(expr, pattern, replacement)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Replaces a pattern with another string in the given expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="reverse">REVERSE<a href="#reverse" class="hash-link" aria-label="Direct link to REVERSE" title="Direct link to REVERSE"></a></h2><p><code>REVERSE(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Reverses the given expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="right">RIGHT<a href="#right" class="hash-link" aria-label="Direct link to RIGHT" title="Direct link to RIGHT"></a></h2><p><code>RIGHT(expr, [length])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns the rightmost number of characters from an expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="round">ROUND<a href="#round" class="hash-link" aria-label="Direct link to ROUND" title="Direct link to ROUND"></a></h2><p><code>ROUND(expr[, digits])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the rounded value for a numerical expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="rpad">RPAD<a href="#rpad" class="hash-link" aria-label="Direct link to RPAD" title="Direct link to RPAD"></a></h2><p><code>RPAD(&lt;CHARACTER&gt;, &lt;INTEGER&gt;, [&lt;CHARACTER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns the rightmost number of characters from an expression, optionally padded with the given characters.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="rtrim">RTRIM<a href="#rtrim" class="hash-link" aria-label="Direct link to RTRIM" title="Direct link to RTRIM"></a></h2><p><code>RTRIM(&lt;CHARACTER&gt;, [&lt;CHARACTER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Trims characters from the trailing end of an expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="safe_divide">SAFE_DIVIDE<a href="#safe_divide" class="hash-link" aria-label="Direct link to SAFE_DIVIDE" title="Direct link to SAFE_DIVIDE"></a></h2><p><code>SAFE_DIVIDE(x, y)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Returns <code>x</code> divided by <code>y</code>, guarded on division by 0.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sin">SIN<a href="#sin" class="hash-link" aria-label="Direct link to SIN" title="Direct link to SIN"></a></h2><p><code>SIN(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the trigonometric sine of an angle expressed in radians.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sqrt">SQRT<a href="#sqrt" class="hash-link" aria-label="Direct link to SQRT" title="Direct link to SQRT"></a></h2><p><code>SQRT(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the square root of a numeric expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="stddev">STDDEV<a href="#stddev" class="hash-link" aria-label="Direct link to STDDEV" title="Direct link to STDDEV"></a></h2><p><code>STDDEV(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Alias for <a href="#stddev_samp"><code>STDDEV_SAMP</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="stddev_pop">STDDEV_POP<a href="#stddev_pop" class="hash-link" aria-label="Direct link to STDDEV_POP" title="Direct link to STDDEV_POP"></a></h2><p><code>STDDEV_POP(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Calculates the population standard deviation of a set of values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="stddev_samp">STDDEV_SAMP<a href="#stddev_samp" class="hash-link" aria-label="Direct link to STDDEV_SAMP" title="Direct link to STDDEV_SAMP"></a></h2><p><code>STDDEV_SAMP(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Calculates the sample standard deviation of a set of values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="string_agg">STRING_AGG<a href="#string_agg" class="hash-link" aria-label="Direct link to STRING_AGG" title="Direct link to STRING_AGG"></a></h2><p><code>STRING_AGG(expr, separator, [size])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Collects all values of an expression into a single string.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="string_to_array">STRING_TO_ARRAY<a href="#string_to_array" class="hash-link" aria-label="Direct link to STRING_TO_ARRAY" title="Direct link to STRING_TO_ARRAY"></a></h2><p><code>STRING_TO_ARRAY(str1, str2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-array-functions">Array</a></p><p>Splits <code>str1</code> into an array on the delimiter specified by <code>str2</code>, which is a regular expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="string_format">STRING_FORMAT<a href="#string_format" class="hash-link" aria-label="Direct link to STRING_FORMAT" title="Direct link to STRING_FORMAT"></a></h2><p><code>STRING_FORMAT(pattern[, args...])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns a string formatted in accordance to Java&#x27;s String.format method.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="string_to_mv">STRING_TO_MV<a href="#string_to_mv" class="hash-link" aria-label="Direct link to STRING_TO_MV" title="Direct link to STRING_TO_MV"></a></h2><p><code>STRING_TO_MV(str1, str2)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-multivalue-string-functions">Multi-value string</a></p><p>Converts a string into an array, split by the given delimiter.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="strlen">STRLEN<a href="#strlen" class="hash-link" aria-label="Direct link to STRLEN" title="Direct link to STRLEN"></a></h2><p><code>STRLEN(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Alias for <a href="#length"><code>LENGTH</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="strpos">STRPOS<a href="#strpos" class="hash-link" aria-label="Direct link to STRPOS" title="Direct link to STRPOS"></a></h2><p><code>STRPOS(&lt;CHARACTER&gt;, &lt;CHARACTER&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns the one-based index position of a substring within an expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="substr">SUBSTR<a href="#substr" class="hash-link" aria-label="Direct link to SUBSTR" title="Direct link to SUBSTR"></a></h2><p><code>SUBSTR(&lt;CHARACTER&gt;, &lt;INTEGER&gt;, [&lt;INTEGER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Alias for <a href="#substring"><code>SUBSTRING</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="substring">SUBSTRING<a href="#substring" class="hash-link" aria-label="Direct link to SUBSTRING" title="Direct link to SUBSTRING"></a></h2><p><code>SUBSTRING(&lt;CHARACTER&gt;, &lt;INTEGER&gt;, [&lt;INTEGER&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns a substring of the expression starting at a given one-based index.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sum">SUM<a href="#sum" class="hash-link" aria-label="Direct link to SUM" title="Direct link to SUM"></a></h2><p><code>SUM(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Calculates the sum of a set of values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="tan">TAN<a href="#tan" class="hash-link" aria-label="Direct link to TAN" title="Direct link to TAN"></a></h2><p><code>TAN(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Calculates the trigonometric tangent of an angle expressed in radians.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="tdigest_generate_sketch">TDIGEST_GENERATE_SKETCH<a href="#tdigest_generate_sketch" class="hash-link" aria-label="Direct link to TDIGEST_GENERATE_SKETCH" title="Direct link to TDIGEST_GENERATE_SKETCH"></a></h2><p><code>TDIGEST_GENERATE_SKETCH(expr, [compression])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Generates a T-digest sketch from values of the specified expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="tdigest_quantile">TDIGEST_QUANTILE<a href="#tdigest_quantile" class="hash-link" aria-label="Direct link to TDIGEST_QUANTILE" title="Direct link to TDIGEST_QUANTILE"></a></h2><p><code>TDIGEST_QUANTILE(expr, quantileFraction, [compression])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Returns the quantile for the specified fraction from a T-Digest sketch constructed from values of the expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="textcat">TEXTCAT<a href="#textcat" class="hash-link" aria-label="Direct link to TEXTCAT" title="Direct link to TEXTCAT"></a></h2><p><code>TEXTCAT(&lt;CHARACTER&gt;, &lt;CHARACTER&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Concatenates two string expressions.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="theta_sketch_estimate">THETA_SKETCH_ESTIMATE<a href="#theta_sketch_estimate" class="hash-link" aria-label="Direct link to THETA_SKETCH_ESTIMATE" title="Direct link to THETA_SKETCH_ESTIMATE"></a></h2><p><code>THETA_SKETCH_ESTIMATE(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns the distinct count estimate from a Theta sketch.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="theta_sketch_estimate_with_error_bounds">THETA_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS<a href="#theta_sketch_estimate_with_error_bounds" class="hash-link" aria-label="Direct link to THETA_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS" title="Direct link to THETA_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS"></a></h2><p><code>THETA_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS(expr, errorBoundsStdDev)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns the distinct count estimate and error bounds from a Theta sketch.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="theta_sketch_intersect">THETA_SKETCH_INTERSECT<a href="#theta_sketch_intersect" class="hash-link" aria-label="Direct link to THETA_SKETCH_INTERSECT" title="Direct link to THETA_SKETCH_INTERSECT"></a></h2><p><code>THETA_SKETCH_INTERSECT([size], expr0, expr1, ...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns an intersection of Theta sketches.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="theta_sketch_not">THETA_SKETCH_NOT<a href="#theta_sketch_not" class="hash-link" aria-label="Direct link to THETA_SKETCH_NOT" title="Direct link to THETA_SKETCH_NOT"></a></h2><p><code>THETA_SKETCH_NOT([size], expr0, expr1, ...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns a set difference of Theta sketches.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="theta_sketch_union">THETA_SKETCH_UNION<a href="#theta_sketch_union" class="hash-link" aria-label="Direct link to THETA_SKETCH_UNION" title="Direct link to THETA_SKETCH_UNION"></a></h2><p><code>THETA_SKETCH_UNION([size], expr0, expr1, ...)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#sketch-functions">Scalar, sketch</a></p><p>Returns a union of Theta sketches.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="time_ceil">TIME_CEIL<a href="#time_ceil" class="hash-link" aria-label="Direct link to TIME_CEIL" title="Direct link to TIME_CEIL"></a></h2><p><code>TIME_CEIL(&lt;TIMESTAMP&gt;, &lt;period&gt;, [&lt;origin&gt;, [&lt;timezone&gt;]])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Rounds up a timestamp by a given time period, optionally from some reference time or timezone.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="time_extract">TIME_EXTRACT<a href="#time_extract" class="hash-link" aria-label="Direct link to TIME_EXTRACT" title="Direct link to TIME_EXTRACT"></a></h2><p><code>TIME_EXTRACT(&lt;TIMESTAMP&gt;, [&lt;unit&gt;, [&lt;timezone&gt;]])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Extracts the value of some unit of the timestamp and returns the number.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="time_floor">TIME_FLOOR<a href="#time_floor" class="hash-link" aria-label="Direct link to TIME_FLOOR" title="Direct link to TIME_FLOOR"></a></h2><p><code>TIME_FLOOR(&lt;TIMESTAMP&gt;, &lt;period&gt;, [&lt;origin&gt;, [&lt;timezone&gt;]])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Rounds down a timestamp by a given time period, optionally from some reference time or timezone.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="time_format">TIME_FORMAT<a href="#time_format" class="hash-link" aria-label="Direct link to TIME_FORMAT" title="Direct link to TIME_FORMAT"></a></h2><p><code>TIME_FORMAT(&lt;TIMESTAMP&gt;, [&lt;pattern&gt;, [&lt;timezone&gt;]])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Formats a timestamp as a string.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="time_in_interval">TIME_IN_INTERVAL<a href="#time_in_interval" class="hash-link" aria-label="Direct link to TIME_IN_INTERVAL" title="Direct link to TIME_IN_INTERVAL"></a></h2><p><code>TIME_IN_INTERVAL(&lt;TIMESTAMP&gt;, &lt;CHARACTER&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Returns whether a timestamp is contained within a particular interval, formatted as a string.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="time_parse">TIME_PARSE<a href="#time_parse" class="hash-link" aria-label="Direct link to TIME_PARSE" title="Direct link to TIME_PARSE"></a></h2><p><code>TIME_PARSE(&lt;string_expr&gt;, [&lt;pattern&gt;, [&lt;timezone&gt;]])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Parses a string into a timestamp.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="time_shift">TIME_SHIFT<a href="#time_shift" class="hash-link" aria-label="Direct link to TIME_SHIFT" title="Direct link to TIME_SHIFT"></a></h2><p><code>TIME_SHIFT(&lt;TIMESTAMP&gt;, &lt;period&gt;, &lt;step&gt;, [&lt;timezone&gt;])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Shifts a timestamp forwards or backwards by a given number of time units.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="timestamp_to_millis">TIMESTAMP_TO_MILLIS<a href="#timestamp_to_millis" class="hash-link" aria-label="Direct link to TIMESTAMP_TO_MILLIS" title="Direct link to TIMESTAMP_TO_MILLIS"></a></h2><p><code>TIMESTAMP_TO_MILLIS(&lt;TIMESTAMP&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Returns the number of milliseconds since epoch for the given timestamp.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="timestampadd">TIMESTAMPADD<a href="#timestampadd" class="hash-link" aria-label="Direct link to TIMESTAMPADD" title="Direct link to TIMESTAMPADD"></a></h2><p><code>TIMESTAMPADD(&lt;unit&gt;, &lt;count&gt;, &lt;TIMESTAMP&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Adds a certain amount of time to a given timestamp.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="timestampdiff">TIMESTAMPDIFF<a href="#timestampdiff" class="hash-link" aria-label="Direct link to TIMESTAMPDIFF" title="Direct link to TIMESTAMPDIFF"></a></h2><p><code>TIMESTAMPDIFF(&lt;unit&gt;, &lt;TIMESTAMP&gt;, &lt;TIMESTAMP&gt;)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#date-and-time-functions">Scalar, date and time</a></p><p>Takes the difference between two timestamps, returning the results in the given units.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="to_json_string">TO_JSON_STRING<a href="#to_json_string" class="hash-link" aria-label="Direct link to TO_JSON_STRING" title="Direct link to TO_JSON_STRING"></a></h2><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-json-functions">JSON</a></p><p><code>TO_JSON_STRING(expr)</code></p><p>Serializes <code>expr</code> into a JSON string.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="trim">TRIM<a href="#trim" class="hash-link" aria-label="Direct link to TRIM" title="Direct link to TRIM"></a></h2><p><code>TRIM([BOTH|LEADING|TRAILING] [&lt;chars&gt; FROM] expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Trims the leading or trailing characters of an expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="trunc">TRUNC<a href="#trunc" class="hash-link" aria-label="Direct link to TRUNC" title="Direct link to TRUNC"></a></h2><p><code>TRUNC(expr[, digits])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Alias for <a href="#truncate"><code>TRUNCATE</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="truncate">TRUNCATE<a href="#truncate" class="hash-link" aria-label="Direct link to TRUNCATE" title="Direct link to TRUNCATE"></a></h2><p><code>TRUNCATE(expr[, digits])</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#numeric-functions">Scalar, numeric</a></p><p>Truncates a numerical expression to a specific number of decimal digits.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="try_parse_json">TRY_PARSE_JSON<a href="#try_parse_json" class="hash-link" aria-label="Direct link to TRY_PARSE_JSON" title="Direct link to TRY_PARSE_JSON"></a></h2><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-json-functions">JSON</a></p><p><code>TRY_PARSE_JSON(expr)</code></p><p>Parses <code>expr</code> into a <code>COMPLEX&lt;json&gt;</code> object. This operator deserializes JSON values when processing them, translating stringified JSON into a nested structure. If the input is not a <code>VARCHAR</code> or it is invalid JSON, this function will result in a <code>NULL</code> value.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="unnest">UNNEST<a href="#unnest" class="hash-link" aria-label="Direct link to UNNEST" title="Direct link to UNNEST"></a></h2><p><code>UNNEST(source_expression) as table_alias_name(column_alias_name)</code></p><p>Unnests a source expression that includes arrays into a target column with an aliased name. </p><p>For more information, see <a href="/docs/27.0.0/querying/sql#unnest">UNNEST</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="upper">UPPER<a href="#upper" class="hash-link" aria-label="Direct link to UPPER" title="Direct link to UPPER"></a></h2><p><code>UPPER(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-scalar#string-functions">Scalar, string</a></p><p>Returns the expression in uppercase.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="var_pop">VAR_POP<a href="#var_pop" class="hash-link" aria-label="Direct link to VAR_POP" title="Direct link to VAR_POP"></a></h2><p><code>VAR_POP(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Calculates the population variance of a set of values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="var_samp">VAR_SAMP<a href="#var_samp" class="hash-link" aria-label="Direct link to VAR_SAMP" title="Direct link to VAR_SAMP"></a></h2><p><code>VAR_SAMP(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Calculates the sample variance of a set of values.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="variance">VARIANCE<a href="#variance" class="hash-link" aria-label="Direct link to VARIANCE" title="Direct link to VARIANCE"></a></h2><p><code>VARIANCE(expr)</code></p><p><strong>Function type:</strong> <a href="/docs/27.0.0/querying/sql-aggregations">Aggregation</a></p><p>Alias for <a href="#var_samp"><code>VAR_SAMP</code></a>.</p></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/docs/27.0.0/querying/sql-json-functions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">JSON functions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/docs/27.0.0/querying/sql-query-context"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SQL query context</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#abs" class="table-of-contents__link toc-highlight">ABS</a></li><li><a href="#acos" class="table-of-contents__link toc-highlight">ACOS</a></li><li><a href="#any_value" class="table-of-contents__link toc-highlight">ANY_VALUE</a></li><li><a href="#approx_count_distinct" class="table-of-contents__link toc-highlight">APPROX_COUNT_DISTINCT</a></li><li><a href="#approx_count_distinct_ds_hll" class="table-of-contents__link toc-highlight">APPROX_COUNT_DISTINCT_DS_HLL</a></li><li><a href="#approx_count_distinct_ds_theta" class="table-of-contents__link toc-highlight">APPROX_COUNT_DISTINCT_DS_THETA</a></li><li><a href="#approx_quantile" class="table-of-contents__link toc-highlight">APPROX_QUANTILE</a></li><li><a href="#approx_quantile_ds" class="table-of-contents__link toc-highlight">APPROX_QUANTILE_DS</a></li><li><a href="#approx_quantile_fixed_buckets" class="table-of-contents__link toc-highlight">APPROX_QUANTILE_FIXED_BUCKETS</a></li><li><a href="#array" class="table-of-contents__link toc-highlight">ARRAY[]</a></li><li><a href="#array_agg" class="table-of-contents__link toc-highlight">ARRAY_AGG</a></li><li><a href="#array_append" class="table-of-contents__link toc-highlight">ARRAY_APPEND</a></li><li><a href="#array_concat" class="table-of-contents__link toc-highlight">ARRAY_CONCAT</a></li><li><a href="#array_concat_agg" class="table-of-contents__link toc-highlight">ARRAY_CONCAT_AGG</a></li><li><a href="#array_contains" class="table-of-contents__link toc-highlight">ARRAY_CONTAINS</a></li><li><a href="#array_length" class="table-of-contents__link toc-highlight">ARRAY_LENGTH</a></li><li><a href="#array_offset" class="table-of-contents__link toc-highlight">ARRAY_OFFSET</a></li><li><a href="#array_offset_of" class="table-of-contents__link toc-highlight">ARRAY_OFFSET_OF</a></li><li><a href="#array_ordinal" class="table-of-contents__link toc-highlight">ARRAY_ORDINAL</a></li><li><a href="#array_ordinal_of" class="table-of-contents__link toc-highlight">ARRAY_ORDINAL_OF</a></li><li><a href="#array_overlap" class="table-of-contents__link toc-highlight">ARRAY_OVERLAP</a></li><li><a href="#array_prepend" class="table-of-contents__link toc-highlight">ARRAY_PREPEND</a></li><li><a href="#array_slice" class="table-of-contents__link toc-highlight">ARRAY_SLICE</a></li><li><a href="#array_to_mv" class="table-of-contents__link toc-highlight">ARRAY_TO_MV</a></li><li><a href="#array_to_string" class="table-of-contents__link toc-highlight">ARRAY_TO_STRING</a></li><li><a href="#asin" class="table-of-contents__link toc-highlight">ASIN</a></li><li><a href="#atan" class="table-of-contents__link toc-highlight">ATAN</a></li><li><a href="#atan2" class="table-of-contents__link toc-highlight">ATAN2</a></li><li><a href="#avg" class="table-of-contents__link toc-highlight">AVG</a></li><li><a href="#bit_and" class="table-of-contents__link toc-highlight">BIT_AND</a></li><li><a href="#bit_or" class="table-of-contents__link toc-highlight">BIT_OR</a></li><li><a href="#bit_xor" class="table-of-contents__link toc-highlight">BIT_XOR</a></li><li><a href="#bitwise_and" class="table-of-contents__link toc-highlight">BITWISE_AND</a></li><li><a href="#bitwise_complement" class="table-of-contents__link toc-highlight">BITWISE_COMPLEMENT</a></li><li><a href="#bitwise_convert_double_to_long_bits" class="table-of-contents__link toc-highlight">BITWISE_CONVERT_DOUBLE_TO_LONG_BITS</a></li><li><a href="#bitwise_convert_long_bits_to_double" class="table-of-contents__link toc-highlight">BITWISE_CONVERT_LONG_BITS_TO_DOUBLE</a></li><li><a href="#bitwise_or" class="table-of-contents__link toc-highlight">BITWISE_OR</a></li><li><a href="#bitwise_shift_left" class="table-of-contents__link toc-highlight">BITWISE_SHIFT_LEFT</a></li><li><a href="#bitwise_shift_right" class="table-of-contents__link toc-highlight">BITWISE_SHIFT_RIGHT</a></li><li><a href="#bitwise_xor" class="table-of-contents__link toc-highlight">BITWISE_XOR</a></li><li><a href="#bloom_filter" class="table-of-contents__link toc-highlight">BLOOM_FILTER</a></li><li><a href="#bloom_filter_test" class="table-of-contents__link toc-highlight">BLOOM_FILTER_TEST</a></li><li><a href="#btrim" class="table-of-contents__link toc-highlight">BTRIM</a></li><li><a href="#case" class="table-of-contents__link toc-highlight">CASE</a></li><li><a href="#cast" class="table-of-contents__link toc-highlight">CAST</a></li><li><a href="#ceil-date-and-time" class="table-of-contents__link toc-highlight">CEIL (date and time)</a></li><li><a href="#ceil-numeric" class="table-of-contents__link toc-highlight">CEIL (numeric)</a></li><li><a href="#char_length" class="table-of-contents__link toc-highlight">CHAR_LENGTH</a></li><li><a href="#character_length" class="table-of-contents__link toc-highlight">CHARACTER_LENGTH</a></li><li><a href="#coalesce" class="table-of-contents__link toc-highlight">COALESCE</a></li><li><a href="#concat" class="table-of-contents__link toc-highlight">CONCAT</a></li><li><a href="#contains_string" class="table-of-contents__link toc-highlight">CONTAINS_STRING</a></li><li><a href="#cos" class="table-of-contents__link toc-highlight">COS</a></li><li><a href="#cot" class="table-of-contents__link toc-highlight">COT</a></li><li><a href="#count" class="table-of-contents__link toc-highlight">COUNT</a></li><li><a href="#current_date" class="table-of-contents__link toc-highlight">CURRENT_DATE</a></li><li><a href="#current_timestamp" class="table-of-contents__link toc-highlight">CURRENT_TIMESTAMP</a></li><li><a href="#date_trunc" class="table-of-contents__link toc-highlight">DATE_TRUNC</a></li><li><a href="#degrees" class="table-of-contents__link toc-highlight">DEGREES</a></li><li><a href="#div" class="table-of-contents__link toc-highlight">DIV</a></li><li><a href="#ds_cdf" class="table-of-contents__link toc-highlight">DS_CDF</a></li><li><a href="#ds_get_quantile" class="table-of-contents__link toc-highlight">DS_GET_QUANTILE</a></li><li><a href="#ds_get_quantiles" class="table-of-contents__link toc-highlight">DS_GET_QUANTILES</a></li><li><a href="#ds_histogram" class="table-of-contents__link toc-highlight">DS_HISTOGRAM</a></li><li><a href="#ds_hll" class="table-of-contents__link toc-highlight">DS_HLL</a></li><li><a href="#ds_quantile_summary" class="table-of-contents__link toc-highlight">DS_QUANTILE_SUMMARY</a></li><li><a href="#ds_quantiles_sketch" class="table-of-contents__link toc-highlight">DS_QUANTILES_SKETCH</a></li><li><a href="#ds_rank" class="table-of-contents__link toc-highlight">DS_RANK</a></li><li><a href="#ds_theta" class="table-of-contents__link toc-highlight">DS_THETA</a></li><li><a href="#ds_tuple_doubles" class="table-of-contents__link toc-highlight">DS_TUPLE_DOUBLES</a></li><li><a href="#ds_tuple_doubles_intersect" class="table-of-contents__link toc-highlight">DS_TUPLE_DOUBLES_INTERSECT</a></li><li><a href="#ds_tuple_doubles_metrics_sum_estimate" class="table-of-contents__link toc-highlight">DS_TUPLE_DOUBLES_METRICS_SUM_ESTIMATE</a></li><li><a href="#ds_tuple_doubles_not" class="table-of-contents__link toc-highlight">DS_TUPLE_DOUBLES_NOT</a></li><li><a href="#ds_tuple_doubles_union" class="table-of-contents__link toc-highlight">DS_TUPLE_DOUBLES_UNION</a></li><li><a href="#earliest" class="table-of-contents__link toc-highlight">EARLIEST</a></li><li><a href="#earliest_by" class="table-of-contents__link toc-highlight">EARLIEST_BY</a></li><li><a href="#exp" class="table-of-contents__link toc-highlight">EXP</a></li><li><a href="#extract" class="table-of-contents__link toc-highlight">EXTRACT</a></li><li><a href="#floor-date-and-time" class="table-of-contents__link toc-highlight">FLOOR (date and time)</a></li><li><a href="#floor-numeric" class="table-of-contents__link toc-highlight">FLOOR (numeric)</a></li><li><a href="#greatest" class="table-of-contents__link toc-highlight">GREATEST</a></li><li><a href="#grouping" class="table-of-contents__link toc-highlight">GROUPING</a></li><li><a href="#hll_sketch_estimate" class="table-of-contents__link toc-highlight">HLL_SKETCH_ESTIMATE</a></li><li><a href="#hll_sketch_estimate_with_error_bounds" class="table-of-contents__link toc-highlight">HLL_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS</a></li><li><a href="#hll_sketch_to_string" class="table-of-contents__link toc-highlight">HLL_SKETCH_TO_STRING</a></li><li><a href="#hll_sketch_union" class="table-of-contents__link toc-highlight">HLL_SKETCH_UNION</a></li><li><a href="#human_readable_binary_byte_format" class="table-of-contents__link toc-highlight">HUMAN_READABLE_BINARY_BYTE_FORMAT</a></li><li><a href="#human_readable_decimal_byte_format" class="table-of-contents__link toc-highlight">HUMAN_READABLE_DECIMAL_BYTE_FORMAT</a></li><li><a href="#human_readable_decimal_format" class="table-of-contents__link toc-highlight">HUMAN_READABLE_DECIMAL_FORMAT</a></li><li><a href="#icontains_string" class="table-of-contents__link toc-highlight">ICONTAINS_STRING</a></li><li><a href="#ipv4_match" class="table-of-contents__link toc-highlight">IPV4_MATCH</a></li><li><a href="#ipv4_parse" class="table-of-contents__link toc-highlight">IPV4_PARSE</a></li><li><a href="#ipv4_stringify" class="table-of-contents__link toc-highlight">IPV4_STRINGIFY</a></li><li><a href="#json_keys" class="table-of-contents__link toc-highlight">JSON_KEYS</a></li><li><a href="#json_object" class="table-of-contents__link toc-highlight">JSON_OBJECT</a></li><li><a href="#json_paths" class="table-of-contents__link toc-highlight">JSON_PATHS</a></li><li><a href="#json_query" class="table-of-contents__link toc-highlight">JSON_QUERY</a></li><li><a href="#json_value" class="table-of-contents__link toc-highlight">JSON_VALUE</a></li><li><a href="#latest" class="table-of-contents__link toc-highlight">LATEST</a></li><li><a href="#latest_by" class="table-of-contents__link toc-highlight">LATEST_BY</a></li><li><a href="#least" class="table-of-contents__link toc-highlight">LEAST</a></li><li><a href="#left" class="table-of-contents__link toc-highlight">LEFT</a></li><li><a href="#length" class="table-of-contents__link toc-highlight">LENGTH</a></li><li><a href="#ln" class="table-of-contents__link toc-highlight">LN</a></li><li><a href="#log10" class="table-of-contents__link toc-highlight">LOG10</a></li><li><a href="#lookup" class="table-of-contents__link toc-highlight">LOOKUP</a></li><li><a href="#lower" class="table-of-contents__link toc-highlight">LOWER</a></li><li><a href="#lpad" class="table-of-contents__link toc-highlight">LPAD</a></li><li><a href="#ltrim" class="table-of-contents__link toc-highlight">LTRIM</a></li><li><a href="#max" class="table-of-contents__link toc-highlight">MAX</a></li><li><a href="#millis_to_timestamp" class="table-of-contents__link toc-highlight">MILLIS_TO_TIMESTAMP</a></li><li><a href="#min" class="table-of-contents__link toc-highlight">MIN</a></li><li><a href="#mod" class="table-of-contents__link toc-highlight">MOD</a></li><li><a href="#mv_append" class="table-of-contents__link toc-highlight">MV_APPEND</a></li><li><a href="#mv_concat" class="table-of-contents__link toc-highlight">MV_CONCAT</a></li><li><a href="#mv_contains" class="table-of-contents__link toc-highlight">MV_CONTAINS</a></li><li><a href="#mv_filter_none" class="table-of-contents__link toc-highlight">MV_FILTER_NONE</a></li><li><a href="#mv_filter_only" class="table-of-contents__link toc-highlight">MV_FILTER_ONLY</a></li><li><a href="#mv_length" class="table-of-contents__link toc-highlight">MV_LENGTH</a></li><li><a href="#mv_offset" class="table-of-contents__link toc-highlight">MV_OFFSET</a></li><li><a href="#mv_offset_of" class="table-of-contents__link toc-highlight">MV_OFFSET_OF</a></li><li><a href="#mv_ordinal" class="table-of-contents__link toc-highlight">MV_ORDINAL</a></li><li><a href="#mv_ordinal_of" class="table-of-contents__link toc-highlight">MV_ORDINAL_OF</a></li><li><a href="#mv_overlap" class="table-of-contents__link toc-highlight">MV_OVERLAP</a></li><li><a href="#mv_prepend" class="table-of-contents__link toc-highlight">MV_PREPEND</a></li><li><a href="#mv_slice" class="table-of-contents__link toc-highlight">MV_SLICE</a></li><li><a href="#mv_to_string" class="table-of-contents__link toc-highlight">MV_TO_STRING</a></li><li><a href="#nullif" class="table-of-contents__link toc-highlight">NULLIF</a></li><li><a href="#nvl" class="table-of-contents__link toc-highlight">NVL</a></li><li><a href="#parse_json" class="table-of-contents__link toc-highlight">PARSE_JSON</a></li><li><a href="#parse_long" class="table-of-contents__link toc-highlight">PARSE_LONG</a></li><li><a href="#position" class="table-of-contents__link toc-highlight">POSITION</a></li><li><a href="#power" class="table-of-contents__link toc-highlight">POWER</a></li><li><a href="#radians" class="table-of-contents__link toc-highlight">RADIANS</a></li><li><a href="#regexp_extract" class="table-of-contents__link toc-highlight">REGEXP_EXTRACT</a></li><li><a href="#regexp_like" class="table-of-contents__link toc-highlight">REGEXP_LIKE</a></li><li><a href="#regexp_replace" class="table-of-contents__link toc-highlight">REGEXP_REPLACE</a></li><li><a href="#repeat" class="table-of-contents__link toc-highlight">REPEAT</a></li><li><a href="#replace" class="table-of-contents__link toc-highlight">REPLACE</a></li><li><a href="#reverse" class="table-of-contents__link toc-highlight">REVERSE</a></li><li><a href="#right" class="table-of-contents__link toc-highlight">RIGHT</a></li><li><a href="#round" class="table-of-contents__link toc-highlight">ROUND</a></li><li><a href="#rpad" class="table-of-contents__link toc-highlight">RPAD</a></li><li><a href="#rtrim" class="table-of-contents__link toc-highlight">RTRIM</a></li><li><a href="#safe_divide" class="table-of-contents__link toc-highlight">SAFE_DIVIDE</a></li><li><a href="#sin" class="table-of-contents__link toc-highlight">SIN</a></li><li><a href="#sqrt" class="table-of-contents__link toc-highlight">SQRT</a></li><li><a href="#stddev" class="table-of-contents__link toc-highlight">STDDEV</a></li><li><a href="#stddev_pop" class="table-of-contents__link toc-highlight">STDDEV_POP</a></li><li><a href="#stddev_samp" class="table-of-contents__link toc-highlight">STDDEV_SAMP</a></li><li><a href="#string_agg" class="table-of-contents__link toc-highlight">STRING_AGG</a></li><li><a href="#string_to_array" class="table-of-contents__link toc-highlight">STRING_TO_ARRAY</a></li><li><a href="#string_format" class="table-of-contents__link toc-highlight">STRING_FORMAT</a></li><li><a href="#string_to_mv" class="table-of-contents__link toc-highlight">STRING_TO_MV</a></li><li><a href="#strlen" class="table-of-contents__link toc-highlight">STRLEN</a></li><li><a href="#strpos" class="table-of-contents__link toc-highlight">STRPOS</a></li><li><a href="#substr" class="table-of-contents__link toc-highlight">SUBSTR</a></li><li><a href="#substring" class="table-of-contents__link toc-highlight">SUBSTRING</a></li><li><a href="#sum" class="table-of-contents__link toc-highlight">SUM</a></li><li><a href="#tan" class="table-of-contents__link toc-highlight">TAN</a></li><li><a href="#tdigest_generate_sketch" class="table-of-contents__link toc-highlight">TDIGEST_GENERATE_SKETCH</a></li><li><a href="#tdigest_quantile" class="table-of-contents__link toc-highlight">TDIGEST_QUANTILE</a></li><li><a href="#textcat" class="table-of-contents__link toc-highlight">TEXTCAT</a></li><li><a href="#theta_sketch_estimate" class="table-of-contents__link toc-highlight">THETA_SKETCH_ESTIMATE</a></li><li><a href="#theta_sketch_estimate_with_error_bounds" class="table-of-contents__link toc-highlight">THETA_SKETCH_ESTIMATE_WITH_ERROR_BOUNDS</a></li><li><a href="#theta_sketch_intersect" class="table-of-contents__link toc-highlight">THETA_SKETCH_INTERSECT</a></li><li><a href="#theta_sketch_not" class="table-of-contents__link toc-highlight">THETA_SKETCH_NOT</a></li><li><a href="#theta_sketch_union" class="table-of-contents__link toc-highlight">THETA_SKETCH_UNION</a></li><li><a href="#time_ceil" class="table-of-contents__link toc-highlight">TIME_CEIL</a></li><li><a href="#time_extract" class="table-of-contents__link toc-highlight">TIME_EXTRACT</a></li><li><a href="#time_floor" class="table-of-contents__link toc-highlight">TIME_FLOOR</a></li><li><a href="#time_format" class="table-of-contents__link toc-highlight">TIME_FORMAT</a></li><li><a href="#time_in_interval" class="table-of-contents__link toc-highlight">TIME_IN_INTERVAL</a></li><li><a href="#time_parse" class="table-of-contents__link toc-highlight">TIME_PARSE</a></li><li><a href="#time_shift" class="table-of-contents__link toc-highlight">TIME_SHIFT</a></li><li><a href="#timestamp_to_millis" class="table-of-contents__link toc-highlight">TIMESTAMP_TO_MILLIS</a></li><li><a href="#timestampadd" class="table-of-contents__link toc-highlight">TIMESTAMPADD</a></li><li><a href="#timestampdiff" class="table-of-contents__link toc-highlight">TIMESTAMPDIFF</a></li><li><a href="#to_json_string" class="table-of-contents__link toc-highlight">TO_JSON_STRING</a></li><li><a href="#trim" class="table-of-contents__link toc-highlight">TRIM</a></li><li><a href="#trunc" class="table-of-contents__link toc-highlight">TRUNC</a></li><li><a href="#truncate" class="table-of-contents__link toc-highlight">TRUNCATE</a></li><li><a href="#try_parse_json" class="table-of-contents__link toc-highlight">TRY_PARSE_JSON</a></li><li><a href="#unnest" class="table-of-contents__link toc-highlight">UNNEST</a></li><li><a href="#upper" class="table-of-contents__link toc-highlight">UPPER</a></li><li><a href="#var_pop" class="table-of-contents__link toc-highlight">VAR_POP</a></li><li><a href="#var_samp" class="table-of-contents__link toc-highlight">VAR_SAMP</a></li><li><a href="#variance" class="table-of-contents__link toc-highlight">VARIANCE</a></li></ul></div></div></div></div></main></div></div><footer class="footer"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="margin-bottom--sm"><img src="/img/favicon.png" class="themedImage_ToTc themedImage--light_HNdA footer__logo"><img src="/img/favicon.png" class="themedImage_ToTc themedImage--dark_i4oU footer__logo"></div><div class="footer__copyright">Copyright © 2023 Apache Software Foundation. Except where otherwise noted, licensed under CC BY-SA 4.0. Apache Druid, Druid, and the Druid logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.</div></div></div></footer></div>
<script src="/assets/js/runtime~main.5371e784.js"></script>
<script src="/assets/js/main.832012d1.js"></script>
</body>
</html>