Class DateUtilities

java.lang.Object
org.apache.drill.exec.vector.DateUtilities

public class DateUtilities extends Object
Utility class for Date, DateTime, TimeStamp, Interval data types.

WARNING: This class is included from the JDBC driver. There is another, similar class called org.apache.drill.exec.expr.fn.impl.DateUtility. If vectors refer to that class, they will fail when called from JDBC. So, place code here if it is needed by JDBC, in the other class if only needed by the Drill engine. (This is a very poor design, but it is what it is.)

  • Field Details

  • Constructor Details

    • DateUtilities

      public DateUtilities()
  • Method Details

    • monthsFromPeriod

      public static int monthsFromPeriod(org.joda.time.Period period)
    • periodToMillis

      public static int periodToMillis(org.joda.time.Period period)
    • toMonths

      public static int toMonths(int years, int months)
    • periodToMonths

      public static int periodToMonths(org.joda.time.Period value)
    • fromIntervalYear

      public static org.joda.time.Period fromIntervalYear(int value)
    • intervalYearStringBuilder

      public static StringBuilder intervalYearStringBuilder(int months)
    • intervalYearStringBuilder

      public static StringBuilder intervalYearStringBuilder(org.joda.time.Period value)
    • pluralify

      public static String pluralify(String term, int value)
    • fromIntervalDay

      public static org.joda.time.Period fromIntervalDay(int days, int millis)
    • intervalDayStringBuilder

      public static StringBuilder intervalDayStringBuilder(int days, int millis)
    • intervalDayStringBuilder

      public static StringBuilder intervalDayStringBuilder(org.joda.time.Period value)
    • fromInterval

      public static org.joda.time.Period fromInterval(int months, int days, int millis)
    • asTwoDigits

      public static String asTwoDigits(int value)
    • intervalStringBuilder

      public static StringBuilder intervalStringBuilder(int months, int days, int millis)
    • intervalStringBuilder

      public static StringBuilder intervalStringBuilder(org.joda.time.Period value)
    • timeToMillis

      public static int timeToMillis(int hours, int minutes, int seconds, int millis)
    • toDrillTime

      public static int toDrillTime(LocalTime localTime)
      Convert from Java LocalTime to the ms-since-midnight format which Drill uses
      Parameters:
      localTime - Java local time
      Returns:
      Drill form of the time
    • fromDrillTime

      public static LocalTime fromDrillTime(int value)
    • toDrillDate

      public static long toDrillDate(LocalDate localDate)
    • fromDrillDate

      public static LocalDate fromDrillDate(long value)
    • toDrillTimestamp

      public static long toDrillTimestamp(Instant instant)
    • fromDrillTimestamp

      public static Instant fromDrillTimestamp(long value)