Skip to content

Commit dcf49a8

Browse files
committed
fix indent, add comments
1 parent 1ad893b commit dcf49a8

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,15 +1147,14 @@ object SimplifyCaseConversionExpressions extends Rule[LogicalPlan] {
11471147
*/
11481148
object SimplifyDateTimeConversions extends Rule[LogicalPlan] {
11491149
def apply(plan: LogicalPlan): LogicalPlan = plan.transformWithPruning(
1150-
_.containsPattern(DATETIME), ruleId) {
1151-
case q: LogicalPlan => q.transformExpressionsUpWithPruning(
11521150
_.containsPattern(DATETIME), ruleId) {
1151+
case q: LogicalPlan => q.transformExpressionsUpWithPruning(
1152+
_.containsPattern(DATETIME), ruleId) {
1153+
// Remove a string to timestamp conversions followed by a timestamp to string conversions if
1154+
// original string is in the same format.
11531155
case DateFormatClass(
11541156
GetTimestamp(
1155-
e @ DateFormatClass(
1156-
_,
1157-
pattern,
1158-
timeZoneId),
1157+
e @ DateFormatClass(_, pattern, timeZoneId),
11591158
pattern2,
11601159
TimestampType,
11611160
_,
@@ -1166,15 +1165,12 @@ object SimplifyDateTimeConversions extends Rule[LogicalPlan] {
11661165
if pattern.semanticEquals(pattern2) && pattern.semanticEquals(pattern3)
11671166
&& timeZoneId == timeZoneId2 && timeZoneId == timeZoneId3 =>
11681167
e
1168+
1169+
// Remove a timestamp to string conversion followed by a string to timestamp conversions if
1170+
// original timestamp is built with the same format.
11691171
case GetTimestamp(
11701172
DateFormatClass(
1171-
e @ GetTimestamp(
1172-
_,
1173-
pattern,
1174-
TimestampType,
1175-
_,
1176-
timeZoneId,
1177-
_),
1173+
e @ GetTimestamp(_, pattern, TimestampType, _, timeZoneId, _),
11781174
pattern2,
11791175
timeZoneId2),
11801176
pattern3,

0 commit comments

Comments
 (0)