Examples of InputRow


Examples of io.druid.data.input.InputRow

    Assert.assertEquals(1, plumber.getPersistCount());
  }

  private InputRow makeRow(final long timestamp)
  {
    return new InputRow()
    {
      @Override
      public List<String> getDimensions()
      {
        return Arrays.asList("testDim");
View Full Code Here

Examples of io.druid.data.input.InputRow

  public void testPersist() throws Exception
  {
    final MutableBoolean committed = new MutableBoolean(false);
    plumber.getSinks().put(0L, new Sink(new Interval(0, TimeUnit.HOURS.toMillis(1)),schema, tuningConfig, DateTime.now().toString()));
    plumber.startJob();
    final InputRow row = EasyMock.createNiceMock(InputRow.class);
    EasyMock.expect(row.getTimestampFromEpoch()).andReturn(0L);
    EasyMock.expect(row.getDimensions()).andReturn(new ArrayList<String>());
    EasyMock.replay(row);
    plumber.add(row);
    plumber.persist(
        new Runnable()
        {
View Full Code Here

Examples of io.druid.data.input.InputRow

      try {
        plumber.startJob();

        long nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis();
        while (firehose.hasMore()) {
          InputRow inputRow = null;
          try {
            try {
              inputRow = firehose.nextRow();
            }
            catch (Exception e) {
View Full Code Here

Examples of io.druid.data.input.InputRow

        )
    );
    final Firehose firehose = combiningFactory.connect(null);
    for (int i = 1; i < 6; i++) {
      Assert.assertTrue(firehose.hasMore());
      final InputRow inputRow = firehose.nextRow();
      Assert.assertEquals(i, inputRow.getTimestampFromEpoch());
      Assert.assertEquals(i, inputRow.getFloatMetric("test"), 0);
    }
    Assert.assertFalse(firehose.hasMore());
  }
View Full Code Here

Examples of io.druid.data.input.InputRow

    Assert.assertFalse(firehose.hasMore());
  }

  private InputRow makeRow(final long timestamp, final float metricValue)
  {
    return new InputRow()
    {
      @Override
      public List<String> getDimensions()
      {
        return Arrays.asList("testDim");
View Full Code Here

Examples of io.druid.data.input.InputRow

  protected void map(
      LongWritable key, Text value, Context context
  ) throws IOException, InterruptedException
  {
    try {
      final InputRow inputRow;
      try {
        inputRow = parser.parse(value.toString());
      }
      catch (Exception e) {
        if (config.isIgnoreInvalidRows()) {
          context.getCounter(HadoopDruidIndexerConfig.IndexJobCounters.INVALID_ROW_COUNTER).increment(1);
          return; // we're ignoring this invalid row
        } else {
          throw e;
        }
      }
      GranularitySpec spec = config.getGranularitySpec();
      if (!spec.bucketIntervals().isPresent() || spec.bucketInterval(new DateTime(inputRow.getTimestampFromEpoch()))
                                                     .isPresent()) {
        innerMap(inputRow, value, context);
      }
    }
    catch (RuntimeException e) {
View Full Code Here

Examples of io.druid.data.input.InputRow

        .build();

    for (Map.Entry<SingleDimensionShardSpec, List<Pair<Boolean, Map<String, String>>>> entry : tests.entrySet()) {
      SingleDimensionShardSpec spec = entry.getKey();
      for (Pair<Boolean, Map<String, String>> pair : entry.getValue()) {
        final InputRow inputRow = new MapBasedInputRow(
            0, ImmutableList.of("billy"), Maps.transformValues(
            pair.rhs, new Function<String, Object>()
        {
          @Override
          public Object apply(String input)
          {
            return input;
          }
        }
        )
        );
        Assert.assertEquals(String.format("spec[%s], row[%s]", spec, inputRow), pair.lhs, spec.isInChunk(inputRow.getTimestampFromEpoch(), inputRow));
      }
    }
  }
View Full Code Here

Examples of io.druid.data.input.InputRow

    }

    @Override
    public InputRow nextRow()
    {
      final InputRow inputRow = rowYielder.get();
      rowYielder = rowYielder.next(null);
      return inputRow;
    }
View Full Code Here

Examples of io.druid.data.input.InputRow

        Set<String> allDimensionNames = Sets.newHashSet();
        final ProgressIndicator progressIndicator = makeProgressIndicator(context);

        for (final Text value : values) {
          context.progress();
          final InputRow inputRow = index.formatRow(parser.parse(value.toString()));
          allDimensionNames.addAll(inputRow.getDimensions());

          int numRows = index.add(inputRow);
          ++lineCount;

          if (numRows >= config.getSchema().getTuningConfig().getRowFlushBoundary()) {
View Full Code Here

Examples of io.druid.data.input.InputRow

    }

    @Override
    public InputRow nextRow()
    {
      InputRow rv = currentFirehose.nextRow();
      if (!currentFirehose.hasMore()) {
        nextFirehose();
      }
      return rv;
    }
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.