Examples of TextDelimited


Examples of cascading.scheme.hadoop.TextDelimited

  public static FlowDef
  createFlowDef( String docPath, String wcPath )
   {
    // create source and sink taps
    Tap docTap = new Hfs( new TextDelimited( true, "\t" ), docPath );
    Tap wcTap = new Hfs( new TextDelimited( true, "\t" ), wcPath );

    // specify a regex operation to split the "document" text lines into a token stream
    Fields token = new Fields( "token" );
    Fields text = new Fields( "text" );
    RegexSplitGenerator splitter = new RegexSplitGenerator( token, "[ \\[\\]\\(\\),.]" );
View Full Code Here

Examples of cascading.scheme.hadoop.TextDelimited

    }

  @Override
  public Tap getDelimitedFile( Fields fields, boolean hasHeader, String delimiter, String quote, Class[] types, String filename, SinkMode mode )
    {
    return new Hfs( new TextDelimited( fields, hasHeader, delimiter, quote, types ), safeFileName( filename ), mode );
    }
View Full Code Here

Examples of cascading.scheme.hadoop.TextDelimited

    }

  @Override
  public Tap getDelimitedFile( Fields fields, boolean skipHeader, boolean writeHeader, String delimiter, String quote, Class[] types, String filename, SinkMode mode )
    {
    return new Hfs( new TextDelimited( fields, skipHeader, writeHeader, delimiter, quote, types ), safeFileName( filename ), mode );
    }
View Full Code Here

Examples of cascading.scheme.hadoop.TextDelimited

    }

  @Override
  public Tap getDelimitedFile( String delimiter, String quote, FieldTypeResolver fieldTypeResolver, String filename, SinkMode mode )
    {
    return new Hfs( new TextDelimited( true, new DelimitedParser( delimiter, quote, fieldTypeResolver ) ), safeFileName( filename ), mode );
    }
View Full Code Here

Examples of cascading.scheme.hadoop.TextDelimited

    pipe = new GroupBy( pipe, new Fields( "ip" ) );

    pipe = new Every( pipe, new Count(), new Fields( "ip", "count" ) );

    final int[] count = {0};
    Tap sink = new Hfs( new TextDelimited( Fields.ALL ), getOutputPath( "committap" ), SinkMode.REPLACE )
    {
    @Override
    public boolean commitResource( Configuration conf ) throws IOException
      {
      count[ 0 ] = count[ 0 ] + 1;
View Full Code Here

Examples of cascading.scheme.hadoop.TextDelimited

    pipe = new GroupBy( pipe, new Fields( "ip" ) );

    pipe = new Every( pipe, new Count(), new Fields( "ip", "count" ) );

    Tap sink = new Hfs( new TextDelimited( Fields.ALL ), getOutputPath( "committapfail" ), SinkMode.REPLACE )
    {
    @Override
    public boolean commitResource( Configuration conf ) throws IOException
      {
      throw new IOException( "failed intentionally" );
View Full Code Here

Examples of cascading.scheme.hadoop.TextDelimited

  @Test
  public void testMissingInputFormat() throws Exception
    {
    getPlatform().copyFromLocal( inputFileApache );

    Tap source = new Hfs( new TextDelimited( new Fields( "offset", "line" ) ), inputFileApache )
    {
    @Override
    public void sourceConfInit( FlowProcess<? extends Configuration> process, Configuration conf )
      {
      // don't set input format
      //super.sourceConfInit( process, conf );
      }
    };

    Pipe pipe = new Pipe( "test" );

    pipe = new Each( pipe, new Fields( "line" ), new RegexParser( new Fields( "ip" ), "^[^ ]*" ), new Fields( "ip" ) );

    pipe = new GroupBy( pipe, new Fields( "ip" ) );

    pipe = new Every( pipe, new Count(), new Fields( "ip", "count" ) );

    Tap sink = new Hfs( new TextDelimited( Fields.ALL ), getOutputPath( "missinginputformat" ), SinkMode.REPLACE );

    try
      {
      Flow flow = getPlatform().getFlowConnector().connect( source, sink, pipe );
      flow.complete();
View Full Code Here

Examples of cascading.scheme.hadoop.TextDelimited

    {
    if( typed )
      return new SQLTypedTextDelimited( fields, delimiter, quote, header, strict, safe );

    DelimitedParser delimiterParser = new DelimitedParser( delimiter, quote, null, strict, safe );
    return new TextDelimited( fields, header, delimiterParser );
    }
View Full Code Here

Examples of cascading.scheme.hadoop.TextDelimited

    {
    if( typed )
      return new SQLTypedTextDelimited( fields, delimiter, quote, header, strict, safe );

    DelimitedParser delimiterParser = new DelimitedParser( delimiter, quote, null, strict, safe );
    return new TextDelimited( fields, header, delimiterParser );
    }
View Full Code Here

Examples of cascading.scheme.local.TextDelimited

        CascadeConnector cascadeConnector = new CascadeConnector(cfg);
        cascadeConnector.connect(flows).complete();
    }

    private Tap sourceTap() {
        return new FileTap(new TextDelimited(new Fields("id", "name", "url", "picture", "ts")), INPUT);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.