File partition.c
FileList > cubrid > src > query > partition.c
Go to the source code of this file
#include <assert.h>
#include "partition_sr.h"
#include "dbtype.h"
#include "fetch.h"
#include "heap_file.h"
#include "object_primitive.h"
#include "object_representation.h"
#include "query_aggregate.hpp"
#include "query_executor.h"
#include "query_opfunc.h"
#include "stream_to_xasl.h"
#include "xasl.h"
#include "xasl_predicate.hpp"
#include "xasl_unpack_info.hpp"
#include "memory_wrapper.hpp"
Classes
Public Types
Public Static Attributes
Public Functions
| Type |
Name |
| void |
partition_cache_finalize (THREAD_ENTRY * thread_p)
|
| int |
partition_cache_init (THREAD_ENTRY * thread_p)
|
| void |
partition_clear_pruning_context (PRUNING_CONTEXT * pinfo)
|
| void |
partition_decache_class (THREAD_ENTRY * thread_p, const OID * class_oid)
|
| int |
partition_find_root_class_oid (THREAD_ENTRY * thread_p, const OID * class_oid, OID * super_oid)
|
| int |
partition_get_partition_oids (THREAD_ENTRY * thread_p, const OID * class_oid, OID ** partition_oids, int * count)
|
| PRUNING_SCAN_CACHE * |
partition_get_scancache (PRUNING_CONTEXT * pcontext, const OID * partition_oid)
|
| void |
partition_init_pruning_context (PRUNING_CONTEXT * pinfo)
|
| int |
partition_load_aggregate_helper (PRUNING_CONTEXT * pcontext, access_spec_node * spec, int pruned_count, BTID * root_btid, HIERARCHY_AGGREGATE_HELPER * helper)
|
| int |
partition_load_pruning_context (THREAD_ENTRY * thread_p, const OID * class_oid, int pruning_type, PRUNING_CONTEXT * pinfo)
|
| PRUNING_SCAN_CACHE * |
partition_new_scancache (PRUNING_CONTEXT * pcontext)
|
| int |
partition_prune_insert (THREAD_ENTRY * thread_p, const OID * class_oid, RECDES * recdes, HEAP_SCANCACHE * scan_cache, PRUNING_CONTEXT * pcontext, int pruning_type, OID * pruned_class_oid, HFID * pruned_hfid, OID * superclass_oid)
|
| int |
partition_prune_partition_index (PRUNING_CONTEXT * pcontext, DB_VALUE * key, OID * class_oid, BTID * btid, int * position)
|
| int |
partition_prune_spec (THREAD_ENTRY * thread_p, val_descr * vd, access_spec_node * spec)
|
| int |
partition_prune_unique_btid (PRUNING_CONTEXT * pcontext, DB_VALUE * key, OID * class_oid, HFID * class_hfid, BTID * btid)
|
| int |
partition_prune_update (THREAD_ENTRY * thread_p, const OID * class_oid, RECDES * recdes, PRUNING_CONTEXT * pcontext, int pruning_type, OID * pruned_class_oid, HFID * pruned_hfid, OID * superclass_oid)
|
Public Static Functions
| Type |
Name |
| int |
partition_attrinfo_get_key (THREAD_ENTRY * thread_p, PRUNING_CONTEXT * pcontext, DB_VALUE * curr_key, OID * class_oid, BTID * btid, DB_VALUE * partition_key)
|
| int |
partition_cache_entry_to_pruning_context (PRUNING_CONTEXT * pinfo, PARTITION_CACHE_ENTRY * entry_p)
|
| int |
partition_cache_pruning_context (PRUNING_CONTEXT * pinfo, bool * already_exists)
|
| bool |
partition_decrement_value (DB_VALUE * val)
|
| bool |
partition_do_regu_variables_contain (PRUNING_CONTEXT * pinfo, const REGU_VARIABLE * left, const REGU_VARIABLE * right)
|
| bool |
partition_do_regu_variables_match (PRUNING_CONTEXT * pinfo, const REGU_VARIABLE * left, const REGU_VARIABLE * right)
|
| int |
partition_find_inherited_btid (THREAD_ENTRY * thread_p, OID * src_class, OID * dest_class, BTID * src_btid, BTID * dest_btid)
|
| int |
partition_find_partition_for_record (PRUNING_CONTEXT * pinfo, const OID * class_oid, RECDES * recdes, OID * partition_oid, HFID * partition_hfid)
|
| int |
partition_free_cache_entry (PARTITION_CACHE_ENTRY * entry)
|
| int |
partition_free_cache_entry_kv (const void * key, void * data, void * args)
|
| void |
partition_free_partition_predicate (PRUNING_CONTEXT * pinfo)
|
| ATTR_ID |
partition_get_attribute_id (REGU_VARIABLE * regu_var)
|
| int |
partition_get_position_in_key (PRUNING_CONTEXT * pinfo, BTID * btid)
|
| int |
partition_get_value_from_inarith (PRUNING_CONTEXT * pinfo, const REGU_VARIABLE * src, DB_VALUE * value_p, bool * is_present)
|
| int |
partition_get_value_from_key (PRUNING_CONTEXT * pinfo, const REGU_VARIABLE * key, DB_VALUE * attr_key, bool * is_present)
|
| int |
partition_get_value_from_regu_var (PRUNING_CONTEXT * pinfo, const REGU_VARIABLE * key, DB_VALUE * value_p, bool * is_value)
|
| bool |
partition_is_reguvar_const (const REGU_VARIABLE * regu_var)
|
| bool |
partition_load_context_from_cache (PRUNING_CONTEXT * pinfo, bool * is_modified)
|
| int |
partition_load_partition_predicate (PRUNING_CONTEXT * pinfo, OR_PARTITION * master)
|
| MATCH_STATUS |
partition_match_index_key (PRUNING_CONTEXT * pinfo, const KEY_INFO * key, RANGE_TYPE range_type, PRUNING_BITSET * pruned)
|
| MATCH_STATUS |
partition_match_key_range (PRUNING_CONTEXT * pinfo, const KEY_RANGE * range, PRUNING_BITSET * pruned)
|
| MATCH_STATUS |
partition_match_pred_expr (PRUNING_CONTEXT * pinfo, const PRED_EXPR * pr, PRUNING_BITSET * pruned)
|
| MATCH_STATUS |
partition_prune (PRUNING_CONTEXT * pinfo, const REGU_VARIABLE * arg, const PRUNING_OP op, PRUNING_BITSET * pruned)
|
| MATCH_STATUS |
partition_prune_db_val (PRUNING_CONTEXT * pinfo, const DB_VALUE * val, const PRUNING_OP op, PRUNING_BITSET * pruned)
|
| MATCH_STATUS |
partition_prune_for_function (PRUNING_CONTEXT * pinfo, const REGU_VARIABLE * left, const REGU_VARIABLE * right, REGU_VARIABLE * part_expr, PRUNING_OP op, PRUNING_BITSET * pruned)
|
| MATCH_STATUS |
partition_prune_hash (PRUNING_CONTEXT * pinfo, const DB_VALUE * val, const PRUNING_OP op, PRUNING_BITSET * pruned)
|
| int |
partition_prune_heap_scan (PRUNING_CONTEXT * pinfo)
|
| int |
partition_prune_index_scan (PRUNING_CONTEXT * pinfo)
|
| MATCH_STATUS |
partition_prune_list (PRUNING_CONTEXT * pinfo, const DB_VALUE * val, const PRUNING_OP op, PRUNING_BITSET * pruned)
|
| MATCH_STATUS |
partition_prune_range (PRUNING_CONTEXT * pinfo, const DB_VALUE * val, const PRUNING_OP op, PRUNING_BITSET * pruned)
|
| PARTITION_CACHE_ENTRY * |
partition_pruning_context_to_cache_entry (PRUNING_CONTEXT * pinfo)
|
| PRUNING_OP |
partition_rel_op_to_pruning_op (REL_OP op)
|
| void |
partition_set_cache_dbvalp_for_attribute (REGU_VARIABLE * var, DB_VALUE * val)
|
| void |
partition_set_cache_info_for_expr (REGU_VARIABLE * regu_var, ATTR_ID attr_id, HEAP_CACHE_ATTRINFO * info)
|
| void |
partition_set_specified_partition (PRUNING_CONTEXT * pinfo, const OID * partition_oid)
|
| bool |
partition_supports_pruning_op_for_function (const PRUNING_OP op, const REGU_VARIABLE * part_expr)
|
| void |
pruningset_add (PRUNING_BITSET * s, int i)
|
| void |
pruningset_copy (PRUNING_BITSET * dest, const PRUNING_BITSET * src)
|
| void |
pruningset_init (PRUNING_BITSET * s, int count)
|
| void |
pruningset_intersect (PRUNING_BITSET * left, const PRUNING_BITSET * right)
|
| bool |
pruningset_is_set (const PRUNING_BITSET * s, int idx)
|
| void |
pruningset_iterator_init (const PRUNING_BITSET * set, PRUNING_BITSET_ITERATOR * i)
|
| int |
pruningset_iterator_next (PRUNING_BITSET_ITERATOR * it)
|
| int |
pruningset_popcount (const PRUNING_BITSET * s)
|
| void |
pruningset_remove (PRUNING_BITSET * s, int i)
|
| void |
pruningset_set_all (PRUNING_BITSET * set)
|
| int |
pruningset_to_spec_list (PRUNING_CONTEXT * pinfo, const PRUNING_BITSET * pruned)
|
| void |
pruningset_union (PRUNING_BITSET * left, const PRUNING_BITSET * right)
|
Macros
| Type |
Name |
| define |
BITSET_LENGTH (s) ((((s)->count - 1) / [**BITS\_IN\_WORD**](partition_8c.md#define-bits_in_word))+1)
|
| define |
BITSET_WORD_COUNT ([**MAX\_ELEMENTS**](partition_8c.md#define-max_elements) / [**BITS\_IN\_WORD**](partition_8c.md#define-bits_in_word))
|
| define |
BITSET_WORD_SIZE [**sizeof**](broker__monitor_8c.md#function-timeout) ([**unsigned**](broker__monitor_8c.md#function-timeout) [**int**](broker__monitor_8c.md#function-timeout))
|
| define |
BITS_IN_WORD (8 \* [**BITSET\_WORD\_SIZE**](partition_8c.md#define-bitset_word_size))
|
| define |
MAX_ELEMENTS 1024
|
| define |
NELEMENTS 1024 /\* [**maximum**](broker__monitor_8c.md#function-timeout) number [**of**](broker__monitor_8c.md#function-timeout) partitions \*/
|
| define |
PARTITIONS_COUNT (pinfo) ((([**pinfo**](broker__monitor_8c.md#function-timeout)) == [**NULL**](freelistheap_8h.md#define-null)) ? 0 : ([**pinfo**](broker__monitor_8c.md#function-timeout))->count - 1)
|
| define |
PARTITION_CACHE_NAME "Partitions\_Cache"
|
| define |
PARTITION_CACHE_SIZE 200
|
| define |
PARTITION_IS_CACHE_INITIALIZED () ([**db\_Partition\_Ht**](partition_8c.md#variable-db_partition_ht) != [**NULL**](freelistheap_8h.md#define-null))
|
| define |
_WORDSIZE 8 \* [**sizeof**](broker__monitor_8c.md#function-timeout)([**int**](broker__monitor_8c.md#function-timeout))
|
Public Types Documentation
typedef MATCH_STATUS
typedef enum match_status MATCH_STATUS;
typedef PARTITION_CACHE_ENTRY
typedef struct partition_cache_entry PARTITION_CACHE_ENTRY;
typedef PRUNING_BITSET
typedef struct pruning_bitset PRUNING_BITSET;
typedef PRUNING_BITSET_ITERATOR
typedef struct pruning_bitset_iterator PRUNING_BITSET_ITERATOR;
typedef PRUNING_OP
typedef enum pruning_op PRUNING_OP;
enum match_status
enum match_status {
MATCH_OK,
MATCH_NOT_FOUND
};
enum pruning_op
enum pruning_op {
PO_INVALID = 0,
PO_LT,
PO_LE,
PO_GT,
PO_GE,
PO_EQ,
PO_NE,
PO_IN,
PO_NOT_IN,
PO_IS_NULL
};
Public Static Attributes Documentation
variable db_Partition_Ht
MHT_TABLE* db_Partition_Ht;
Public Functions Documentation
function partition_cache_finalize
void partition_cache_finalize (
THREAD_ENTRY * thread_p
)
function partition_cache_init
int partition_cache_init (
THREAD_ENTRY * thread_p
)
function partition_clear_pruning_context
void partition_clear_pruning_context (
PRUNING_CONTEXT * pinfo
)
function partition_decache_class
void partition_decache_class (
THREAD_ENTRY * thread_p,
const OID * class_oid
)
function partition_find_root_class_oid
int partition_find_root_class_oid (
THREAD_ENTRY * thread_p,
const OID * class_oid,
OID * super_oid
)
function partition_get_partition_oids
int partition_get_partition_oids (
THREAD_ENTRY * thread_p,
const OID * class_oid,
OID ** partition_oids,
int * count
)
function partition_get_scancache
PRUNING_SCAN_CACHE * partition_get_scancache (
PRUNING_CONTEXT * pcontext,
const OID * partition_oid
)
function partition_init_pruning_context
void partition_init_pruning_context (
PRUNING_CONTEXT * pinfo
)
function partition_load_aggregate_helper
int partition_load_aggregate_helper (
PRUNING_CONTEXT * pcontext,
access_spec_node * spec,
int pruned_count,
BTID * root_btid,
HIERARCHY_AGGREGATE_HELPER * helper
)
function partition_load_pruning_context
int partition_load_pruning_context (
THREAD_ENTRY * thread_p,
const OID * class_oid,
int pruning_type,
PRUNING_CONTEXT * pinfo
)
function partition_new_scancache
PRUNING_SCAN_CACHE * partition_new_scancache (
PRUNING_CONTEXT * pcontext
)
function partition_prune_insert
int partition_prune_insert (
THREAD_ENTRY * thread_p,
const OID * class_oid,
RECDES * recdes,
HEAP_SCANCACHE * scan_cache,
PRUNING_CONTEXT * pcontext,
int pruning_type,
OID * pruned_class_oid,
HFID * pruned_hfid,
OID * superclass_oid
)
function partition_prune_partition_index
int partition_prune_partition_index (
PRUNING_CONTEXT * pcontext,
DB_VALUE * key,
OID * class_oid,
BTID * btid,
int * position
)
function partition_prune_spec
int partition_prune_spec (
THREAD_ENTRY * thread_p,
val_descr * vd,
access_spec_node * spec
)
function partition_prune_unique_btid
int partition_prune_unique_btid (
PRUNING_CONTEXT * pcontext,
DB_VALUE * key,
OID * class_oid,
HFID * class_hfid,
BTID * btid
)
function partition_prune_update
int partition_prune_update (
THREAD_ENTRY * thread_p,
const OID * class_oid,
RECDES * recdes,
PRUNING_CONTEXT * pcontext,
int pruning_type,
OID * pruned_class_oid,
HFID * pruned_hfid,
OID * superclass_oid
)
Public Static Functions Documentation
function partition_attrinfo_get_key
static int partition_attrinfo_get_key (
THREAD_ENTRY * thread_p,
PRUNING_CONTEXT * pcontext,
DB_VALUE * curr_key,
OID * class_oid,
BTID * btid,
DB_VALUE * partition_key
)
function partition_cache_entry_to_pruning_context
static int partition_cache_entry_to_pruning_context (
PRUNING_CONTEXT * pinfo,
PARTITION_CACHE_ENTRY * entry_p
)
function partition_cache_pruning_context
static int partition_cache_pruning_context (
PRUNING_CONTEXT * pinfo,
bool * already_exists
)
function partition_decrement_value
static bool partition_decrement_value (
DB_VALUE * val
)
function partition_do_regu_variables_contain
static bool partition_do_regu_variables_contain (
PRUNING_CONTEXT * pinfo,
const REGU_VARIABLE * left,
const REGU_VARIABLE * right
)
function partition_do_regu_variables_match
static bool partition_do_regu_variables_match (
PRUNING_CONTEXT * pinfo,
const REGU_VARIABLE * left,
const REGU_VARIABLE * right
)
function partition_find_inherited_btid
static int partition_find_inherited_btid (
THREAD_ENTRY * thread_p,
OID * src_class,
OID * dest_class,
BTID * src_btid,
BTID * dest_btid
)
function partition_find_partition_for_record
static int partition_find_partition_for_record (
PRUNING_CONTEXT * pinfo,
const OID * class_oid,
RECDES * recdes,
OID * partition_oid,
HFID * partition_hfid
)
function partition_free_cache_entry
static int partition_free_cache_entry (
PARTITION_CACHE_ENTRY * entry
)
function partition_free_cache_entry_kv
static int partition_free_cache_entry_kv (
const void * key,
void * data,
void * args
)
function partition_free_partition_predicate
static void partition_free_partition_predicate (
PRUNING_CONTEXT * pinfo
)
function partition_get_attribute_id
static ATTR_ID partition_get_attribute_id (
REGU_VARIABLE * regu_var
)
function partition_get_position_in_key
static int partition_get_position_in_key (
PRUNING_CONTEXT * pinfo,
BTID * btid
)
function partition_get_value_from_inarith
static int partition_get_value_from_inarith (
PRUNING_CONTEXT * pinfo,
const REGU_VARIABLE * src,
DB_VALUE * value_p,
bool * is_present
)
function partition_get_value_from_key
static int partition_get_value_from_key (
PRUNING_CONTEXT * pinfo,
const REGU_VARIABLE * key,
DB_VALUE * attr_key,
bool * is_present
)
function partition_get_value_from_regu_var
static int partition_get_value_from_regu_var (
PRUNING_CONTEXT * pinfo,
const REGU_VARIABLE * key,
DB_VALUE * value_p,
bool * is_value
)
function partition_is_reguvar_const
static bool partition_is_reguvar_const (
const REGU_VARIABLE * regu_var
)
function partition_load_context_from_cache
static bool partition_load_context_from_cache (
PRUNING_CONTEXT * pinfo,
bool * is_modified
)
function partition_load_partition_predicate
static int partition_load_partition_predicate (
PRUNING_CONTEXT * pinfo,
OR_PARTITION * master
)
function partition_match_index_key
static MATCH_STATUS partition_match_index_key (
PRUNING_CONTEXT * pinfo,
const KEY_INFO * key,
RANGE_TYPE range_type,
PRUNING_BITSET * pruned
)
function partition_match_key_range
static MATCH_STATUS partition_match_key_range (
PRUNING_CONTEXT * pinfo,
const KEY_RANGE * range,
PRUNING_BITSET * pruned
)
function partition_match_pred_expr
static MATCH_STATUS partition_match_pred_expr (
PRUNING_CONTEXT * pinfo,
const PRED_EXPR * pr,
PRUNING_BITSET * pruned
)
function partition_prune
static MATCH_STATUS partition_prune (
PRUNING_CONTEXT * pinfo,
const REGU_VARIABLE * arg,
const PRUNING_OP op,
PRUNING_BITSET * pruned
)
function partition_prune_db_val
static MATCH_STATUS partition_prune_db_val (
PRUNING_CONTEXT * pinfo,
const DB_VALUE * val,
const PRUNING_OP op,
PRUNING_BITSET * pruned
)
function partition_prune_for_function
static MATCH_STATUS partition_prune_for_function (
PRUNING_CONTEXT * pinfo,
const REGU_VARIABLE * left,
const REGU_VARIABLE * right,
REGU_VARIABLE * part_expr,
PRUNING_OP op,
PRUNING_BITSET * pruned
)
function partition_prune_hash
static MATCH_STATUS partition_prune_hash (
PRUNING_CONTEXT * pinfo,
const DB_VALUE * val,
const PRUNING_OP op,
PRUNING_BITSET * pruned
)
function partition_prune_heap_scan
static int partition_prune_heap_scan (
PRUNING_CONTEXT * pinfo
)
function partition_prune_index_scan
static int partition_prune_index_scan (
PRUNING_CONTEXT * pinfo
)
function partition_prune_list
static MATCH_STATUS partition_prune_list (
PRUNING_CONTEXT * pinfo,
const DB_VALUE * val,
const PRUNING_OP op,
PRUNING_BITSET * pruned
)
function partition_prune_range
static MATCH_STATUS partition_prune_range (
PRUNING_CONTEXT * pinfo,
const DB_VALUE * val,
const PRUNING_OP op,
PRUNING_BITSET * pruned
)
function partition_pruning_context_to_cache_entry
static PARTITION_CACHE_ENTRY * partition_pruning_context_to_cache_entry (
PRUNING_CONTEXT * pinfo
)
function partition_rel_op_to_pruning_op
static PRUNING_OP partition_rel_op_to_pruning_op (
REL_OP op
)
function partition_set_cache_dbvalp_for_attribute
static void partition_set_cache_dbvalp_for_attribute (
REGU_VARIABLE * var,
DB_VALUE * val
)
function partition_set_cache_info_for_expr
static void partition_set_cache_info_for_expr (
REGU_VARIABLE * regu_var,
ATTR_ID attr_id,
HEAP_CACHE_ATTRINFO * info
)
function partition_set_specified_partition
static void partition_set_specified_partition (
PRUNING_CONTEXT * pinfo,
const OID * partition_oid
)
function partition_supports_pruning_op_for_function
static bool partition_supports_pruning_op_for_function (
const PRUNING_OP op,
const REGU_VARIABLE * part_expr
)
function pruningset_add
static void pruningset_add (
PRUNING_BITSET * s,
int i
)
function pruningset_copy
static void pruningset_copy (
PRUNING_BITSET * dest,
const PRUNING_BITSET * src
)
function pruningset_init
static void pruningset_init (
PRUNING_BITSET * s,
int count
)
function pruningset_intersect
static void pruningset_intersect (
PRUNING_BITSET * left,
const PRUNING_BITSET * right
)
function pruningset_is_set
static bool pruningset_is_set (
const PRUNING_BITSET * s,
int idx
)
function pruningset_iterator_init
static void pruningset_iterator_init (
const PRUNING_BITSET * set,
PRUNING_BITSET_ITERATOR * i
)
function pruningset_iterator_next
static int pruningset_iterator_next (
PRUNING_BITSET_ITERATOR * it
)
function pruningset_popcount
static int pruningset_popcount (
const PRUNING_BITSET * s
)
function pruningset_remove
static void pruningset_remove (
PRUNING_BITSET * s,
int i
)
function pruningset_set_all
static void pruningset_set_all (
PRUNING_BITSET * set
)
function pruningset_to_spec_list
static int pruningset_to_spec_list (
PRUNING_CONTEXT * pinfo,
const PRUNING_BITSET * pruned
)
function pruningset_union
static void pruningset_union (
PRUNING_BITSET * left,
const PRUNING_BITSET * right
)
Macro Definition Documentation
define BITSET_LENGTH
#define BITSET_LENGTH (
s
) `((((s)->count - 1) / BITS_IN_WORD )+1)`
define BITSET_WORD_COUNT
#define BITSET_WORD_COUNT `( MAX_ELEMENTS / BITS_IN_WORD )`
define BITSET_WORD_SIZE
#define BITSET_WORD_SIZE `sizeof ( unsigned int )`
define BITS_IN_WORD
#define BITS_IN_WORD `(8 * BITSET_WORD_SIZE )`
define MAX_ELEMENTS
#define MAX_ELEMENTS `1024`
define NELEMENTS
#define NELEMENTS `1024 /* maximum number of partitions */`
define PARTITIONS_COUNT
#define PARTITIONS_COUNT (
pinfo
) `((( pinfo ) == NULL ) ? 0 : ( pinfo )->count - 1)`
define PARTITION_CACHE_NAME
#define PARTITION_CACHE_NAME `"Partitions_Cache"`
define PARTITION_CACHE_SIZE
#define PARTITION_CACHE_SIZE `200`
define PARTITION_IS_CACHE_INITIALIZED
#define PARTITION_IS_CACHE_INITIALIZED (
) `( db_Partition_Ht != NULL )`
define _WORDSIZE
#define _WORDSIZE `8 * sizeof ( int )`
The documentation for this class was generated from the following file cubrid/src/query/partition.c