-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Add function generateSnowflakeID
#63577
Conversation
This is an automated comment for commit 1425f07 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
serial
and generateSnowflakeID
functions
generateSerialID
and generateSnowflakeID
functionsgenerateSnowflakeID
@kazalika I reverted Please create a new PR for |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
fb70f2f
@rschu1ze, are you sure we need two functions? Why not have a single function that acquires global monotonic increments per each block and processes a block without synchronization? It does not matter if it does not strictly follow the spec of Snowflake ID. But having these two functions is unnecessarily obscure and complicated for an end-user. |
@alexey-milovidov The original motivation for two functions was generateUUIDv7 which comes in three forms (the "non-monotonic" variant does not make sense for snowflake ids so it was omitted). Anyways, thinking about it, the use case for generateSnowflakeIDThreadMonotonic is indeed quite obscure. Let me remove it (--> #64499). If there is an actual need / use case, we can restore the code. Besides that, the "normal" |
@rschu1ze Thank you! |
@alexey-milovidov Looking at the original PR, I guess the only reason to introduce Revert: #64506 |
@kazalika really awesome implementation, I wonder though if the API is a bit inconsistent: snowflakeToDateTime(generateSnowflakeID()::Int64) will return |
Changelog category:
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Added new SQL functions
generateSnowflakeID
for generating Twitter-style Snowflake IDs.Documentation entry for user-facing changes
Modify your CI run
NOTE: If your merge the PR with modified CI you MUST KNOW what you are doing
NOTE: Checked options will be applied if set before CI RunConfig/PrepareRunConfig step
Include tests (required builds will be added automatically):
Exclude tests:
Extra options:
Only specified batches in multi-batch jobs: