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 
			
		
		
		
	feat(joblist): descend into SelectFilter even if it contains correlated sub.
This commit is contained in:
		| @@ -26,6 +26,7 @@ | |||||||
| using namespace std; | using namespace std; | ||||||
|  |  | ||||||
| #include "selectfilter.h" | #include "selectfilter.h" | ||||||
|  | #include "simplecolumn.h" | ||||||
| #include "bytestream.h" | #include "bytestream.h" | ||||||
| #include "objectreader.h" | #include "objectreader.h" | ||||||
|  |  | ||||||
| @@ -62,7 +63,8 @@ const string SelectFilter::toString() const | |||||||
| { | { | ||||||
|   ostringstream oss; |   ostringstream oss; | ||||||
|   oss << "SelectFilter " |   oss << "SelectFilter " | ||||||
|       << "returnedColPos=" << fReturnedColPos << endl; |       << "returnedColPos=" << fReturnedColPos  | ||||||
|  |       << " correlated " << fCorrelated << endl; | ||||||
|  |  | ||||||
|   for (uint32_t i = 0; i < fCols.size(); i++) |   for (uint32_t i = 0; i < fCols.size(); i++) | ||||||
|     oss << fCols[i]->toString(); |     oss << fCols[i]->toString(); | ||||||
| @@ -214,4 +216,32 @@ bool SelectFilter::operator!=(const TreeNode* t) const | |||||||
|   return (!(*this == t)); |   return (!(*this == t)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void SelectFilter::setSimpleColumnListExtended() | ||||||
|  | { | ||||||
|  |   fSimpleColumnListExtended.clear(); | ||||||
|  |   for (auto col : fCols) | ||||||
|  |   { | ||||||
|  |     col->setSimpleColumnListExtended(); | ||||||
|  |     fSimpleColumnListExtended.insert(fSimpleColumnListExtended.end(), | ||||||
|  |                                      col->simpleColumnListExtended().begin(), | ||||||
|  |                                      col->simpleColumnListExtended().end()); | ||||||
|  |   } | ||||||
|  |   if (fCorrelated) | ||||||
|  |   { | ||||||
|  |     auto* subFilters = fSub->filters(); | ||||||
|  |     if (subFilters) | ||||||
|  |     { | ||||||
|  |       std::vector<execplan::SimpleColumn*> simpleColumns; | ||||||
|  |       subFilters->walk(execplan::getSimpleColsExtended, &simpleColumns); | ||||||
|  |       fSimpleColumnListExtended.insert(fSimpleColumnListExtended.end(), | ||||||
|  |                                        simpleColumns.begin(), | ||||||
|  |                                        simpleColumns.end()); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | const std::vector<SimpleColumn*>& SelectFilter::simpleColumnListExtended() | ||||||
|  | { return fSimpleColumnListExtended; } | ||||||
|  |  | ||||||
| }  // namespace execplan | }  // namespace execplan | ||||||
|   | |||||||
| @@ -170,6 +170,9 @@ class SelectFilter : public Filter | |||||||
|    */ |    */ | ||||||
|   bool operator!=(const SelectFilter& t) const; |   bool operator!=(const SelectFilter& t) const; | ||||||
|  |  | ||||||
|  |   void setSimpleColumnListExtended(); | ||||||
|  |   const std::vector<SimpleColumn*>& simpleColumnListExtended(); | ||||||
|  |  | ||||||
|  private: |  private: | ||||||
|   // default okay? |   // default okay? | ||||||
|   // SelectFilter& operator=(const SelectFilter& rhs); |   // SelectFilter& operator=(const SelectFilter& rhs); | ||||||
| @@ -180,6 +183,7 @@ class SelectFilter : public Filter | |||||||
|   bool fCorrelated; |   bool fCorrelated; | ||||||
|   std::string fData; |   std::string fData; | ||||||
|   uint64_t fReturnedColPos;  // offset in fSub->returnedColList to indicate the start of projection |   uint64_t fReturnedColPos;  // offset in fSub->returnedColList to indicate the start of projection | ||||||
|  |   std::vector<SimpleColumn*> fSimpleColumnListExtended{}; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| std::ostream& operator<<(std::ostream& output, const SelectFilter& rhs); | std::ostream& operator<<(std::ostream& output, const SelectFilter& rhs); | ||||||
|   | |||||||
| @@ -48,6 +48,7 @@ using namespace joblist; | |||||||
| #include "functioncolumn.h" | #include "functioncolumn.h" | ||||||
| #include "simplecolumn.h" | #include "simplecolumn.h" | ||||||
| #include "simplefilter.h" | #include "simplefilter.h" | ||||||
|  | #include "selectfilter.h" | ||||||
| #include "aggregatecolumn.h" | #include "aggregatecolumn.h" | ||||||
| #include "constantfilter.h" | #include "constantfilter.h" | ||||||
| #include "../../utils/windowfunction/windowfunction.h" | #include "../../utils/windowfunction/windowfunction.h" | ||||||
| @@ -95,12 +96,13 @@ void getSimpleColsExtended(execplan::ParseTree* n, void* obj) | |||||||
| { | { | ||||||
|   vector<SimpleColumn*>* list = reinterpret_cast<vector<SimpleColumn*>*>(obj); |   vector<SimpleColumn*>* list = reinterpret_cast<vector<SimpleColumn*>*>(obj); | ||||||
|   TreeNode* tn = n->data(); |   TreeNode* tn = n->data(); | ||||||
|   SimpleColumn* sc = dynamic_cast<SimpleColumn*>(tn); |  | ||||||
|   FunctionColumn* fc = dynamic_cast<FunctionColumn*>(tn); |  | ||||||
|   ArithmeticColumn* ac = dynamic_cast<ArithmeticColumn*>(tn); |   ArithmeticColumn* ac = dynamic_cast<ArithmeticColumn*>(tn); | ||||||
|   SimpleFilter* sf = dynamic_cast<SimpleFilter*>(tn); |  | ||||||
|   ConstantFilter* cf = dynamic_cast<ConstantFilter*>(tn); |  | ||||||
|   AggregateColumn* agc = dynamic_cast<AggregateColumn*>(tn); |   AggregateColumn* agc = dynamic_cast<AggregateColumn*>(tn); | ||||||
|  |   ConstantFilter* cf = dynamic_cast<ConstantFilter*>(tn); | ||||||
|  |   FunctionColumn* fc = dynamic_cast<FunctionColumn*>(tn); | ||||||
|  |   SimpleColumn* sc = dynamic_cast<SimpleColumn*>(tn); | ||||||
|  |   SelectFilter* selectFilter = dynamic_cast<SelectFilter*>(tn); | ||||||
|  |   SimpleFilter* sf = dynamic_cast<SimpleFilter*>(tn); | ||||||
|  |  | ||||||
|   if (sc) |   if (sc) | ||||||
|   { |   { | ||||||
| @@ -126,6 +128,11 @@ void getSimpleColsExtended(execplan::ParseTree* n, void* obj) | |||||||
|     sf->setSimpleColumnListExtended(); |     sf->setSimpleColumnListExtended(); | ||||||
|     list->insert(list->end(), sf->simpleColumnListExtended().begin(), sf->simpleColumnListExtended().end()); |     list->insert(list->end(), sf->simpleColumnListExtended().begin(), sf->simpleColumnListExtended().end()); | ||||||
|   } |   } | ||||||
|  |   else if (selectFilter) | ||||||
|  |   { | ||||||
|  |     selectFilter->setSimpleColumnListExtended(); | ||||||
|  |     list->insert(list->end(), selectFilter->simpleColumnListExtended().begin(), selectFilter->simpleColumnListExtended().end()); | ||||||
|  |   } | ||||||
|   else if (cf) |   else if (cf) | ||||||
|   { |   { | ||||||
|     cf->setSimpleColumnListExtended(); |     cf->setSimpleColumnListExtended(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user