bool HybridScanExecutor::DExecute() { // SEQUENTIAL SCAN if (type_ == HYBRID_SCAN_TYPE_SEQUENTIAL) { LOG_TRACE("Sequential Scan"); return SeqScanUtil(); } // INDEX SCAN else if (type_ == HYBRID_SCAN_TYPE_INDEX) { LOG_TRACE("Index Scan"); PL_ASSERT(children_.size() == 0); if (index_done_ == false) { if (index_->GetIndexType() == INDEX_CONSTRAINT_TYPE_PRIMARY_KEY) { auto status = ExecPrimaryIndexLookup(); if (status == false) { return false; } } else { return false; } } return IndexScanUtil(); } // HYBRID SCAN else if (type_ == HYBRID_SCAN_TYPE_HYBRID) { LOG_TRACE("Hybrid Scan"); // do two part search if (index_done_ == false) { if (indexed_tile_offset_ == INVALID_OID) { index_done_ = true; } else { ExecPrimaryIndexLookup(); LOG_TRACE("Using index -- tile count : %lu", result_.size()); } } if (IndexScanUtil() == true) { return true; } // Scan seq return SeqScanUtil(); } // FALLBACK else { throw Exception("Invalid hybrid scan type : " + std::to_string(type_)); } }
/** * @brief Creates logical tile(s) after scanning index. * @return true on success, false otherwise. */ bool IndexScanExecutor::DExecute() { LOG_TRACE("Index Scan executor :: 0 child"); if (!done_) { if (index_->GetIndexType() == INDEX_CONSTRAINT_TYPE_PRIMARY_KEY) { auto status = ExecPrimaryIndexLookup(); if (status == false) return false; } else { auto status = ExecSecondaryIndexLookup(); if (status == false) return false; } } // Already performed the index lookup PL_ASSERT(done_); while (result_itr_ < result_.size()) { // Avoid returning empty tiles if (result_[result_itr_]->GetTupleCount() == 0) { result_itr_++; continue; } else { SetOutput(result_[result_itr_]); result_itr_++; return true; } } // end while return false; }
bool HybridScanExecutor::DExecute() { if (type_ == planner::SEQ) { return SeqScanUtil(); } else if (type_ == planner::INDEX) { // LOG_INFO("Hybrrd Scan executor, Index Scan :: 0 child"); assert(children_.size() == 0); if (!index_done_) { if (index_->GetIndexType() == INDEX_CONSTRAINT_TYPE_PRIMARY_KEY) { auto status = ExecPrimaryIndexLookup(); if (status == false) return false; } else { return false; } } return IndexScanUtil(); } else { // do two part search if (index_done_ == false) { //Timer<> timer; //timer.Start(); if (indexed_tile_offset_ == INVALID_OID) { index_done_ = true; } else { ExecPrimaryIndexLookup(); } } if (IndexScanUtil() == true) { return true; } // Scan seq return SeqScanUtil(); } }