If you want to use Presto SQL during data development, you can configure a Presto SQL job in the E-MapReduce (EMR) console. This topic describes how to configure a Presto SQL job in the EMR console.


  1. Go to the Data Platform tab.
    1. Log on to the Alibaba Cloud EMR console by using your Alibaba Cloud account.
    2. In the top navigation bar, select the region where your cluster resides and select a resource group based on your business requirements.
    3. Click the Data Platform tab.
  2. In the Projects section of the page that appears, find the project that you want to edit and click Edit Job in the Actions column.
  3. Create a Presto SQL job.
    1. In the Edit Job pane on the left, right-click the folder on which you want to perform operations and select Create Job.
    2. In the Create Job dialog box, specify Name and Description, and then select Presto SQL from the Job Type drop-down list.
      This option indicates that a Presto SQL job will be created. You can use the following command syntax to submit a Presto SQL job:
      presto <options> -f {SQL_SCRIPT}
      Note SQL_SCRIPT refers to the SQL statements that you entered in the job editor.
    3. Click OK.
  4. Edit job content.
    1. Configure the command line parameters required to submit the job in the Content field.
      SELECT * from table1;
    2. Click Save.

Configure Presto CLI parameters

By default, Presto queries data tables under the hive catalog and default schema. You can configure Presto command-line interface (CLI) parameters to specify catalogs and schemas. You can use one of the following methods to configure Presto CLI parameters in a Presto SQL job:
  • Use environment variables
    • Password: If password authentication is enabled for the Presto service, add the PRESTO_PASSWORD environment variable to specify a password.
    • Other parameters: Configure the parameters in the PRESTO_CLI_PARAMS environment variable. Example: PRESTO_CLI_PARAMS="--catalog mysql --schema db1 ".
  • Use custom variables
    • Password: Add a custom variable named presto.password to the job to specify a password for Presto authentication.
    • Other parameters: Add custom variables in the format of _presto.xxx to the job. The custom variables are added to the list of Presto CLI parameters. The corresponding option is in the format of --xxx.
      The following custom variables are supported:
      ## Basic parameters
      * _presto.schema <schema>
      * _presto.catalog <catalog>
      ## Control and debugging parameters
      * _presto.trace-token <trace token>
      * _presto.session <session>...
      * _presto.source <source>
      * _presto.resource-estimate <resource-estimate>...
      * _presto.log-levels-file <log levels file>
      ## Connection parameters
      * _presto.server <server>
      * _presto.http-proxy <http-proxy>  * ignore-errors
      * _presto.socks-proxy <socks-proxy>
      ## Authentication parameters
      * _presto.user <user>
      * _presto.password <password>
      * _presto.client-info <client-info>
      * _presto.client-request-timeout <client request timeout>
      * _presto.client-tags <client tags>
      * _presto.access-token <access token>
      * _presto.truststore-password <truststore password>
      * _presto.truststore-path <truststore path>
      * _presto.keystore-password <keystore password>
      * _presto.keystore-path <keystore path>
      * _presto.extra-credential <extra-credential>...
      ## High-security parameters
      * _presto.krb5-config-path <krb5 config path>
      * _presto.krb5-credential-cache-path <krb5 credential cache path>
      * _presto.krb5-disable-remote-service-hostname-canonicalization
      * _presto.krb5-keytab-path <krb5 keytab path>
      * _presto.krb5-principal <krb5 principal>
      * _presto.krb5-remote-service-name <krb5 remote service name>
      * _presto.krb5-service-principal-pattern <krb5 remote service principal pattern>