zhouqingqing / qpmodel

A Relational Optimizer and Executor
MIT License
64 stars 18 forks source link

what if x.query_.physicPlan_ is null here, it's a bug should be fixed #230

Closed 9DemonFox closed 3 years ago

9DemonFox commented 3 years ago
        if (this.logic_.filter_ != null)
        {
            Expr expr = this.logic_.filter_;
            expr.VisitEachT<SubqueryExpr>(x =>
            {
                if (x.query_.physicPlan_ != null)
                {
                    var phynode = x.query_.physicPlan_ as PhysicNode;
                    incCost += phynode.InclusiveCost();
                }
            }
            );
        }
zhouqingqing commented 3 years ago

do you have a test case that x.query.physicPlan is null?

9DemonFox commented 3 years ago

@zhouqingqing , I don't really figure out what kind of sql statements can use to create this test case. Could you please give me an example?

zhouqingqing commented 3 years ago

If you believe there is no case can have "x.query.physicPlan is null", then you shall change it to "Debug.Assert(x.query.physicPlan != null)".

zhouqingqing commented 3 years ago

use assertion instead 7b5ce91c516afef9283a6759b090b87738495b28