incubator-flume-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Hsieh (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLUME-722) RegexAllExtractor doesn't ignore empty groups
Date Fri, 05 Aug 2011 09:53:27 GMT

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

Jonathan Hsieh commented on FLUME-722:
--------------------------------------

Here's a test the fails before and succeeds after the fix.  Fold this into TestExtractors
please?

{code}
  /**
  * the parser step creates a "" that is not the canonical "" which requires equals vs ==
test
  **/
  @Test
  public void testRegexAllExtractorEmptyProblem() throws IOException,
      InterruptedException, FlumeSpecException {
    final MemorySinkSource mem = new MemorySinkSource();
    mem.open();
    SinkFactoryImpl sf = new SinkFactoryImpl();
    sf.setSink("mem", new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        return mem;
      }
      
    });
    FlumeBuilder.setSinkFactory(sf);
    RegexAllExtractor re = (RegexAllExtractor) FlumeBuilder.buildSink(
        LogicalNodeContext.testingContext(), "regexAll(\"(.+)\\\\t(.+)\","
            + "\"\", \"keep\") mem");

    re.open();
    re.append(new EventImpl("ignoreme\tkeepme".getBytes()));
    re.close();

    mem.close();
    mem.open();
    Event e1 = mem.next();
    assertEquals(null, Attributes.readString(e1, ""));
    assertEquals("keepme", Attributes.readString(e1, "keep"));
  }
{code}

Thanks,
Jon.

> RegexAllExtractor doesn't ignore empty groups
> ---------------------------------------------
>
>                 Key: FLUME-722
>                 URL: https://issues.apache.org/jira/browse/FLUME-722
>             Project: Flume
>          Issue Type: Bug
>          Components: Sinks+Sources
>    Affects Versions: v0.9.4
>            Reporter: Nicholas Verbeck
>            Assignee: Mingjie Lai
>            Priority: Minor
>              Labels: decorator, regexall
>         Attachments: FLUME-722.patch
>
>
> Hi flume devs.
> I saw a bug when using RegexAllExtractor: line 94:
>          if(names.get(grp-1) != ""){
>            Attributes.setString(e, names.get(grp-1), val);
>          }
> Please help to file a jira and correct it to use String.equal(), otherwise it doesn't
ignore empty groups.
> (I don't think I can open a issue at cloudera jira.)
> Thanks,
> Mingjie

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message