You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Yash Sharma <ya...@gmail.com> on 2013/11/13 08:46:28 UTC

Review Request 15474: Fixed the simple_plan.json logical plan

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15474/
-----------------------------------------------------------

Review request for drill.


Repository: drill-git


Description
-------

Old simple_plan.json was not correctly written as per the new style logical plan. Added few fixes:

Changes made:
- Removed do [  ]  step
- Added id’s and input’s for each step
- Added output prefix to project step
 
Let me know if this helps.
 
-Yash
 
*******************************************************************************
LOGICAL PLAN: simple_plan.json
*******************************************************************************
 
{
  head:{
    type:"APACHE_DRILL_LOGICAL",
    version:"1",
    generator:{
      type:"manual",
      info:"na"
    }
  },
  storage:{
    console: {type: "console"},
    fs1: {type: "fs", root:"file:///"},
    cp: {type: "classpath"}
  },
  query:[
    
                {
                  @id:"1",
                  op: "scan",
                  memo: "initial_scan",
                  ref: "donuts",
                  storageengine: "cp",
                  selection: {
                    path: "/donuts.json",
                    type: "JSON"
                  }
                },
        {
                  @id:"2",
                  input:"1",
                  op: "transform",
                  transforms: [
                    { ref: "quantity", expr: "donuts.sales"}
                  ]
                },
                {
                  @id:"3",
                  input:"2",
                  op: "filter",
                  expr: "donuts.ppu < 1.00"
                }, 
                {
                  @id:"4",
                  input:"3",
                  op: "segment",
                  ref: "ppusegment",
                  exprs: ["donuts.ppu"]
                },
                {
                  @id:"5",
                  input:"4",
                  op: "collapsingaggregate",
                  within: "ppusegment",
                  carryovers: ["donuts.ppu"], 
                  aggregations: [
                    { ref: "donuts.typeCount",  expr: "count(1)" },
                    { ref: "donuts.quantity",  expr: "sum(quantity)" },
                    { ref: "donuts.sales",  expr: "sum(donuts.ppu * quantity)" }
                  ]
                },
                {
                  @id:"6",
                  input:"5",
                  op: "order",
                  orderings: [
                    {order: "DESC", expr: "donuts.ppu" }
                  ]
                }, 
                {
                  @id:"7",
                  input:"6",
                  op: "project",
                  projections: [
                    { ref: "output.output", expr: "donuts" }
                  ]
                },
               {
          @id:"8",
                  input:"7",
                  op: "limit",
          first: 0,
          last: 100
        }, 
                {
                  @id:"9",
                  input:"8",
                  op: "store",
                  memo: "output sink",
                  storageengine: "console",
                  target: {pipe: "STD_OUT"}
                }      
  ]
}


Diffs
-----

  exec/ref/src/test/resources/simple_plan.json c0837e6 

Diff: https://reviews.apache.org/r/15474/diff/


Testing
-------

Yes.
Via Console(Reference Interpreter) & RunSimplePlan.java
Output:

{
  "output" : {
    "sales" : 184.25,
    "typeCount" : 2,
    "quantity" : 335,
    "ppu" : 0.55
  }
} 
 {
  "output" : {
    "sales" : 109.71,
    "typeCount" : 2,
    "quantity" : 159,
    "ppu" : 0.69
  }
}


Thanks,

Yash Sharma


Re: Review Request 15474: Fixed the simple_plan.json logical plan

Posted by Yash Sharma <ya...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15474/
-----------------------------------------------------------

(Updated Nov. 13, 2013, 8:13 a.m.)


Review request for drill.


Repository: drill-git


Description (updated)
-------

Old simple_plan.json was not correctly written as per the new style logical plan. Added few fixes:

Changes made:
- Removed do [  ]  step
- Added id’s and input’s for each step
- Added output prefix to project step

*******************************************************************************
LOGICAL PLAN: simple_plan.json
*******************************************************************************
 
{
  head:{
    type:"APACHE_DRILL_LOGICAL",
    version:"1",
    generator:{
      type:"manual",
      info:"na"
    }
  },
  storage:{
    console: {type: "console"},
    fs1: {type: "fs", root:"file:///"},
    cp: {type: "classpath"}
  },
  query:[
    
                {
                  @id:"1",
                  op: "scan",
                  memo: "initial_scan",
                  ref: "donuts",
                  storageengine: "cp",
                  selection: {
                    path: "/donuts.json",
                    type: "JSON"
                  }
                },
        {
                  @id:"2",
                  input:"1",
                  op: "transform",
                  transforms: [
                    { ref: "quantity", expr: "donuts.sales"}
                  ]
                },
                {
                  @id:"3",
                  input:"2",
                  op: "filter",
                  expr: "donuts.ppu < 1.00"
                }, 
                {
                  @id:"4",
                  input:"3",
                  op: "segment",
                  ref: "ppusegment",
                  exprs: ["donuts.ppu"]
                },
                {
                  @id:"5",
                  input:"4",
                  op: "collapsingaggregate",
                  within: "ppusegment",
                  carryovers: ["donuts.ppu"], 
                  aggregations: [
                    { ref: "donuts.typeCount",  expr: "count(1)" },
                    { ref: "donuts.quantity",  expr: "sum(quantity)" },
                    { ref: "donuts.sales",  expr: "sum(donuts.ppu * quantity)" }
                  ]
                },
                {
                  @id:"6",
                  input:"5",
                  op: "order",
                  orderings: [
                    {order: "DESC", expr: "donuts.ppu" }
                  ]
                }, 
                {
                  @id:"7",
                  input:"6",
                  op: "project",
                  projections: [
                    { ref: "output.output", expr: "donuts" }
                  ]
                },
               {
          @id:"8",
                  input:"7",
                  op: "limit",
          first: 0,
          last: 100
        }, 
                {
                  @id:"9",
                  input:"8",
                  op: "store",
                  memo: "output sink",
                  storageengine: "console",
                  target: {pipe: "STD_OUT"}
                }      
  ]
}


Diffs
-----

  exec/ref/src/test/resources/simple_plan.json c0837e6 

Diff: https://reviews.apache.org/r/15474/diff/


Testing
-------

Yes.
Via Console(Reference Interpreter) & RunSimplePlan.java
Output:

{
  "output" : {
    "sales" : 184.25,
    "typeCount" : 2,
    "quantity" : 335,
    "ppu" : 0.55
  }
} 
 {
  "output" : {
    "sales" : 109.71,
    "typeCount" : 2,
    "quantity" : 159,
    "ppu" : 0.69
  }
}


Thanks,

Yash Sharma