Package io.druid.data.input

Examples of io.druid.data.input.MapBasedInputRow


  private MapBasedInputRow makeRow(long ts, String dim, int value)
  {
    List<String> dimensions = Lists.newArrayList(dim);
    Map<String, Object> metrics = ImmutableMap.of("metric", (Object) Float.valueOf(value));

    return new MapBasedInputRow(ts, dimensions, metrics);
  }
View Full Code Here


        .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

    };
  }

  private static InputRow IR(String dt, String dim1, String dim2, float met)
  {
    return new MapBasedInputRow(
        new DateTime(dt).getMillis(),
        ImmutableList.of("dim1", "dim2"),
        ImmutableMap.<String, Object>of(
            "dim1", dim1,
            "dim2", dim2,
View Full Code Here

                                    final String metric = metSelector.getKey();
                                    final ObjectColumnSelector selector = metSelector.getValue();
                                    theEvent.put(metric, selector.get());
                                  }
                                  cursor.advance();
                                  return new MapBasedInputRow(timestamp, dims, theEvent);
                                }

                                @Override
                                public void remove()
                                {
View Full Code Here

    );

    List<Result<TimeseriesResultValue>> results;

    oneRowIndex.add(
        new MapBasedInputRow(
            new DateTime("2012-01-01T00:00:00Z").getMillis(),
            ImmutableList.of("dim1"),
            ImmutableMap.<String, Object>of("dim1", "x")
        )
    );

    results = runTimeseriesCount(oneRowIndex);

    Assert.assertEquals("index size", 1, oneRowIndex.size());
    Assert.assertEquals("result size", 1, results.size());
    Assert.assertEquals("result timestamp", new DateTime("2012-01-01T00:00:00Z"), results.get(0).getTimestamp());
    Assert.assertEquals("result count metric", 1, (long) results.get(0).getValue().getLongMetric("rows"));

    oneRowIndex.add(
        new MapBasedInputRow(
            new DateTime("2012-01-01T00:00:00Z").getMillis(),
            ImmutableList.of("dim1"),
            ImmutableMap.<String, Object>of("dim1", "y")
        )
    );
View Full Code Here

TOP

Related Classes of io.druid.data.input.MapBasedInputRow

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.