This topic describes how to configure a Spark SQL job.
Prerequisites
Ensure you have created a project. For more information, see project management.Procedure
-
Go to the Projects page in Data Platform.
-
Log in to the E-MapReduce console with your Alibaba Cloud account.
-
In the top navigation bar, select the region and resource group.
-
Click the Data Development tab.
-
-
In the row of the project you want to edit, click Edit Job.
- Create a Spark SQL job.
- On the left side of the page, right-click the target folder and select Create Job.
- In the Create Job dialog box, enter a Job Name and Description. From the Job Type drop-down list, select Spark SQL.
Note By default, the platform submits Spark SQL jobs in yarn-client mode.The platform submits this type of job with the following command:
spark-sql [options] [cli options] {SQL_CONTENT}The following table describes the parameters.Parameter Description options On the Advanced Settings tab of the Job Settings panel, click the
icon in the Environment Variable row to add the SPARK_CLI_PARAMS environment variable. Example: SPARK_CLI_PARAMS="--executor-memory 1g --executor-cores".cli options Examples: -e <quoted-query-string>: runs the SQL query string in quotation marks.-f <filename>: runs the SQL statements in the specified file.
SQL_CONTENT The SQL statements you enter. - Click OK.
- Edit the job content.
- In the Content field, enter the Spark SQL statements.
Example:
-- Example SQL statements. -- SQL statements cannot exceed 64 KB. show databases; show tables; -- The system automatically appends 'limit 2000' to SELECT statements. select * from test1; - Click Save.
- In the Content field, enter the Spark SQL statements.