Skip to content

Instantly share code, notes, and snippets.

@dvirsky
Created March 29, 2018 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvirsky/d6a78b47ec00b550a1cbf9cc30e2e5ec to your computer and use it in GitHub Desktop.
Save dvirsky/d6a78b47ec00b550a1cbf9cc30e2e5ec to your computer and use it in GitHub Desktop.
typedef struct {
RSMultiKey *keys;
} AggregateLoadStep;
typedef struct {
const char *reducer;
CmdArg *args; // TODO: something better here...
const char *alias;
} AggregateGroupReduce;
typedef struct {
RSMultiKey *properties;
AggregateGroupReduce *reducers;
size_t numReducers;
const char *alias;
} AggregateGroupStep;
typedef struct {
const char *expr;
const char *alias;
} AggregateApplyStep;
typedef struct {
RSMultiKey *keys;
uint64_t ascendMap;
int max;
} AggregateSortStep;
typedef struct {
int offset;
int num;
} AggregateLimitStep;
typedef enum {
AggregateStep_Group,
AggregateStep_Sort,
AggregateStep_Apply,
AggregateStep_Limit,
AggregateStep_Load,
} AggregateStepType;
typedef struct AggregateStep {
union {
AggregateApplyStep apply;
AggregateGroupStep group;
AggregateLoadStep load;
AggregateLimitStep limit;
AggregateSortStep sort;
};
AggregateStepType type;
struct AggregateStep *next;
} AggregateStep;
typedef struct {
size_t count;
int maxIdle;
} AggregateCursor;
typedef struct {
const char *index;
const char *query;
size_t queryLen;
AggregateStep *head;
AggregateStep *tail;
size_t size;
int hasCursor;
AggregateCursor cursor;
} AggregatePlan;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment