コード例 #1
0
// is this BaseColumn a primary or partitioning key and is val a single 
// value or a constant that can be safely coerced to BaseColumn's type?
NABoolean BaseColumn::isKeyColumnValue(ItemExpr& val) const
{
  NAColumn *baseCol = getNAColumn();
  return
    (baseCol != NULL &&
     (baseCol->isPrimaryKey() || baseCol->isPartitioningKey()) &&
     canSafelyCoerce(val));
}
コード例 #2
0
// this method sets the primary key columns. It goes through all the columns
// of the table, and collects the columns which are marked as primary keys
void TableDesc::setPrimaryKeyColumns()
{
    ValueIdSet primaryColumns;

    for ( CollIndex j = 0 ; j < colList_.entries() ; j++ )
    {

        ValueId valId = colList_[j];

        NAColumn *column = valId.getNAColumn();

        if ( column->isPrimaryKey() )
        {
            primaryColumns.insert(valId) ;
            // mark column as referenced for histogram, as we may need its histogram
            // during plan generation
            if ((column->isUserColumn() || column->isSaltColumn() ) &&
                    (column->getNATable()->getSpecialType() == ExtendedQualName::NORMAL_TABLE) )
                column->setReferencedForMultiIntHist();
        }
    }

    primaryKeyColumns_ = primaryColumns;
}