Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
uniqArray
Description
TheArray combinator
can be applied to the uniq
function to calculate the approximate number of unique elements across all arrays,
using the uniqArray aggregate combinator function.
The uniqArray function is useful when you need to count unique elements across
multiple arrays in a dataset. It’s equivalent to using uniq(arrayJoin()), where
arrayJoin first flattens the arrays and then uniq counts the unique elements.
Example usage
In this example, we’ll use a sample dataset of user interests across different categories to demonstrate howuniqArray works. We’ll compare it with
uniq(arrayJoin()) to show the difference in counting unique elements.
Query
uniqArray function counts unique elements across all arrays combined, similar to uniq(arrayJoin()).
In this example:
uniqArrayreturns 5 because there are 5 unique interests across all users: ‘reading’, ‘gaming’, ‘music’, ‘sports’, ‘cooking’uniq(arrayJoin())also returns 5, showing that both functions count unique elements across all arrays
Response