# tTopBy

Groups and sorts data and outputs several rows from the first one of the data in each group.

tTopBy groups the input data by applying user-defined keys, sorts records in each group and sends to its following component a given number of first rows of the sorted records.

### In this section

* [tTopBy properties for Apache Spark Batch](https://help.qlik.com/talend/en-US/components/8.0/processing/ttopby-properties-for-apache-spark-batch)
* [tTopBy properties for Apache Spark Streaming (deprecated)](https://help.qlik.com/talend/en-US/components/8.0/processing/ttopby-properties-for-apache-spark-streaming)
* [tTopBy properties for Apache Spark Structured Streaming](https://help.qlik.com/talend/en-US/components/8.0/processing/ttopby-properties-for-apache-spark-structured-streaming)