Skip to content

Conversation

@codetyri0n
Copy link
Contributor

@codetyri0n codetyri0n commented Oct 21, 2025

Which issue does this PR close?

What changes are included in this PR?

  • Added a SQL example in scalar functions md to demonstrate setting execution time zone (optional) for current_time() and current_date().

Are these changes tested?

Are there any user-facing changes?

…zone (optional) for current_time() and current_date().
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 21, 2025
@codetyri0n
Copy link
Contributor Author

@alamb could you please take a look

@Jefffrey
Copy link
Contributor

I believe these should be modified in the source files instead of this doc as it gets autogenerated, see:

#[user_doc(
doc_section(label = "Time and Date Functions"),
description = r#"
Returns the current date in the session time zone.
The `current_date()` return value is determined at query time and will return the same date, no matter when in the query plan the function executes.
"#,
syntax_example = "current_date()"
)]

You could add it via a sql_example block like here for example:

sql_example = r#"```sql
> select range(2, 10, 3);
+-----------------------------------+
| range(Int64(2),Int64(10),Int64(3))|
+-----------------------------------+
| [2, 5, 8] |
+-----------------------------------+
> select range(DATE '1992-09-01', DATE '1993-03-01', INTERVAL '1' MONTH);
+--------------------------------------------------------------+
| range(DATE '1992-09-01', DATE '1993-03-01', INTERVAL '1' MONTH) |
+--------------------------------------------------------------+
| [1992-09-01, 1992-10-01, 1992-11-01, 1992-12-01, 1993-01-01, 1993-02-01] |
+--------------------------------------------------------------+
```"#,

Then run ./dev/update_function_docs.sh to generate that doc

@codetyri0n
Copy link
Contributor Author

thanks, ill modify this accordingly

@github-actions github-actions bot added the functions Changes to functions implementation label Oct 21, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Jefffrey and @codetyri0n - this looks like an improvement to me

@alamb alamb added this pull request to the merge queue Oct 21, 2025
Merged via the queue into apache:main with commit 6d52e54 Oct 21, 2025
29 checks passed
@codetyri0n codetyri0n deleted the datetime_docs branch October 22, 2025 06:28
tobixdev pushed a commit to tobixdev/datafusion that referenced this pull request Nov 2, 2025
…he#18200)

## Which issue does this PR close?
- Closes apache#18199 
## What changes are included in this PR?
- Added a SQL example in scalar functions md to demonstrate setting
execution time zone (optional) for current_time() and current_date().
## Are these changes tested?
## Are there any user-facing changes?
EeshanBembi pushed a commit to EeshanBembi/datafusion that referenced this pull request Nov 24, 2025
…he#18200)

## Which issue does this PR close?
- Closes apache#18199 
## What changes are included in this PR?
- Added a SQL example in scalar functions md to demonstrate setting
execution time zone (optional) for current_time() and current_date().
## Are these changes tested?
## Are there any user-facing changes?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update documentation for current_date and current_time functions

3 participants