Codota Logo
Clip.add
Code IndexAdd Codota to your IDE (free)

How to use
add
method
in
com.yahoo.bullet.result.Clip

Best Java code snippets using com.yahoo.bullet.result.Clip.add (Showing top 16 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: com.yahoo.bullet/bullet-core

/**
 * Construct a Clip with the given List of {@link BulletRecord}.
 *
 * @param records The input records.
 * @return The created Clip.
 */
public static Clip of(List<BulletRecord> records) {
  return new Clip().add(records);
}
origin: com.yahoo.bullet/bullet-core

  /**
   * Construct a Clip with the given metadata.
   *
   * @param meta The Meta to add. The objects in the Meta must be serializable to JSON
   *             with {@link com.google.gson.Gson}.
   * @return This object for chaining
   */
  public static Clip of(Meta meta) {
    return new Clip().add(meta);
  }
}
origin: com.yahoo.bullet/bullet-core

/**
 * Construct a Clip with the given {@link BulletRecord}.
 *
 * @param record The input record.
 * @return The created Clip.
 */
public static Clip of(BulletRecord record) {
  return new Clip().add(record);
}
origin: com.yahoo.bullet/bullet-core

/**
 * Adds all the {@link BulletRecord} and the {@link Meta} from the given {@link Clip} to this.
 *
 * @param clip The clip to add.
 * @return This Clip for chaining.
 */
public Clip add(Clip clip) {
  if (clip != null) {
    add(clip.getMeta());
    add(clip.getRecords());
  }
  return this;
}
origin: com.yahoo.bullet/bullet-core

@Override
public Clip getResult(String metaKey, Map<String, String> conceptKeys) {
  Clip data = super.getResult(metaKey, conceptKeys);
  data.add(getRecords());
  return data;
}
origin: com.yahoo.bullet/bullet-core

@Override
public Clip getResult(String metaKey, Map<String, String> conceptKeys) {
  merge();
  Clip data = super.getResult(metaKey, conceptKeys);
  return data.add(getCount());
}
origin: com.yahoo.bullet/bullet-core

@Override
public Clip getResult(String metaKey, Map<String, String> conceptKeys) {
  merge();
  Clip data = super.getResult(metaKey, conceptKeys);
  data.add(getRecords());
  return data;
}
origin: com.yahoo.bullet/bullet-core

@Override
public Clip getResult() {
  // This has already called aggregation.getMetadata
  Clip clip = Clip.of(getMetadata());
  clip.add(aggregation.getRecords());
  return clip;
}
origin: com.yahoo.bullet/bullet-core

@Override
public Clip getResult(String metaKey, Map<String, String> conceptKeys) {
  merge();
  Clip result = super.getResult(metaKey, conceptKeys);
  result.add(getRecords());
  return result;
}
origin: com.yahoo.bullet/bullet-core

/**
 * Returns the {@link List} of {@link BulletRecord} result so far. See {@link #getResult()} for the full result
 * with metadata.
 *
 * @return The records that are part of the result.
 */
@Override
public List<BulletRecord> getRecords() {
  try {
    incrementRate();
    Clip result = new Clip();
    result.add(window.getRecords());
    result = postAggregate(result);
    return result.getRecords();
  } catch (RuntimeException e) {
    log.error("Unable to get serialized result for query {}", this);
    return null;
  }
}
origin: com.yahoo.bullet/bullet-core

/**
 * Gets the resulting {@link Clip} of the results so far.
 *
 * @return A non-null {@link Clip} representing the aggregated result.
 */
@Override
public Clip getResult() {
  Clip result;
  try {
    incrementRate();
    result = window.getResult();
    result = postAggregate(result);
    result.add(getResultMetadata());
  } catch (RuntimeException e) {
    log.error("Unable to get serialized data for query {}", this);
    result = Clip.of(getErrorMeta(e));
  }
  return result;
}
origin: bullet-db/bullet-storm

