Help required to understand cascading error

188 views
Skip to first unread message

Bhupesh Dhiman

unread,
Mar 2, 2015, 4:20:25 AM3/2/15
to cascadi...@googlegroups.com
Hi All,

I have written small code in cascading and getting error for it. please help me in understanding whats wrong with my program.

code: 

public class Main
  {
  public static void main( String[] args )
    {
    String docPath = args[ 0 ];
    String wcPath = args[ 1 ];

    Properties properties = new Properties();
    AppProps.setApplicationJarClass( properties, Main.class );
    FlowConnector flowConnector = new Hadoop2MR1FlowConnector( properties );

    Tap docTap = new Hfs( new TextDelimited( true, "\t" ), docPath );
    Tap wcTap = new Hfs( new TextDelimited( true, "\t" ), wcPath );
    Tap hiveTap = new Hfs( new TextDelimited( true, "\t" ), "/user/bdhiman/result" );

    Fields token = new Fields( "token" );
    Fields text = new Fields( "text" );
    RegexSplitGenerator splitter = new RegexSplitGenerator( token, "[ \\[\\]\\(\\),.]" );

    Pipe docPipe = new Each( "token", text, splitter, Fields.RESULTS );

    Pipe wcPipe = new Pipe( "wc", docPipe );
    wcPipe = new GroupBy( wcPipe, token );
    wcPipe = new Every( wcPipe, Fields.ALL, new Count(), Fields.ALL );

    Pipe copy=new Pipe("copy",wcPipe);

    Flow flow = flowConnector.connect( "wc", docTap, wcTap, wcPipe );
    Flow flow2 =        flowConnector.connect( "copy", wcTap, hiveTap, copy );

    Cascade cascade = new CascadeConnector( properties ).connect("result", flow,flow2);
    cascade.complete();

    }
  }


Error:

15/03/02 14:20:43 INFO Configuration.deprecation: mapred.used.genericoptionsparser is deprecated. Instead, use mapreduce.client.genericoptionsparser.used
15/03/02 14:20:43 INFO Configuration.deprecation: mapred.output.compress is deprecated. Instead, use mapreduce.output.fileoutputformat.compress
15/03/02 14:20:44 INFO Configuration.deprecation: mapred.map.child.java.opts is deprecated. Instead, use mapreduce.map.java.opts
15/03/02 14:20:44 INFO Configuration.deprecation: mapred.reduce.child.java.opts is deprecated. Instead, use mapreduce.reduce.java.opts
15/03/02 14:20:44 INFO planner.HadoopPlanner: using application jar: /home/bdhiman/cascading/Impatient-master/hivetest/./build/libs/impatient.jar
Exception in thread "main" cascading.flow.planner.PlannerException: could not build flow from assembly: [[token][impatient.Main.main(Main.java:61)] unable to resolve argument selector: [{1}:'text'], with incoming: [{2}:'token', 'count']]
        at cascading.flow.planner.FlowPlanner.handleExceptionDuringPlanning(FlowPlanner.java:578)
        at cascading.flow.hadoop.planner.HadoopPlanner.buildFlow(HadoopPlanner.java:286)
        at cascading.flow.hadoop.planner.HadoopPlanner.buildFlow(HadoopPlanner.java:80)
        at cascading.flow.FlowConnector.connect(FlowConnector.java:459)
        at cascading.flow.FlowConnector.connect(FlowConnector.java:450)
        at cascading.flow.FlowConnector.connect(FlowConnector.java:426)
        at cascading.flow.FlowConnector.connect(FlowConnector.java:275)
        at cascading.flow.FlowConnector.connect(FlowConnector.java:220)
        at impatient.Main.main(Main.java:78)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
Caused by: cascading.pipe.OperatorException: [token][impatient.Main.main(Main.java:61)] unable to resolve argument selector: [{1}:'text'], with incoming: [{2}:'token', 'count']
        at cascading.pipe.Operator.resolveArgumentSelector(Operator.java:345)
        at cascading.pipe.Each.outgoingScopeFor(Each.java:368)
        at cascading.flow.planner.ElementGraph.resolveFields(ElementGraph.java:628)
        at cascading.flow.planner.ElementGraph.resolveFields(ElementGraph.java:610)
        at cascading.flow.hadoop.planner.HadoopPlanner.buildFlow(HadoopPlanner.java:270)
        ... 12 more
Caused by: cascading.tuple.FieldsResolverException: could not select fields: [{1}:'text'], from: [{2}:'token', 'count']
        at cascading.tuple.Fields.indexOf(Fields.java:1016)
        at cascading.tuple.Fields.select(Fields.java:1072)
        at cascading.pipe.Operator.resolveArgumentSelector(Operator.java:341)
        ... 16 more
15/03/02 14:20:44 INFO state.AppStats: shutdown finalizing app status
15/03/02 14:20:46 INFO rest.DrivenDocumentService: plugin protocol action: 'allow'
15/03/02 14:20:46 INFO rest.DrivenDocumentService:



Thanks
Bhupesh
Reply all
Reply to author
Forward
0 new messages