diff options
| author | chenzizhan <[email protected]> | 2023-12-11 11:12:57 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2023-12-11 11:12:57 +0800 |
| commit | a3bd4934eb46e67d76489e2fec597e9cb30a84de (patch) | |
| tree | 3fd4789202bd552bf75671d543f1a91891a123df /src/fieldstat.c | |
| parent | 8cb0a7ede8d30b0e1a49fa1582e26795d5258b27 (diff) | |
feat: query cube modev4.4.3
Diffstat (limited to 'src/fieldstat.c')
| -rw-r--r-- | src/fieldstat.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/fieldstat.c b/src/fieldstat.c index 33f60de..b62ea39 100644 --- a/src/fieldstat.c +++ b/src/fieldstat.c @@ -1433,3 +1433,26 @@ int fieldstat_find_cube(const struct fieldstat *instance, const struct fieldstat return cube_id; } + +int fieldstat_get_cube_mode(const struct fieldstat *instance, int cube_id, enum sampling_mode *mode, int *primary_metric_id) +{ + if (instance == NULL) { + return FS_ERR_NULL_HANDLER; + } + if (cube_id < 0 || cube_id >= instance->valid_cube_arr_length) { + return FS_ERR_INVALID_CUBE_ID; + } + const struct fs_cube *cube = instance->cube[cube_id]; + if (cube == NULL) { + return FS_ERR_INVALID_CUBE_ID; + } + + *mode = cube->sampling_mode; + if (cube->sampling_mode == SAMPLING_MODE_TOPK) { + *primary_metric_id = cube->primary_metric_id; + } else { + *primary_metric_id = -1; + } + + return FS_OK; +}
\ No newline at end of file |
