@@ -20,9 +20,9 @@ class TExpression {
2020
2121 // Constructs an expression from ExprNode, also save expression context and plan
2222 // properties. Plan properties are needed to access subplan IUs
23- // If an expression is not a lambda, we save its body separately and generate a new
24- // lambda. The body is needed to by in sych with the originial expression in terms of
25- // pointers, that might be needed in replace map.
23+ // The expression can be constructed from a full lambda as well as any yql expression.
24+ // In the former case a new lambda is built automatically
25+
2626 TExpression (TExprNode::TPtr node, TExprContext* ctx, TPlanProps* props = nullptr );
2727
2828 TExpression () = default ;
@@ -72,7 +72,6 @@ class TExpression {
7272 TString ToString () const ;
7373
7474 TExprNode::TPtr Node;
75- TExprNode::TPtr Body;
7675 TExprContext* Ctx;
7776 TPlanProps* PlanProps;
7877};
@@ -92,7 +91,7 @@ class TJoinCondition {
9291 TInfoUnit GetRightIU () const ;
9392
9493 // Find all non-column reference expression in this condition and insert them into a map
95- void ExtractExpressions (TNodeOnNodeOwnedMap& map, TVector<std::pair<TInfoUnit, TExprNode::TPtr>>& exprMap);
94+ bool ExtractExpressions (TNodeOnNodeOwnedMap& map, TVector<std::pair<TInfoUnit, TExprNode::TPtr>>& exprMap);
9695
9796 const TExpression& Expr;
9897 TVector<TInfoUnit> LeftIUs;
@@ -102,14 +101,29 @@ class TJoinCondition {
102101 bool EquiJoin = false ;
103102};
104103
104+ // Create an expression that accesses a single column
105105TExpression MakeColumnAccess (TInfoUnit column, TPositionHandle pos, TExprContext* ctx, TPlanProps* props = nullptr );
106+
107+ // Create a constant expression. Constant expressions don't need plan properties
106108TExpression MakeConstant (TString type, TString value, TPositionHandle pos, TExprContext* ctx);
109+
110+ // Create. a null expression of a specific type, also doesn't need plan properties
107111TExpression MakeNothing (TPositionHandle pos, const TTypeAnnotationNode* type, TExprContext* ctx);
112+
113+ // Make a conjunction from a list of conjuncts. Expression context and plan properies will be extracted
114+ // from one of the conjuncts.
108115TExpression MakeConjunction (const TVector<TExpression>& vec, bool pgSyntax = false );
116+
117+ // Make a binary predicate with an arbitrary callable, extract context and properties from one of the arguments
109118TExpression MakeBinaryPredicate (TString callable, const TExpression& left, const TExpression& right);
110119
120+ // Get all members from a expression node
111121void GetAllMembers (TExprNode::TPtr node, TVector<TInfoUnit> &IUs);
122+
123+ // Get all members from an expression node, but also mark subplan context separately and optionally include
124+ // dependencies in correlated subqueries
112125void GetAllMembers (TExprNode::TPtr node, TVector<TInfoUnit> &IUs, const TPlanProps& props, bool withSubplanContext, bool withDependencies);
126+
113127TString PrintRBOExpression (TExprNode::TPtr expr, TExprContext & ctx);
114128
115129}
0 commit comments