~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/string_functions/functions.cc

  • Committer: Prafulla Tekawade
  • Date: 2010-07-18 03:36:32 UTC
  • mto: (1662.1.4 rollup)
  • mto: This revision was merged to the branch mainline in revision 1664.
  • Revision ID: prafulla_t@users.sourceforge.net-20100718033632-p7q6qtgliqbhe38p
Fix for Bug 592444

There were two problems:
o. In greedy_search optimizer method, best_extension_by_limited search
   maintains join embedding(nestedness) of tables added so far, so that 
   correct(valid)  join order is selected
   These are requirements from nested outer join executioner.
   The problem was, embedding_map was not correctly updated when a table 
   is added to optimal plan outside best_extension_by_limited search, 
   by greedy_search method. We need to update join->cur_embedding_map
   correctly here so that execution plan for other tables get
   generated.
   Invoked checked_interleaving_with_nj from greedy_search on the
   best_table selected. Fixed its prototype to take only one JoinTab
   This is same as mysql 5.1 source tree.
o. The other problem was, join->cur_embedding_map was not restored correctly
   when a table is added to the optimal plan to reflect the current embedding 
   map. 
   Taken good documented method restore_prev_nj_state which restores 
   cur_embedding_map from mysql 5.1 source tree and modified it for drizzled 
   code.

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) 2010 Brian Aker
5
 
 *  Copyright (C) 2010 Stewart Smith
6
 
 *
7
 
 *  This program is free software; you can redistribute it and/or modify
8
 
 *  it under the terms of the GNU General Public License as published by
9
 
 *  the Free Software Foundation; either version 2 of the License, or
10
 
 *  (at your option) any later version.
11
 
 *
12
 
 *  This program is distributed in the hope that it will be useful,
13
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 *  GNU General Public License for more details.
16
 
 *
17
 
 *  You should have received a copy of the GNU General Public License
18
 
 *  along with this program; if not, write to the Free Software
19
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 
 */
21
 
 
22
 
#include "config.h"
23
 
#include "plugin/string_functions/functions.h"
24
 
 
25
 
using namespace drizzled;
26
 
 
27
 
static int init(drizzled::module::Context &context)
28
 
{
29
 
  context.add(new plugin::Create_function<Item_func_elt>("elt"));
30
 
  context.add(new plugin::Create_function<Item_func_format>("format"));
31
 
  context.add(new plugin::Create_function<Item_func_quote>("quote"));
32
 
  context.add(new plugin::Create_function<drizzled::string_functions::Regex>("regex"));
33
 
 
34
 
  return 0;
35
 
}
36
 
 
37
 
DRIZZLE_DECLARE_PLUGIN
38
 
{
39
 
  DRIZZLE_VERSION_ID,
40
 
  "String Functions",
41
 
  "1.0",
42
 
  "Brian Aker, Stewart Smith",
43
 
  "String Functions.",
44
 
  PLUGIN_LICENSE_GPL,
45
 
  init,
46
 
  NULL,
47
 
  NULL
48
 
}
49
 
DRIZZLE_DECLARE_PLUGIN_END;