# tSqlRow properties for Apache Spark Streaming

These properties are used to configure tSqlRow running in the Spark Streaming Job framework.

The Spark Streaming tSqlRow component belongs to the Processing family.

This component is available in Talend Real Time Big Data Platform and Talend Data Fabric.

## Basic settings

| Schema and Edit 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><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<br>schema to make changes to the schema.<br><br>Information noteNote: If you<br>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. 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> |
| --- | --- |
| SQL context | Select the query languages you want tSqlRow to use.<br><br><ul> <li> <p> <span>SQL Spark Context</span>: the Spark native query language.</p> </li> <li> <p> <span>SQL Hive Context</span>: the Hive query language                supported by Spark.</p> <p>In <span>SQL Hive Context</span>, <span>tSqlRow</span> does not allow you to use Hive metastore. If you need to                read or write data to Hive metastore, use <span>tHiveInput</span> or <span>tHiveOutput</span> instead                and in this situation, you need to design your Job differently.</p> <p>For further information about the Spark supported Hive query statements, see <a href="https://spark.apache.org/docs/2.3.0/sql-programming-guide.html#supported-hive-features" target="_blank">Supported Hive features</a>.</p> </li> </ul> |
| Query | Enter your query paying particularly attention to properly sequence<br>the fields in order to match the schema definition.<br><br>The tSqlRow<br>component uses the label of its input link to name the registered table that stores the<br>datasets from the same input link. For example, if a input link is labeled to *row1*, this *row1* is automatically<br>the name of the table in which you can perform queries. |

## Advanced settings

| Register UDF jars | Add the Spark SQL or Hive SQL UDF (user-defined function) jars you want tSqlRow to use. If you do not want to call your UDF using its<br>FQCN (Fully-Qualified Class Name), you must define a function alias for this UDF in the<br>Temporary UDF<br>functions table and use this alias. It is recommended to use the alias<br>approach, as an alias is often more practical to use to call a UDF from the query.<br><br>Once you add one row to this table, click it to display the [...] button and then click this<br>button to display the jar import wizard. Through this wizard, import the UDF jar files you<br>want to use. |
| --- | --- |
| Temporary UDF functions | Complete this table to give each imported UDF class a temporary function name to be used<br>in the query in tSqlRow.<br><br>If you have selected SQL Spark Context from the SQL context list, the UDF output<br>type column is displayed. In this column, you need to select the data type of the<br>output of the Spark SQL UDF to be used. |

## Usage

| **Usage rule** | This component is used as an intermediate step.<br><br>This component, along with the Spark Streaming component Palette it belongs to, appears<br>only when you are creating a Spark Streaming Job.<br><br>Note that in this documentation, unless otherwise explicitly stated, a scenario presents<br>only Standard Jobs, that is to say traditional<br>Talend<br>data<br>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>When using Qubole, add a                                        <span>tS3Configuration</span> to your Job to write                                    your actual business data in the S3 system with Qubole. Without                                        <span>tS3Configuration</span>, this business data is                                    written in the Qubole HDFS system and destroyed once you shut                                    down your cluster.</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/7.3/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/7.3/components/hdfs/thdfsconfiguration-properties-for-apache-spark-batch">tHDFSConfiguration Apache Spark Batch</a> or <a href="https://help.qlik.com/talend/r/en-US/7.3/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. |