Presto SQL job configuration

Updated at:

You can configure a Presto SQL job in Alibaba Cloud E-MapReduce to use Presto SQL in your data workflow.

Procedure

  1. Go to the Projects page in Data Platform.

    1. Log in to the E-MapReduce console with your Alibaba Cloud account.

    2. In the top navigation bar, select the region and resource group.

    3. Click the Data Development tab.

  2. In the row of the project you want to edit, click Edit Job.

  3. Create a Presto SQL job.
    1. On the left side of the page, right-click the target folder and select Create Job.
    2. In the Create Job dialog box, enter a Name and Description. From the Job Type drop-down list, select Presto SQL.
      This will create a Presto SQL job. Jobs of this type are submitted using the following command:
      presto <options> -f {SQL_SCRIPT}
      Note The SQL_SCRIPT file stores the SQL statements you enter in the job editor.
    3. Click OK.
  4. Edit the job content.
    1. In the Content section, enter the SQL statements for the job.
      Example:
      SELECT * from table1;
    2. Click Save.

Presto CLI parameters

By default, Presto queries tables in catalog=hive and schema=default. To query tables in a different catalog and schema, set Presto CLI parameters. You can set Presto CLI parameters for a Presto SQL job in two ways:
  • Use an environment variable
    • Set the password: If password authentication is enabled for the Presto service, add an environment variable named PRESTO_PASSWORD to provide the password.
    • Set other parameters: Add parameters to an environment variable named PRESTO_CLI_PARAMS, for example, PRESTO_CLI_PARAMS="--catalog mysql --schema db1 ".
  • Use a custom variable
    • Set password: To set the password for Presto authentication, add a custom variable named presto.password to the job.
    • Set other parameters: The system appends any custom variable in the format _presto.xxx to the Presto CLI parameter list as the --xxx option.
      The following custom variables are supported.
      ## Basic parameters
      * _presto.schema <schema>
      * _presto.catalog <catalog>
      
      ## Control/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>