[
https://issues.apache.org/jira/browse/PHOENIX-11?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13965276#comment-13965276
]
ravi commented on PHOENIX-11:
-----------------------------
[[email protected]]
Thanks for taking a stab at it. The loader itself does the work for you by
giving the column names as part of ResourceSchema. Hence, you can refer a
column by its name within the script.
So, for a table definition as below.
{code}
DDL:
---------
CREATE TABLE HIRES( CLIENTID INTEGER NOT NULL, EMPID INTEGER NOT NULL, NAME
VARCHAR CONSTRAINT pk PRIMARY KEY(CLIENTID,EMPID));
Pig Script to find the number of users by just CLIENTID
--------------------------------------------------------------------
raw = LOAD 'hbase://table/HIRES USING
org.apache.phoenix.pig.PhoenixHBaseLoader('localhost')';
grpd = GROUP raw BY CLIENTID;
cnt = FOREACH grpd GENERATE group AS CLIENT,COUNT(raw);
DUMP cnt;
{code}
I hope this clears the confusion. Please let me know how it goes.
> Create Pig Loader
> -----------------
>
> Key: PHOENIX-11
> URL: https://issues.apache.org/jira/browse/PHOENIX-11
> Project: Phoenix
> Issue Type: Bug
> Reporter: James Taylor
> Assignee: maghamravikiran
>
> A Pig Storage function exists, so we can store to phoenix tables. What is
> needed is a Loader to go with the Storer.
--
This message was sent by Atlassian JIRA
(v6.2#6252)