Tabnine Logo
PeriodGranularity.bucketStart
Code IndexAdd Tabnine to your IDE (free)

How to use
bucketStart
method
in
org.apache.druid.java.util.common.granularity.PeriodGranularity

Best Java code snippets using org.apache.druid.java.util.common.granularity.PeriodGranularity.bucketStart (Showing top 13 results out of 315)

origin: apache/incubator-druid

@Nonnull
@Override
public ExprEval eval(final ObjectBinding bindings)
{
 final PeriodGranularity granularity = computeGranularity(args, bindings);
 return ExprEval.of(granularity.bucketStart(DateTimes.utc(args.get(0).eval(bindings).asLong())).getMillis());
}
origin: apache/incubator-druid

@Override
public DateTime toDate(String filePath, Formatter formatter)
{
 Integer[] vals = getDateValues(filePath, formatter);
 GranularityType granularityType = GranularityType.fromPeriod(period);
 DateTime date = granularityType.getDateTime(vals);
 if (date != null) {
  return bucketStart(date);
 }
 return null;
}
origin: apache/incubator-druid

@Nonnull
@Override
public ExprEval eval(final ObjectBinding bindings)
{
 ExprEval eval = arg.eval(bindings);
 if (eval.isNumericNull()) {
  // Return null if the argument if null.
  return ExprEval.of(null);
 }
 return ExprEval.of(granularity.bucketStart(DateTimes.utc(eval.asLong())).getMillis());
}
origin: apache/incubator-druid

@Test
public void testTruncateKathmandu()
{
 final DateTimeZone tz = DateTimeZone.forTimeZone(TimeZone.getTimeZone("Asia/Kathmandu"));
 final DateTime date = new DateTime("2011-03-15T21:42:23.898+05:45", tz);
 final PeriodGranularity year = new PeriodGranularity(new Period("P1Y"), null, tz);
 final PeriodGranularity hour = new PeriodGranularity(new Period("PT1H"), null, tz);
 final PeriodGranularity twoHour = new PeriodGranularity(new Period("PT2H"), null, tz);
 Assert.assertEquals(
   new DateTime("2011-01-01T00:00:00.000+05:45", tz),
   year.toDateTime(year.bucketStart(date).getMillis())
 );
 Assert.assertEquals(
   new DateTime("2011-03-15T21:00:00.000+05:45", tz),
   hour.toDateTime(hour.bucketStart(date).getMillis())
 );
 Assert.assertEquals(
   new DateTime("2011-03-15T20:00:00.000+05:45", tz),
   twoHour.toDateTime(twoHour.bucketStart(date).getMillis())
 );
}

origin: apache/incubator-druid

@Test
public void testTruncateDhaka()
{
 final DateTimeZone tz = DateTimeZone.forTimeZone(TimeZone.getTimeZone("Asia/Dhaka"));
 final DateTime date = new DateTime("2011-03-15T21:42:23.898+06:00", tz);
 final PeriodGranularity year = new PeriodGranularity(new Period("P1Y"), null, tz);
 final PeriodGranularity hour = new PeriodGranularity(new Period("PT1H"), null, tz);
 final PeriodGranularity twoHour = new PeriodGranularity(new Period("PT2H"), null, tz);
 Assert.assertEquals(
   new DateTime("2011-01-01T00:00:00.000+06:00", tz),
   year.toDateTime(year.bucketStart(date).getMillis())
 );
 Assert.assertEquals(
   new DateTime("2011-03-15T21:00:00.000+06:00", tz),
   hour.toDateTime(hour.bucketStart(date).getMillis())
 );
 Assert.assertEquals(
   new DateTime("2011-03-15T20:00:00.000+06:00", tz),
   twoHour.toDateTime(twoHour.bucketStart(date).getMillis())
 );
}

origin: apache/incubator-druid

),
Lists.newArrayList(
  periodOrigin.bucketStart(DateTimes.of("2012-01-01T05:00:04.123-08:00")),
  periodOrigin.bucketStart(DateTimes.of("2012-01-02T07:00:04.123-08:00")),
  periodOrigin.bucketStart(DateTimes.of("2012-01-04T07:20:04.123-08:00"))
),
Lists.newArrayList(
  periodNoOrigin.bucketStart(DateTimes.of("2012-01-01T05:00:04.123-08:00")),
  periodNoOrigin.bucketStart(DateTimes.of("2012-01-02T07:00:04.123-08:00")),
  periodNoOrigin.bucketStart(DateTimes.of("2012-01-04T07:20:04.123-08:00"))
origin: apache/incubator-druid

),
Lists.newArrayList(
  periodOrigin.bucketStart(DateTimes.of("2012-01-01T05:00:04.123-08:00")),
  periodOrigin.bucketStart(DateTimes.of("2012-01-02T07:00:04.123-08:00")),
  periodOrigin.bucketStart(DateTimes.of("2012-03-01T07:20:04.123-08:00")),
  periodOrigin.bucketStart(DateTimes.of("2012-02-04T05:00:00.000-08:00"))
),
Lists.newArrayList(
  periodNoOrigin.bucketStart(DateTimes.of("1970-01-01T05:02:04.123-08:00")),
  periodNoOrigin.bucketStart(DateTimes.of("2012-01-01T05:02:04.123-08:00")),
  periodNoOrigin.bucketStart(DateTimes.of("2012-01-15T07:01:04.123-08:00")),
  periodNoOrigin.bucketStart(DateTimes.of("2012-02-16T00:00:00.000-08:00"))
),
Lists.newArrayList(
  periodOrigin.bucketStart(DateTimes.of("2012-01-01T05:00:04.123-08:00")),
  periodOrigin.bucketStart(DateTimes.of("2012-01-02T07:00:04.123-08:00")),
  periodOrigin.bucketStart(DateTimes.of("2012-01-03T00:20:04.123-08:00")),
  periodOrigin.bucketStart(DateTimes.of("2012-02-03T22:25:00.000-08:00"))
origin: apache/incubator-druid

),
Lists.newArrayList(
  hour.bucketStart(DateTimes.of("2012-11-04T00:30:00-07:00")),
  hour.bucketStart(DateTimes.of("2012-11-04T01:30:00-07:00")),
  hour.bucketStart(DateTimes.of("2012-11-04T01:30:00-08:00")),
  hour.bucketStart(DateTimes.of("2012-11-04T02:30:00-08:00")),
  hour.bucketStart(DateTimes.of("2012-11-04T03:30:00-08:00"))
origin: apache/incubator-druid

@Test
public void testCompoundPeriodMillisTruncate()
{
 {
  final DateTime origin = DateTimes.of("2012-01-02T05:00:00.000-08:00");
  PeriodGranularity periodOrigin = new PeriodGranularity(
    new Period("PT12H5M"),
    origin,
    DateTimeZone.UTC
  );
  assertSameDateTime(
    Lists.newArrayList(
      DateTimes.of("2012-01-01T04:50:00.000-08:00"),
      DateTimes.of("2012-01-02T05:00:00.000-08:00"),
      DateTimes.of("2012-01-02T17:05:00.000-08:00"),
      DateTimes.of("2012-02-03T22:25:00.000-08:00")
    ),
    Lists.newArrayList(
      periodOrigin.bucketStart(DateTimes.of("2012-01-01T05:00:04.123-08:00")),
      periodOrigin.bucketStart(DateTimes.of("2012-01-02T07:00:04.123-08:00")),
      periodOrigin.bucketStart(DateTimes.of("2012-01-03T00:20:04.123-08:00")),
      periodOrigin.bucketStart(DateTimes.of("2012-02-03T22:25:00.000-08:00"))
    )
  );
 }
}
origin: apache/incubator-druid

),
Lists.newArrayList(
  periodOrigin.bucketStart(DateTimes.of("2012-01-01T05:00:04.123Z")),
  periodOrigin.bucketStart(DateTimes.of("2012-01-02T07:08:04.123Z")),
  periodOrigin.bucketStart(DateTimes.of("2012-01-04T00:20:04.123Z"))
),
Lists.newArrayList(
  periodNoOrigin.bucketStart(DateTimes.of("2012-01-01T05:00:04.123Z")),
  periodNoOrigin.bucketStart(DateTimes.of("2012-01-02T07:00:04.123Z")),
  periodNoOrigin.bucketStart(DateTimes.of("2012-01-04T00:20:04.123Z"))
origin: org.apache.druid/druid-processing

@Nonnull
@Override
public ExprEval eval(final ObjectBinding bindings)
{
 final PeriodGranularity granularity = computeGranularity(args, bindings);
 return ExprEval.of(granularity.bucketStart(DateTimes.utc(args.get(0).eval(bindings).asLong())).getMillis());
}
origin: org.apache.druid/java-util

@Override
public DateTime toDate(String filePath, Formatter formatter)
{
 Integer[] vals = getDateValues(filePath, formatter);
 GranularityType granularityType = GranularityType.fromPeriod(period);
 DateTime date = granularityType.getDateTime(vals);
 if (date != null) {
  return bucketStart(date);
 }
 return null;
}
origin: org.apache.druid/druid-processing

@Nonnull
@Override
public ExprEval eval(final ObjectBinding bindings)
{
 ExprEval eval = arg.eval(bindings);
 if (eval.isNumericNull()) {
  // Return null if the argument if null.
  return ExprEval.of(null);
 }
 return ExprEval.of(granularity.bucketStart(DateTimes.utc(eval.asLong())).getMillis());
}
org.apache.druid.java.util.common.granularityPeriodGranularitybucketStart

Popular methods of PeriodGranularity

  • <init>
  • getPeriod
  • getTimeZone
  • getOrigin
  • bucketEnd
  • getDateValues
  • getIterable
  • increment
  • isCompoundPeriod
  • serialize
  • truncate
  • truncateCompoundPeriod
  • truncate,
  • truncateCompoundPeriod,
  • truncateMillisPeriod,
  • toDateTime

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • setScale (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now