-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathhypertable_restrict_info.h
More file actions
69 lines (57 loc) · 2.28 KB
/
Copy pathhypertable_restrict_info.h
File metadata and controls
69 lines (57 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* This file and its contents are licensed under the Apache License 2.0.
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#pragma once
#include "hypertable.h"
typedef struct DimensionRestrictInfo
{
const Dimension *dimension;
} DimensionRestrictInfo;
typedef struct DimensionRestrictInfoOpen
{
DimensionRestrictInfo base;
int64 lower_bound; /* internal time representation */
StrategyNumber lower_strategy;
int64 upper_bound; /* internal time representation */
StrategyNumber upper_strategy;
} DimensionRestrictInfoOpen;
typedef struct DimensionRestrictInfoClosed
{
DimensionRestrictInfo base;
List *partitions; /* hash values */
StrategyNumber strategy; /* either Invalid or equal */
} DimensionRestrictInfoClosed;
/* HypertableRestrictInfo represents restrictions on a hypertable. It uses
* range exclusion logic to figure out which chunks can match the description */
typedef struct HypertableRestrictInfo
{
/*
* number of base restrictions
* that are true everywhere inside the HRI. */
int num_quals_proven_true_by_hri;
int num_dimensions;
/*
* Array of dimension restrictions.
*/
DimensionRestrictInfo *dimension_restriction[FLEXIBLE_ARRAY_MEMBER];
} HypertableRestrictInfo;
extern HypertableRestrictInfo *ts_hypertable_restrict_info_create(Hypertable *ht);
/* Add restrictions based on a List of RestrictInfo */
extern void ts_hypertable_restrict_info_add(HypertableRestrictInfo *hri, PlannerInfo *root,
List *base_restrict_infos);
/*
* Add a single restriction. Returns true if the clause is true everywhere inside
* the current hypertable restrictions.
*/
extern bool ts_hypertable_restrict_info_add_clause(HypertableRestrictInfo *hri, PlannerInfo *root,
Expr *clause);
/* Get a list of chunk oids for chunks whose constraints match the restriction clauses */
extern Chunk **ts_hypertable_restrict_info_get_chunks(HypertableRestrictInfo *hri, Hypertable *ht,
bool include_osm, unsigned int *num_chunks);
extern Chunk **ts_hypertable_restrict_info_get_chunks_ordered(HypertableRestrictInfo *hri,
Hypertable *ht, bool include_osm,
Chunk **chunks, bool reverse,
List **nested_oids,
unsigned int *num_chunks);