Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.Event


    return Type.getPrimitive(Type.TypeName.TIMESTAMP);
  }

  @Override
  public Object eval(EventWrapper event, Object... args) {
    Event e = event.getEvent();
    return new Timestamp(e.getTimestamp(), e.getNanos());
  }
View Full Code Here


    return Type.getPrimitive(Type.TypeName.STRING);
  }

  @Override
  public Object eval(EventWrapper event, Object... args) {
    Event e = event.getEvent();
    return new Utf8(e.getPriority().toString());
  }
View Full Code Here

    // with the regex /([^=]*)=(\\d*),(.*)/

    Map<String, String> properties = new HashMap<String, String>();
    properties.put("regex", "([^=]*)=(\\d*),(.*)");

    Event event = new EventImpl("foo=42,this is a lovely record".getBytes());
    EventParser parser = new RegexEventParser(properties);
    parser.reset(event);

    CharSequence field1 = (CharSequence) parser.getColumn(0,
        Type.getPrimitive(Type.TypeName.STRING));
View Full Code Here

    GenericData.Record record = new GenericData.Record(schema);
    record.put("left", 4);
    record.put("right", "foo");

    Event event = makeEvent(record, schema);
    EventParser parser = makeParser(schema);
    parser.reset(event);

    Integer outLeft = (Integer) parser.getColumn(0, Type.getPrimitive(Type.TypeName.INT));
    assertEquals(4, outLeft.intValue());
View Full Code Here

    return event;
  }

  @Test
  public void testEmpty() throws Exception {
    Event e = makeEvent("");
    DelimitedEventParser ep = new DelimitedEventParser();
    ep.reset(e);

    try {
      ep.getColumn(0, Type.getPrimitive(Type.TypeName.INT));
View Full Code Here

    }
  }

  @Test
  public void testSingleCol() throws Exception {
    Event e = makeEvent("42");
    DelimitedEventParser ep = new DelimitedEventParser();
    ep.reset(e);

    int result = (Integer) ep.getColumn(0, Type.getPrimitive(Type.TypeName.INT));
    assertEquals(42, result);
View Full Code Here

    }
  }

  @Test
  public void testMultiCols() throws Exception {
    Event e = makeEvent("1,2,3,4");
    DelimitedEventParser ep = new DelimitedEventParser();
    ep.reset(e);

    // Open all the columns in-order, assert that they parse correctly.
    for (int i = 0; i < 4; i++) {
View Full Code Here

    return Type.getPrimitive(Type.TypeName.STRING);
  }

  @Override
  public Object eval(EventWrapper event, Object... args) {
    Event e = event.getEvent();
    return new Utf8(e.getHost());
  }
View Full Code Here

    return Type.getPrimitive(Type.TypeName.INT);
  }

  @Override
  public Object eval(EventWrapper event, Object... args) {
    Event e = event.getEvent();
    return Integer.valueOf(e.getPriority().ordinal());
  }
View Full Code Here

      // Schema error - the user tried to put a null in a field declared non-null.
      // We silently elide the entire record.
      LOG.debug("Omitting record with NULL value in non-null field: " + npe.toString());
      return;
    }
    Event out = new EventImpl(mOutputBytes.toByteArray(),
        timestamp, inEvent.getPriority(), inEvent.getNanos(), inEvent.getHost());
    AvroEventWrapper outWrapper = new AvroEventWrapper(mOutputSchema);
    outWrapper.reset(out);
    emit(outWrapper, context);
  }
View Full Code Here

TOP

Related Classes of com.cloudera.flume.core.Event

Copyright © 2018 www.massapicom. 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.