Skip to content
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

Support generating sequences in the Faker connector #24590

Merged
merged 8 commits into from
Dec 31, 2024

Conversation

nineinchnick
Copy link
Member

@nineinchnick nineinchnick commented Dec 28, 2024

Description

Support generating sequences in the Faker connector. It might be useful for columns representing primary keys, which often use sequences. Another use case would be equal distribution of values in temporal columns.

There's also no other easy way of generating sequences for timestamps, since the sequence function has a limit of 10k elements, and the sequence table function doesn't support temporal types at all.

It's a prerequisite for #24585

There are a few limitations:

  • not checking for overflows for large steps
  • small increments are not supported in some cases - like nanosecond steps with timestamp(9)

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

## Faker
* Support generating sequences in the Faker connector. ({issue}`24590`)

@cla-bot cla-bot bot added the cla-signed label Dec 28, 2024
@github-actions github-actions bot added the docs label Dec 28, 2024
@nineinchnick nineinchnick force-pushed the faker-sequences branch 2 times, most recently from 0bb9e43 to 021867e Compare December 29, 2024 13:53
@nineinchnick nineinchnick marked this pull request as ready for review December 29, 2024 13:53
{
Range genericRange = handle.domain().getValues().getRanges().getSpan();
Type type = handle.type();
// check every type in order defined in StandardTypes
Copy link
Member

Choose a reason for hiding this comment

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

why order matters?

Copy link
Member Author

@nineinchnick nineinchnick Dec 30, 2024

Choose a reason for hiding this comment

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

Only for consistency, there are now 3 blocks of code that enumerate different types. I also wanted to document why they're in this particular order.

Copy link
Member

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

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

skimmed. LGTM

Fix handling upper bounds for floating point types. The implementation
did not account for rounding issue near the bound, and the test was
using values outside of the allowed range.
Refactor to make subsequent commit's diff smaller
@raunaqmorarka raunaqmorarka merged commit fdf4964 into trinodb:master Dec 31, 2024
24 checks passed
@github-actions github-actions bot added this to the 469 milestone Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants