MaxGekk commented on code in PR #41314:
URL: https://github.com/apache/spark/pull/41314#discussion_r1205644934
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TimeTravelSpec.scala:
##########
@@ -38,21 +38,25 @@ object TimeTravelSpec {
val ts = timestamp.get
assert(ts.resolved && ts.references.isEmpty &&
!SubqueryExpression.hasSubquery(ts))
if (!Cast.canAnsiCast(ts.dataType, TimestampType)) {
- throw QueryCompilationErrors.invalidTimestampExprForTimeTravel(ts)
+ throw QueryCompilationErrors.invalidTimestampExprForTimeTravel(
+ "INVALID_TIME_TRAVEL_TIMESTAMP_EXPR.DATA_TYPE", ts, ts.dataType)
}
val tsToEval = ts.transform {
case r: RuntimeReplaceable => r.replacement
case _: Unevaluable =>
- throw QueryCompilationErrors.invalidTimestampExprForTimeTravel(ts)
+ throw QueryCompilationErrors.invalidTimestampExprForTimeTravel(
+ "INVALID_TIME_TRAVEL_TIMESTAMP_EXPR.UNEVALUABLE", ts)
case e if !e.deterministic =>
- throw QueryCompilationErrors.invalidTimestampExprForTimeTravel(ts)
+ throw QueryCompilationErrors.invalidTimestampExprForTimeTravel(
+ "INVALID_TIME_TRAVEL_TIMESTAMP_EXPR.NON_DETERMINISTIC", ts)
}
val tz = Some(conf.sessionLocalTimeZone)
// Set `ansiEnabled` to false, so that it can return null for invalid
input and we can provide
// better error message.
val value = Cast(tsToEval, TimestampType, tz, ansiEnabled = false).eval()
if (value == null) {
- throw QueryCompilationErrors.invalidTimestampExprForTimeTravel(ts)
+ throw QueryCompilationErrors.invalidTimestampExprForTimeTravel(
Review Comment:
I think so, one is about incorrect input type, but another one is about
incorrect values. Could you name the sub-class as `INPUT`, and say in its
message something like `The input value <inputVal> cannot be cast to the
"TIMESTAMP" type.`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]