Ad hoc query allows you to test your code in the development environment. This way, you can perform troubleshooting or check whether your code works as expected.

Background information

You do not need to commit and deploy ad hoc query nodes or configure scheduling policies for ad hoc query nodes. You can configure scheduling policies only for nodes that are created under Business process on the Data Development tab of the DataStudio page.

Create a folder

  1. Go to the DataStudio page.
    1. Log on to the DataWorks console.
    2. In the left-side navigation pane, click Workspaces.
    3. In the top navigation bar, select the region where the target workspace resides. Find the target workspace and click Data Analytics in the Actions column.
  2. On the left-side navigation submenu, click the Temporary query icon.
    You can click the Show icon icon in the lower-left corner to show or hide the left-side navigation submenu.
  3. On the Temporary query tab, move the pointer over the Create icon icon and select Folder.
  4. In the New folder dialog box, enter a name for the folder in the Folder name field and set the Destination folder parameter.
    Note
    • The folder name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and periods (.).
    • DataWorks supports multi-level folders. You can save a newly created folder under another folder that already exists.
  5. Click New.

Create an ad hoc query node

On the Temporary query tab, you can create a variety of ad hoc query nodes, such as EMR Hive, ODPS SQL, EMR Spark SQL, EMR Presto, EMR Impala, Shell, AnalyticDB for PostgreSQL, AnalyticDB for MySQL, and Data Lake Analytics nodes.

In this example, create an ODPS SQL node.

  1. On the Temporary query tab, right-click the folder you created and choose New Node > ODPS SQL.
  2. In the New node dialog box, set the Node name and Destination folder parameters.
    Note The node name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and periods (.). It is not case-sensitive.
  3. Click Submit.
  4. On the node configuration tab that appears, enter an SQL query statement.
    Ad-hoc query
    Note
    • If the current workspace is bound to multiple MaxCompute compute engines, you must select a desired MaxCompute engine instance before you submit the query statement for execution.
    • The selected MaxCompute engine instance may use a default resource group that is charged in pay-as-you-go mode. In this case, you can click the Cost Estimation icon icon in the toolbar to estimate the cost of this operation. The actual cost is included in your bill.
  5. Click the Run icon icon in the toolbar to view the query result.