v.21.11New Features

Support for Multidimensional Distance Functions and Tuple Operations in ClickHouse

Support multidimensional cosine distance and euclidean distance functions; L1, L2, Lp, Linf distances and norms. Scalar product on tuples and various arithmetic operators on tuples. This fully closes #4509 and even more. #27933 (Alexey Boykov).
Added support for multidimensional distance functions including cosine distance, euclidean distance, L1, L2, Lp, and Linf distances and norms, as well as scalar product and various arithmetic operations on tuples.

Why it matters

This feature provides extended mathematical and geometric computation capabilities directly in ClickHouse, enabling users to perform advanced vector and tuple-based calculations. It addresses the need for efficient and diverse distance metrics and tuple arithmetic, improving analytical and machine learning workflows within the database.

How to use it

Use the newly introduced functions for distances such as cosineDistance(), euclideanDistance(), and norms like L1, L2, Lp, Linf on multidimensional data represented as tuples. Leverage scalar product functions and arithmetic operators directly on tuple data types in SQL queries to perform these calculations.