Skip to content

Commit 50879c6

Browse files
authored
Create data-flow-cast.md
1 parent 5094a4b commit 50879c6

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: Rank transformation in mapping data flow
3+
description: Learn how to use a mapping data flow rank transformation to generate a ranking column in Azure Data Factory or Synapse Analytics pipelines.
4+
titleSuffix: Azure Data Factory & Azure Synapse
5+
author: kromerm
6+
ms.author: makromer
7+
ms.reviewer: makromer
8+
ms.service: data-factory
9+
ms.subservice: data-flows
10+
ms.topic: conceptual
11+
ms.custom: synapse
12+
ms.date: 09/09/2021
13+
---
14+
15+
# Rank transformation in mapping data flow
16+
17+
[!INCLUDE[appliesto-adf-asa-md](includes/appliesto-adf-asa-md.md)]
18+
19+
[!INCLUDE[data-flow-preamble](includes/data-flow-preamble.md)]
20+
21+
Use the rank transformation to generate an ordered ranking based upon sort conditions specified by the user.
22+
23+
> [!VIDEO https://www.microsoft.com/en-us/videoplayer/embed/RE4GGJo]
24+
25+
## Configuration
26+
27+
:::image type="content" source="media/data-flow/rank-configuration.png" alt-text="Rank settings":::
28+
29+
**Case insensitive:** If a sort column is of type string, case will be factored into the ranking.
30+
31+
**Dense:** If enabled, the rank column will be dense ranked. Each rank count will be a consecutive number and rank values won't be skipped after a tie.
32+
33+
**Rank column:** The name of the rank column generated. This column will be of type long.
34+
35+
**Sort conditions:** Choose which columns you're sorting by and in which order the sort happens. The order determines sorting priority.
36+
37+
The above configuration takes incoming basketball data and creates a rank column called 'pointsRanking'. The row with the highest value of the column *PTS* will have a *pointsRanking* value of 1.
38+
39+
## Data flow script
40+
41+
### Syntax
42+
43+
```
44+
<incomingStream>
45+
rank(
46+
desc(<sortColumn1>),
47+
asc(<sortColumn2>),
48+
...,
49+
caseInsensitive: { true | false }
50+
dense: { true | false }
51+
output(<rankColumn> as long)
52+
) ~> <sortTransformationName<>
53+
```
54+
55+
### Example
56+
57+
:::image type="content" source="media/data-flow/rank-configuration.png" alt-text="Rank settings":::
58+
59+
The data flow script for the above rank configuration is in the following code snippet.
60+
61+
```
62+
PruneColumns
63+
rank(
64+
desc(PTS, true),
65+
caseInsensitive: false,
66+
output(pointsRanking as long),
67+
dense: false
68+
) ~> RankByPoints
69+
```
70+
71+
## Next steps
72+
73+
Filter rows based upon the rank values using the [filter transformation](data-flow-filter.md).

0 commit comments

Comments
 (0)