feat: truncate request by time ranges (#262)
* feat: truncate request by time ranges Signed-off-by: discord9 <discord9@163.com> * fix: default time unit is millisecond Signed-off-by: discord9 <discord9@163.com> * refactor: per review Signed-off-by: discord9 <discord9@163.com> * add time ranges to truncate table expr Signed-off-by: discord9 <discord9@163.com> * chore: make all Signed-off-by: discord9 <discord9@163.com> * chore: fmt Signed-off-by: discord9 <discord9@163.com> * chore: make all Signed-off-by: discord9 <discord9@163.com> * chore: make all Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com>
This commit is contained in:
@@ -154,6 +154,26 @@ message IntervalMonthDayNano {
|
||||
int64 nanoseconds = 3;
|
||||
}
|
||||
|
||||
/// Time Unit for timestamp
|
||||
enum TimeUnit {
|
||||
// The default time unit is MILLISECOND
|
||||
MILLISECOND = 0;
|
||||
SECOND = 1;
|
||||
MICROSECOND = 2;
|
||||
NANOSECOND = 3;
|
||||
}
|
||||
|
||||
message TimeRange {
|
||||
int64 start = 1;
|
||||
int64 end = 2;
|
||||
}
|
||||
|
||||
/// Truncate partially by time ranges
|
||||
message TimeRanges {
|
||||
TimeUnit time_unit = 1;
|
||||
repeated TimeRange time_ranges = 2;
|
||||
}
|
||||
|
||||
// (hi: high 64 bits, lo: low 64 bits) are used to keep the decimal128 value.
|
||||
message Decimal128 {
|
||||
int64 hi = 1;
|
||||
|
||||
@@ -177,6 +177,8 @@ message TruncateTableExpr {
|
||||
string schema_name = 2;
|
||||
string table_name = 3;
|
||||
TableId table_id = 4;
|
||||
// if empty, truncate entire table, else only truncate time ranges
|
||||
TimeRanges time_ranges = 5;
|
||||
}
|
||||
|
||||
message DropDatabaseExpr {
|
||||
|
||||
@@ -215,8 +215,15 @@ message CompactRequest {
|
||||
|
||||
message TruncateRequest {
|
||||
uint64 region_id = 1;
|
||||
oneof kind {
|
||||
All all = 2;
|
||||
TimeRanges time_ranges = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Truncate all data in region
|
||||
message All {}
|
||||
|
||||
// The column definition of a region. Unlike the message `ColumnDef` in
|
||||
// `ddl.proto` which is for clients outside GreptimeDB, this `RegionColumnDef`
|
||||
// is for region requests use only. So it carries an extra field `column_id`
|
||||
|
||||
Reference in New Issue
Block a user