# tSchemaComplianceCheck for Apache Spark Batch

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

The Spark Batch tSchemaComplianceCheck component belongs to the Data Quality family.

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

## Basic settings

| Properties | Description |
| --- | --- |
| Base 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>It describes the structure and nature of your data to be processed as                           it is.</p></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> |
| Base on default schema | Select this option to carry out all checks on all columns against<br>the base schema. |
| Custom defined | Select this option to carry out particular checks on particular columns. When<br>this option is selected, the Columns table shows. |
| Checked Columns | <ul> <li><p>In this table, define what checks are to be carried out on which                        columns. </p></li> <li><p> <span>Column</span>: Displays the columns                        names.</p></li> <li><p> <span>Type</span>: Select the type of data                        each column is supposed to contain. This validation is mandatory for                        all columns.</p></li> <li><p> <span>Date pattern</span>: Define the expected                        date format for each column with the data type of                        <em>Date</em>.</p></li> <li><p> <span>Nullable</span>: Select the check box in                        an individual column to define the column to be nullable, that is,                        to allow empty rows in this column to go to the output flow                        regardless of the base schema definition. To define all columns to                        be nullable, select the check box in the table header.</p></li> <li> <p> <span>Max length</span>: Select the check box                        in an individual column to verify the data length of the column                        against the length definition of the base schema. To carry out this                        verification on all the columns, select the check box in the table                        header.</p></li> </ul> |
| Use another schema for compliance check | Define a reference schema as you expect the data to be, in order<br>to reject the non-compliant data.<br><br>It can be restrictive on data type, null values, and/or<br>length. |
| Discard the excess content of column when the actual length is<br>greater than the declared length | With any of the three modes of tSchemaComplianceCheck, select this check box to<br>truncate the data that exceeds the length specified rather than<br>reject it.<br><br>Information noteNote:<br><br>This option is applicable only on data of String type. |

## Advanced settings

| Properties | Description |
| --- | --- |
| Ignore TimeZone when Check Date | Select this check box to ignore the time zone setup upon date<br>check.<br><br>Not available when the Check all columns<br>from schema mode is selected. |
| Treat all empty string as NULL | Select this check box to treat any empty fields in any columns as<br>null values, instead of empty strings.<br><br>By default, this check box is selected. When it is cleared, the<br>Choose Column(s) table shows to<br>let you select individual columns. |

## Global Variables

| Variables | Description |
| --- | --- |
| Global Variables | ERROR\_MESSAGE: the error message generated by the<br>component when an error occurs. This is an After variable and it returns a string. This<br>variable functions only if the Die on error checkbox is<br>cleared, if the component has this checkbox.<br><br>A Flow variable functions during the execution of a component<br>while an After variable functions after the execution of the component.<br><br>To fill up a field or expression with a variable, press Ctrl+Space to access the variable list and choose the variable to use from<br>it.<br><br>For more information about variables, see [Using contexts and variables](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/contexts-and-variables). |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This component is used as an intermediate step. |
| 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. |