You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "MaxGekk (via GitHub)" <gi...@apache.org> on 2025/06/14 14:36:37 UTC

[PR] [WIP][SQL] Make timestamp from date and time [spark]

MaxGekk opened a new pull request, #51179:
URL: https://github.com/apache/spark/pull/51179

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'common/utils/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as new features, bug fixes, or other behavior changes. Documentation-only updates are not considered user-facing changes.
   
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   <!--
   If generative AI tooling has been used in the process of authoring this patch, please include the
   phrase: 'Generated-by: ' followed by the name of the tool and its version.
   If no, write 'No'.
   Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
   -->
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "srielau (via GitHub)" <gi...@apache.org>.
srielau commented on PR #51179:
URL: https://github.com/apache/spark/pull/51179#issuecomment-2980606506

   What is the exact type? Since both DATE and TIME are WITHOUT TIMEZONE , presumably the result should be without timezone.
   Do we have a separate make_timestamp_ntz() version?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [WIP][SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2150474320


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala:
##########
@@ -2746,7 +2746,11 @@ object TryMakeTimestampLTZExpressionBuilder extends ExpressionBuilder {
 
 // scalastyle:off line.size.limit
 @ExpressionDescription(
-  usage = "_FUNC_(year, month, day, hour, min, sec[, timezone]) - Create timestamp from year, month, day, hour, min, sec and timezone fields. The result data type is consistent with the value of configuration `spark.sql.timestampType`. If the configuration `spark.sql.ansi.enabled` is false, the function returns NULL on invalid inputs. Otherwise, it will throw an error instead.",
+  usage = """
+    _FUNC_(year, month, day, hour, min, sec[, timezone]) - Create timestamp from year, month, day, hour, min, sec and timezone fields. The result data type is consistent with the value of configuration `spark.sql.timestampType`. If the configuration `spark.sql.ansi.enabled` is false, the function returns NULL on invalid inputs. Otherwise, it will throw an error instead.

Review Comment:
   SGTM



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "uros-db (via GitHub)" <gi...@apache.org>.
uros-db commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2152791567


##########
sql/core/src/test/resources/sql-tests/analyzer-results/datetime-legacy.sql.out:
##########
@@ -1899,3 +1899,21 @@ org.apache.spark.sql.catalyst.parser.ParseException
     "fragment" : "timediff('YEAR', date'2020-02-15', date'2023-02-15')"
   } ]
 }
+
+
+-- !query
+SELECT make_timestamp(DATE'0001-01-01', TIME'0:0:0')
+-- !query analysis
+[Analyzer test output redacted due to nondeterminism]

Review Comment:
   What's exactly non-deterministic here?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2154282590


##########
sql/core/src/test/resources/sql-tests/analyzer-results/datetime-legacy.sql.out:
##########
@@ -1899,3 +1899,54 @@ org.apache.spark.sql.catalyst.parser.ParseException
     "fragment" : "timediff('YEAR', date'2020-02-15', date'2023-02-15')"
   } ]
 }
+
+
+-- !query
+SELECT make_timestamp(DATE'0001-01-01', TIME'0:0:0')
+-- !query analysis
+[Analyzer test output redacted due to nondeterminism]
+
+
+-- !query
+SELECT make_timestamp(DATE'2025-06-14', TIME'17:25:30.5', 'CET')
+-- !query analysis
+[Analyzer test output redacted due to nondeterminism]
+
+
+-- !query
+SELECT make_timestamp(DATE'9999-12-31', TIME'23:59:59.123456')
+-- !query analysis
+[Analyzer test output redacted due to nondeterminism]
+
+
+-- !query
+SELECT make_timestamp(NULL, TIME'0:0:0.000001')
+-- !query analysis
+Project [make_timestamp(year(cast(null as date)), month(cast(null as date)), dayofmonth(cast(null as date)), hour(00:00:00.000001), minute(00:00:00.000001), cast(secondsoftimewithfraction(00:00:00.000001) as decimal(16,6)), None, Some(America/Los_Angeles), true, TimestampType) AS make_timestamp(year(NULL), month(NULL), dayofmonth(NULL), hour(TIME '00:00:00.000001'), minute(TIME '00:00:00.000001'), secondsoftimewithfraction(TIME '00:00:00.000001'))#x]
++- OneRowRelation
+
+
+-- !query
+SELECT make_timestamp(DATE'1970-01-01', NULL)
+-- !query analysis
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "FAILED_FUNCTION_CALL",

Review Comment:
   Seems like we don't properly handle NULLs in time expressions, at least by `HoursOfTime`. I will recheck this.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on PR #51179:
URL: https://github.com/apache/spark/pull/51179#issuecomment-2983647103

   > presumably the result should be without timezone
   
   It depends on the config as the function doc says: "The result data type is consistent with the value of configuration `spark.sql.timestampType`.". If the result type is `TIMESTAMP_NTZ`, return local timestamp otherwise non-local using provided time zone or from the SQL config.
   
   New behaviour of two parameters `date` and `time` is consistent to existing one with the `year`, `month`, ... `seconds`.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "mihailom-db (via GitHub)" <gi...@apache.org>.
mihailom-db commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2154257473


##########
sql/core/src/test/resources/sql-tests/analyzer-results/datetime-legacy.sql.out:
##########
@@ -1899,3 +1899,21 @@ org.apache.spark.sql.catalyst.parser.ParseException
     "fragment" : "timediff('YEAR', date'2020-02-15', date'2023-02-15')"
   } ]
 }
+
+
+-- !query
+SELECT make_timestamp(DATE'0001-01-01', TIME'0:0:0')
+-- !query analysis
+[Analyzer test output redacted due to nondeterminism]

Review Comment:
   I would assume that we might call current_timestamp or similar functions that could produce different literals. But if this is the case, I would say this is the bug in the new system where we do not filter on the specific expressions, but on literals in general. cc: @dtenedor on this PR, for context



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk closed pull request #51179: [SPARK-51415][SQL] Make timestamp from date and time
URL: https://github.com/apache/spark/pull/51179


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2154283575


##########
sql/core/src/test/resources/sql-tests/inputs/timestamp.sql:
##########
@@ -169,3 +169,8 @@ select timediff(SECOND, date'2022-02-15', timestamp'2022-02-14 23:59:59');
 
 select timediff('MINUTE', timestamp'2023-02-14 01:02:03', timestamp'2023-02-14 02:00:03');
 select timediff('YEAR', date'2020-02-15', date'2023-02-15');
+
+-- Construct timestamp from date and time

Review Comment:
   I added tests. Thanks.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on PR #51179:
URL: https://github.com/apache/spark/pull/51179#issuecomment-2993505214

   Hi All, I believe it would be better to extend the `make_timestamp_ntz` function first of all. Users would be able to construct TIMSTAMP WITHOUT TIME ZONE from DATE and TIME WITHOUT TIME ZONE. Extending of `make_timestamp` has the issue https://github.com/apache/spark/pull/51232#issuecomment-2992469555. I would like to ask you for review alternative PR: https://github.com/apache/spark/pull/51232.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2155145686


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala:
##########
@@ -317,20 +317,21 @@ object HourExpressionBuilder extends ExpressionBuilder {
 case class SecondsOfTimeWithFraction(child: Expression)
   extends RuntimeReplaceable
   with ExpectsInputTypes {
-
   override def replacement: Expression = {
-
+    val precision = child.dataType match {
+      case TimeType(precision) => precision
+      case _ => TimeType.MAX_PRECISION
+    }
     StaticInvoke(
       classOf[DateTimeUtils.type],
       DecimalType(8, 6),
       "getSecondsOfTimeWithFraction",
       Seq(child, Literal(precision)),
       Seq(child.dataType, IntegerType))
   }
-  private val precision: Int = child.dataType.asInstanceOf[TimeType].precision

Review Comment:
   I made the fix here in the PR because the bug is triggered when the expression is invoked from MakeTimestamp with `NullType` directly (without checking `inputTypes`).



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on PR #51179:
URL: https://github.com/apache/spark/pull/51179#issuecomment-2980177825

   @srielau @uros-db @mihailom-db Please, review the PR.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on PR #51179:
URL: https://github.com/apache/spark/pull/51179#issuecomment-2987041819

   @LuciferYang @yaooqinn @dongjoon-hyun Could you review this PR, please.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #51179:
URL: https://github.com/apache/spark/pull/51179#issuecomment-2989600537

   +1 to prohibit


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "uros-db (via GitHub)" <gi...@apache.org>.
uros-db commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2152792599


##########
sql/core/src/test/resources/sql-tests/inputs/timestamp.sql:
##########
@@ -169,3 +169,8 @@ select timediff(SECOND, date'2022-02-15', timestamp'2022-02-14 23:59:59');
 
 select timediff('MINUTE', timestamp'2023-02-14 01:02:03', timestamp'2023-02-14 02:00:03');
 select timediff('YEAR', date'2020-02-15', date'2023-02-15');
+
+-- Construct timestamp from date and time

Review Comment:
   How do we handle null values? Can we add tests for this?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2154237104


##########
sql/core/src/test/resources/sql-tests/analyzer-results/datetime-legacy.sql.out:
##########
@@ -1899,3 +1899,21 @@ org.apache.spark.sql.catalyst.parser.ParseException
     "fragment" : "timediff('YEAR', date'2020-02-15', date'2023-02-15')"
   } ]
 }
+
+
+-- !query
+SELECT make_timestamp(DATE'0001-01-01', TIME'0:0:0')
+-- !query analysis
+[Analyzer test output redacted due to nondeterminism]

Review Comment:
   Not clear to me. I have leave a question in the PR: https://github.com/apache/spark/pull/40496/files#r2154235184 



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [WIP][SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "mihailom-db (via GitHub)" <gi...@apache.org>.
mihailom-db commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2149351480


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala:
##########
@@ -2746,7 +2746,11 @@ object TryMakeTimestampLTZExpressionBuilder extends ExpressionBuilder {
 
 // scalastyle:off line.size.limit
 @ExpressionDescription(
-  usage = "_FUNC_(year, month, day, hour, min, sec[, timezone]) - Create timestamp from year, month, day, hour, min, sec and timezone fields. The result data type is consistent with the value of configuration `spark.sql.timestampType`. If the configuration `spark.sql.ansi.enabled` is false, the function returns NULL on invalid inputs. Otherwise, it will throw an error instead.",
+  usage = """
+    _FUNC_(year, month, day, hour, min, sec[, timezone]) - Create timestamp from year, month, day, hour, min, sec and timezone fields. The result data type is consistent with the value of configuration `spark.sql.timestampType`. If the configuration `spark.sql.ansi.enabled` is false, the function returns NULL on invalid inputs. Otherwise, it will throw an error instead.

Review Comment:
   nit: Should we move the output type and error out comments after the second declaration of the function?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "mihailom-db (via GitHub)" <gi...@apache.org>.
mihailom-db commented on PR #51179:
URL: https://github.com/apache/spark/pull/51179#issuecomment-2981692203

   @srielau We do have make_timestamp_ntz(). This is the base function which takes timezone from the config or from the input. When it comes to date/time not having zone, I would say neither do hour, minute, second, day, year, month from which the original make_timestamp was done. Should we maybe just improve the docs around this?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on code in PR #51179:
URL: https://github.com/apache/spark/pull/51179#discussion_r2154237104


##########
sql/core/src/test/resources/sql-tests/analyzer-results/datetime-legacy.sql.out:
##########
@@ -1899,3 +1899,21 @@ org.apache.spark.sql.catalyst.parser.ParseException
     "fragment" : "timediff('YEAR', date'2020-02-15', date'2023-02-15')"
   } ]
 }
+
+
+-- !query
+SELECT make_timestamp(DATE'0001-01-01', TIME'0:0:0')
+-- !query analysis
+[Analyzer test output redacted due to nondeterminism]

Review Comment:
   Not clear to me too. I have leaved a question in the PR: https://github.com/apache/spark/pull/40496/files#r2154235184 



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-51415][SQL] Make timestamp from date and time [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on PR #51179:
URL: https://github.com/apache/spark/pull/51179#issuecomment-2987864214

   > I guess these cases shall be considered invalid?
   
   Good question, should we prohibit any implicit casts to DATE like:
   ```sql
   spark-sql (default)> SELECT make_timestamp('2018-11-17', TIME'0:0:0');
   2018-11-17 00:00:00
   spark-sql (default)> SELECT make_timestamp(timestamp_ntz'2018-11-17', time'1:2:3');
   2018-11-17 01:02:03
   ```
   Probably, yes. WDYT?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org