# tPartition (deprecated)

Availability-note[Deprecated](https://help.talend.com/r/en-US/Cloud/labels-on-talend-help-center/availability-deprecated)

This content is deprecated.

Information noteDeprecation: The tPartition component is deprecated from the 8.0 R2023-02 Talend monthly patch. Talend recommends you to use the tManagePartitions component for newly created Jobs.

Allows you to visually define how an input dataset is partitioned.

The tPartition splits the input dataset into a given number of partitions.

## tPartition properties for Apache Spark Batch

These properties are used to configure tPartition running in the Spark Batch Job framework.

The Spark Batch tPartition component belongs to the Processing family.

The component in this framework is available in all Talend products with Big Data and in Talend Data Fabric.

## Basic settings

| Properties | Description |
| --- | --- |
| Schema and Edit<br>Schema | A schema is a row description. It defines the number of fields<br>(columns) to be processed and passed on to the next component. When you create a Spark<br>Job, avoid the reserved word line when naming the<br>fields.<br><br>Click Edit<br>schema to make changes to the schema. If the current schema is of the Repository type, three options are available:<br><br><ul> <li> <p> <span>View schema</span>: choose this                option to view the schema only.</p> </li> <li> <p> <span>Change to built-in property</span>:                choose this option to change the schema to <span>Built-in</span> for local changes.</p> </li> <li> <p> <span>Update repository connection</span>:                choose this option to change the schema stored in the repository and decide whether                to propagate the changes to all the Jobs upon completion.</p> <p>If you just want to                propagate the changes to the current Job, you can select <span>No</span> upon completion and choose this schema metadata                again in the <span>Repository Content</span>                window.</p> </li> </ul><br><br>Click Sync<br>columns to retrieve the schema from the previous component connected in the<br>Job. |
| Number of partitions | Enter the number of partitions you want to split the input dataset up into. |
| Repartition by range | Select this check box to divide the dataset into multiple partitions. For more<br>information, see the [official Spark documentation](https://spark.apache.org/docs/2.4.0/api/java/org/apache/spark/sql/Dataset.html#repartitionByRange-scala.collection.Seq-).<br><br>This option is only available in Dataset mode.<br><br>Information noteNote: tPartition component supports Spark Dataset API only when:<br><br><ul> <li>The Job uses with SparkV2 and onwards.</li> <li>The <span>Use Dataset API</span> check box from the                              <span>Spark configuration</span> view of your Job is                           selected.</li> <li>The Job do not use custom partitioner nor custom comparator.</li> </ul> |
| Use coalesce | Select this check box to reduce the number of partitions that are returned. For<br>more information, see the [official Spark documentation](https://spark.apache.org/docs/2.4.0/api/java/org/apache/spark/sql/Dataset.html#coalesce-int-).<br><br>This option is only available in Dataset mode.<br><br>Information noteNote: tPartition component supports Spark Dataset API only when:<br><br><ul> <li>The Job uses with SparkV2 and onwards.</li> <li>The <span>Use Dataset API</span> check box from the                              <span>Spark configuration</span> view of your Job is                           selected.</li> <li>The Job do not use custom partitioner nor custom comparator.</li> </ul> |
| Partition key | Complete this table to define the key to be used for the partitioning.<br><br>In the Partition key table, the schema columns are<br>automatically added into the Column<br>column and in the Partition column<br>column, you need to select the check box(es) corresponding to the<br>column(s) you want to use as the key of the partitioning.<br><br>This partitioning proceeds in the hash mode, that is to say, the<br>records meeting the same criteria (the key) are dispatched into the<br>same partition. |
| Use custom partitioner | Select this check box to use a Spark partitioner you need to<br>import from outside Talend Studio. For example, a partitioner you have developed by yourself. In this<br>situation, you need to give the following information:<br><br><ul> <li> <p> <span>Custom partitioner FQCN</span>: enter                              the fully qualified class name of the partitioner to be imported.</p> </li> <li> <p> <span>Custom partitioner JAR</span>: click                              the <span>[+]</span> button as many time as                              needed to add the same number of rows. In each row, click the                                 <span>[...]</span> button to import the                              jar file containing this partitioner class and its dependent jar                              files.</p> </li> </ul> |
| Sort within partitions | Select this check box to sort the records in each<br>partition.<br><br>This feature is useful when a partition contains several distinct<br>key values.<br><br><ul> <li> <p> <span>Natural key order</span>: keys                                        are sorted in their natural order, for example, in the                                        alphabetical order.  </p> </li> <li> <p> <span>Custom comparator</span>: this                                        allows you to use a custom program to sort the keys. </p> <p>You need to enter the fully qualified class name of the										comparator to be imported in the <span>Custom comparator FQCN</span> field and add the jar										files to be loaded in the <span>Custom											comparator JAR</span> table.</p> </li> </ul> |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This component is used as an intermediate step.<br><br>This component, along with the Spark Batch component Palette it belongs to,<br>appears only when you are creating a Spark Batch Job.<br><br>Note that in this documentation, unless otherwise explicitly stated, a<br>scenario presents only Standard Jobs, that is to<br>say traditional<br>Talend<br>data integration Jobs. |
| Spark Connection | In the Spark<br>Configuration tab in the Run<br>view, define the connection to a given Spark cluster for the whole Job. In<br>addition, since the Job expects its dependent jar files for execution, you must<br>specify the directory in the file system to which these jar files are<br>transferred so that Spark can access these files:<br><br><ul> <li> <div> <span>Yarn mode</span> (Yarn client or Yarn cluster):<ul> <li> <p>When using Google Dataproc, specify a bucket in the                                            <span>Google Storage staging bucket</span>                                        field in the <span>Spark configuration</span>                                        tab.</p> </li> <li> <p>When using HDInsight, specify the blob to be used for Job                                        deployment in the <span>Windows Azure Storage                                            configuration</span> area in the <span>Spark                                            configuration</span> tab.</p> </li> <li>When using Altus, specify the S3 bucket or the Azure                                    Data Lake Storage for Job deployment in the <span>Spark                                        configuration</span> tab.</li> <li> <p>When using on-premises distributions, use                                        the configuration component corresponding to the file system                                        your cluster is using. Typically, this system is HDFS and so                                        use <a href="https://help.qlik.com/talend/r/en-US/8.0/components/hdfs/thdfsconfiguration">tHDFSConfiguration</a>.</p> </li> </ul> </div> </li> <li> <p> <span>Standalone mode</span>: use the                            configuration component corresponding to the file system your cluster is                            using, such as <a href="https://help.qlik.com/talend/r/en-US/8.0/components/hdfs/thdfsconfiguration-properties-for-apache-spark-batch">tHDFSConfiguration Apache Spark Batch</a> or <a href="https://help.qlik.com/talend/r/en-US/8.0/components/amazon-s3/ts3configuration-properties-for-apache-spark-batch">tS3Configuration Apache Spark Batch</a>.</p> <p>If you are using Databricks without any configuration component present                            in your Job, your business data is written directly in DBFS (Databricks                            Filesystem).</p> </li> </ul><br><br>This connection is effective on a per-Job basis. |