[ 
https://issues.apache.org/jira/browse/PHOENIX-3240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15563534#comment-15563534
 ] 

Josh Elser commented on PHOENIX-3240:
-------------------------------------

Oh, and right, this also explains the issue. Pig is putting JodaTime on the 
classpath too. We try to hand off a relocated DateTime instance and the Pig 
code doesn't know how to handle that. We should just use version of JodaTime 
from Pig.

Going back to the original plan, we should just create a new shaded jar just 
for Pig that doesn't include JodaTime (since PIg would be providing it).

> 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)

Reply via email to