What is the problem the feature request solves?
What is the problem the feature request solves?
This is #4288 sub-issue
These are the dedicated TimeType expressions from timeExpressions.scala. All are
RuntimeReplaceable and resolve to StaticInvoke(DateTimeUtils, methodName, ...).
They follow the same shim pattern as make_time.
Describe the potential solution
time extraction (from TimeType to Int/Decimal)
| SQL |
Spark expression |
StaticInvoke method |
Return type |
extract(HOUR FROM t) |
HoursOfTime |
getHoursOfTime |
IntegerType |
extract(MINUTE FROM t) |
MinutesOfTime |
getMinutesOfTime |
IntegerType |
extract(SECOND FROM t) |
SecondsOfTime |
getSecondsOfTime |
IntegerType |
extract(SECOND FROM t) (with fraction) |
SecondsOfTimeWithFraction |
getSecondsOfTimeWithFraction |
DecimalType |
Shim pattern: Match StaticInvoke where staticObject == classOf[DateTimeUtils.type]
and functionName is one of the above.
Rust implementation: Simple arithmetic on nanoseconds since midnight:
- hours = nanos / NANOS_PER_HOUR
- minutes = (nanos % NANOS_PER_HOUR) / NANOS_PER_MINUTE
- seconds = (nanos % NANOS_PER_MINUTE) / NANOS_PER_SECOND
Additional context
No response
What is the problem the feature request solves?
What is the problem the feature request solves?
This is #4288 sub-issue
These are the dedicated TimeType expressions from timeExpressions.scala. All are
RuntimeReplaceable and resolve to StaticInvoke(DateTimeUtils, methodName, ...).
They follow the same shim pattern as make_time.
Describe the potential solution
time extraction (from TimeType to Int/Decimal)
extract(HOUR FROM t)HoursOfTimegetHoursOfTimeextract(MINUTE FROM t)MinutesOfTimegetMinutesOfTimeextract(SECOND FROM t)SecondsOfTimegetSecondsOfTimeextract(SECOND FROM t)(with fraction)SecondsOfTimeWithFractiongetSecondsOfTimeWithFractionShim pattern: Match
StaticInvokewherestaticObject == classOf[DateTimeUtils.type]and
functionNameis one of the above.Rust implementation: Simple arithmetic on nanoseconds since midnight:
Additional context
No response