Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-3240

ClassCastException from Pig loader

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.8.0
    • 4.9.0, 4.8.2
    • None
    • None

    Description

      I'm loading data from Hive table to Phoenix table in using Phoenix-Pig integration. my pig script looks like following:

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

      If the source table has timestamp, MapReduce job for Pig script does not work:

      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)
      

      Attachments

        Issue Links

          Activity

            People

              elserj Josh Elser
              warwithin YoungWoo Kim
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: