Tabnine Logo
GranularityType.create
Code IndexAdd Tabnine to your IDE (free)

How to use
create
method
in
org.apache.druid.java.util.common.granularity.GranularityType

Best Java code snippets using org.apache.druid.java.util.common.granularity.GranularityType.create (Showing top 2 results out of 315)

origin: apache/incubator-druid

public static List<Granularity> granularitiesFinerThan(final Granularity gran0)
{
 final List<Granularity> retVal = new ArrayList<>();
 final DateTime origin = (gran0 instanceof PeriodGranularity) ? ((PeriodGranularity) gran0).getOrigin() : null;
 final DateTimeZone tz = (gran0 instanceof PeriodGranularity) ? ((PeriodGranularity) gran0).getTimeZone() : null;
 for (GranularityType gran : GranularityType.values()) {
  /**
   * All and None are excluded b/c when asked to give all granularities finer
   * than "TEN_MINUTE", you want the answer to be "FIVE_MINUTE, MINUTE and SECOND"
   * it doesn't make sense to include ALL or None to be part of this.
   */
  if (gran == GranularityType.ALL || gran == GranularityType.NONE) {
   continue;
  }
  final Granularity segmentGranularity = gran.create(origin, tz);
  final long segmentGranularityDurationMillis = segmentGranularity.bucket(DateTimes.EPOCH).toDurationMillis();
  final long gran0DurationMillis = gran0.bucket(DateTimes.EPOCH).toDurationMillis();
  if (segmentGranularityDurationMillis <= gran0DurationMillis) {
   retVal.add(segmentGranularity);
  }
 }
 retVal.sort((g1, g2) -> {
  long duration1 = g2.bucket(DateTimes.EPOCH).toDurationMillis();
  long duration2 = g1.bucket(DateTimes.EPOCH).toDurationMillis();
  return Longs.compare(duration1, duration2);
 });
 return retVal;
}
origin: org.apache.druid/java-util

public static List<Granularity> granularitiesFinerThan(final Granularity gran0)
{
 final List<Granularity> retVal = Lists.newArrayList();
 final DateTime origin = (gran0 instanceof PeriodGranularity) ? ((PeriodGranularity) gran0).getOrigin() : null;
 final DateTimeZone tz = (gran0 instanceof PeriodGranularity) ? ((PeriodGranularity) gran0).getTimeZone() : null;
 for (GranularityType gran : GranularityType.values()) {
  /**
   * All and None are excluded b/c when asked to give all granularities finer
   * than "TEN_MINUTE", you want the answer to be "FIVE_MINUTE, MINUTE and SECOND"
   * it doesn't make sense to include ALL or None to be part of this.
   */
  if (gran == GranularityType.ALL || gran == GranularityType.NONE) {
   continue;
  }
  final Granularity segmentGranularity = gran.create(origin, tz);
  final long segmentGranularityDurationMillis = segmentGranularity.bucket(DateTimes.EPOCH).toDurationMillis();
  final long gran0DurationMillis = gran0.bucket(DateTimes.EPOCH).toDurationMillis();
  if (segmentGranularityDurationMillis <= gran0DurationMillis) {
   retVal.add(segmentGranularity);
  }
 }
 retVal.sort((g1, g2) -> {
  long duration1 = g2.bucket(DateTimes.EPOCH).toDurationMillis();
  long duration2 = g1.bucket(DateTimes.EPOCH).toDurationMillis();
  return Longs.compare(duration1, duration2);
 });
 return retVal;
}
org.apache.druid.java.util.common.granularityGranularityTypecreate

Popular methods of GranularityType

  • fromPeriod
    Note: This is only an estimate based on the values in period. This will not work for complicated per
  • getDefaultGranularity
  • values
  • getDateTime
  • getDefaultFormat
  • getHiveFormat
  • getLowerDefaultFormat
  • isStandard
    For a select subset of granularites, users can specify them directly as string. These are "predefine
  • toString
  • valueOf
  • name
  • name

Popular in Java

  • Running tasks concurrently on multiple threads
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Kernel (java.awt.image)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Path (java.nio.file)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • BoxLayout (javax.swing)
  • Best IntelliJ 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