MySQL 8.3.0
Source Code Documentation
gis0geo.cc File Reference

InnoDB R-tree related functions. More...

#include <cmath>
#include "page0cur.h"

Namespaces

namespace  dd
 The version of the current data dictionary table definitions.
 

Functions

static void copy_coords (double *dst, const double *src)
 Copy mbr of dimension n_dim from src to dst. More...
 
static void pick_seeds (rtr_split_node_t *node, int n_entries, rtr_split_node_t **seed_a, rtr_split_node_t **seed_b, int n_dim, const dd::Spatial_reference_system *srs)
 Select two nodes to collect group upon. More...
 
static bool ut_rnd_gen_bool (void)
 Generates a random boolean value. More...
 
static void pick_next (rtr_split_node_t *node, int n_entries, double *g1, double *g2, rtr_split_node_t **choice, int *n_group, int n_dim, const dd::Spatial_reference_system *srs)
 Select next node and group where to add. More...
 
static void mark_all_entries (rtr_split_node_t *node, int n_entries, int n_group)
 Mark not-in-group entries as n_group. More...
 
int split_rtree_node (rtr_split_node_t *node, int n_entries, int all_size, int key_size, int min_size, int size1, int size2, double **d_buffer, int n_dim, uchar *first_rec, const dd::Spatial_reference_system *srs)
 Split rtree node. More...
 
bool rtree_key_cmp (page_cur_mode_t mode, const uchar *a, int a_len, const uchar *b, int b_len, const dd::Spatial_reference_system *srs)
 Compares two keys a and b depending on mode mode can contain these flags: PAGE_CUR_INTERSECT a intersects b PAGE_CUR_CONTAIN a contains b PAGE_CUR_DISJOINT a disjoint b PAGE_CUR_WITHIN a within b PAGE_CUR_MBR_EQUAL All coordinates of MBRs are equal. More...
 

Detailed Description

InnoDB R-tree related functions.

Created 2013/03/27 Allen Lai and Jimmy Yang

Function Documentation

◆ copy_coords()

static void copy_coords ( double *  dst,
const double *  src 
)
inlinestatic

Copy mbr of dimension n_dim from src to dst.

Parameters
dstin/out: destination.
srcin: source.

◆ mark_all_entries()

static void mark_all_entries ( rtr_split_node_t node,
int  n_entries,
int  n_group 
)
static

Mark not-in-group entries as n_group.

Parameters
nodein/out: split nodes.
n_entriesin: entries number.
n_groupin: group number.

◆ pick_next()

static void pick_next ( rtr_split_node_t node,
int  n_entries,
double *  g1,
double *  g2,
rtr_split_node_t **  choice,
int *  n_group,
int  n_dim,
const dd::Spatial_reference_system srs 
)
static

Select next node and group where to add.

Parameters
nodein: split nodes.
n_entriesin: entries number.
g1in: mbr of group 1.
g2in: mbr of group 2.
choiceout: the next node.
n_groupout: group number.
n_dimin: dimensions.
srsin: SRS of R-tree

◆ pick_seeds()

static void pick_seeds ( rtr_split_node_t node,
int  n_entries,
rtr_split_node_t **  seed_a,
rtr_split_node_t **  seed_b,
int  n_dim,
const dd::Spatial_reference_system srs 
)
static

Select two nodes to collect group upon.

Parameters
nodein: split nodes.
n_entriesin: entries number.
seed_aout: seed 1.
seed_bout: seed 2.
n_dimin: dimensions.
srsin: SRS of R-tree

◆ rtree_key_cmp()

bool rtree_key_cmp ( page_cur_mode_t  mode,
const uchar a,
int  a_len,
const uchar b,
int  b_len,
const dd::Spatial_reference_system srs 
)

Compares two keys a and b depending on mode mode can contain these flags: PAGE_CUR_INTERSECT a intersects b PAGE_CUR_CONTAIN a contains b PAGE_CUR_DISJOINT a disjoint b PAGE_CUR_WITHIN a within b PAGE_CUR_MBR_EQUAL All coordinates of MBRs are equal.

Parameters
[in]modecompare method
[in]afirst key
[in]a_lenfirst key len
[in]bsecond key
[in]b_lensecond_key_len
[in]srsSpatial reference system of R-tree
Return values
trueif the predicate is true, otherwise false.

◆ split_rtree_node()

int split_rtree_node ( rtr_split_node_t node,
int  n_entries,
int  all_size,
int  key_size,
int  min_size,
int  size1,
int  size2,
double **  d_buffer,
int  n_dim,
uchar first_rec,
const dd::Spatial_reference_system srs 
)

Split rtree node.

Split rtree nodes.

Return which group the first rec is in.

Parameters
nodein: split nodes.
n_entriesin: entries number.
all_sizein: total key's size.
key_sizein: key's size.
min_sizein: minimal group size.
size1in: size of group.
size2in: initial group sizes
d_bufferin/out: buffer.
n_dimin: dimensions.
first_recin: the first rec.
srsin: SRS of R-tree

◆ ut_rnd_gen_bool()

static bool ut_rnd_gen_bool ( void  )
static

Generates a random boolean value.

Returns
the random value