Database Reference
In-Depth Information
Figure 6-18 . Fetching rows having the fname vivek
Upon running such queries, they are transformed into MapReduce jobs unless the
conditional column is not a partition key. A query over a partition key can fetch data
directly from the data nodes and no MapReduce process will be required as data is
already partitioned by partition keys. We can define the partition key while creating
the table as follows:
CREATE TABLE employee (
fname String,
lname String,
emailId String,
salary FLOAT,
)
PARTITIONED BY (location STRING, joining_year INT,
joining_month INT, joining_day INT) ;
Any conditional query over all parts of a partition key will quickly locate data
folders, as data will be automatically arranged into different folders as per the defined
partition key.
Hive External Table
We can also create an external Hive table over the HDFS directory. It is recommended
to create an external table if it doesn't need to be managed by Hive.
Let's revisit the same tweets example for external table exercises.
 
Search WWH ::




Custom Search