> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Rank

export const ComponentMetadata = ({warehouses, unsupportedWarehouses = [], componentType, connectionInputs, connectionOutputs}) => {
  const allWarehouses = [...warehouses.map(w => ({
    name: w,
    supported: true
  })), ...unsupportedWarehouses.map(w => ({
    name: w,
    supported: false
  }))];
  return <div style={{
    background: 'var(--colors-background-light, #f9fafb)',
    border: '1px solid var(--colors-border-default, #e5e7eb)',
    borderRadius: '12px',
    padding: '20px 28px',
    marginBottom: '28px',
    boxShadow: '0 1px 4px rgba(0,0,0,0.10)'
  }}>
      <table style={{
    width: '100%',
    borderCollapse: 'collapse'
  }}>
        <tbody>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle',
    width: '180px'
  }}>Project Availability</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>
              <div style={{
    display: 'flex',
    flexWrap: 'wrap',
    gap: '8px'
  }}>
                {allWarehouses.map((w, i) => <span key={i} style={{
    background: w.supported ? '#dcfce7' : '#fee2e2',
    color: w.supported ? '#15803d' : '#b91c1c',
    border: `1px solid ${w.supported ? '#bbf7d0' : '#fca5a5'}`,
    borderRadius: '9999px',
    padding: '3px 12px',
    fontSize: '0.85rem',
    fontWeight: '500',
    whiteSpace: 'nowrap'
  }}>
                    {w.name} {w.supported ? '✅' : '❌'}
                  </span>)}
              </div>
            </td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Component Type</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{componentType}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Inputs</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{connectionInputs}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Outputs</td>
            <td style={{
    verticalAlign: 'middle'
  }}>{connectionOutputs}</td>
          </tr>
        </tbody>
      </table>
    </div>;
};

<ComponentMetadata warehouses={["Snowflake", "Databricks", "Amazon Redshift", "Google BigQuery"]} componentType="Transformation" connectionInputs="One" connectionOutputs="Unlimited" />

The **Rank** transformation component lets you determine the rank of a value in a group of values, and add this to your data as a new column.

It supports multiple SQL window functions: RANK, DENSE\_RANK, CUME\_DIST, PERCENT\_RANK, and ROW\_NUMBER. For more information, read the following documentation:

* [Snowflake window functions](https://docs.snowflake.com/en/sql-reference/functions-analytic.html)
* [Databricks window functions](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-window-functions)
* [Amazon Redshift window functions](https://docs.aws.amazon.com/redshift/latest/dg/c_Window_functions.html)
* [Google BigQuery window functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls)

### Use case

This component can be used to highlight the highest and lowest values in your data, identify duplicate data, and rank values by percentile. For example, you can use it to:

* Identify top-performing ads using RANK or DENSE RANK.
* Remove duplicate data from your dataset by partitioning and sorting data, then using ROW NUMBER = 1.
* Segment your data by percentile, to analyze data from different customer demographics.

<Note>
  When sampling data from a **Rank** component, if the input dataset is very large, the sample output may not display rows in the correct order. This is a display issue only—the data in this component has been ranked correctly.
</Note>

***

## Properties

<ResponseField name="Name" type="string" required>
  A human-readable name for the component.
</ResponseField>

{/* <!-- param-start:[includeInputColumns] | warehouses: [snowflake, databricks, redshift, bigquery] --> */}

<ResponseField name="Include input columns" type="boolean" required>
  Defines whether the component passes all input columns into the output.
</ResponseField>

{/* <!-- param-start:[partitionData] | warehouses: [snowflake, databricks, redshift, bigquery] --> */}

<ResponseField name="Partition data" type="dual listbox">
  Defines how the input data is partitioned to perform the rank calculation. The calculation is then performed on each partition.

  To use grid variables, toggle **Use Grid Variable** on at the top of the dialog. For more information, read [Grid variables](/docs/guides/grid-variables).
</ResponseField>

{/* <!-- param-start:[orderingWithinPartitions] | warehouses: [snowflake, databricks, redshift, bigquery] --> */}

<ResponseField name="Ordering within partitions" type="column editor" required>
  Order input columns within the partitioned data. Drag to reorder, then choose the following:

  * **Ascending**
  * **Descending**
  * **Nulls First**
  * **Nulls Last**

  <Note>**Nulls First** and **Nulls Last** are not available for Google BigQuery.</Note>

  Click the **Text mode** toggle at the bottom of the dialog to open a multi-line editor that lets you add items in a single block. For more information, read [Text mode](/docs/guides/components-overview#text-mode).

  To use grid variables, toggle **Use Grid Variable** on at the bottom of the dialog. For more information, read [Grid variables](/docs/guides/grid-variables).
</ResponseField>

{/* <!-- param-start:[functions] | warehouses: [snowflake, databricks, redshift, bigquery] --> */}

<ResponseField name="Functions" type="column editor" required>
  Select a window function:

  * **Rank:** Determines the rank of a value in a group of values.
  * **Dense Rank:** Determines the rank of a value in a group of values. The Dense Rank function differs from rank in one respect: if two or more rows tie, there is no gap in the sequence of ranked values.
  * **Cumulative Distribution:** Determines the cumulative distribution of a value within a window or partition.
  * **Percent Rank:** Calculates the percent rank of a given row.
  * **Row Number:** Determines the ordinal number of the current row within a group of rows, counting from 1.

  Then, add the name of the output column that the window function will create.

  Click the **Text mode** toggle at the bottom of the dialog to open a multi-line editor that lets you add items in a single block. For more information, read [Text mode](/docs/guides/components-overview#text-mode).

  To use grid variables, toggle **Use Grid Variable** on at the bottom of the dialog. For more information, read [Grid variables](/docs/guides/grid-variables).
</ResponseField>
