Exemplo n.º 1
0
//////////////////////////////////////////////////////////////////////////////
// For a given vector of index columns, check if the GroupBy columns are
// a prefix of the index, in any order.
//////////////////////////////////////////////////////////////////////////////
NABoolean Refresh::areGroupByColsAnIndexPrefix(const NAColumnArray & groupByCols,
        const NAColumnArray & columnArray) const
{
    if(groupByCols.entries() > columnArray.entries())
        return FALSE;

    // For nGroupBys GroupBy columns, check that the first nGroupBys columns
    // of the index are GroupBy columns.
    CollIndex nGroupBys = groupByCols.entries();
    for (CollIndex indexCol(0); indexCol < nGroupBys; indexCol++)
    {
        NABoolean foundIt = FALSE;
        const NAString& indexColName = columnArray[indexCol]->getColName();
        for (CollIndex groupByCol(0); groupByCol < nGroupBys; groupByCol++)
        {
            if(groupByCols[groupByCol]->getColName() == indexColName)
            {
                foundIt = TRUE;
                break;
            }
        }
        if (!foundIt)
            return FALSE;
    }

    return TRUE;
} // Refresh::groupByContainedAsPrefix
// LCOV_EXCL_START :dd
NABoolean NAColumnArray::operator==(const NAColumnArray &other) const
{
  if (entries() != other.entries())
    return FALSE;

  for (CollIndex i=0;i<entries();i++)
    {
     if (NOT (*at(i)== *other.at(i)))
       return FALSE;
     if (NOT (isAscending(i) == other.isAscending(i)))
       return FALSE;
    }
  return TRUE;
}