# tHiveOutput properties for Apache Spark Batch

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

The Spark Batch tHiveOutput component belongs to the Databases family.

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

Information noteImportant: Talend does not support the import of schema for complex data types such as array, struct, and map.

## Basic settings

| Properties | Description |
| --- | --- |
| Hive storage configuration | Select the tHiveConfiguration<br>component from which you want Spark to use the configuration details to connect to<br>Hive.<br><br>If you are running your Spark Job on Spark Universal with Yarn Cluster<br>mode, this property is not available. The Hive storage configuration<br>directly comes from the XML files inside the Hadoop configuration JAR<br>file. For more information, see [Defining Yarn cluster connection<br>parameters with Spark Universal](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/defining-yarn-cluster-connection-parameters-with-spark-universal). |
| HDFS Storage configuration | Select the tHDFSConfiguration component from which you want Spark to use the configuration<br>details to connect to a given HDFS system and transfer the dependent jar files to this HDFS<br>system. This field is relevant only when you are using an on-premises distribution.<br><br>If you are running your Spark Job on Spark Universal with Yarn Cluster<br>mode, this property is not available. The HDFS storage configuration<br>directly comes from the XML files inside the Hadoop configuration JAR<br>file. For more information, see [Defining Yarn cluster connection<br>parameters with Spark Universal](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/defining-yarn-cluster-connection-parameters-with-spark-universal). |
| Schema and Edit Schema | <ul> <li> <p>A schema is a row description. It defines the number of fields            (columns) to be processed and passed on to the next component. When you create a Spark            Job, avoid the reserved word <kbd>line</kbd> when naming the            fields.</p> <p>Click <span>Edit        schema</span> to make changes to the schema. If the current schema is of the <span>Repository</span> type, three options are available:</p> <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> </li> <li> <p> <span>Built-In</span>: You create and store the schema locally for this component                only.</p> </li> <li> <p> <span>Repository</span>: You have already created the schema and stored it in the                Repository. You can reuse it in various projects and Job designs.</p> </li> </ul> |
| Output source | Select the type of the output data you want tHiveOutput to change:<br><br><ul> <li> <p> <span>Hive table</span>: the <span>Database</span> field, the <span>Table name</span> field, the <span>Table format</span> list and the <span>Enable                            Hive partitions</span> check box are displayed. You need to enter                        the related information about the Hive database to be connected to and the                        Hive table you need to modify.</p> <p>By default, the format of the output data is JSON, but you can                        change it to ORC or Parquet by selecting the corresponding option from the                            <span>Table format</span> list.</p> </li> </ul> |
| Save mode | Select the type of changes you want to make regarding the target Hive table:<br><br><ul> <li> <span>Create</span>: creates the target Hive table and writes data                        in this table.</li> <li> <span>Append</span>: adds data to an existing table.</li> <li> <span>Overwrite</span>: overwrites the data of the existing                        table.</li> <li> <span>Create if it does not exist</span>: creates a Hive table                        and adds data in it if there is no existing table. If there is an existing                        table, the input data is not saved.<p>This property is available when you                           have installed the 8.0.1-R2024-03 Studio Monthly or a later one provided                           by <span>Talend</span>. For more information, check with your administrator.</p> </li> </ul> |
| Enable Hive partitions | Select the Enable Hive partitions check box and in<br>the Partition keys table, define partitions for<br>the Hive table you are creating or changing. In the Partition<br>keys table, select columns from the input schema of<br>tHiveOutput to use as partition keys.<br><br>Bear in mind that:<br><br><ul> <li> <p>When the <span>Save mode</span> to be used is                                            <kbd>Append</kbd>, meaning that you are                                        adding data to an existing Hive table, the partition columns                                        you select in the <span>Partition keys</span>                                        table must be already partition keys of the Hive table to be                                        updated.</p> </li> <li> <p>A partitioned Hive table created by <span>tHiveOutput</span> can only be read                                        by <span>tHiveInput</span> due to Spark specific                                        limitations. If you need to read your partitioned table                                        through Hive itself, it is recommended to use                                            <span>tHiveRow</span> or                                            <span>tHiveCreateTable</span> in a Standard Job to                                        create this table and then use <span>tHiveOutput</span> to append data to it.</p> </li> <li> <p>Defining columns as partition keys does not alter your data                                        but only create subfolders using the partition keys and put                                        data in them.</p> </li> </ul> |

## Advanced settings

| Properties | Description |
| --- | --- |
| Sort columns alphabetically | Select this check box to sort the schema columns in the alphabetical order. If you leave this check box clear, these columns stick to the order defined in the schema editor. |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This component is used as an end component and requires an input link.<br><br>This component should use a tHiveConfiguration component present in the same Job to connect to<br>Hive.<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. |