Giter VIP home page Giter VIP logo

Comments (3)

findepi avatar findepi commented on May 23, 2024

marked release blocker. not because join pushdown in SQL server is so important (it is not), but because of the engine side of the problem.

the planner apparently puts

n.nationkey = c.nationkey AND n.regionkey IS DISTINCT FROM c.custkey

as a join condition.
but then, sometimes after ReorderJoin, the IS DISTINCT FROM moves to FilterNode above the JoinNode.
the plan is equivalent, but

  • some pushdowns may start or stop to be applied
  • when pushdown doesn't happen, the join operator will produce more data, unless we put the filter back into JoinNode.

from trino.

martint avatar martint commented on May 23, 2024

The non-determinism is because the SQL server connector is returning stats non-deterministically and that the connector is handling pushdown inconsistently for filter(join(r, l), <f>) vs join(r, l, <f>).

If I recall correctly, for the first execution, the connector doesn't return column stats. For the second one, it does. This results in a different join order and slightly different query plan that the connector refuses to push down.

from trino.

findepi avatar findepi commented on May 23, 2024

Yes, the plan are different.
When SQL Server connector is offered a join pushdown with n.nationkey = c.nationkey AND n.regionkey IS DISTINCT FROM c.custkey condition, it rejects the offer (it does not support IS DISTINCT FROM predicates).

When ReorderJoins kicks in, the join condition becomes n.nationkey = c.nationkey and the resst (n.regionkey IS DISTINCT FROM c.custkey) becomes a filter above. When SQL Server connector is offered a join pushdown with n.nationkey = c.nationkey, it can accept it (cost-based, or eaerly depending on configuration).

Both plans are obviously equivalent (produce same relations) and correct. The fact that engine sometimes presents more and sometimes fewer join conditions to the connector is something undesirable.

from trino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.