Your browser is out of date

Update your browser to view this website correctly. Update my browser now

×

Cloudera Tutorials

Ready to Get Started?

Introduction

You will use Zeppelin's JDBC Hive Interpreter to perform SQL queries against the noSQL HBase table "tweets_sentiment" for the sum of happy and sad tweets and perform visualizations of the results.

Prerequisites

  • Enabled Connected Data Architecture
  • Setup the Development Environment
  • Acquired Twitter Data
  • Cleaned Raw Twitter Data
  • Built a Sentiment Classification Model
  • Deployed a Sentiment Classification Model

Outline

Implement a Zeppelin Notebook to Visualize Sentiment Scores

Create Hive Table Mapping to HBase Table

To visualize the data stored in HBase, you can use zeppelin's JDBC Hive Interpreter:

%jdbc(hive)
CREATE EXTERNAL TABLE IF NOT EXISTS tweets_sentiment(`key` BIGINT, `handle` STRING, `language` STRING, `location` STRING, `sentiment` DOUBLE, `tweet_id` BIGINT)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES("hbase.columns.mapping" = ":key,social_media_sentiment:twitter.handle,social_media_sentiment:twitter.language,social_media_sentiment:twitter.location,social_media_sentiment:twitter.sentiment,social_media_sentiment:twitter.tweet_id")
TBLPROPERTIES("hbase.table.name" = "tweets_sentiment");

create_hive_mapped_hbase_table

Load a Sample of the Data

Load data from the Hive table:

%jdbc(hive)
SELECT * FROM tweets_sentiment;

load_hive_tweets_sentiment_table

Visualize Sentiment Score Per Language in Bar Chart

To see each tweet's sentiment score per language, copy and paste the following query.

%jdbc(hive)
SELECT language, sentiment FROM tweets_sentiment;

load_language_sentiment_score

Summary

Congratulations! You just learned to write Hive code to access an HBase table, query against the table and visualize the data using Zeppelin's JDBC Hive Interpreter.

Further Reading



Your form submission has failed.

This may have been caused by one of the following:

  • Your request timed out
  • A plugin/browser extension blocked the submission. If you have an ad blocking plugin please disable it and close this message to reload the page.