queryparser-0.1.0.1: Analysis and parsing library for SQL queries.

Safe HaskellNone
LanguageHaskell2010

Database.Sql.Util.Lineage.ColumnPlus

Synopsis

Documentation

type ColumnLineagePlus = Map (Either FQTN FQCN) ColumnPlusSet Source #

ColumnLineagePlus is a set of descendants, each with an associated set of ancestors. Descendents may be a column (representing values in that column) or a table (representing row-count).

Ancestors are the same, but that ancestor columns may be further specialized by field path.

Tracking impacts on row-count is necessary because row-count can have impacts on data without any columns being involved. For a clear example, consider `CREATE TABLE foo AS SELECT COUNT(1) FROM BAR;`

It also gives us something coherent to speak about with respect to EXISTS - the value depends on the row count of the subquery.

N.b. While it looks like we're talking about "tables", this is *not* the same thing as table-level lineage. Changes to values in existing rows does not impact row count. Following an UPDATE, if we ask "has this table changed, such that we need to rerun things downstream?", the answer is clearly yes. If we ask "has the row-count of this table changed, such that we need to rerun things that depend only on row-count?" the answer is clearly not.

data ColumnLineage Source #

Instances

Evaluation ColumnLineage Source # 

Associated Types

type EvalValue ColumnLineage :: * Source #

type EvalRow ColumnLineage :: * -> * Source #

type EvalMonad ColumnLineage :: * -> * Source #

Methods

addItems :: Proxy * ColumnLineage -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalT ColumnLineage TableContext (EvalMonad ColumnLineage) (EvalRow ColumnLineage [EvalValue ColumnLineage]) Source #

removeItems :: Proxy * ColumnLineage -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalT ColumnLineage TableContext (EvalMonad ColumnLineage) (EvalRow ColumnLineage [EvalValue ColumnLineage]) Source #

unionItems :: Proxy * ColumnLineage -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalT ColumnLineage TableContext (EvalMonad ColumnLineage) (EvalRow ColumnLineage [EvalValue ColumnLineage]) Source #

intersectItems :: Proxy * ColumnLineage -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalT ColumnLineage TableContext (EvalMonad ColumnLineage) (EvalRow ColumnLineage [EvalValue ColumnLineage]) Source #

distinctItems :: Proxy * ColumnLineage -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalRow ColumnLineage [EvalValue ColumnLineage] Source #

offsetItems :: Proxy * ColumnLineage -> Int -> RecordSet ColumnLineage -> RecordSet ColumnLineage Source #

limitItems :: Proxy * ColumnLineage -> Int -> RecordSet ColumnLineage -> RecordSet ColumnLineage Source #

filterBy :: Expr ResolvedNames Range -> RecordSet ColumnLineage -> EvalT ColumnLineage TableContext (EvalMonad ColumnLineage) (RecordSet ColumnLineage) Source #

inList :: EvalValue ColumnLineage -> [EvalValue ColumnLineage] -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

inSubquery :: EvalValue ColumnLineage -> EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

existsSubquery :: EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

atTimeZone :: EvalValue ColumnLineage -> EvalValue ColumnLineage -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

handleConstant :: Proxy * ColumnLineage -> Constant a -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

handleCases :: Proxy * ColumnLineage -> [(Expr ResolvedNames Range, Expr ResolvedNames Range)] -> Maybe (Expr ResolvedNames Range) -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

handleFunction :: Proxy * ColumnLineage -> FunctionName Range -> Distinct -> [Expr ResolvedNames Range] -> [(ParamName Range, Expr ResolvedNames Range)] -> Maybe (Filter ResolvedNames Range) -> Maybe (OverSubExpr ResolvedNames Range) -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

handleGroups :: [RColumnRef ()] -> EvalRow ColumnLineage ([EvalValue ColumnLineage], EvalRow ColumnLineage [EvalValue ColumnLineage]) -> EvalRow ColumnLineage (RecordSet ColumnLineage) Source #

handleLike :: Proxy * ColumnLineage -> Operator a -> Maybe (Escape ResolvedNames Range) -> Pattern ResolvedNames Range -> Expr ResolvedNames Range -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

handleOrder :: Proxy * ColumnLineage -> [Order ResolvedNames Range] -> RecordSet ColumnLineage -> EvalT ColumnLineage TableContext (EvalMonad ColumnLineage) (RecordSet ColumnLineage) Source #

handleSubquery :: EvalRow ColumnLineage [EvalValue ColumnLineage] -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

handleJoin :: Proxy * ColumnLineage -> JoinType a -> JoinCondition ResolvedNames Range -> RecordSet ColumnLineage -> RecordSet ColumnLineage -> EvalT ColumnLineage TableContext (EvalMonad ColumnLineage) (RecordSet ColumnLineage) Source #

handleStructField :: Expr ResolvedNames Range -> StructFieldName a -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

handleTypeCast :: CastFailureAction -> Expr ResolvedNames Range -> DataType a -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage) Source #

binop :: Proxy * ColumnLineage -> Text -> Maybe (EvalValue ColumnLineage -> EvalValue ColumnLineage -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage)) Source #

unop :: Proxy * ColumnLineage -> Text -> Maybe (EvalValue ColumnLineage -> EvalT ColumnLineage ExprContext (EvalMonad ColumnLineage) (EvalValue ColumnLineage)) Source #

type EvalValue ColumnLineage Source # 
type EvalRow ColumnLineage Source # 
type EvalMonad ColumnLineage Source #