Deveel.Data.Sql.Query.QueryTablePlanner.EvaluateMultiples C# (CSharp) Method

EvaluateMultiples() private method

private EvaluateMultiples ( List list, List plans ) : void
list List
plans List
return void
        private void EvaluateMultiples(List<SqlBinaryExpression> list, List<ExpressionPlan> plans)
        {
            // FUTURE OPTIMIZATION:
            //   This join order planner is a little primitive in design.  It orders
            //   optimizable joins first and least optimizable last, but does not
            //   take into account other factors that we could use to optimize
            //   joins in the future.

            foreach (var expression in list) {
                // Get the list of variables in the left hand and right hand side
                var lhsVar = expression.Left.AsReferenceName();
                var rhsVar = expression.Right.AsReferenceName();

                // Work out how optimizable the join is.
                // The calculation is as follows;
                // a) If both the lhs and rhs are a single variable then the
                //    optimizable value is set to 0.6f.
                // b) If only one of lhs or rhs is a single variable then the
                //    optimizable value is set to 0.64f.
                // c) Otherwise it is set to 0.68f (exhaustive select guarenteed).

                if (lhsVar == null && rhsVar == null) {
                    // Neither lhs or rhs are single vars
                    plans.Add(new ExhaustiveJoinPlan(this, expression));
                } else if (lhsVar != null && rhsVar != null) {
                    // Both lhs and rhs are a single var (most optimizable type of
                    // join).
                    plans.Add(new StandardJoinPlan(this, expression, 0.60f));
                } else {
                    // Either lhs or rhs is a single var
                    plans.Add(new StandardJoinPlan(this, expression, 064f));
                }
            }
        }