Class DefaultKernelUtils
Object
io.delta.kernel.defaults.internal.DefaultKernelUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic longdaysToMicros(int days, ZoneOffset timezone) Converts a number of days since epoch (1970-01-01 00:00:00 UTC) to microseconds between epoch and start of the day in the given timezone.static longfromJulianDay(int days, long nanos) Returns the number of microseconds since epoch from Julian day and nanoseconds in a day.static io.delta.kernel.types.DataTypegetDataType(io.delta.kernel.types.StructType schema, io.delta.kernel.expressions.Column column) Search for the data type of the given column in the schema.static longmillisToMicros(long millis) static longparseTimestampNTZ(String timestampString) Parses a TimestampNTZ string in UTC format, supporting milliseconds and microseconds, to microseconds since the Unix epoch.toJulianDay(long micros) Returns Julian day and remaining nanoseconds from the number of microseconds
-
Method Details
-
fromJulianDay
public static long fromJulianDay(int days, long nanos) Returns the number of microseconds since epoch from Julian day and nanoseconds in a day. -
toJulianDay
Returns Julian day and remaining nanoseconds from the number of microsecondsNote: support timestamp since 4717 BC (without negative nanoseconds, compatible with Hive).
-
millisToMicros
public static long millisToMicros(long millis) -
daysToMicros
Converts a number of days since epoch (1970-01-01 00:00:00 UTC) to microseconds between epoch and start of the day in the given timezone. -
parseTimestampNTZ
Parses a TimestampNTZ string in UTC format, supporting milliseconds and microseconds, to microseconds since the Unix epoch.- Parameters:
timestampString- the timestamp string to parse.- Returns:
- the number of microseconds since epoch.
-
getDataType
public static io.delta.kernel.types.DataType getDataType(io.delta.kernel.types.StructType schema, io.delta.kernel.expressions.Column column) Search for the data type of the given column in the schema.- Parameters:
schema- the schema to searchcolumn- the column whose data type is to be found- Returns:
- the data type of the column
- Throws:
IllegalArgumentException- if the column is not found in the schema
-