@Test
public void testRateLimitErrorFromUpstream() {
  config.set(BulletStormConfig.TOPOLOGY_METRICS_BUILT_IN_ENABLE, true);
  config.validate();
  setup(bolt);
  Tuple query = TupleUtils.makeIDTuple(TupleClassifier.Type.QUERY_TUPLE, "42", "{}", EMPTY);
  bolt.execute(query);
  List<BulletRecord> sent = sendRawRecordTuplesTo(bolt, "42", RAW_MAX_SIZE - 1);
  Assert.assertEquals(collector.getEmittedCount(), 0);
  Assert.assertEquals(context.getLongMetric(TopologyConstants.ACTIVE_QUERIES_METRIC), Long.valueOf(1));
  RateLimitError rateLimitError = new RateLimitError(2000.0, 1000.0);
  Tuple error = TupleUtils.makeIDTuple(TupleClassifier.Type.ERROR_TUPLE, "42", rateLimitError);
  bolt.execute(error);
  Assert.assertEquals(collector.getEmittedCount(), 2);
  Assert.assertEquals(context.getLongMetric(TopologyConstants.ACTIVE_QUERIES_METRIC), Long.valueOf(0));
  Tuple expected = TupleUtils.makeTuple(TupleClassifier.Type.RESULT_TUPLE, "42",
                     Clip.of(sent).add(rateLimitError.makeMeta()).asJSON(),
                     new Metadata(Metadata.Signal.FAIL, null));
  Assert.assertTrue(wasResultEmittedTo(TopologyConstants.RESULT_STREAM, expected));
  Tuple metadata = TupleUtils.makeTuple(TupleClassifier.Type.FEEDBACK_TUPLE, "42", new Metadata(Metadata.Signal.KILL, null));
  Assert.assertTrue(wasMetadataEmittedTo(TopologyConstants.FEEDBACK_STREAM, metadata));
  Assert.assertEquals(collector.getAllEmittedTo(TopologyConstants.RESULT_STREAM).count(), 1);
  Assert.assertEquals(collector.getAllEmittedTo(TopologyConstants.FEEDBACK_STREAM).count(), 1);
}
origin: bullet-db/bullet-storm

@Test
public void testRateLimitingOnCombine() {
  RateLimitError rateLimitError = new RateLimitError(42.0, 5.0);
  bolt = new RateLimitedJoinBolt(2, rateLimitError, config);
  setup(bolt);
  Tuple query = TupleUtils.makeIDTuple(TupleClassifier.Type.QUERY_TUPLE, "42", makeAggregationQuery(RAW, 10));
  bolt.execute(query);
  // After consuming the 3rd one, it is rate limited and the fourth is not consumed
  List<BulletRecord> sent = sendRawRecordTuplesTo(bolt, "42", 4);
  Assert.assertEquals(collector.getEmittedCount(), 2);
  Tuple expected = TupleUtils.makeTuple(TupleClassifier.Type.RESULT_TUPLE, "42",
                     Clip.of(sent.subList(0, 3)).add(rateLimitError.makeMeta()).asJSON(),
                     new Metadata(Metadata.Signal.FAIL, null));
  Assert.assertTrue(wasResultEmittedTo(TopologyConstants.RESULT_STREAM, expected));
  Tuple metadata = TupleUtils.makeTuple(TupleClassifier.Type.FEEDBACK_TUPLE, "42", new Metadata(Metadata.Signal.KILL, null));
  Assert.assertTrue(wasMetadataEmittedTo(TopologyConstants.FEEDBACK_STREAM, metadata));
}
origin: bullet-db/bullet-storm

@Test
public void testQueryIdentifierMetadata() {
  config = configWithRawMaxAndEmptyMeta();
  enableMetadataInConfig(config, Concept.QUERY_METADATA.getName(), "meta");
  enableMetadataInConfig(config, Concept.QUERY_ID.getName(), "id");
  setup(new JoinBolt(config));
  Tuple query = TupleUtils.makeIDTuple(TupleClassifier.Type.QUERY_TUPLE, "42", "{}", EMPTY);
  bolt.execute(query);
  List<BulletRecord> sent = sendRawRecordTuplesTo(bolt, "42");
  Meta meta = new Meta();
  meta.add("meta", singletonMap("id", "42"));
  Tuple expected = TupleUtils.makeTuple(TupleClassifier.Type.RESULT_TUPLE, "42", Clip.of(sent).add(meta).asJSON(), COMPLETED);
  Assert.assertTrue(wasResultEmittedTo(TopologyConstants.RESULT_STREAM, expected));
  Tuple metadata = TupleUtils.makeTuple(TupleClassifier.Type.FEEDBACK_TUPLE, "42", new Metadata(Metadata.Signal.COMPLETE, null));
  Assert.assertTrue(wasMetadataEmittedTo(TopologyConstants.FEEDBACK_STREAM, metadata));
  Assert.assertEquals(collector.getAllEmittedTo(TopologyConstants.RESULT_STREAM).count(), 1);
  Assert.assertEquals(collector.getAllEmittedTo(TopologyConstants.FEEDBACK_STREAM).count(), 1);
}
origin: bullet-db/bullet-storm

