void TupleValueExpression::PerformBinding( const std::vector<const planner::BindingContext *> &binding_contexts) { const auto &context = binding_contexts[GetTupleId()]; ai_ = context->Find(GetColumnId()); PELOTON_ASSERT(ai_ != nullptr); LOG_TRACE("TVE Column ID %u.%u binds to AI %p (%s)", GetTupleId(), GetColumnId(), ai_, ai_->name.c_str()); }
void OperatorToPlanTransformer::Visit(const PhysicalProject *) { auto project_prop = requirements_->GetPropertyOfType(PropertyType::PROJECT) ->As<PropertyProjection>(); (void)project_prop; size_t project_list_size = project_prop->GetProjectionListSize(); // expressions to evaluate TargetList tl = TargetList(); // columns which can be returned directly DirectMapList dml = DirectMapList(); // schema of the projections output std::vector<catalog::Column> columns; for (size_t project_idx = 0; project_idx < project_list_size; project_idx++) { auto expr = project_prop->GetProjection(project_idx); std::string column_name; // if the root of the expression is a column value we can // just do a direct mapping if (expr->GetExpressionType() == ExpressionType::VALUE_TUPLE) { auto tup_expr = (expression::TupleValueExpression *)expr; column_name = tup_expr->GetColumnName(); dml.push_back( DirectMap(project_idx, std::make_pair(0, tup_expr->GetColumnId()))); } // otherwise we need to evaluat the expression else { column_name = "expr" + std::to_string(project_idx); tl.push_back(Target(project_idx, expr->Copy())); } columns.push_back(catalog::Column( expr->GetValueType(), type::Type::GetTypeSize(expr->GetValueType()), column_name)); } // build the projection plan node and insert aboce the scan std::unique_ptr<planner::ProjectInfo> proj_info( new planner::ProjectInfo(std::move(tl), std::move(dml))); std::shared_ptr<catalog::Schema> schema_ptr(new catalog::Schema(columns)); std::unique_ptr<planner::AbstractPlan> project_plan( new planner::ProjectionPlan(std::move(proj_info), schema_ptr)); output_plan_ = std::move(project_plan); }
// -------------------------------------------------------------------------------- // void guPLSoListBox::SetTracksOrder( const int order ) { if( !m_DisableSorting ) { if( m_TracksOrder != order ) { m_TracksOrder = order; if( order == wxNOT_FOUND ) m_TracksOrderDesc = false; } else if( order != wxNOT_FOUND ) { m_TracksOrderDesc = !m_TracksOrderDesc; if( !m_TracksOrderDesc ) { m_TracksOrder = wxNOT_FOUND; m_TracksOrderDesc = false; } } int ColId = m_TracksOrder; // Create the Columns int CurColId; int Index; int Count = m_ColumnNames.Count(); for( Index = 0; Index < Count; Index++ ) { CurColId = GetColumnId( Index ); SetColumnLabel( Index, m_ColumnNames[ CurColId ] + ( ( ColId == CurColId ) ? ( m_TracksOrderDesc ? wxT( " ▼" ) : wxT( " ▲" ) ) : wxEmptyString ) ); } ReloadItems(); } }
bool HashExecutor::DExecute() { LOG_INFO("Hash Executor"); if (done_ == false) { const planner::HashPlan &node = GetPlanNode<planner::HashPlan>(); // First, get all the input logical tiles while (children_[0]->Execute()) { child_tiles_.emplace_back(children_[0]->GetOutput()); } if (child_tiles_.size() == 0) { LOG_TRACE("Hash Executor : false -- no child tiles "); return false; } /* * * HashKeys is a vector of TupleValue expr * from which we construct a vector of column ids that represent the * attributes of the underlying table. * The hash table is built on top of these hash key attributes * */ auto &hashkeys = node.GetHashKeys(); // Construct a logical tile for (auto &hashkey : hashkeys) { assert(hashkey->GetExpressionType() == EXPRESSION_TYPE_VALUE_TUPLE); auto tuple_value = reinterpret_cast<const expression::TupleValueExpression *>( hashkey.get()); column_ids_.push_back(tuple_value->GetColumnId()); } // Construct the hash table by going over each child logical tile and // hashing for (size_t child_tile_itr = 0; child_tile_itr < child_tiles_.size(); child_tile_itr++) { auto tile = child_tiles_[child_tile_itr].get(); // Go over all tuples in the logical tile for (oid_t tuple_id : *tile) { // Key : container tuple with a subset of tuple attributes // Value : < child_tile offset, tuple offset > hash_table_[HashMapType::key_type(tile, tuple_id, &column_ids_)].insert( std::make_pair(child_tile_itr, tuple_id)); } } done_ = true; } // Return logical tiles one at a time while (result_itr < child_tiles_.size()) { if (child_tiles_[result_itr]->GetTupleCount() == 0) { result_itr++; continue; } else { SetOutput(child_tiles_[result_itr++].release()); LOG_TRACE("Hash Executor : true -- return tile one at a time "); return true; } } LOG_TRACE("Hash Executor : false -- done "); return false; }