# tTopBy properties for Apache Spark Structured Streaming

[Preview](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Introduction/feature-preview-program-overview.htm)

These properties are used to configure tTopBy running in the Spark Structured Streaming Job framework.

The Spark Structured Streaming tTopBy component belongs to the Processing family.

The streaming version of this component is available in Talend Real-Time Big Data Platform and in Talend Data Fabric.

## Basic settings

| Properties | Description |
| --- | --- |
| Schema and Edit schema | A schema is a row description. It defines the fields (columns) processed by the<br>component. When you create a Spark Job, avoid the reserved word<br>line when naming fields.<br><br><ul> <li><p><span>Built-In</span>: create and store the schema locally for                        this component only.</p></li> <li><p><span>Repository</span>: reuse a schema created and stored in                        the Repository across projects and Job designs.</p></li> </ul><br><br>Click Edit schema to modify the schema. If you modify a<br>Repository schema, the available options include:<br><br><ul> <li><p><span>View schema</span>: view the schema without modifying it.</p></li> <li><p><span>Change to built-in property</span>: change the schema to                        <span>Built-in</span> for local changes.</p></li> <li><p><span>Update repository connection</span>: modify the Repository                        schema and choose whether to propagate the changes to other Jobs.</p></li> </ul> |
| Number of line selected | Enter the number of rows to be outputted. The current component selects this number of<br>rows down from the first rows of the sorted data. |
| Partition Key | Select the column(s) from which the records are used as keys to group the input<br>data.<br><br>You need to click [+] to add as many lines as required to use as keys for the grouping to be<br>completed |
| Criteria | <ul> <li> <p>Click <span>[+]</span> to add as many lines as required for the sort        to be completed.</p> </li> <li> <p>In the <span>Schema column</span> column, select the column from your        schema, which the sort will be based on. Note that the order is essential as it determines        the sorting priority.</p> </li> <li> <p>In the other columns, select how you need the data to be sorted. For example, if you need        to sort the data in ascending alphabetical order (from A to Z), select <span>alpha</span> and <span>asc</span> in the corresponding        columns.</p> </li> </ul> |

## Usage

| Usage guidance | Description |
| --- | --- |
| Usage rule | This component is used as an intermediate step.<br><br>This component maintains a stateful ranking of the top N rows per partition<br>group across micro-batches. If no partition key is defined, all rows are<br>ranked together as a single global group.<br><br>Information noteRestriction: The output mode of the downstream output component<br>must not be set to Append. Use<br>Update or Complete<br>instead.<br><br>This component, along with the Spark Structured Streaming component Palette it belongs to,<br>appears only when you are creating a Spark Structured Streaming Job. |
| Spark Connection | You need to use the Structured Streaming Configuration<br>tab in the Run view to define the connection to a Spark cluster for<br>the whole Job.<br><br>This connection is effective on a per-Job basis. |