mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-12-03 12:27:42 +08:00
support sharding key type int64
This commit is contained in:
parent
2817c857e3
commit
db11d4af10
@ -339,9 +339,9 @@ partition_satisfies(sharding_partition_t *partition, struct condition_t cond)
|
||||
g_warning(G_STRLOC ":error condition");
|
||||
}
|
||||
} else { /* int and datetime */
|
||||
int low = (int)(int64_t) partition->low_value;
|
||||
int high = (int)(int64_t) partition->value; /* high range OR hash value */
|
||||
int val = cond.v.num;
|
||||
int64_t low = (int64_t) partition->low_value;
|
||||
int64_t high = (int64_t) partition->value; /* high range OR hash value */
|
||||
int64_t val = cond.v.num;
|
||||
switch (cond.op) {
|
||||
case TK_EQ:
|
||||
return val > low && val <= high;
|
||||
@ -366,7 +366,7 @@ partition_satisfies(sharding_partition_t *partition, struct condition_t cond)
|
||||
}
|
||||
|
||||
g_warning(G_STRLOC ":error reach here");
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* filter out those which not satisfy cond */
|
||||
|
@ -684,9 +684,15 @@ cmp_shard_range_groups_int(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
sharding_partition_t *item1 = *(sharding_partition_t **)a;
|
||||
sharding_partition_t *item2 = *(sharding_partition_t **)b;
|
||||
int n1 = (int)(int64_t) item1->value;
|
||||
int n2 = (int)(int64_t) item2->value;
|
||||
return n1 - n2;
|
||||
int64_t n1 = (int64_t) item1->value;
|
||||
int64_t n2 = (int64_t) item2->value;
|
||||
if (n1 > n2) {
|
||||
return 1;
|
||||
} else if (n1 == n2) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
|
Loading…
Reference in New Issue
Block a user