Apache Druid supports two query languages: Druid SQL and native queries. This document describes the SQL language.
Druid supports string dimensions containing multiple values. This page describes the operations you can perform on multi-value string dimensions using Druid SQL. See SQL multi-value strings and native Multi-value dimensions for more information.
All array references in the multi-value string function documentation can refer to multi-value string columns or ARRAY types. These functions are largely identical to the array functions, but use VARCHAR types and behavior. Multi-value strings can also be converted to ARRAY types using MV_TO_ARRAY. For additional details about ARRAY types, see ARRAY data type documentation.
| Function | Description | 
|---|---|
| MV_FILTER_ONLY(expr, arr) | Filters multi-value exprto include only values contained in arrayarr. | 
| MV_FILTER_NONE(expr, arr) | Filters multi-value exprto include no values contained in arrayarr. | 
| MV_LENGTH(arr) | Returns length of the array expression. | 
| MV_OFFSET(arr, long) | Returns the array element at the 0-based index supplied, or null for an out of range index. | 
| MV_ORDINAL(arr, long) | Returns the array element at the 1-based index supplied, or null for an out of range index. | 
| MV_CONTAINS(arr, expr) | If expris a scalar type, returns 1 ifarrcontainsexpr. Ifexpris an array, returns 1 ifarrcontains all elements ofexpr. Otherwise returns 0. | 
| MV_OVERLAP(arr1, arr2) | Returns 1 if arr1andarr2have any elements in common, else 0. | 
| MV_OFFSET_OF(arr, expr) | Returns the 0-based index of the first occurrence of exprin the array. If no matching elements exist in the array, returns-1ornullifdruid.generic.useDefaultValueForNull=false. | 
| MV_ORDINAL_OF(arr, expr) | Returns the 1-based index of the first occurrence of exprin the array. If no matching elements exist in the array, returns-1ornullifdruid.generic.useDefaultValueForNull=false. | 
| MV_PREPEND(expr, arr) | Adds exprtoarrat the beginning, the resulting array type determined by the type of the array. | 
| MV_APPEND(arr1, expr) | Appends exprtoarr, the resulting array type determined by the type of the first array. | 
| MV_CONCAT(arr1, arr2) | Concatenates arr2toarr1. The resulting array type is determined by the type ofarr1. | 
| MV_SLICE(arr, start, end) | Returns the subarray of arrfrom the 0-based index start(inclusive) to end(exclusive), ornull, if start is less than 0, greater than length of arr or greater than end. | 
| MV_TO_STRING(arr, str) | Joins all elements of arrby the delimiter specified bystr. | 
| STRING_TO_MV(str1, str2) | Splits str1into an array on the delimiter specified bystr2, which is a regular expression. | 
| MV_TO_ARRAY(str) | Converts a multi-value string from a VARCHARto aVARCHAR ARRAY. |