Skip to content

fix date_part('isodow')#22116

Merged
comphead merged 1 commit into
apache:mainfrom
sdf-jkl:temporal-isodow-fix
May 12, 2026
Merged

fix date_part('isodow')#22116
comphead merged 1 commit into
apache:mainfrom
sdf-jkl:temporal-isodow-fix

Conversation

@sdf-jkl
Copy link
Copy Markdown
Contributor

@sdf-jkl sdf-jkl commented May 12, 2026

Which issue does this PR close?

Rationale for this change

Bug in date_part - isodow argument logic

What changes are included in this PR?

  • fix the logic
  • fix the docs

Are these changes tested?

  • Yes, unit tests

Are there any user-facing changes?

  • Yes, this PR fixes the logic bug. Docs are updated.

@github-actions github-actions Bot added documentation Improvements or additions to documentation sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation spark labels May 12, 2026
Copy link
Copy Markdown
Member

@waynexia waynexia left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

Double checked this behavior https://en.wikipedia.org/wiki/ISO_8601#Week_dates:

[D] is the weekday number, from 1 through 7, beginning with Monday and ending with Sunday.

@comphead comphead added this pull request to the merge queue May 12, 2026
Merged via the queue into apache:main with commit f6a1995 May 12, 2026
36 checks passed
gstvg pushed a commit to gstvg/arrow-datafusion that referenced this pull request May 14, 2026
## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

- Closes apache#22115.

## Rationale for this change

Bug in `date_part` - `isodow` argument logic
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

## What changes are included in this PR?

- fix the logic
- fix the docs
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

## Are these changes tested?

- Yes, unit tests
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

## Are there any user-facing changes?

- Yes, this PR fixes the logic bug. Docs are updated.
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
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 spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

date_part('isodow') / EXTRACT(isodow) returns 0..=6 instead of PostgreSQL's 1..=7

3 participants