Presto (namely PrestoDB) is a flexible and scalable distributed SQL query engine that allows you to execute standard SQL statements to perform interactive analytic queries of big data. For more information, see Overview. DataWorks provides E-MapReduce (EMR) Presto nodes that you can use to develop and periodically schedule Presto tasks. This topic describes the procedure of using an EMR Presto node to develop tasks and the related precautions.
Prerequisites
A workflow is created in DataStudio.
Development operations in different types of compute engines are performed based on workflows in DataStudio. Therefore, before you create a node, you must create a workflow. For more information, see Create a workflow.
An Alibaba Cloud EMR cluster is created and registered to DataWorks.
Before you create an EMR node and use the EMR node to develop EMR tasks in DataWorks, you must register a desired EMR cluster to a DataWorks workspace. For more information, see Register an EMR cluster to DataWorks.
(Required if you use a RAM user to develop tasks) The RAM user is added to the DataWorks workspace as a member and is assigned the Development or Workspace Administrator role. The Workspace Administrator role has more permissions than necessary. Exercise caution when you assign the Workspace Administrator role. For more information about how to add a member, see Add workspace members and assign roles to them.
An exclusive resource group for scheduling is purchased and configured. The configurations include association with a workspace and network configuration. For more information, see Create and use an exclusive resource group for scheduling.
Limits
Limits on EMR clusters and DataWorks resources
Only EMR Hadoop clusters support EMR Presto nodes for task development. EMR DataLake clusters and custom clusters do not support EMR Presto nodes.
EMR Presto nodes can be run only on an exclusive resource group for scheduling.
Limits on task development
The size of an SQL statement for Presto task development cannot exceed 130 KB.
If you use an EMR Presto node to query data, a maximum of 10,000 data records can be returned, and the total size of the returned data records cannot exceed 10 MB.
Other limits
Data lineage: Tasks that are developed by using EMR Presto nodes do not support generation of data lineages.
Create an EMR Presto node (Expand for details)
Develop a Presto task
You can double-click the name of the created EMR Presto node to go to the configuration tab of the node and then perform the following operations to develop a Presto task.
(Optional) Select an EMR compute engine instance
If multiple EMR clusters are registered to the current workspace, you must select one from the Engine Instance EMR drop-down list based on your business requirements. If only one EMR cluster is registered to the current workspace, you do not need to select an EMR cluster.
Simple SQL code development example
In the SQL editor, enter code for the node. Example:
show tables;
select * from userinfo ;
Use scheduling parameters to develop SQL code
DataWorks provides scheduling parameters. To enable parameters to be dynamically passed in the code of a node, you can define variables in the node code in the ${Variable name}
format, and assign parameters to the variables as values in the Scheduling Parameter section of the Properties tab on the configuration tab of the node. For information about the supported formats of scheduling parameters, see Supported formats of scheduling parameters.
select '${var}'; -- You can assign a specific scheduling parameter to the var variable.
(Optional) Configure advanced parameters
For more information about how to configure the parameters of the task, see Spark Configuration.
Advanced parameter | Description |
"FLOW_SKIP_SQL_ANALYZE" | The manner in which SQL statements are executed. Valid values:
Note This parameter is available only for testing in the development environment of a DataWorks workspace. |
"USE_GATEWAY" | Specifies whether to use a gateway cluster to commit jobs on the current node. Valid values:
Note If the EMR cluster to which the node belongs is not associated with a gateway cluster but the USE_GATEWAY parameter is set to |
Configure scheduling properties
If you want the system to periodically run the node, you can click Properties in the right-side navigation pane on the configuration tab of the node to configure properties for the node based on your business requirements.
Configure basic properties for the node. For more information, see Configure basic properties.
Configure the scheduling cycle, rerun properties, and scheduling dependencies of the node. For more information, see Configure time properties and Configure same-cycle scheduling dependencies.
NoteBefore you commit the node, you must configure the Rerun and Parent Nodes parameters on the Properties tab.
Configure resource properties for the node. For more information, see Configure the resource property. If the node that you created is an auto triggered node and you want the node to access the Internet or a virtual private cloud (VPC), you must select the resource group for scheduling that is connected to the node. For more information, see Establish a network connection between a resource group and a data source.
Debug the node
Optional. Select a resource group and assign custom parameters to variables.
Click the icon in the top toolbar of the configuration tab of the EMR Presto node. In the Parameters dialog box, select an exclusive resource group for scheduling that you want to use to debug and run the node.
If you use scheduling parameters in your node code, you can assign the scheduling parameters to variables as values in the node code for debugging. For more information about the assignment logic of scheduling parameters, see What are the differences in the value assignment logic of scheduling parameters among the Run, Run with Parameters, and Perform Smoke Testing in Development Environment modes?
Save and execute the SQL statements.
In the top toolbar, click the icon to save the SQL statements. Then, click the icon to execute the SQL statements.
Optional. Perform smoke testing.
You can perform smoke testing on the node in the development environment when you commit the node or after you commit the node. For more information, see Perform smoke testing.
What to do next
Commit and deploy the node.
Click the icon in the top toolbar to save the node.
Click the icon in the top toolbar to commit the node.
In the Commit Node dialog box, configure the Change description parameter.
Click OK.
If you use a workspace in standard mode, you must deploy the node in the production environment after you commit the node. On the left side of the top navigation bar, click Deploy. For more information, see Deploy nodes.
View the node.
Click Operation Center in the upper-right corner of the configuration tab of the node to go to Operation Center in the production environment.
View the scheduled node. For more information, see View and manage auto triggered nodes.
To view more information about the node, click Operation Center in the top navigation bar of the DataStudio page. For more information, see Overview.