Package io.druid.query.timeboundary

Examples of io.druid.query.timeboundary.TimeBoundaryResultValue


    );

    List<Result<TimeBoundaryResultValue>> expectedTimeBoundaryResults = Arrays.asList(
        new Result<TimeBoundaryResultValue>(
            new DateTime("2011-01-12T00:00:00.000Z"),
            new TimeBoundaryResultValue(
                ImmutableMap.of(
                    TimeBoundaryQuery.MIN_TIME,
                    new DateTime("2011-01-12T00:00:00.000Z"),
                    TimeBoundaryQuery.MAX_TIME,
                    new DateTime("2011-01-13T00:00:00.000Z")
View Full Code Here


  public void testTimeBoundary()
  {
    List<Result<TimeBoundaryResultValue>> expectedResults = Arrays.asList(
        new Result<TimeBoundaryResultValue>(
            new DateTime("2011-01-12T00:00:00.000Z"),
            new TimeBoundaryResultValue(
                ImmutableMap.of(
                    TimeBoundaryQuery.MIN_TIME,
                    new DateTime("2011-01-12T00:00:00.000Z"),
                    TimeBoundaryQuery.MAX_TIME,
                    new DateTime("2011-01-15T02:00:00.000Z")
View Full Code Here

  public void testTimeBoundary2()
  {
    List<Result<TimeBoundaryResultValue>> expectedResults = Arrays.asList(
        new Result<TimeBoundaryResultValue>(
            new DateTime("2011-01-12T00:00:00.000Z"),
            new TimeBoundaryResultValue(
                ImmutableMap.of(
                    TimeBoundaryQuery.MIN_TIME,
                    new DateTime("2011-01-12T00:00:00.000Z"),
                    TimeBoundaryQuery.MAX_TIME,
                    new DateTime("2011-01-15T00:00:00.000Z")
View Full Code Here

    }

    return Arrays.asList(
        new Result<>(
            timestamp,
            new TimeBoundaryResultValue(value)
        )
    );
  }
View Full Code Here

          {
            return Sequences.simple(
                ImmutableList.of(
                    new Result<>(
                        new DateTime("2014-01-12"),
                        new TimeBoundaryResultValue(
                            ImmutableMap.<String, Object>of(
                                "maxTime",
                                new DateTime("2014-01-12")
                            )
                        )
                    )
                )
            );
          }
        },
        new DateTime("2014-08-02").getMillis()
    );

    final Query<Result<TimeBoundaryResultValue>> timeBoundaryQuery =
        Druids.newTimeBoundaryQueryBuilder()
              .dataSource("dummy")
              .build();

    Assert.assertEquals(
        Lists.newArrayList(
            new Result<>(
                new DateTime("2014-08-02"),
                new TimeBoundaryResultValue(ImmutableMap.<String, Object>of("maxTime", new DateTime("2014-08-02")))
            )
        ),
        Sequences.toList(
            timeBoundaryRunner.run(timeBoundaryQuery, CONTEXT),
            Lists.<Result<TimeBoundaryResultValue>>newArrayList()
View Full Code Here

              {
                if (input instanceof Result) {
                  Result res = (Result) input;
                  Object value = res.getValue();
                  if (value instanceof TimeBoundaryResultValue) {
                    TimeBoundaryResultValue boundary = (TimeBoundaryResultValue) value;

                    DateTime minTime = null;
                    try{
                      minTime = boundary.getMinTime();
                    } catch(IllegalArgumentException e) {}

                    final DateTime maxTime = boundary.getMaxTime();

                    return (T) ((TimeBoundaryQuery) query).buildResult(
                        new DateTime(Math.min(res.getTimestamp().getMillis() - offset, now)),
                        minTime != null ? minTime.minus(offset) : null,
                        maxTime != null ? new DateTime(Math.min(maxTime.getMillis() - offset, now)) : null
View Full Code Here

TOP

Related Classes of io.druid.query.timeboundary.TimeBoundaryResultValue

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.