How to access Hive table with RCFile storage in Pig

Document created by Hao Zhu Employee on Feb 18, 2016
Version 1Show Document
  • View in full screen mode

Author: Hao Zhu

Original Publication Date: January 27, 2015

 

Goal:

This article shows how to access a Hive table with RCFile storage in Pig.

Solution:

1. Create a Hive table with RCFile storage.

create table rcfile_table (x int) stored as rcfile;

2. Locate piggybank.jar.

For example, in MapR Pig 0.13, it is located at:

/opt/mapr/pig/pig-0.13/contrib/piggybank/java/piggybank.jar

3. Register the jar in Pig and then you can load the RCFile table.

$ pig -useHCatalog 
grunt> register /opt/mapr/pig/pig-0.13/contrib/piggybank/java/piggybank.jar
grunt> a = LOAD '/user/hive/warehouse/rcfile_table' USING org.apache.pig.piggybank.storage.HiveColumnarLoader('x int');

Attachments

    Outcomes