You've already forked mariadb-columnstore-engine
							
							
				mirror of
				https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
				synced 2025-10-31 18:30:33 +03:00 
			
		
		
		
	* MSan added with fixes for libc++ * libc++ sepatare build * add libc++ to ci * libstdc++ in CI * libcpp and msan to external projects * std::sqrt * awful_hack(ci): install whole llvm instead of libc++ in terrible way for test containers * Adding ddeb packages for teststages and repos * libc++ more for test container * save some money on debug * colored coredumps * revert ci * chore(ci): collect asan ubsan and libc++ build with mtr and regression status ignored
		
			
				
	
	
		
			123 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			123 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /* Copyright (C) 2014 InfiniDB, Inc.
 | |
|    Copyright (C) 2016 MariaDB Corporation
 | |
| 
 | |
|    This program is free software; you can redistribute it and/or
 | |
|    modify it under the terms of the GNU General Public License
 | |
|    as published by the Free Software Foundation; version 2 of
 | |
|    the License.
 | |
| 
 | |
|    This program is distributed in the hope that it will be useful,
 | |
|    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |
|    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | |
|    GNU General Public License for more details.
 | |
| 
 | |
|    You should have received a copy of the GNU General Public License
 | |
|    along with this program; if not, write to the Free Software
 | |
|    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 | |
|    MA 02110-1301, USA. */
 | |
| 
 | |
| /***********************************************************************
 | |
|  *   $Id: ha_select_sub.cpp 9210 2013-01-21 14:10:42Z rdempsey $
 | |
|  *
 | |
|  *
 | |
|  ***********************************************************************/
 | |
| /** class SelectSubQuery definition */
 | |
| 
 | |
| // #define NDEBUG
 | |
| #define PREFER_MY_CONFIG_H
 | |
| #include <my_config.h>
 | |
| #include <cassert>
 | |
| 
 | |
| #include "idb_mysql.h"
 | |
| 
 | |
| #include "parsetree.h"
 | |
| #include "logicoperator.h"
 | |
| #include "selectfilter.h"
 | |
| #include "simplescalarfilter.h"
 | |
| #include "predicateoperator.h"
 | |
| #include "rowcolumn.h"
 | |
| #include "simplecolumn.h"
 | |
| using namespace execplan;
 | |
| 
 | |
| #include "errorids.h"
 | |
| using namespace logging;
 | |
| 
 | |
| #include "ha_subquery.h"
 | |
| using namespace std;
 | |
| 
 | |
| namespace cal_impl_if
 | |
| {
 | |
| SelectSubQuery::SelectSubQuery(gp_walk_info& gwip) : SubQuery(gwip), fSelSub(NULL)
 | |
| {
 | |
| }
 | |
| 
 | |
| SelectSubQuery::SelectSubQuery(gp_walk_info& gwip, Item_subselect* selSub) : SubQuery(gwip), fSelSub(selSub)
 | |
| {
 | |
| }
 | |
| 
 | |
| SelectSubQuery::~SelectSubQuery()
 | |
| {
 | |
| }
 | |
| 
 | |
| SCSEP SelectSubQuery::transform()
 | |
| {
 | |
|   idbassert(fSelSub);
 | |
|   SCSEP csep(new CalpontSelectExecutionPlan());
 | |
|   csep->sessionID(fGwip.sessionid);
 | |
|   csep->subType(CalpontSelectExecutionPlan::SELECT_SUBS);
 | |
| 
 | |
|   // gwi for the sub query
 | |
|   gp_walk_info gwi(fGwip.timeZone, fGwip.subQueriesChain);
 | |
|   gwi.thd = fGwip.thd;
 | |
|   gwi.subQuery = this;
 | |
| 
 | |
|   // @4632 merge table list to gwi in case there is FROM sub to be referenced
 | |
|   // in the SELECT sub
 | |
|   gwi.derivedTbCnt = fGwip.derivedTbList.size();
 | |
|   uint32_t tbCnt = fGwip.tbList.size();
 | |
| 
 | |
|   gwi.tbList.insert(gwi.tbList.begin(), fGwip.tbList.begin(), fGwip.tbList.end());
 | |
|   gwi.derivedTbList.insert(gwi.derivedTbList.begin(), fGwip.derivedTbList.begin(), fGwip.derivedTbList.end());
 | |
| 
 | |
|   if (getSelectPlan(gwi, *(fSelSub->get_select_lex()), csep, false) != 0)
 | |
|   {
 | |
|     if (!gwi.fatalParseError)
 | |
|     {
 | |
|       fGwip.fatalParseError = true;
 | |
|       fGwip.parseErrorText = "Error occurred in SelectSubQuery::transform()";
 | |
|     }
 | |
|     else
 | |
|     {
 | |
|       fGwip.fatalParseError = gwi.fatalParseError;
 | |
|       fGwip.parseErrorText = gwi.parseErrorText;
 | |
|     }
 | |
| 
 | |
|     csep.reset();
 | |
|     return csep;
 | |
|   }
 | |
| 
 | |
|   // Insert column statistics
 | |
|   fGwip.mergeTableStatistics(gwi.tableStatisticsMap);
 | |
| 
 | |
|   // Insert subselect CSEP
 | |
|   fGwip.subselectList.push_back(csep);
 | |
| 
 | |
|   // remove outer query tables
 | |
|   CalpontSelectExecutionPlan::TableList tblist;
 | |
| 
 | |
|   if (csep->tableList().size() >= tbCnt)
 | |
|     tblist.insert(tblist.begin(), csep->tableList().begin() + tbCnt, csep->tableList().end());
 | |
| 
 | |
|   CalpontSelectExecutionPlan::SelectList derivedTbList;
 | |
| 
 | |
|   if (csep->derivedTableList().size() >= gwi.derivedTbCnt)
 | |
|     derivedTbList.insert(derivedTbList.begin(), csep->derivedTableList().begin() + gwi.derivedTbCnt,
 | |
|                          csep->derivedTableList().end());
 | |
| 
 | |
|   csep->tableList(tblist);
 | |
|   csep->derivedTableList(derivedTbList);
 | |
|   return csep;
 | |
| }
 | |
| 
 | |
| }  // namespace cal_impl_if
 |