v.19.17New Feature

Add _shard_num Virtual Column for the Distributed Engine #7624 (azat Khuzhin)

Add _shard_num virtual column for the Distributed engine #7624 (Azat Khuzhin)
Added a new virtual column named _shard_num for tables using the Distributed engine in ClickHouse.

Why it matters

This feature allows users to identify the shard number from which each row in a Distributed table originates. It helps in debugging, monitoring, and analyzing data distribution across shards, improving transparency and control over distributed queries.

How to use it

Users can simply include the _shard_num column in their SELECT queries on Distributed tables to retrieve the shard number of each row, for example:

SELECT _shard_num, * FROM distributed_table