-
Notifications
You must be signed in to change notification settings - Fork 2.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
schemadiff
: temporal range partition rotation analysis and operation
#17426
base: main
Are you sure you want to change the base?
schemadiff
: temporal range partition rotation analysis and operation
#17426
Conversation
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17426 +/- ##
==========================================
+ Coverage 67.60% 67.69% +0.08%
==========================================
Files 1581 1584 +3
Lines 253945 254897 +952
==========================================
+ Hits 171670 172540 +870
- Misses 82275 82357 +82 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…rgument Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Now fully supporting weekly rotations, including all week modes, based on either requested interval or on a parsed |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
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.
Renamed as partitioning_analysis.go
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.
Renamed as partitioning_analysis_test.go
Description
This PR introduces elaborate analysis and operations over temporal range partitioned tables.
Temporal range partitioned tables are tables with range partitions using any form of temporal value, ie:
PARTITION BY RANGE COLUMNS (col_name)
over a single column of typeDATE
orDATETIME
PARTITION BY RANGE (temporal_func(col_name))
using one of several explicitly supported functions:TO_SECONDS
TO_DAYS
YEARWEEK
YEAR
8.4
:UNIX_TIMESTAMP
and using aTIMESTAMP
columnschemadiff
then offers:AnalyzeTemporalRangePartitioning()
returningTemporalRangePartitioningAnalysis
, which determines whether the table is at all partitioned byRANGE
, and can be considered as being temporal partitioned. Analysis includes the minimal rotation interval, the function used, if any, the column used, whetherMAXVALUE
is used, etc.TemporalRangePartitioningNextRotation()
, given a table, interval, expected ahead-of-time partitions and time reference, returning a list ofALTER TABLE
statements that prepare futuristic empty partitions, as needed.schemadiff
analyzes the actual values in the table definition, whether these areDATE
,DATETIME
, or product of one of the supported functions, to determine which of the ahead-of-time partitions are already covered by existing schema, and which needs to be added.The function generates either
ADD PARTITION
orREORGANIZE PARTITION
statements, based on whetherMAXVALUE
partition is present.There's a variety of conditions to make the function return an error: if the table is not temporal range partitioned, if the interval is invalid for the table, and more.
TemporalRangePartitioningRetention()
: given a table and an expiration time, this function returns a (possibly empty)ALTER TABLE DROP PARTITION ...
statement dropping all expired partitions. Again,schemadiff
computed the actual partition values whether explicitDATE
,DATETIME
or product of one of the supported functions.Related Issue(s)
Checklist
Deployment Notes