You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Johannes Zillmann (JIRA)" <ji...@apache.org> on 2008/02/14 00:47:09 UTC

[jira] Updated: (PIG-109) improve exception handling for function instantiation

     [ https://issues.apache.org/jira/browse/PIG-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johannes Zillmann updated PIG-109:
----------------------------------

    Attachment: pigExceptionPatch-627601.diff

I attached a patch with a slightly cleaned up exception handling around PigContext#instantiateFunc().
With these modification the complete stacktrace was shown to me in the console and i could easily fix the problem.

The new stacktrace looks like
{noformat}
08/02/13 23:42:05 ERROR mapreduceExec.MapReduceLauncher: Error message from task (map) tip_200802110401_0075_m_000000 java.lang.RuntimeException: could not instantiate 'com.example.DatabaseStoreFunc' with arguments '[testTable_tmp, 0|model_group|java.lang.String|false|false|false|64;1|avg_call_time|java.lang.Double|false|false|false]'
        at org.apache.pig.impl.PigContext.instantiateFunc(PigContext.java:427)
        at org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:434)
        at org.apache.pig.backend.hadoop.executionengine.mapreduceExec.PigOutputFormat.getRecordWriter(PigOutputFormat.java:57)
        at org.apache.pig.backend.hadoop.executionengine.mapreduceExec.PigOutputFormat.getRecordWriter(PigOutputFormat.java:47)
        at org.apache.pig.backend.hadoop.executionengine.mapreduceExec.PigMapReduce.setupMapPipe(PigMapReduce.java:205)
        at org.apache.pig.backend.hadoop.executionengine.mapreduceExec.PigMapReduce.run(PigMapReduce.java:103)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:192)
        at org.apache.hadoop.mapred.TaskTracker$Child.main(TaskTracker.java:1760)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.apache.pig.impl.PigContext.instantiateFunc(PigContext.java:422)
        ... 7 more
Caused by: java.lang.RuntimeException: Failed to load JDBC driver. 
...
Caused by: java.lang.ClassNotFoundException: org.hsqldb.jdbcDriver
...
{noformat}

The patch is against revision 627601.

> improve exception handling for function instantiation
> -----------------------------------------------------
>
>                 Key: PIG-109
>                 URL: https://issues.apache.org/jira/browse/PIG-109
>             Project: Pig
>          Issue Type: Test
>          Components: impl
>            Reporter: Johannes Zillmann
>         Attachments: pigExceptionPatch-627601.diff
>
>
> Running pig on a cluster i got an instantiation exception for my custom StoreFunc:
> {noformat}
> 08/02/13 22:58:42 ERROR mapreduceExec.MapReduceLauncher: Error message from task (map) tip_200802110401_0072_m_000000 java.lang.RuntimeException: java.io.IOException: null
>         at org.apache.pig.impl.PigContext.instantiateFunc(PigContext.java:427)
>         at org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:435)
>         at org.apache.pig.backend.hadoop.executionengine.mapreduceExec.PigOutputFormat.getRecordWriter(PigOutputFormat.java:58)
>         at org.apache.pig.backend.hadoop.executionengine.mapreduceExec.PigOutputFormat.getRecordWriter(PigOutputFormat.java:47)
>         at org.apache.pig.backend.hadoop.executionengine.mapreduceExec.PigMapReduce.setupMapPipe(PigMapReduce.java:205)
>         at org.apache.pig.backend.hadoop.executionengine.mapreduceExec.PigMapReduce.run(PigMapReduce.java:103)
>         at org.apache.hadoop.mapred.MapTask.run(MapTask.java:192)
>         at org.apache.hadoop.mapred.TaskTracker$Child.main(TaskTracker.java:1760)
> {noformat} 
> Easy to figure out that there is a problem with my StoreFunc, but hard to figure out what exactly.
> Looking into the pig code up from PigContext#instantiateFunc() there is a kind of exception handling which seems unecessary complicated.
> Any exception which can happen while instantiating the store func (like InstantiationException or InvocationTargetException) is catched and wrapped with a IOException. 
> Later on the cause of the IOException is inspected (LOLoad, around line 60) or wrapped into a RuntimeException without handing the causes over (PigSplit, around line 101).
> Since every exception which can raise on PigContext#instantiateFunc() is rather an user error since a temporary environment problem, i think this method can just throw an unchecked exception and don't have to declare IOeception anymore. This should save a lot of trouble in calling methods.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.