# Hive Quickstart

[Apache Hive](https://hive.apache.org/) is a data warehouse system built on top of
[Apache Hadoop](https://hadoop.apache.org) that facilitates easy data summarization,
ad-hoc queries, and the analysis of large datasets stored in various databases and
file systems that integrate with Hadoop.
Hive offers a simple way to apply structure to large amounts of unstructured data
and then perform batch SQL-like queries on that data.

The Treasure Data Hive service (TD Hive) provides batch data processing on data stored in Treasure Data’s data lake,
based on Apache Hive. Treasure Data operates compute clusters for running Hive jobs.

The Customer Data Platform (CDP) application uses Hive jobs for some of its internal operations,
and you can also run your own Hive jobs. You can submit SELECT or DML queries using the Hive query language (HiveQL),
using TD Console, API calls, the TD Toolbelt, or from TD workflows. The service queues, executes the queries,
and returns the results. You can also design your system so that results are delivered to destinations
specified in your Result Output.

## Apache Hive and TD Hive Differences

- TD Hive supports the flexible schema capabilities of the TD platform; schema can be inferred from data loaded into tables or can be set explicitly.
- Treasure Data supports HiveQL semantics, but unlike Apache Hive, Treasure Data allows the user to set and modify the schema at any time. We do not require that a table schema be defined upfront.


## Accessing Hive

You can access Hive using the following:

- TD Console
- TD Toolbelt
- REST API


### TD Console

1. Open the TD Console
2. Open the **Data Workbench**
3. Select **Queries**
![image](/assets/345090.de1e51b9284b079634025bc992c1cb036c6294932e248c711fa72f0469f6d2dd.89112c51.png)
4. Click **New Query** button
![image](/assets/345092.a637e42e590f7a9c6f56508896620c3f65844fcb5ba968466d5c5821bcd134b0.89112c51.png)
5. Select the query type of **Hive**, write a query on the editor and click "Run" button
6. After you run your query, you can check the query processing log


### TD Toolbelt

You can use the Toolbelt command-line (CLI) client to submit Hive queries.

1. Ensure that [TD Toolbelt](/tools/cli-and-sdks/quickstart) is installed.
2. Execute `td query` command like the following:



```
td query -w -T hive -d testdb "SELECT code, COUNT(1) FROM www_access GROUP BY code"
```

### REST API

You can use [POST /v3/job/issue/hive/:database](/apis/td_api_v3-public/jobs/createjob) endpoint to submit Hive queries.