Skip to content

Commit 874be03

Browse files
authored
Merge pull request #100210 from dagiro/freshness166
freshness166
2 parents 3b201da + 55bd79c commit 874be03

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

articles/hdinsight/hadoop/apache-hadoop-use-hive-curl.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
title: Use Apache Hadoop Hive with Curl in HDInsight - Azure
33
description: Learn how to remotely submit Apache Pig jobs to Azure HDInsight using Curl.
44
author: hrasheed-msft
5+
ms.author: hrasheed
56
ms.reviewer: jasonh
6-
77
ms.service: hdinsight
8-
ms.custom: hdinsightactive
98
ms.topic: conceptual
10-
ms.date: 06/28/2019
11-
ms.author: hrasheed
9+
ms.custom: hdinsightactive
10+
ms.date: 01/06/2020
1211
---
1312

1413
# Run Apache Hive queries with Apache Hadoop in HDInsight using REST
@@ -23,7 +22,7 @@ Learn how to use the WebHCat REST API to run Apache Hive queries with Apache Had
2322

2423
* A REST client. This document uses [Invoke-WebRequest](https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest) on Windows PowerShell and [Curl](https://curl.haxx.se/) on [Bash](https://docs.microsoft.com/windows/wsl/install-win10).
2524

26-
* If you use Bash, you will also need jq, a command-line JSON processor. See [https://stedolan.github.io/jq/](https://stedolan.github.io/jq/).
25+
* If you use Bash, you'll also need jq, a command-line JSON processor. See [https://stedolan.github.io/jq/](https://stedolan.github.io/jq/).
2726

2827
## Base URI for Rest API
2928

@@ -34,6 +33,7 @@ The base Uniform Resource Identifier (URI) for the REST API on HDInsight is `htt
3433
When using cURL or any other REST communication with WebHCat, you must authenticate the requests by providing the user name and password for the HDInsight cluster administrator. The REST API is secured via [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). To help ensure that your credentials are securely sent to the server, always make requests by using Secure HTTP (HTTPS).
3534

3635
### Setup (Preserve credentials)
36+
3737
Preserve your credentials to avoid reentering them for each example. The cluster name will be preserved in a separate step.
3838

3939
**A. Bash**
@@ -51,9 +51,10 @@ $creds = Get-Credential -UserName "admin" -Message "Enter the HDInsight login"
5151
```
5252

5353
### Identify correctly cased cluster name
54-
The actual casing of the cluster name may be different than you expect, depending on how the cluster was created. The steps here will show the actual casing, and then store it in a variable for all subsequent examples.
5554

56-
Edit the scripts below to replace `CLUSTERNAME` with your cluster name. Then enter the command. (The cluster name for the FQDN is not case-sensitive.)
55+
The actual casing of the cluster name may be different than you expect, depending on how the cluster was created. The steps here will show the actual casing, and then store it in a variable for all later examples.
56+
57+
Edit the scripts below to replace `CLUSTERNAME` with your cluster name. Then enter the command. (The cluster name for the FQDN isn't case-sensitive.)
5758

5859
```bash
5960
export clusterName=$(curl -u admin:$password -sS -G "https://CLUSTERNAME.azurehdinsight.net/api/v1/clusters" | jq -r '.items[].Clusters.cluster_name')
@@ -70,7 +71,7 @@ $clusterName = (ConvertFrom-Json $resp.Content).items.Clusters.cluster_name;
7071
$clusterName
7172
```
7273

73-
## <a id="curl"></a>Run a Hive query
74+
## Run a Hive query
7475

7576
1. To verify that you can connect to your HDInsight cluster, use one of the following commands:
7677

@@ -141,7 +142,7 @@ $clusterName
141142

142143
These statements perform the following actions:
143144

144-
* `DROP TABLE` - If the table already exists, it is deleted.
145+
* `DROP TABLE` - If the table already exists, it's deleted.
145146
* `CREATE EXTERNAL TABLE` - Creates a new 'external' table in Hive. External tables store only the table definition in Hive. The data is left in the original location.
146147
147148
> [!NOTE]
@@ -150,7 +151,7 @@ $clusterName
150151
> Dropping an external table does **not** delete the data, only the table definition.
151152
152153
* `ROW FORMAT` - How the data is formatted. The fields in each log are separated by a space.
153-
* `STORED AS TEXTFILE LOCATION` - Where the data is stored (the example/data directory) and that it is stored as text.
154+
* `STORED AS TEXTFILE LOCATION` - Where the data is stored (the example/data directory) and that it's stored as text.
154155
* `SELECT` - Selects a count of all rows where column **t4** contains the value **[ERROR]**. This statement returns a value of **3** as there are three rows that contain this value.
155156

156157
> [!NOTE]
@@ -182,15 +183,11 @@ $clusterName
182183

183184
You can list and download these files by using the [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli). For more information on using the Azure CLI with Azure Storage, see the [Use Azure CLI with Azure Storage](https://docs.microsoft.com/azure/storage/storage-azure-cli#create-and-manage-blobs) document.
184185

185-
## <a id="nextsteps"></a>Next steps
186-
187-
For general information on Hive with HDInsight:
188-
189-
* [Use Apache Hive with Apache Hadoop on HDInsight](hdinsight-use-hive.md)
186+
## Next steps
190187

191188
For information on other ways you can work with Hadoop on HDInsight:
192189

193-
* [Use Apache Pig with Apache Hadoop on HDInsight](hdinsight-use-pig.md)
190+
* [Use Apache Hive with Apache Hadoop on HDInsight](hdinsight-use-hive.md)
194191
* [Use MapReduce with Apache Hadoop on HDInsight](hdinsight-use-mapreduce.md)
195192

196193
For more information on the REST API used in this document, see the [WebHCat reference](https://cwiki.apache.org/confluence/display/Hive/WebHCat+Reference) document.

0 commit comments

Comments
 (0)