You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2025/07/09 19:01:48 UTC

(spark) branch master updated: [SPARK-52733][SQL][DOCS] Update the page about TIME literals

This is an automated email from the ASF dual-hosted git repository.

maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 589e93a02725 [SPARK-52733][SQL][DOCS] Update the page about TIME literals
589e93a02725 is described below

commit 589e93a02725939c266f9ee97f96fdc6d3db33cd
Author: Max Gekk <ma...@gmail.com>
AuthorDate: Wed Jul 9 21:01:31 2025 +0200

    [SPARK-52733][SQL][DOCS] Update the page about TIME literals
    
    ### What changes were proposed in this pull request?
    In the PR, I propose to update the doc page https://spark.apache.org/docs/latest/sql-ref-literals.html about literals, and provide information about the TIME literals. After the changes, the page looks like:
    <img width="846" alt="Screenshot 2025-07-09 at 15 14 02" src="https://github.com/user-attachments/assets/973189f0-029c-46eb-9775-dbd3ee92cff4" />
    
    ### Why are the changes needed?
    To improve user experience with Spark SQL, and provide actual information about the TIME data type.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    By checking the result page.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No.
    
    Closes #51420 from MaxGekk/time-lit-pattern-doc.
    
    Authored-by: Max Gekk <ma...@gmail.com>
    Signed-off-by: Max Gekk <ma...@gmail.com>
---
 docs/sql-ref-literals.md | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/docs/sql-ref-literals.md b/docs/sql-ref-literals.md
index 7a10676cce23..13f310503b51 100644
--- a/docs/sql-ref-literals.md
+++ b/docs/sql-ref-literals.md
@@ -373,7 +373,7 @@ SELECT -3.E-3D AS col;
 
 ### Datetime Literal
 
-A datetime literal is used to specify a date or timestamp value.
+A datetime literal is used to specify a date, time or timestamp value.
 
 #### Date Syntax
 
@@ -410,6 +410,44 @@ SELECT DATE '2011-11-11' AS col;
 +----------+
 ```
 
+#### Time Syntax
+
+```sql
+TIME { '[h]h:[m]m[:]' |
+       '[h]h:[m]m:[s]s[.]' |
+       '[h]h:[m]m:[s]s.[ms][ms][ms][us][us][us]'}
+```
+**Note:** defaults to `00` if hour, minute or second is not specified.
+
+#### Time Examples
+
+```sql
+SELECT TIME'12:00' as col;
++--------+
+|col     |
++--------+
+|12:00:00|
++--------+
+SELECT TIME'2:0' as col;
++--------+
+|col     |
++--------+
+|02:00:00|
++--------+
+SELECT TIME'2:0:3' as col;
++--------+
+|col     |
++--------+
+|02:00:03|
++--------+
+SELECT TIME'23:59:59.999999' as col;
++---------------+
+|col            |
++---------------+
+|23:59:59.999999|
++---------------+
+```
+
 #### Timestamp Syntax
 
 ```sql


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