Questions tagged [hive]

Apache Hive is a database built on top of Hadoop and facilitates easy data summarization, ad-hoc queries, and the analysis of large datasets stored in Hadoop compatible distributed file system. Hive provides a mechanism to project structure onto this data and query the data using a SQL-like language called HiveQL. Please DO NOT use this tag for flutter database which is also named Hive, use flutter-hive tag instead.

Apache Hive is a database built on top of Hadoop that provides the following:

  • Tools to enable easy data summarization (ETL)
  • Ad-hoc querying and analysis of large datasets data stored in Hadoop file system (HDFS)
  • A mechanism to put structure on this data
  • An advanced query language called Hive Query Language which is based on SQL and some additional features such as DISTRIBUTE BY, TRANSFORM, and which enables users familiar with SQL to query this data.

At the same time, this language also allows traditional map/reduce programmers the ability to plug in their custom mappers and reducers to do more sophisticated analysis that may not be supported by the built-in capabilities of the language.

Since Hive is Hadoop-based, it does not and cannot promise low latencies on queries. The paradigm here is strictly of submitting jobs and being notified when the jobs are completed as opposed to real-time queries. In contrast to the systems such as Oracle where analysis is run on a significantly smaller amount of data, but the analysis proceeds much more iteratively with the response times between iterations being less than a few minutes, Hive queries response times for even the smallest jobs can be of the order of several minutes. However for larger jobs (e.g., jobs processing terabytes of data) in general they may run into hours and days. Many optimizations and improvements were made to spped-up processing such as fetch-only task, LLAP, materialized views, etc

To summarize, while low latency performance is not the top-priority of Hive's design principles, the following are Hive's key features:

  • Scalability (scale out with more machines added dynamically to the Hadoop cluster)
  • Extensibility (with map/reduce framework and UDF/UDAF/UDTF)
  • Fault-tolerance
  • Loose-coupling with its input formats
  • Rather reach query kanguage with native suport for JSON, XML, regexp, possibility to call java methods, using python and shell transformations, analytics and windowing functions, possibility to connect to different RDBMS using JDBC drivers, Kafka connector.
  • Ability to read and write almost any file formats using native and third-party SerDe, RegexSerDe.
  • Numerous third-party extensions, for example brickhouse UDFs, etc

How to write good Hive question:

  1. Add clear textual problem description.
  2. Provide query and/or table DDL if applicable
  3. Provide exception message
  4. Provide input and desired output data example
  5. Questions about query performance should include EXPLAIN query output.
  6. Do not use pictures for SQL, DDL, DML, data examples, EXPLAIN output and exception messages.
  7. Use proper code and text formatting

Official links:

Useful Links:

21846 questions
24
votes
6 answers

How to list all hive databases being in use or created so far?

Similar to SHOW TABLES command, do we have any such command to list all databases created so far?
Raja Reddy
  • 772
  • 8
  • 19
  • 37
24
votes
2 answers

metastore_db created wherever I run Hive

Folder metastore_db is created in any directory where I run Hive query. Is there any way to have only one metastore_db in a defined location and stop it from being created all over the places? Does it have anything to do with hive.metastore.local?
darcyy
  • 5,236
  • 5
  • 28
  • 41
24
votes
12 answers

Inserting Data into Hive Table

I am new to hive. I have successfully setup a single node hadoop cluster for development purpose and on top of it, I have installed hive and pig. I created a dummy table in hive: create table foo (id int, name string); Now, I want to insert data…
Tapan Avasthi
  • 425
  • 2
  • 7
  • 16
24
votes
3 answers

Amazon EC2 vs. Amazon EMR

I have implemented a task in Hive. Currently it is working fine on my single node cluster. Now I am planning to deploy it on AWS. I don't know anything about the AWS. If I plan to deploy it then what should I choose Amazon EC2 or Amazon EMR? I want…
Bhavesh Shah
  • 3,299
  • 11
  • 49
  • 73
23
votes
3 answers

Exporting Hive Table to a S3 bucket

I've created a Hive Table through an Elastic MapReduce interactive session and populated it from a CSV file like this: CREATE TABLE csvimport(id BIGINT, time STRING, log STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'; LOAD DATA LOCAL INPATH…
seedhead
  • 3,655
  • 4
  • 32
  • 38
23
votes
2 answers

LATERAL VIEW EXPLODE in presto

New to presto, any pointer how can I use LATERAL VIEW EXPLODE in presto for below table. I need to filter on names in my presto query CREATE EXTERNAL TABLE `id`( `id` string, `names` map>, `tags`…
rkj
  • 671
  • 3
  • 14
  • 25
23
votes
2 answers

Does Spark SQL use Hive Metastore?

I am developing a Spark SQL application and I've got few questions: I read that Spark-SQL uses Hive metastore under the cover? Is this true? I'm talking about a pure Spark-SQL application that does not explicitly connect to any Hive…
user1888243
  • 2,591
  • 9
  • 32
  • 44
23
votes
5 answers

How to load CSV data with enclosed by double quotes and separated by tab into HIVE table?

I am trying to load data from a csv file in which the values are enclosed by double quotes '"' and tab separated '\t' . But when I try to load that into hive its not throwing any error and data is loaded without any error but I think all the data is…
Sharad
  • 3,562
  • 6
  • 37
  • 59
23
votes
11 answers

Hive startup -[ERROR] Terminal initialization failed; falling back to unsupported

I have downloaded hive and modified HADOOP_HOME to HADOOP_HOME=${bin}/../../usr/local/hadoop my actual hadoop path is /usr/local/hadoop in .bashrc i have added the below env variables export HIVE_HOME=/usr/lib/hive/apache-hive-1.1.0-bin export…
Venkat
  • 301
  • 1
  • 4
  • 11
23
votes
4 answers

Required field 'client_protocol' is unset

I am using Hive 0.12, and I'm trying the JDBC from apache. When I try to run the code, I get apache.thrift.TApplicationException. import java.sql.SQLException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import…
user3782579
  • 315
  • 1
  • 4
  • 15
23
votes
6 answers

What is use of hcatalog in hadoop?

I'm new to Hadoop. I know that the HCatalog is a table and storage management layer for Hadoop. But how exactly it works and how to use it. Please give some simple example.
Vijay_Shinde
  • 1,332
  • 2
  • 17
  • 38
23
votes
6 answers

Hive: Filtering Data between Specified Dates when Date is a String

I'm trying to filter data between September 1st, 2010 and August 31st, 2013 in a Hive table. The column containing the date is in string format (yyyy-mm-dd). I can use month() and year() on this column. But how do I use them to filter data between…
mixedbag99
  • 529
  • 1
  • 4
  • 17
23
votes
3 answers

What are the advantages of setting "hive.exec.parallel" to false in Hive ?

I came to know that when hive.exec.parallel is set to true in hive i.e set hive.exec.parallel=true; then independent tasks in a query can run in parallel. Thanks to Qubole for this: Are there any advantages of setting this parameter to false?…
Mayank Jaiswal
  • 12,338
  • 7
  • 39
  • 41
22
votes
7 answers

JSON output format for Hive Query results

Is there any way to convert the Hive query result in JSON format?
divinedragon
  • 5,105
  • 13
  • 50
  • 97
22
votes
2 answers

Create temporary table in Hive?

Does Hive support temporary tables? I can't find it in the apache docs.
CMaury
  • 1,273
  • 5
  • 13
  • 25