public OutputColumnDescriptor ResolveColumnReference(ColumnReferenceExpression node)
        {
            IQueryModel model = EnsureModel();

            if (TryColumnReference(model, node, out QueryColumnBase col))
            {
                return(ColumnModelToDescriptor(col));
            }

            throw new NotImplementedException(node.WhatIsThis());
        }
        private bool TryColumnReference(IQueryModel model, ColumnReferenceExpression node, out QueryColumnBase col)
        {
            if (node.ColumnType != ColumnType.Regular)
            {
                throw new NotImplementedException(node.AsText());
            }

            if (node.MultiPartIdentifier.Count == 2)
            {
                // source (table/view) name without schema or alias
                string sourceNameOrAlias = node.MultiPartIdentifier[0].Dequote();
                string columnName        = node.MultiPartIdentifier[1].Dequote();

                if (model.TryGetQueryOutputColumnByName(this.batchResolver, columnName, out col))
                {
                    return(true);
                }
                else
                {
                    throw new NotImplementedException(node.WhatIsThis()); // not resolved?
                }
            }
            else if (node.MultiPartIdentifier.Count == 1)
            {
                // no source only column name => traverse all source and find t
                string columnName = node.MultiPartIdentifier[0].Dequote();
                if (model.TryGetQueryOutputColumnByName(this.batchResolver, columnName, out col))
                {
                    return(true);
                }
                else
                {
                    throw new NotImplementedException(node.WhatIsThis()); // not resolved?
                }
            }
            else
            {
                // 3 or 4
                throw new NotImplementedException(node.AsText() + "   ## " + statement.WhatIsThis());
            }
        }