Giter VIP home page Giter VIP logo

Comments (4)

crwen avatar crwen commented on June 2, 2024 1

I think this problem is caused by NormalizationRule: PushPredicateThroughJoin

I don't think it would help. Filter is never pulled up since binding, so it won't be pushed down.

from fncksql.

KKould avatar KKould commented on June 2, 2024

It seems that there is something wrong with HashJoin, I'm debugging now, I'll merge this first

from fncksql.

KKould avatar KKould commented on June 2, 2024

It seems that there is something wrong with HashJoin, I'm debugging now, I'll merge this first

ops, I found the problem. In correlated subqueries, there is no left data in right.
so this case will return empty data (wrong)

let fnck_sql = DataBaseBuilder::path(temp_dir.path())
    .build()
    .await?;
let _ = fnck_sql
    .run("create table t2(id int primary key, a int not null, b int not null);")
    .await?;
let _ = fnck_sql
    .run("create table t3(id int primary key, a int not null, c int not null);")
    .await?;
let _ = fnck_sql
    .run("insert into t2 values (0, 1, 2), (3, 4, 5), (8, 0, 0);")
    .await?;
let _ = fnck_sql
    .run("insert into t3 values (0, 2, 2), (3, 8, 5);")
    .await?;
let (schema, tuples) = fnck_sql.run("select id,a,b from t2 where id in (select a from t3 where a > t2.a);").await?;
println!("{}", create_table(&schema, &tuples));

there is only t3.a on the right but no t2.a, so filter always returns false

+--------------------------------------------------------------------+
| PLAN                                                               |
+====================================================================+
| Projection [t2.id, t2.a, t2.b] [Project]                           |
|   LeftSemi Join On t2.id = (t3.a) as (_temp_table_0_.a) [HashJoin] |
|     Scan t2 -> [id, a, b] [SeqScan]                                |
|     Projection [(t3.a) as (_temp_table_0_.a)] [Project]            |
|       Projection [t3.a] [Project]                                  |
|         Filter (t3.a > t2.a), Is Having: false [Filter]            |
|           Scan t3 -> [a] [SeqScan]                                 |
+--------------------------------------------------------------------+

I think this problem is caused by NormalizationRule: PushPredicateThroughJoin

from fncksql.

KKould avatar KKould commented on June 2, 2024

yep, I made a mistake. This seems to be a feature that has not yet been implemented.

from fncksql.

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.