Package org.apache.drill.exec.vector
Class DateUtilities
java.lang.Object
org.apache.drill.exec.vector.DateUtilities
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 Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final long
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
asTwoDigits
(int value) static LocalDate
fromDrillDate
(long value) static LocalTime
fromDrillTime
(int value) static Instant
fromDrillTimestamp
(long value) static org.joda.time.Period
fromInterval
(int months, int days, int millis) static org.joda.time.Period
fromIntervalDay
(int days, int millis) static org.joda.time.Period
fromIntervalYear
(int value) static StringBuilder
intervalDayStringBuilder
(int days, int millis) static StringBuilder
intervalDayStringBuilder
(org.joda.time.Period value) static StringBuilder
intervalStringBuilder
(int months, int days, int millis) static StringBuilder
intervalStringBuilder
(org.joda.time.Period value) static StringBuilder
intervalYearStringBuilder
(int months) static StringBuilder
intervalYearStringBuilder
(org.joda.time.Period value) static int
monthsFromPeriod
(org.joda.time.Period period) static int
periodToMillis
(org.joda.time.Period period) static int
periodToMonths
(org.joda.time.Period value) static String
static int
timeToMillis
(int hours, int minutes, int seconds, int millis) static long
toDrillDate
(LocalDate localDate) static int
toDrillTime
(LocalTime localTime) Convert from Java LocalTime to the ms-since-midnight format which Drill usesstatic long
toDrillTimestamp
(Instant instant) static int
toMonths
(int years, int months)
-
Field Details
-
yearsToMonths
public static final int yearsToMonths- See Also:
-
yearsToQuarter
public static final int yearsToQuarter- See Also:
-
daysToWeeks
public static final int daysToWeeks- See Also:
-
hoursToMillis
public static final int hoursToMillis- See Also:
-
minutesToMillis
public static final int minutesToMillis- See Also:
-
secondsToMillis
public static final int secondsToMillis- See Also:
-
monthToStandardDays
public static final int monthToStandardDays- See Also:
-
monthsToMillis
public static final long monthsToMillis- See Also:
-
daysToStandardMillis
public static final int daysToStandardMillis- See Also:
-
-
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
-
intervalYearStringBuilder
-
pluralify
-
fromIntervalDay
public static org.joda.time.Period fromIntervalDay(int days, int millis) -
intervalDayStringBuilder
-
intervalDayStringBuilder
-
fromInterval
public static org.joda.time.Period fromInterval(int months, int days, int millis) -
asTwoDigits
-
intervalStringBuilder
-
intervalStringBuilder
-
timeToMillis
public static int timeToMillis(int hours, int minutes, int seconds, int millis) -
toDrillTime
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
-
toDrillDate
-
fromDrillDate
-
toDrillTimestamp
-
fromDrillTimestamp
-