# tHMapInput

Information noteNote: This component is not shipped with your Talend Studio by default. To use it, you need to install the Data Mapper &gt; Talend Data Mapper for Spark feature using the Feature Manager. For more information, see [Installing features using the Feature Manager](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/install-features-to-talend-studio).

Runs a Talend Data Mapper map where input and output structures may differ, as a Spark batch execution, and sends the data for use by a downstream component.

tHMapInput transforms data from a single source, in a Spark environment, for use by a downstream component.

## tHMapInput properties for Apache Spark Batch

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

The Spark Batch tHMapInput component belongs to the Processing family.

This component is available in Talend Platform products with Big Data and in Talend Data Fabric.

## Basic settings

| Properties | Description |
| --- | --- |
| Storage | To connect to an HDFS installation, select the Define a storage configuration component<br>check box and then select the name of the component to use from those<br>available in the drop-down list.<br><br>This option requires you to have previously configured the<br>connection to the HDFS installation to be used, as described in the<br>documentation for the tHDFSConfiguration component.<br><br>If you leave the Define a<br>storage configuration component check box unselected,<br>you can only convert files locally. |
| Configure Component | Before you configure this component, you must have already<br>added a downstream component and linked it to the tHMapInput component, and retreived the<br>schema from the downstream component.<br><br>To configure the component, click the [...] button and, in the Component Configuration window, perform<br>the following actions.<br><br><ol> <li> <p>Click the <span>Select</span> button next to the <span>Record structure</span> field and                                        then, in the <span>Select a                                            Structure</span> dialog box that opens, select the                                        map you want to use and then click <span>OK</span>.</p> <p>This structure must have been previously                                        created in <em> <span>Talend Data Mapper</span> </em>.</p> </li> <li> <p>Select the <span>Input                                            Representation</span> to use from the drop-down                                        list.</p> <p>Supported input formats are Avro, COBOL, EDI,                                        Flat, IDocs, JSON and XML.</p> </li> <li> <p>Click <span>Next</span>.</p> </li> <li> <p>Tell the component where each new record                                        begins. In order for you to be able to do so, you need to                                        fully understand the structure of your data.</p> <p>Exactly how you do this varies depending on                                        the input representation being used, and you will be                                        presented with one of the following options.</p> <ol> <li> <p>Select an appropriate record                                                delimiter for your data. Note that you must specify                                                this value without quotes. </p> <ul> <li> <p> <span>Separator</span>                                                  lets you specify a separator indicator, such as <em>\n</em>, to identify a new                                                  line.</p> <p>Supported indicators are <em>\n</em> for a Unix-type new line,                                                  <em>\r\n</em> for Windows and <em>\r</em> for Mac, and <em>\t</em> for tab characters.</p> </li> <li> <p> <span>Start/End                                                  with</span> lets you specify the initial                                                  characters that indicate a new record, such as <em>&lt;root</em>, or the characters                                                  that indicate where a record ends.</p> <p> <span>Start with</span>                                                  also supports new lines, <em>\n</em>                                                  for a Unix-type new line, <em>\r\n</em> for Windows and <em>\r</em> for Mac, and <em>\t</em> for                                                  tab characters.</p> <p>Select the <span>Regular                                                  Expression</span> check box if you to wish to                                                  enter a regular expression to match the start of a                                                  record. When you select XML or JSON, this check                                                  box is selected by default and a pre-configured                                                  regular expression is provided.</p> </li> <li> <span>Sample File</span>: To test the                                                  signature with a sample file, click the                                                  <span>[...]</span> button, browse to the                                                  file you want to use as a sample, click                                                  <span>Open</span>, and then click                                                  <span>Run</span> to test your                                                  sample.<p>Testing the signature lets you check                                                  that the total number of records and their minimum                                                  and maximum length corresponds to what you expect                                                  based on your knowledge of the data. This step                                                  assumes you have a local subset of your data to                                                  use as a sample.</p> </li> <li> <p>Click <span>Finish</span>.</p> </li> </ul> </li> <li> <div>If your input representation is COBOL                                                or Flat with positional and/or binary encoding                                                properties, define the signature for the input                                                record structure:<ul> <li> <span>Input Record root</span>                                                  corresponds to the root element in your input                                                  record.</li> <li> <p> <span>Minimum Record                                                  Size</span> corresponds to the size in bytes                                                  of the smallest record. If you set this value too                                                  low, you may encounter performance issues, since                                                  the component will perform more checks than                                                  necessary when looking for a new record.</p> </li> <li> <p> <span>Maximum Record                                                  Size</span> corresponds to the size in bytes                                                  of the largest record, and is used to determine                                                  how much memory is allocated to read the                                                  input.</p> </li> <li> <span>Sample from Workspace</span> or                                                  <span>Sample from File System</span>: To                                                  test the signature with a sample file, click the                                                  <span>[...]</span>                                                  button, and then browse to the file you want to                                                  use as a sample.<p>Testing the signature lets you                                                  check that the total number of records and their                                                  minimum and maximum length corresponds to what you                                                  expect based on your knowledge of the data. This                                                  step assumes you have a local subset of your data                                                  to use as a sample.</p> </li> <li> <p> <span>Footer Size</span>                                                  corresponds to the size in bytes of the footer, if                                                  any. At runtime, the footer will be ignored rather                                                  than being mistakenly included in the last record.                                                  Leave this field empty if there is no footer.</p> </li> <li> <p>Click the <span>Next</span> button to open                                                  the <span>Signature                                                  Parameters</span> window, select the fields                                                  that define the signature of your record input                                                  structure (that is, to identify where a new record                                                  begins), update the <span>Operation</span> and <span>Value</span> columns as                                                  appropriate, and then click <span>Next</span>.</p> </li> <li> <p>In the <span>Record                                                  Signature Test</span> window that opens, check                                                  that your Records are correctly delineated by                                                  scrolling through them with the                                                  <span>Back</span> and                                                  <span>Next</span> buttons and performing                                                  a visual check, and then click                                                  <span>Finish</span>.</p> </li> </ul> </div> </li> </ol> </li> <li> <p>Map the elements from the input structure to                                        the output structure in the new map that opens, and then                                        press <span>Ctrl+S</span> to save                                        your map.</p> <p>For more information on creating maps, see <a href="https://help.qlik.com/talend/r/en-US/8.0/data-mapper-user-guide/creating-standard-map" target="_blank">Creating standard maps</a>.</p> </li> </ol> |
| Input | Click the [...]<br>button to define the path to where the input file is stored. |
| Open Map Editor | Click the [...] button<br>to open the Structure Generate/Select<br>wizard.<br><br>You can first select the type of map to create:<br><br><ul> <li><span>Standard Map</span>: Map that perform mappings using                                functions based on xQuery</li> <li><span>DSQL Map</span>: Map that performs mappings using                                    <span>Data Shaping Query Language</span>.</li> </ul><br><br><br>You can select the Don't ask me again check box<br>to save this preference. For more information about these map types, see<br>[Working with maps](https://help.qlik.com/talend/r/en-US/8.0/data-mapper-user-guide/working-with-maps).<br><br>Information noteNote: This option is available only if you have installed the<br>R2023-10 Studio monthly update or a later one delivered by Talend. For more information, check with your administrator.<br><br>Then you can either have the hierarchical mapper structure generated<br>automatically based on the schema, or select an existing hierarchical mapper<br>structure. You must do this for both the input and output sides of your Map.<br>The following lists the options for the output structure:<br><br><ul> <li> <span>Generate hierarchical mapper structure based on the                                    schema</span> option: When you connect multiple output                                connections to the tHMap, the page displays a confirmation message                                that informs you that the mapper structures are generated based on                                the output connections.</li> <li> <span>Select an existing hierarchical mapper                                    structure</span> option: You can connect multiple outputs                                that are payload-based connections to the tHMap. If there is a                                single payload-type connection, you can select the <span>Allow                                    support for multiple output connections</span> check box.                                The generated output map inherits from the existing payload                                structure.</li> </ul><br><br>If Talend Studio detects multiple output connections available, the window displays both<br>output structure options without the support for multiple output connections<br>check boxes.<br><br>If neither input nor output connection exists, the Structure Selection page<br>is displayed. |
| Synchronize map with schema connections | Select this check box if you want to automatically regenerate<br>your map's input and output structures after one of the following changes:<br><br><ul> <li>Connection metadata change</li> <li>Input or output connection added</li> <li>Input or output connection removed</li> </ul><br><br><br>No changes are detected when a connection is activated or deactivated.<br><br>If this check box is selected, the map is automatically<br>synchronized when opened from the component after a change. If not, a dialog appears to<br>ask whether you want to synchronize.<br><br>Information noteNote: For structures with multiple<br>connections, the map can only be synchronized if the structures have the same form<br>as the ones generated by the component configuration wizard. For example, flattening<br>maps with multiple outputs cannot be synchronized automatically. |
| **Die on error** | This check box is selected by default.<br><br>Clear the checkbox to skip any rows on error and complete the<br>process for error-free rows.<br><br><br>If you opt to clear the<br>check box, you can perform any of these options:<br><br><ul> <li> <div>Connect the tHMapInput component to an output                                    component, for example tAvroOutput, using a <span><span>Row</span><abbr> &gt; </abbr><span> Rejects</span></span> connection. In the output component, ensure that                                    you add a fixed metadata with the following columns:<ul> <li>inputRecord: contains the rejected                                            input record during the transformation.</li> <li>recordId: refers to the record                                            identifier. For a text or binary input, the recordId                                            specifies the start offset of the record in the input                                            file. For an AVRO input, the recordId specifies the                                            timestamp when the input was processed.</li> <li>errorMessage: contains the                                            transformation status with details of the cause of the                                            transformation error.</li> </ul> </div> </li> <li> <p>You can retrieve the rejected records in a file.                                    One of these mechanisms triggers this feature: (1) a context                                    variable (<span>talend_transform_reject_file_path</span>) and (2) a                                    system variable set in the Advanced Job parameters (<span>spark.hadoop.talend.transform.reject.file.path</span>).</p> <p>When you set the file path on the Hadoop                                    Distributed File System (HDFS), no further configurations are                                    needed. When you set the file on Amazon S3 or any other                                    Hadoop-compatible file systems, add the associated Spark                                    advanced configuration parameter.</p> <p>In case of errors at runtime, <span>tHMapFile</span> checks if one of the                                    mechanisms exists and, if so, appends the rejected record to the                                    designated file. The reject file content includes the                                    concatenation of the rejected records without any additional                                    metadata.</p> <p>If the file system you use does not support                                    appending to a file, a separate file is created for each                                    rejection. The file uses the provided file path as the prefix                                    and adds a suffix that is the offset of the input file and the                                    size of the rejected record.</p> </li> </ul><br><br>Information noteNote: Any errors while trying to store the reject are logged and the<br>processing continues. |

## Advanced settings

| Properties | Description |
| --- | --- |
| Use old Eclipse runtime (deprecated) | Select this check box to include the old Eclipse runtime in<br>your Job.<br><br>Information noteNote: This option is available only if you have<br>installed the R2024-03 Talend Studio<br>monthly update or a later one delivered by Talend.<br>For more information, check with your administrator.<br><br>Information noteNote: From Talend Studio 8.0 R2025-04<br>onwards, the Use old Eclipse runtime (deprecated) parameter<br>has been removed. |

## Usage

| Usage guidance | Description |
| --- | --- |
| Usage rule | This component is used with a tHDFSConfiguration component which defines the<br>connection to the HDFS storage.<br><br>It is an input component and requires an output flow. |
| Usage with Talend Runtime | If you want to deploy a Job or Route containing a data mapping component<br>with Talend Runtime, you first need to install the Talend Data Mapper feature. For more information, see [Using Talend Data Mapper with Talend Runtime](https://help.qlik.com/talend/r/en-US/8.0/data-mapper-user-guide/using-talend-data-mapper-with-talend-runtime). |