All Products
Search
Document Center

E-MapReduce:Use editors on the Hue web UI

Last Updated:Dec 21, 2023

If you want to use a graphical interface to execute HiveQL or Spark SQL statements, you can use Hue. This topic describes how to use the Hive and SparkSql editors on the Hue web UI. In this topic, an E-MapReduce (EMR) V4.9.0 cluster is used.

Prerequisites

  • A security group rule is configured.

    Important

    When you configure the authorization object in the security group rule, enter only the CIDR blocks or IP addresses that need to access Hue. Do not enter the CIDR block 0.0.0.0/0.

  • Port 8888 is enabled.

Use the SparkSql editor

  1. Go to the Cluster Overview page of your cluster.

    1. Log on to the Alibaba Cloud EMR console.

    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 Cluster Management tab.

    4. On the Cluster Management page, find your cluster and click Details in the Actions column.

  2. In the left-side navigation pane, click Connect Strings.

  3. On the Public Connect Strings page, click the URL of Hue.

    On the page that appears, enter your Hue username and password to access the Hue web UI.

    Note

    For more information about how to obtain a Hue account and password, see Use Hue.

  4. Go to the SparkSql page.

    1. In the left-side navigation pane, click the editor icon.

    2. Select Sparksql.

      The SparkSql page appears.

  5. Execute statements in the SparkSql editor.

    1. Enter the following CREATE TABLE statement in the editor:

      CREATE TABLE IF NOT EXISTS `store_sales`(
        `ss_sold_date_sk` bigint,
        `ss_sold_time_sk` bigint,
        `ss_item_sk` bigint);
    2. Click the run icon to execute the statement.

      After the information shown in the following figure appears, the table is created. create-table

    3. Execute the following statement in the SparkSql editor to query tables:

      SHOW TABLES

      After you successfully execute the preceding statement, you can view the created table on the Results tab, as shown in the following figure. sparksql_show_table

Use the Hive editor

  1. Go to the Cluster Overview page of your cluster.

    1. Log on to the Alibaba Cloud EMR console.

    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 Cluster Management tab.

    4. On the Cluster Management page, find your cluster and click Details in the Actions column.

  2. In the left-side navigation pane, click Connect Strings.

  3. On the Public Connect Strings page, click the URL of Hue.

    On the page that appears, enter your Hue username and password to access the Hue web UI.

    Note

    For more information about how to obtain a Hue account and password, see Use Hue.

  4. Go to the Hive page.

    1. In the left-side navigation pane, click the editor icon.

    2. Select Hive.

      The Hive page appears.

  5. Execute statements in the Hive editor.

    1. Enter the following statement in the editor to query databases in your cluster:

      SHOW DATABASES
    2. Click the run icon to execute the statement.

      After you successfully execute the preceding statement, you can view the existing databases on the Results tab, as shown in the following figure. show-databases

    3. Enter the following CREATE TABLE statement in the editor:

      CREATE TABLE IF NOT EXISTS `store_sales`(
        `ss_sold_date_sk` bigint,
        `ss_sold_time_sk` bigint,
        `ss_item_sk` bigint);
    4. Click the run icon to execute the statement.

      After the information shown in the following figure appears, the table is created. hive_create_table

    5. Execute the following statement in the Hive editor to query tables:

      SHOW TABLES

      After you successfully execute the preceding statement, you can view the created table on the Results tab, as shown in the following figure. hive_show_table