Skip to content

feat(timestamp): improve ibis.timestamp() #11129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

NickCrews
Copy link
Contributor

@NickCrews NickCrews commented Apr 16, 2025

  • when you create a ibis.timestamp(), it detects the max needed resolution for that timestamp, and uses that. For example, "2025-04-17 01:02:03" before was infered as a dt.Timestamp with scale=None. Now it has scale=0, eg with second resolution. This sets the stage to allow for really big dates, like in the year 3000, to work. Otherwise, when a backend told to compile a Literal of type Timestamp(scale=None), it was forced to use the highest possible resolution to ensure that the result wasnt truncated. For eg datafusion, this meant it tried to cast to nanosecond resolution, but you can't fit these huge dates into nanosecond resolution.
  • adds a nullable flag to the factory functions ibis.timestamp()
  • adds typing to rules.highest_precedence_shape() and _dtype()
  • makes them more ergonomic so you can pass in an iterable of other attribute names.
  • adds .from_datetime and .from_pandas methods to dt.Timestamp, so the implementation is in one place

@github-actions github-actions bot added tests Issues or PRs related to tests datatypes Issues relating to ibis's datatypes (under `ibis.expr.datatypes`) labels Apr 16, 2025
@NickCrews NickCrews force-pushed the nullable-dtype branch 2 times, most recently from c0b98de to f88521e Compare April 16, 2025 16:01
@github-actions github-actions bot added bigquery The BigQuery backend sql Backends that generate SQL labels Apr 16, 2025
Copy link
Contributor

ACTION NEEDED

Ibis follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message.

Please update your PR title and description to match the specification.

See https://github.com/ibis-project/ibis/blob/main/.releaserc.js
for the list of acceptable prefixes, eg "feat:", "fix:", "chore:", etc.

The commitlint output is:

⧗   input: fixup: fix timezone getting passed to Literal op
✖   type must be one of [build, chore, ci, depr, docs, feat, fix, perf, refactor, revert, style, test] [type-enum]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bigquery The BigQuery backend datatypes Issues relating to ibis's datatypes (under `ibis.expr.datatypes`) sql Backends that generate SQL tests Issues or PRs related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants