match_number function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 19.0 and above

Important

This feature is in Beta. Workspace admins can control access to this feature from the Previews page. See Manage Azure Databricks previews.

Returns the sequential number of the match within each PARTITION BY group. Numbering starts at 1 in every partition and is independent across partitions. Distinct matches produced by AFTER MATCH SKIP are numbered in match order within the partition. Use this function only in the MEASURES and DEFINE clauses of MATCH_RECOGNIZE.

Syntax

match_number()

Arguments

This function takes no arguments.

Returns

A BIGINT greater than 0.

Common error conditions