Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Apache Hive Essentials

You're reading from   Apache Hive Essentials Immerse yourself on a fantastic journey to discover the attributes of big data by using Hive

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher Packt
ISBN-13 9781783558575
Length 208 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dayong Du Dayong Du
Author Profile Icon Dayong Du
Dayong Du
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Apache Hive Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Overview of Big Data and Hive FREE CHAPTER 2. Setting Up the Hive Environment 3. Data Definition and Description 4. Data Selection and Scope 5. Data Manipulation 6. Data Aggregation and Sampling 7. Performance Considerations 8. Extensibility Considerations 9. Security Considerations 10. Working with Other Tools Index

Set operation – UNION ALL


To operate the result set vertically, Hive only supports UNION ALL right now. And, the result set of UNION ALL keeps duplicates if any. Before Hive 0.13.0, UNION ALL can only be used in the subquery. Since Hive 0.13.0, UNION ALL can also be used in top-level queries. The following are examples of the UNION ALL statements:

  • Check the name column in the employee_hr and employee table:

    jdbc:hive2://> SELECT name FROM employee_hr;
    +----------+
    |   name   |
    +----------+
    | Michael  |
    | Will     |
    | Steven   |
    | Lucy     |
    +----------+
    4 rows selected (0.116 seconds)
    
    jdbc:hive2://> SELECT name FROM employee;
    +----------+
    |   name   |
    +----------+
    | Michael  |
    | Will     |
    | Shelley  |
    | Lucy     |
    +----------+
    4 rows selected (0.049 seconds)
    
  • Use UNION on the name column from both tables, including duplications:

    jdbc:hive2://> SELECT a.name 
    . . . . . . .> FROM employee a
    . . . . . . .> UNION ALL
    . . . . . . .> SELECT b.name 
    . . . . . . .> FROM employee_hr...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images