[
https://issues.apache.org/jira/browse/PHOENIX-3240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15563696#comment-15563696
]
ASF GitHub Bot commented on PHOENIX-3240:
-----------------------------------------
GitHub user joshelser opened a pull request:
https://github.com/apache/phoenix/pull/217
PHOENIX-3240 Create phoenix-$VERSION-pig shaded jar
Running inside of Pig's environment creates some issues where Pig is already
providing some versions of dependencies (e.g. joda-time). Create a custom
JAR specifically to be used with Pig.
Testing approach:
1. `create table foobar(a varchar, b date not null, constraint pk primary
key (a, b));`
2. `cd /usr/local/lib/pig-0.16.0`
3. `PIG_HOME=$(pwd)
PIG_CLASSPATH=/usr/local/lib/phoenix/phoenix-4.9.0-HBase-1.2-SNAPSHOT-pig.jar
./bin/pig` (or alternatively, `register
/usr/local/lib/phoenix/phoenix-4.9.0-HBase-1.2-SNAPSHOT-pig.jar` in the pig
interpreter)
4. Create a two-column CSV file in HDFS (e.g. `a1,2016-10-10 17:05:00`)
5. `A = load 'times' using PigStorage(',') as (a:chararray, b:datetime);`
6. `STORE A into 'hbase://FOOBAR' using
org.apache.phoenix.pig.PhoenixHBaseStorage('localhost:2181:/hbase-1.2','-batchSize
100');`
7. `select * from FOOBAR;`
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/joshelser/phoenix 3240-shaded-pig
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/phoenix/pull/217.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #217
----
commit ee0101d175708d6abe1079b36d07bd4a9cbada16
Author: Josh Elser <[email protected]>
Date: 2016-10-10T22:03:44Z
PHOENIX-3240 Create phoenix-$VERSION-pig shaded jar
Running inside of Pig's environment creates some issues where Pig is already
providing some versions of dependencies (e.g. joda-time). Create a custom
JAR specifically to be used with Pig.
----
> ClassCastException from Pig loader
> ----------------------------------
>
> Key: PHOENIX-3240
> URL: https://issues.apache.org/jira/browse/PHOENIX-3240
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.8.0
> Reporter: YoungWoo Kim
> Assignee: Josh Elser
> Fix For: 4.9.0
>
>
> I'm loading data from Hive table to Phoenix table in using Phoenix-Pig
> integration. my pig script looks like following:
> {code}
> T = LOAD 'mydb.$TBL' USING org.apache.hive.hcatalog.pig.HCatLoader();
> STORE T into 'hbase://MYSCHEMA.$TBL' using
> org.apache.phoenix.pig.PhoenixHBaseStorage('i004,i005,i006','-batchSize
> 1000');
> {code}
> If the source table has timestamp, MapReduce job for Pig script does not work:
> {noformat}
> ERROR 0: java.lang.ClassCastException: org.joda.time.DateTime cannot be cast
> to org.apache.phoenix.shaded.org.joda.time.DateTime
> org.apache.pig.backend.executionengine.ExecException: ERROR 0:
> java.lang.ClassCastException: org.joda.time.DateTime cannot be cast to
> org.apache.phoenix.shaded.org.joda.time.DateTime
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.getStats(MapReduceLauncher.java:822)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.launchPig(MapReduceLauncher.java:452)
> at
> org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.launchPig(HExecutionEngine.java:304)
> at org.apache.pig.PigServer.launchPlan(PigServer.java:1390)
> at
> org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:1375)
> at org.apache.pig.PigServer.execute(PigServer.java:1364)
> at org.apache.pig.PigServer.executeBatch(PigServer.java:415)
> at org.apache.pig.PigServer.executeBatch(PigServer.java:398)
> at
> org.apache.pig.tools.grunt.GruntParser.executeBatch(GruntParser.java:171)
> at
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:234)
> at
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:205)
> at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81)
> at org.apache.pig.Main.run(Main.java:502)
> at org.apache.pig.Main.main(Main.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
> at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
> Caused by: java.lang.ClassCastException: org.joda.time.DateTime cannot be
> cast to org.apache.phoenix.shaded.org.joda.time.DateTime
> at
> org.apache.phoenix.pig.util.TypeUtil.castPigTypeToPhoenix(TypeUtil.java:201)
> at
> org.apache.phoenix.pig.PhoenixHBaseStorage.putNext(PhoenixHBaseStorage.java:189)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputFormat$PigRecordWriter.write(PigOutputFormat.java:136)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputFormat$PigRecordWriter.write(PigOutputFormat.java:95)
> at
> org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.write(MapTask.java:658)
> at
> org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(TaskInputOutputContextImpl.java:89)
> at
> org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.write(WrappedMapper.java:112)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapOnly$Map.collect(PigMapOnly.java:48)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:260)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:64)
> at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:146)
> at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
> at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
> at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Subject.java:422)
> at
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)