[SPARK-36046][SQL][FOLLOWUP] Implement prettyName for MakeTimestampNTZ and MakeTimestampLTZ

### What changes were proposed in this pull request?
This PR follows https://github.com/apache/spark/pull/33299 and implement `prettyName` for `MakeTimestampNTZ` and `MakeTimestampLTZ` based on the discussion show below
https://github.com/apache/spark/pull/33299/files#r668423810

### Why are the changes needed?
This PR fix the incorrect alias usecase.

### Does this PR introduce _any_ user-facing change?
'No'.
Modifications are transparent to users.

### How was this patch tested?
Jenkins test.

Closes #33430 from beliefer/SPARK-36046-followup.

Authored-by: gengjiaan <gengjiaan@360.cn>
Signed-off-by: Gengliang Wang <gengliang@apache.org>
(cherry picked from commit 033a5731b4)
Signed-off-by: Gengliang Wang <gengliang@apache.org>
This commit is contained in:
gengjiaan 2021-07-20 21:31:00 +08:00 committed by Gengliang Wang
parent 7cd89efca5
commit 0f6cf8abe3
2 changed files with 6 additions and 2 deletions

View file

@ -555,8 +555,8 @@ object FunctionRegistry {
expression[SessionWindow]("session_window"), expression[SessionWindow]("session_window"),
expression[MakeDate]("make_date"), expression[MakeDate]("make_date"),
expression[MakeTimestamp]("make_timestamp"), expression[MakeTimestamp]("make_timestamp"),
expression[MakeTimestampNTZ]("make_timestamp_ntz", true), expression[MakeTimestampNTZ]("make_timestamp_ntz"),
expression[MakeTimestampLTZ]("make_timestamp_ltz", true), expression[MakeTimestampLTZ]("make_timestamp_ltz"),
expression[MakeInterval]("make_interval"), expression[MakeInterval]("make_interval"),
expression[MakeDTInterval]("make_dt_interval"), expression[MakeDTInterval]("make_dt_interval"),
expression[MakeYMInterval]("make_ym_interval"), expression[MakeYMInterval]("make_ym_interval"),

View file

@ -2403,6 +2403,8 @@ case class MakeTimestampNTZ(
MakeTimestamp(year, month, day, hour, min, sec, dataType = TimestampNTZType)) MakeTimestamp(year, month, day, hour, min, sec, dataType = TimestampNTZType))
} }
override def prettyName: String = "make_timestamp_ntz"
override def exprsReplaced: Seq[Expression] = Seq(year, month, day, hour, min, sec) override def exprsReplaced: Seq[Expression] = Seq(year, month, day, hour, min, sec)
override protected def withNewChildInternal(newChild: Expression): Expression = override protected def withNewChildInternal(newChild: Expression): Expression =
@ -2473,6 +2475,8 @@ case class MakeTimestampLTZ(
MakeTimestamp(year, month, day, hour, min, sec, Some(timezone), dataType = TimestampType)) MakeTimestamp(year, month, day, hour, min, sec, Some(timezone), dataType = TimestampType))
} }
override def prettyName: String = "make_timestamp_ltz"
override def exprsReplaced: Seq[Expression] = Seq(year, month, day, hour, min, sec) override def exprsReplaced: Seq[Expression] = Seq(year, month, day, hour, min, sec)
override protected def withNewChildInternal(newChild: Expression): Expression = override protected def withNewChildInternal(newChild: Expression): Expression =