Database Reference
In-Depth Information
tags set<varchar> : Really, we need a set here. Our tags are not ordered,
and this should not be reflected in the structure of the field. Lists are more
structured, and therefore, the implementation of a list might take a slight
performance hit. However, there are no sets in Phoenix as yet, and a list is
close enough to what we need here.
downloadurl map<varchar,varchar> : As you can see, we made
downloadurl map<String, String> , where the key is the region and
the value is the URI of the video. That is because content delivery systems
usually store the video in different regions. Once a user makes a request,
we know their location by IP. From here, we can find the recommended
geographical location, from all that we have available, and the map will
return the URL for that location.
Exercises
Let's see how well we have understood the concepts. Next, you will find some
exercises and their sample answers:
Try to do them yourself first, and then look at the sample
answers.
• Manually insert a row in the video table.
The sample answer is as follows:
INSERT INTO videos
(videoid, videoname, username, description, location, tags,
upload_date)
VALUES
(18134b9d-6222-4f0e-b06d-4ba1e6c62f50, 'my cat',
'johnsmith', 'this is my cat', {'us' :
'http://right.here'}, {'cats', 'pets'}, '2013-09-09
21:33:15');
Note that there is no UUID generator for HBase, and this one was generated
with the Java code.
• Experiment with the data load.
To generate data for this, we have provided the code in an open source
project. Moreover, the project contains the JAR files that are already prebuilt
and committed. So, just by cloning it, you can start using the JAR files
without the need to build the code.
 
Search WWH ::




Custom Search