CUBRID Engine  latest
query_bitset.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "query_bitset.h"
#include "memory_alloc.h"
Include dependency graph for query_bitset.c:

Go to the source code of this file.

Macros

#define NBYTES(n)   ((n) * sizeof(BITSET_CARRIER))
 
#define NELEMS(n)   ((n) * _WORDSIZE)
 
#define bitset_malloc(env, size)   malloc(size)
 
#define bitset_free(ptr)   free_and_init(ptr)
 

Functions

void bitset_extend (BITSET *dst, int nwords)
 
void bitset_assign (BITSET *dst, const BITSET *src)
 
void bitset_add (BITSET *dst, int x)
 
void bitset_remove (BITSET *dst, int x)
 
void bitset_union (BITSET *dst, const BITSET *src)
 
void bitset_intersect (BITSET *dst, const BITSET *src)
 
void bitset_difference (BITSET *dst, const BITSET *src)
 
int bitset_subset (const BITSET *r, const BITSET *s)
 
int bitset_intersects (const BITSET *r, const BITSET *s)
 
int bitset_is_empty (const BITSET *s)
 
int bitset_is_equivalent (const BITSET *r, const BITSET *s)
 
int bitset_cardinality (const BITSET *s)
 
int bitset_iterate (const BITSET *s, BITSET_ITERATOR *si)
 
int bitset_next_member (BITSET_ITERATOR *si)
 
int bitset_first_member (const BITSET *s)
 
void bitset_print (const BITSET *s, FILE *fp)
 
void bitset_init (BITSET *s, QO_ENV *env)
 
void bitset_delset (BITSET *s)
 

Variables

static const char nbits []
 
static BITSET_CARRIER empty_set_words [NWORDS] = { 0 }
 
BITSET EMPTY_SET = { NULL, empty_set_words, NWORDS, {{0}} }
 

Macro Definition Documentation

#define bitset_free (   ptr)    free_and_init(ptr)

Definition at line 39 of file query_bitset.c.

Referenced by bitset_delset(), and bitset_extend().

#define bitset_malloc (   env,
  size 
)    malloc(size)

Definition at line 38 of file query_bitset.c.

#define NBYTES (   n)    ((n) * sizeof(BITSET_CARRIER))

Definition at line 35 of file query_bitset.c.

Referenced by bitset_assign(), and bitset_extend().

#define NELEMS (   n)    ((n) * _WORDSIZE)

Definition at line 36 of file query_bitset.c.

Function Documentation

void bitset_extend ( BITSET dst,
int  nwords 
)

Definition at line 92 of file query_bitset.c.

References ARG_FILE_LINE, bitset_free, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), NBYTES, and NULL.

Referenced by bitset_add(), bitset_assign(), and bitset_union().

Here is the caller graph for this function:

void bitset_intersect ( BITSET dst,
const BITSET src 
)

Definition at line 200 of file query_bitset.c.

Referenced by gen_outer(), make_mergelist_proc(), qo_compute_projected_segs(), qo_index_scan_new(), and qo_search_planner().

Here is the caller graph for this function:

int bitset_is_equivalent ( const BITSET r,
const BITSET s 
)

Definition at line 342 of file query_bitset.c.

Referenced by planner_visit_node(), qo_check_new_best_plan_on_info(), qo_classify_outerjoin_terms(), qo_discover_edges(), qo_join_new(), and qo_plan_iscan_terms_cmp().

Here is the caller graph for this function:

int bitset_iterate ( const BITSET s,
BITSET_ITERATOR si 
)

Definition at line 464 of file query_bitset.c.

References bitset_next_member(), bitset_iterator::next, and bitset_iterator::set.

