Category Archives: Pig

PIG UDF with testNG test case – concatenate two strings

PIG UDF class package org.puneetha.pig.udf; import java.io.IOException; import org.apache.log4j.Logger; import org.apache.pig.EvalFunc; import org.apache.pig.data.Tuple; /*** * * * @author Puneetha * */ public final class ConcatStrPig extends EvalFunc<String>{ private static final Logger logger = Logger.getLogger(Thread.currentThread().getStackTrace()[0].getClassName()); @Override public String exec(final Tuple input) throws IOException { logger.debug("Tuple=" + input.toString()); String separator = " "; StringBuilder result = new… Read More »

Category: Pig

PIG – Commands

PIG Syntax Highlighting in vim http://www.vim.org/scripts/script.php?script_id=2186

Category: Pig

Query Hive table from Pig – using HCatalog

Querying hive table from PIG using HCatalog $cat hcatScript.pig A = LOAD 'db1.tablename' USING org.apache.hcatalog.pig.HCatLoader(); B = LIMIT A 10; dump B; $pig -useHCatalog -f hcatScript.pig Comment below if you find this blog useful.