@Test
public void testUnknownConceptMetadata() {
  config = configWithRawMaxAndEmptyMeta();
  enableMetadataInConfig(config, Concept.QUERY_METADATA.getName(), "meta");
  enableMetadataInConfig(config, Concept.QUERY_ID.getName(), "id");
  enableMetadataInConfig(config, "foo", "bar");
  setup(new JoinBolt(config));
  Tuple query = TupleUtils.makeIDTuple(TupleClassifier.Type.QUERY_TUPLE, "42", "{}", EMPTY);
  bolt.execute(query);
  List<BulletRecord> sent = sendRawRecordTuplesTo(bolt, "42");
  Meta meta = new Meta();
  meta.add("meta", singletonMap("id", "42"));
  Tuple expected = TupleUtils.makeTuple(TupleClassifier.Type.RESULT_TUPLE, "42", Clip.of(sent).add(meta).asJSON(), COMPLETED);
  Assert.assertTrue(wasResultEmittedTo(TopologyConstants.RESULT_STREAM, expected));
  Tuple metadata = TupleUtils.makeTuple(TupleClassifier.Type.FEEDBACK_TUPLE, "42", new Metadata(Metadata.Signal.COMPLETE, null));
  Assert.assertTrue(wasMetadataEmittedTo(TopologyConstants.FEEDBACK_STREAM, metadata));
  Assert.assertEquals(collector.getAllEmittedTo(TopologyConstants.RESULT_STREAM).count(), 1);
  Assert.assertEquals(collector.getAllEmittedTo(TopologyConstants.FEEDBACK_STREAM).count(), 1);
}
origin: bullet-db/bullet-storm

@Test
public void testRateLimitingWithTicks() {
  RateLimitError rateLimitError = new RateLimitError(42.0, 5.0);
  bolt = new RateLimitedJoinBolt(2, rateLimitError, config);
  setup(bolt);
  Tuple query = TupleUtils.makeIDTuple(TupleClassifier.Type.QUERY_TUPLE, "42", makeAggregationQuery(RAW, 10));
  bolt.execute(query);
  List<BulletRecord> sent = sendRawRecordTuplesTo(bolt, "42", 2);
  Assert.assertEquals(collector.getEmittedCount(), 0);
  Tuple tick = TupleUtils.makeTuple(TupleClassifier.Type.TICK_TUPLE);
  bolt.execute(tick);
  Assert.assertEquals(collector.getEmittedCount(), 2);
  Tuple expected = TupleUtils.makeTuple(TupleClassifier.Type.RESULT_TUPLE, "42",
                     Clip.of(sent).add(rateLimitError.makeMeta()).asJSON(),
                     new Metadata(Metadata.Signal.FAIL, null));
  Assert.assertTrue(wasResultEmittedTo(TopologyConstants.RESULT_STREAM, expected));
  Tuple metadata = TupleUtils.makeTuple(TupleClassifier.Type.FEEDBACK_TUPLE, "42", new Metadata(Metadata.Signal.KILL, null));
  Assert.assertTrue(wasMetadataEmittedTo(TopologyConstants.FEEDBACK_STREAM, metadata));
}
com.yahoo.bullet.resultClipadd

Javadoc

Adds a BulletRecord to the records in the Clip.

Popular methods of Clip

  • of
    Construct a Clip with the given List of BulletRecord.
  • asJSON
  • getMeta
  • <init>
  • getRecords

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • onRequestPermissionsResult (Fragment)
  • getSystemService (Context)
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
  • Runner (org.openjdk.jmh.runner)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now