Referenced by add_subqueries(), bitset_first_member(), bitset_has_path(), bitset_print(), gen_outer(), make_mergelist_proc(), make_namelist_from_projected_segs(), make_outer_instnum(), make_pred_from_bitset(), planner_nodeset_join_cost(), planner_permutate(), planner_visit_node(), qo_add_dep_term(), qo_analyze_term(), qo_check_parent_eq_class_for_multi_range_opt(), qo_check_seg_belongs_to_range_term(), qo_check_subplan_join_cond_for_multi_range_opt(), qo_check_subqueries_for_multi_range_opt(), qo_check_terms_for_multiple_range_opt(), qo_classify_outerjoin_terms(), qo_combine_partitions(), qo_compute_projected_size(), qo_discover_edges(), qo_discover_indexes(), qo_discover_partitions(), qo_discover_sort_limit_join_nodes(), qo_discover_sort_limit_nodes(), qo_dump_planner_info(), qo_eqclass_dump(), qo_eqclass_wrt(), qo_examine_correlated_index(), qo_examine_merge_join(), qo_examine_nl_join(), qo_find_index_segs(), qo_generate_index_scan(), qo_generate_join_index_scan(), qo_get_multi_col_range_segs(), qo_get_xasl_index_info(), qo_index_scan_new(), qo_iscan_cost(), qo_join_info(), qo_nljoin_cost(), qo_plan_compute_cost(), qo_plan_compute_iscan_sort_list(), qo_plan_print_projected_segs(), qo_plan_scan_print_json(), qo_plan_scan_print_text(), qo_scan_info(), qo_search_partition_join(), qo_search_planner(), qo_seg_nodes(), qo_subquery_dump(), qo_term_string(), qo_termset_fprint(), and qo_top_plan_new().

int bitset_next_member ( BITSET_ITERATOR si)

Definition at line 478 of file query_bitset.c.

References _BIT, _WORD, _WORDSIZE, bitset_iterator::next, and bitset_iterator::set.

Referenced by add_subqueries(), bitset_has_path(), bitset_iterate(), bitset_print(), gen_outer(), make_mergelist_proc(), make_namelist_from_projected_segs(), make_outer_instnum(), make_pred_from_bitset(), planner_nodeset_join_cost(), planner_permutate(), planner_visit_node(), qo_add_dep_term(), qo_analyze_term(), qo_check_parent_eq_class_for_multi_range_opt(), qo_check_seg_belongs_to_range_term(), qo_check_subplan_join_cond_for_multi_range_opt(), qo_check_subqueries_for_multi_range_opt(), qo_check_terms_for_multiple_range_opt(), qo_classify_outerjoin_terms(), qo_combine_partitions(), qo_compute_projected_size(), qo_discover_edges(), qo_discover_indexes(), qo_discover_partitions(), qo_discover_sort_limit_join_nodes(), qo_discover_sort_limit_nodes(), qo_dump_planner_info(), qo_eqclass_dump(), qo_eqclass_wrt(), qo_examine_correlated_index(), qo_examine_merge_join(), qo_examine_nl_join(), qo_find_index_segs(), qo_generate_index_scan(), qo_generate_join_index_scan(), qo_get_multi_col_range_segs(), qo_get_xasl_index_info(), qo_index_scan_new(), qo_iscan_cost(), qo_join_info(), qo_nljoin_cost(), qo_plan_compute_cost(), qo_plan_compute_iscan_sort_list(), qo_plan_print_projected_segs(), qo_plan_scan_print_json(), qo_plan_scan_print_text(), qo_scan_info(), qo_search_partition_join(), qo_search_planner(), qo_seg_nodes(), qo_subquery_dump(), qo_term_string(), qo_termset_fprint(), and qo_top_plan_new().

void bitset_print ( const BITSET s,
FILE *  fp 
)

Definition at line 527 of file query_bitset.c.

References bitset_is_empty(), bitset_iterate(), bitset_next_member(), and i.

Referenced by qo_dump_info(), qo_node_dump(), qo_partition_dump(), qo_plan_print_subqueries(), qo_term_dump(), and qo_term_fprint().

Here is the caller graph for this function:

void bitset_remove ( BITSET dst,
int  x 
)

Variable Documentation

BITSET EMPTY_SET = { NULL, empty_set_words, NWORDS, {{0}} }

Definition at line 64 of file query_bitset.c.

Referenced by gen_inner(), gen_outer(), make_sort_limit_proc(), and qo_to_xasl().

BITSET_CARRIER empty_set_words[NWORDS] = { 0 }
static

Definition at line 63 of file query_bitset.c.

const char nbits[]
static
Initial value:
= {
0,
1,
1,
2,
1,
2,
2,
3,
1,
2,
2,
3,
2,
3,
3,
4,
}

Definition at line 44 of file query_bitset.c.

Referenced by bitset_cardinality(), and qstr_ffs().