object SparkIntervalUtils extends SparkIntervalUtils
- Alphabetic
- By Inheritance
- SparkIntervalUtils
- SparkIntervalUtils
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- def durationToMicros(duration: Duration, endField: Byte): Long
- Definition Classes
- SparkIntervalUtils
- def durationToMicros(duration: Duration): Long
Converts this duration to the total length in microseconds.
Converts this duration to the total length in microseconds.
If this duration is too large to fit in a Long microseconds, then an exception is thrown.
If this duration has greater than microsecond precision, then the conversion will drop any excess precision information as though the amount in nanoseconds was subject to integer division by one thousand.
- returns
The total length of the duration in microseconds
- Definition Classes
- SparkIntervalUtils
- Exceptions thrown
ArithmeticException
If numeric overflow occurs
- def microsToDuration(micros: Long): Duration
Obtains a Duration representing a number of microseconds.
Obtains a Duration representing a number of microseconds.
- micros
The number of microseconds, positive or negative
- returns
A Duration, not null
- Definition Classes
- SparkIntervalUtils
- def monthsToPeriod(months: Int): Period
Obtains a Period representing a number of months.
Obtains a Period representing a number of months. The days unit will be zero, and the years and months units will be normalized.
The months unit is adjusted to have an absolute value < 12, with the years unit being adjusted to compensate. For example, the method returns "2 years and 3 months" for the 27 input months.
The sign of the years and months units will be the same after normalization. For example, -13 months will be converted to "-1 year and -1 month".
- months
The number of months, positive or negative
- returns
The period of months, not null
- Definition Classes
- SparkIntervalUtils
- def periodToMonths(period: Period, endField: Byte): Int
- Definition Classes
- SparkIntervalUtils
- def periodToMonths(period: Period): Int
Gets the total number of months in this period.
Gets the total number of months in this period.
This returns the total number of months in the period by multiplying the number of years by 12 and adding the number of months.
- returns
The total number of months in the period, may be negative
- Definition Classes
- SparkIntervalUtils
- Exceptions thrown
ArithmeticException
If numeric overflow occurs
- def stringToInterval(input: UTF8String): CalendarInterval
Converts a string to CalendarInterval case-insensitively.
Converts a string to CalendarInterval case-insensitively.
- Definition Classes
- SparkIntervalUtils
- Exceptions thrown
IllegalArgumentException
if the input string is not in valid interval format.
- def toDayTimeIntervalString(micros: Long, style: IntervalStyle, startField: Byte, endField: Byte): String
Converts a day-time interval as a number of microseconds to its textual representation which conforms to the ANSI SQL standard.
Converts a day-time interval as a number of microseconds to its textual representation which conforms to the ANSI SQL standard.
- micros
The number of microseconds, positive or negative
- style
The style of textual representation of the interval
- startField
The start field (DAY, HOUR, MINUTE, SECOND) which the interval comprises of.
- endField
The end field (DAY, HOUR, MINUTE, SECOND) which the interval comprises of.
- returns
Day-time interval string
- Definition Classes
- SparkIntervalUtils
- def toYearMonthIntervalString(months: Int, style: IntervalStyle, startField: Byte, endField: Byte): String
Converts an year-month interval as a number of months to its textual representation which conforms to the ANSI SQL standard.
Converts an year-month interval as a number of months to its textual representation which conforms to the ANSI SQL standard.
- months
The number of months, positive or negative
- style
The style of textual representation of the interval
- startField
The start field (YEAR or MONTH) which the interval comprises of.
- endField
The end field (YEAR or MONTH) which the interval comprises of.
- returns
Year-month interval string
- Definition Classes
- SparkIntervalUtils