# tJava 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)

Use these properties to configure tJava running in the Spark Structured Streaming Job framework.

The Spark Structured Streaming tJava component belongs to the Custom Code 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 number of fields (columns) to<br>be processed by the component. Depending on your Java code,<br>tJava can pass the input dataset as-is or produce a<br>transformed output dataset.<br><br><ul> <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><br><br>Click Edit schema to make changes to<br>the schema. If you make changes, the schema automatically becomes built-in.<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> |
| Code | Enter the Java code to process the incoming DataFrame. The DataFrame is<br>available using the variable name composed of the component label and the<br>connection label.<br><br>For information about the Spark Java API, see the [Apache Spark Java API<br>documentation](https://spark.apache.org/docs/latest/api/java/index.html). |

## Advanced settings

| Properties | Description |
| --- | --- |
| Classes code | Define the classes that you need to use in the code written in the Code field in the Basic settings<br>view.<br><br>It is recommended to define new classes in this field, instead of in the Code field, so as to avoid<br>eventual exceptions in serialization. |
| Import | Enter the Java code to import, if necessary, external libraries<br>used in the Code field of the Basic settings view. |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This component is used as an end component and requires an input link.<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. |
| Code example | The input dataset is available as ds\_input\_tJava\_1, and the<br>output dataset is available as ds\_output\_tJava\_1. You can<br>modify the input data and pass the modified output dataset to downstream<br>components.<br><br>```<br>// Print the input stream to the console.<br>// ds_input_tJava_1.writeStream()<br>//     .outputMode("append")<br>//     .format("console")<br>//     .option("truncate", "false")<br>//     .option("numRows", 50)<br>//     .start().awaitTermination();<br><br>// Add a column containing the uppercase value of newColumn1 and pass the result downstream.<br>// Add import static org.apache.spark.sql.functions.*; to the IMPORT section.<br>ds_output_tJava_1 = ds_input_tJava_1.withColumn(<br>"newColumn1",<br>upper(col("newColumn1"))<br>);<br>``` |
| 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. |