Code Monkey home page Code Monkey logo

Comments (3)

aytrack avatar aytrack commented on June 10, 2024
[16:14:44]TiDB root:test> SELECT * FROM (SELECT t0.c0, (TIMEDIFF('2003-07-13', '2007-06-25') AND true) IS TRUE AS flag FROM v0 LEFT JOIN t0 ON 1) AS t  where flag = 1;
+------------+------+
| c0         | flag |
+------------+------+
| 1.4013e-45 | 1    |
+------------+------+
1 row in set
Time: 0.004s
[16:14:52]TiDB root:test> SELECT * FROM (SELECT t0.c0, (TIMEDIFF('2003-07-13', '2007-06-25') AND true) IS TRUE AS flag FROM v0 LEFT JOIN t0 ON 1) AS t ;
+--------+------+
| c0     | flag |
+--------+------+
| <null> | 1    |
+--------+------+
1 row in set
Time: 0.004s
[16:15:00]TiDB root:test> explain SELECT * FROM (SELECT t0.c0, (TIMEDIFF('2003-07-13', '2007-06-25') AND true) IS TRUE AS flag FROM v0 LEFT JOIN t0 ON 1) AS t  where flag = 1;
+--------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------------------------------------+
| id                       | estRows | task      | access object | operator info                                                                                                 |
+--------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------------------------------------+
| Projection_12            | 2.56    | root      |               | test.t0.c0, istrue(and(istrue_with_null(cast(timediff(2003-07-13, 2007-06-25), double BINARY)), 1))->Column#5 |
| └─HashJoin_14            | 2.56    | root      |               | CARTESIAN left outer join                                                                                     |
|   ├─Selection_15(Build)  | 1.60    | root      |               | eq(istrue(and(istrue_with_null(cast(timediff("2003-07-13", "2007-06-25"), double BINARY)), 1)), 1)            |
|   │ └─TableReader_18     | 2.00    | root      |               | data:TableFullScan_17                                                                                         |
|   │   └─TableFullScan_17 | 2.00    | cop[tikv] | table:t0      | keep order:false                                                                                              |
|   └─Selection_19(Probe)  | 1.60    | root      |               | eq(istrue(and(istrue_with_null(cast(timediff("2003-07-13", "2007-06-25"), double BINARY)), 1)), 1)            |
|     └─TableReader_21     | 2.00    | root      |               | data:TableFullScan_20                                                                                         |
|       └─TableFullScan_20 | 2.00    | cop[tikv] | table:t0      | keep order:false                                                                                              |
+--------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------------------------------------+
8 rows in set
Time: 0.004s
[16:15:10]TiDB root:test> explain SELECT * FROM (SELECT t0.c0, (TIMEDIFF('2003-07-13', '2007-06-25') AND true) IS TRUE AS flag FROM v0 LEFT JOIN t0 ON 1) AS t ;
+---------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------------------------------------+
| id                        | estRows | task      | access object | operator info                                                                                                 |
+---------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------------------------------------+
| Projection_8              | 4.00    | root      |               | test.t0.c0, istrue(and(istrue_with_null(cast(timediff(2003-07-13, 2007-06-25), double BINARY)), 1))->Column#5 |
| └─HashJoin_10             | 4.00    | root      |               | CARTESIAN left outer join                                                                                     |
|   ├─Projection_11(Build)  | 2.00    | root      |               | 1->Column#8                                                                                                   |
|   │ └─TableReader_13      | 2.00    | root      |               | data:TableFullScan_12                                                                                         |
|   │   └─TableFullScan_12  | 2.00    | cop[tikv] | table:t0      | keep order:false                                                                                              |
|   └─TableReader_15(Probe) | 2.00    | root      |               | data:TableFullScan_14                                                                                         |
|     └─TableFullScan_14    | 2.00    | cop[tikv] | table:t0      | keep order:false                                                                                              |
+---------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------------------------------------+

from tidb.

winoros avatar winoros commented on June 10, 2024

The result of the select_15 and select_19 is correct, but the join is wrong.
image

from tidb.

windtalker avatar windtalker commented on June 10, 2024

The root cause is the same as #51290

from tidb.

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.