当前位置: 首页>>代码示例>>C++>>正文


C++ Columns::at方法代码示例

本文整理汇总了C++中Columns::at方法的典型用法代码示例。如果您正苦于以下问题:C++ Columns::at方法的具体用法?C++ Columns::at怎么用?C++ Columns::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Columns的用法示例。


在下文中一共展示了Columns::at方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InitializeFlatLayout

void MergeJoin::InitializeFlatLayout(IRelationalOperator * lChild, 
				     IRelationalOperator * rChild,
				     const Columns & joinColumns)
{
  m_child[LEFT] = lChild;
  m_child[RIGHT] = rChild;

  /* create (left|right)+(proj|join) schemas. */
  for (int i = 0; i < N_BRANCHES; i++)
    {
      int idx = i * 2;
      Schema * joinSchema = new Schema();

      m_consumed[i] = true;
      m_inBuffer[i] = BufferManager::getInstance()->allocate();
      
      /* create projection & join schemas */
      m_tuple[idx|PROJ].schema(m_child[i]->schema());
      m_tuple[idx|JOIN].schema(m_child[i]->schema());

      for (int j = 0; j < joinColumns.count(); j++)
	{ 
	  const Column * column = joinColumns.at(j);
	  const Schema * schema = m_tuple[idx|PROJ].schema();
	  
	  if (schema->contains(column->m_qualified_name))
	    {
	      const Attribute * a = (*schema)[column->m_qualified_name];
	      m_joinCols[idx|PROJ].push_back(a);
	      m_joinCols[idx|JOIN].push_back(a);
	    }  
	}

      m_tuple[idx|PROJ].m_data = new byte[m_tuple[idx|PROJ].schema()->rsize()];
      m_tuple[idx|JOIN].m_data = new byte[m_tuple[idx|JOIN].schema()->rsize()];

      m_tsr[i] = new TupleStreamReader(*m_inBuffer[i]);
    }
  
  /* create merged schema */
  for (int i = 0; i < N_BRANCHES; i++)
    {
      int idx = i * 2;
      for (int j = 0; j < m_tuple[idx].schema()->nitems(); j++)
	{
	  m_schema.add(m_tuple[idx].schema()->at(j));
	}
    }
  
  m_data = new byte[m_schema.rsize()];
  m_buffer = BufferManager::getInstance()->allocate();
  m_tsw = new TupleStreamWriter(*m_buffer, m_schema.rsize());
}
开发者ID:Adamanthil,项目名称:DBCacheBenchmarking,代码行数:53,代码来源:MergeJoin.cpp

示例2: InitializePartitionLayout

void MergeJoin::InitializePartitionLayout(IRelationalOperator * lChild, 
					  IRelationalOperator * rChild,
					  const Columns & joinColumns)
{
  std::vector<const Attribute *> layout;
  std::vector<const Attribute *> partition[2];

  m_child[LEFT] = lChild;
  m_child[RIGHT] = rChild;

  /* create (left|right)+(proj|join) schemas. */
  for (int i = 0; i < N_BRANCHES; i++)
    {
      int idx = i * 2;
      Schema * joinSchema = new Schema(); joinSchema->m_partitions = 1;

      layout.clear();
      layout.reserve(m_child[i]->schema()->nitems());

      m_consumed[i] = true;
      m_inBuffer[i] = BufferManager::getInstance()->allocate();

      /* create projection schema */
      m_tuple[idx|PROJ].schema(m_child[i]->schema());
            
      /* retrieve join columns for ith child */
      for (int j = 0; j < joinColumns.count(); j++)
	{ 
	  const Column * column = joinColumns.at(j);
	  const Schema * schema = m_tuple[idx|PROJ].schema();

	  if (schema->contains(column->m_qualified_name))
	    {
	      const Attribute * a = (*schema)[column->m_qualified_name];
	      m_joinCols[idx|PROJ].push_back(a);

	      joinSchema->add(a);
	      m_joinCols[idx|JOIN].push_back(a);
	    }  
	}

      /* create layouts for children. */
      partition[0].clear();
      partition[1].clear();
      m_layout[i] = new MaterializationLayout(2, m_inBuffer[i]->capacity(), 
					      m_tuple[idx|PROJ].schema()->rsize());

      for (int j = 0; j < m_tuple[idx|PROJ].schema()->nitems(); j++)
	{
	  const Attribute * a = m_tuple[idx|PROJ].schema()->at(j);
	  if (!joinColumns.contains(a->qualified_name()))
	    {
	      partition[1].push_back(a);
	    }
	  else
	    {
	      partition[0].push_back(a);
	      layout.push_back(a);
	    }
	}

      m_layout[i]->add(partition[0]);
      m_layout[i]->add(partition[1]);

      /* synchronize schemas for read optimization */
      for (int j = 0; j < partition[1].size(); j++)
	{
	  layout.push_back(partition[1][j]);
	}

      Schema * s = new Schema(&layout);
      s->m_partitions = 3;
      m_tuple[idx|PROJ].schema(s); 
      
      /* create join schema */
      m_tuple[idx|JOIN].schema(joinSchema);

      m_tuple[idx|PROJ].m_data = new byte[m_tuple[idx|PROJ].schema()->rsize()];
      m_tuple[idx|JOIN].m_data = new byte[m_tuple[idx|JOIN].schema()->rsize()];

      m_tsr[i] = new TupleStreamReader(*m_inBuffer[i]);
      m_tsr[i]->layout(m_layout[i]);
      m_child[i]->layout(m_layout[i]);
    }
  
  /* create merged schema */
  for (int i = 0; i < N_BRANCHES; i++)
    {
      int idx = i * 2;
      for (int j = 0; j < m_tuple[idx].schema()->nitems(); j++)
	{
	  m_schema.add(m_tuple[idx].schema()->at(j));
	}
    }
  
  m_data = new byte[m_schema.rsize()];
  m_buffer = BufferManager::getInstance()->allocate();
  m_tsw = new TupleStreamWriter(*m_buffer, m_schema.rsize());
}
开发者ID:Adamanthil,项目名称:DBCacheBenchmarking,代码行数:99,代码来源:MergeJoin.cpp


注:本文中的Columns::at方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。