Code Monkey home page Code Monkey logo

Comments (2)

gangliao avatar gangliao commented on May 29, 2024
        let sql = concat!(
            "SELECT a, b, d ",
            "FROM t1 JOIN t2 ON a = c ",
            "ORDER BY b ASC ",
            "LIMIT 3"
        );

        //       +-----------------+
        //       |global_limit_exec|
        //       +--------+--------+
        //                |
        //           +----v----+
        //           |sort_exec|
        //           +----+----+
        //                |
        //        +-------v-------+
        //        |projection_exec|
        //        +-------+-------+
        //                |
        //     +----------v----------+
        //     |coalesce_batches_exec|
        //     +----------+----------+
        //                |
        //         +------v-------+
        //         |hash_join_exec|
        //         +------+-------+
        //                |
        //       +--------v---------+
        //       |                  |
        // +-----v-----+      +-----v-----+
        // |memory_exec|      |memory_exec|
        // +-----------+      +-----------+
{
   "execution_plan":"global_limit_exec",
   "input":{
      "execution_plan":"sort_exec",
      "input":{
         "execution_plan":"projection_exec",
         "expr":[
            [
               {
                  "physical_expr":"column",
                  "name":"a"
               },
               "a"
            ],
            [
               {
                  "physical_expr":"column",
                  "name":"b"
               },
               "b"
            ],
            [
               {
                  "physical_expr":"column",
                  "name":"d"
               },
               "d"
            ]
         ],
         "schema":{
            "fields":[
               {
                  "name":"a",
                  "data_type":"Utf8",
                  "nullable":false,
                  "dict_id":0,
                  "dict_is_ordered":false
               },
               {
                  "name":"b",
                  "data_type":"Int32",
                  "nullable":false,
                  "dict_id":0,
                  "dict_is_ordered":false
               },
               {
                  "name":"d",
                  "data_type":"Int32",
                  "nullable":false,
                  "dict_id":0,
                  "dict_is_ordered":false
               }
            ],
            "metadata":{
               
            }
         },
         "input":{
            "execution_plan":"coalesce_batches_exec",
            "input":{
               "execution_plan":"hash_join_exec",
               "left":{
                  "execution_plan":"memory_exec",
                  "schema":{
                     "fields":[
                        {
                           "name":"a",
                           "data_type":"Utf8",
                           "nullable":false,
                           "dict_id":0,
                           "dict_is_ordered":false
                        },
                        {
                           "name":"b",
                           "data_type":"Int32",
                           "nullable":false,
                           "dict_id":0,
                           "dict_is_ordered":false
                        }
                     ],
                     "metadata":{
                        
                     }
                  },
                  "projection":[
                     0,
                     1
                  ]
               },
               "right":{
                  "execution_plan":"memory_exec",
                  "schema":{
                     "fields":[
                        {
                           "name":"c",
                           "data_type":"Utf8",
                           "nullable":false,
                           "dict_id":0,
                           "dict_is_ordered":false
                        },
                        {
                           "name":"d",
                           "data_type":"Int32",
                           "nullable":false,
                           "dict_id":0,
                           "dict_is_ordered":false
                        }
                     ],
                     "metadata":{
                        
                     }
                  },
                  "projection":[
                     0,
                     1
                  ]
               },
               "on":[
                  [
                     "a",
                     "c"
                  ]
               ],
               "join_type":"Inner",
               "schema":{
                  "fields":[
                     {
                        "name":"a",
                        "data_type":"Utf8",
                        "nullable":false,
                        "dict_id":0,
                        "dict_is_ordered":false
                     },
                     {
                        "name":"b",
                        "data_type":"Int32",
                        "nullable":false,
                        "dict_id":0,
                        "dict_is_ordered":false
                     },
                     {
                        "name":"c",
                        "data_type":"Utf8",
                        "nullable":false,
                        "dict_id":0,
                        "dict_is_ordered":false
                     },
                     {
                        "name":"d",
                        "data_type":"Int32",
                        "nullable":false,
                        "dict_id":0,
                        "dict_is_ordered":false
                     }
                  ],
                  "metadata":{
                     
                  }
               }
            },
            "target_batch_size":16384
         }
      },
      "expr":[
         {
            "expr":{
               "physical_expr":"column",
               "name":"b"
            },
            "options":{
               "descending":false,
               "nulls_first":true
            }
         }
      ],
      "concurrency":8
   },
   "limit":3,
   "concurrency":8
}

from flock.

gangliao avatar gangliao commented on May 29, 2024

Lambda 2:

      //       +-----------------+
      //       |global_limit_exec|
      //       +--------+--------+
      //                |
      //           +----v----+
      //           |sort_exec|
      //           +----+----+
      //                |
      //        +-------v-------+
      //        |projection_exec|
      //        +-------+-------+
      //                |
      //     +----------v----------+
      //     |coalesce_batches_exec|
      //     +----------+----------+

Lambda 1:

      //         +------v-------+
      //         |hash_join_exec|
      //         +------+-------+
      //                |
      //       +--------v---------+
      //       |                  |
      // +-----v-----+      +-----v-----+
      // |memory_exec|      |memory_exec|
      // +-----------+      +-----------+

Lambda 0 (source):

      //         +-------v--------+
      //         |repartition_exec|
      //         +-------+--------+
      //                 |
      //       +---------v---------+
      //       |                   |
      // +-----v-----+       +-----v-----+
      // |stream_exec|       |stream_exec|
      // +-----------+       +-----------+

coalesce_batches_exec is used to merge small record batches into a big one for vectorized processing.

repartition_exec is used to partition batches so that they can be sent to the next stage through payload.

from flock.

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.