~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/nested_join.h

pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
 
20
#ifndef DRIZZLED_NESTED_JOIN_H
 
21
#define DRIZZLED_NESTED_JOIN_H
 
22
 
 
23
#include <drizzled/sql_list.h>
 
24
#include <drizzled/sql_bitmap.h>
 
25
#include <drizzled/item.h>
 
26
#include <drizzled/table_list.h>
 
27
 
 
28
#include <bitset>
 
29
 
 
30
struct nested_join_st
 
31
{
 
32
  /* list of elements in the nested join */
 
33
  List<TableList> join_list;
 
34
 
 
35
  /* bitmap of tables in the nested join */
 
36
  table_map used_tables;
 
37
 
 
38
  /* tables that rejects nulls           */
 
39
  table_map not_null_tables;
 
40
 
 
41
  /* the first nested table in the plan  */
 
42
  JoinTable *first_nested;
 
43
 
 
44
  /*
 
45
    Used to count tables in the nested join in 2 isolated places:
 
46
    1. In make_outerjoin_info().
 
47
    2. check_interleaving_with_nj/restore_prev_nj_state (these are called
 
48
    by the join optimizer.
 
49
    Before each use the counters are zeroed by reset_nj_counters.
 
50
  */
 
51
  uint32_t counter_;
 
52
 
 
53
  /* Bit used to identify this nested join*/
 
54
  std::bitset<64> nj_map;
 
55
 
 
56
  /*
 
57
    (Valid only for semi-join nests) Bitmap of tables outside the semi-join
 
58
    that are used within the semi-join's ON condition.
 
59
  */
 
60
  table_map sj_depends_on;
 
61
  /* Outer non-trivially correlated tables */
 
62
  table_map sj_corr_tables;
 
63
 
 
64
  List<Item> sj_outer_expr_list;
 
65
};
 
66
 
 
67
#endif /* DRIZZLED_NESTED_JOIN_H */