public TemporaryTableHeader ToTableHeader()
        {
            TemporaryTableHeader header = new TemporaryTableHeader();

            foreach (var pair in RawRecordLayout.OrderBy(e => e.Value))
            {
                header.AddColumn(pair.Key.ColumnName, pair.Key.ColumnGraphType, pair.Value);
            }

            return(header);
        }
 /// <summary>
 /// Given a column reference, returns its offset in the raw records produced by the SQL statement.
 /// </summary>
 /// <param name="columnReference"></param>
 /// <returns></returns>
 public int LocateColumnReference(WColumnReferenceExpression columnReference)
 {
     if (RawRecordLayout.ContainsKey(columnReference))
     {
         return(RawRecordLayout[columnReference]);
     }
     else
     {
         throw new QueryCompilationException(string.Format("Column reference {0} cannot be located in the raw records in the current execution pipeline.",
                                                           columnReference.ToString("")));
     }
 }
        /// <summary>
        /// Given a column reference, i.e., the composite key of (table alias, column name),
        /// return its offset in raw records produced by the SQL statement.
        /// </summary>
        /// <param name="tableAlias">Table alias</param>
        /// <param name="columnName">Column name</param>
        /// <returns>The offset of the column reference in the raw records</returns>
        public int LocateColumnReference(string tableAlias, string columnName)
        {
            WColumnReferenceExpression targetName = new WColumnReferenceExpression(tableAlias, columnName);

            if (RawRecordLayout.ContainsKey(targetName))
            {
                return(RawRecordLayout[targetName]);
            }
            else
            {
                throw new QueryCompilationException(string.Format("Column reference {0}.{1} cannot be located in the raw records in the current execution pipeline.",
                                                                  tableAlias, columnName));
            }
        }
 public bool TryLocateColumnReference(WColumnReferenceExpression columnReference, out int columnIndex)
 {
     return(RawRecordLayout.TryGetValue(columnReference, out columnIndex));
 }
 public void ClearField()
 {
     RawRecordLayout.Clear();
 }