-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Conversation
0bb9e43
to
021867e
Compare
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerPageSource.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerPageSource.java
Show resolved
Hide resolved
{ | ||
Range genericRange = handle.domain().getValues().getRanges().getSpan(); | ||
Type type = handle.type(); | ||
// check every type in order defined in StandardTypes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why order matters?
There was a problem hiding this comment.
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.
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerPageSource.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
021867e
to
f7d560f
Compare
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerColumnHandle.java
Show resolved
Hide resolved
f7d560f
to
a6137e3
Compare
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 thesequence
table function doesn't support temporal types at all.It's a prerequisite for #24585
There are a few limitations:
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: