本文整理汇总了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());
}
示例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());
}