You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Sean Hsuan-Yi Chu (JIRA)" <ji...@apache.org> on 2015/02/02 03:37:34 UTC

[jira] [Commented] (DRILL-2012) Flatten fails when we filter by a non-projected column

    [ https://issues.apache.org/jira/browse/DRILL-2012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14300831#comment-14300831 ] 

Sean Hsuan-Yi Chu commented on DRILL-2012:
------------------------------------------

Interestingly, the plan has a flaw. The project at the third to the bottom does not project from the right incoming column.

Line 119-139 from the attachment:
{
    "pop" : "project",
    "@id" : 5,
    "exprs" : [ {
      "ref" : "`EXPR$0`",
      "expr" : "`type`"
    }, {
      "ref" : "`EXPR$1`",
      "expr" : "`id`"
    }, {
      "ref" : "`EXPR$2`",
      "expr" : "`topping`"
    }, {
      "ref" : "`EXPR$3`",
      "expr" : "`topping`"
    } ],
    "child" : 6,
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 1.0
  }


> Flatten  fails when we filter by a non-projected column
> -------------------------------------------------------
>
>                 Key: DRILL-2012
>                 URL: https://issues.apache.org/jira/browse/DRILL-2012
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>            Reporter: Rahul Challapalli
>            Assignee: Sean Hsuan-Yi Chu
>            Priority: Critical
>         Attachments: Plan.txt, error.log
>
>
> git.commit.id.abbrev=b491cdb
> {code}
> {
>     "id": "0001",
>     "type": "donut",
>     "name": "Cake",
>     "ppu": 0.55,
>     "batters":
>         {
>             "batter":
>                 [
>                     { "id": "1001", "type": "Regular" },
>                     { "id": "1002", "type": "Chocolate" },
>                     { "id": "1003", "type": "Blueberry" },
>                     { "id": "1004", "type": "Devil's Food" }
>                 ]
>         },
>     "topping":
>         [
>             { "id": "5001", "type": "None" },
>             { "id": "5002", "type": "Glazed" },
>             { "id": "5005", "type": "Sugar" },
>             { "id": "5007", "type": "Powdered Sugar" },
>             { "id": "5006", "type": "Chocolate with Sprinkles" },
>             { "id": "5003", "type": "Chocolate" },
>             { "id": "5004", "type": "Maple" }
>         ]
> }
> {code}
> The below query fails :
> {code}
> select j.id id, j.name name, flatten(j.topping) tt, flatten(j.batters.batter) bb from `sample.json` j where j.type = 'donut';
> Query failed: Query failed: Failure while running fragment., Trying to flatten a non-repeated filed. [ 98ff5db0-4aa7-4f65-9a7a-93ae8bc41f6b on qa-node190.qa.lab:31010 ]
> [ 98ff5db0-4aa7-4f65-9a7a-93ae8bc41f6b on qa-node190.qa.lab:31010 ]
> {code}
> However if I include the filter column in the list of selected columns, then the query succeeds.
> {code}
> select j.type, j.id id, j.name name, flatten(j.topping) tt, flatten(j.batters.batter) bb from `user.json` j where j.type = 'donut';
> +------------+------------+------------+------------+------------+
> |    type    |     id     |    name    |     tt     |     bb     |
> +------------+------------+------------+------------+------------+
> | donut      | 0001       | Cake       | {"id":"5001","type":"None"} | {"id":"1001","type":"Regular"} |
> | donut      | 0001       | Cake       | {"id":"5001","type":"None"} | {"id":"1002","type":"Chocolate"} |
> | donut      | 0001       | Cake       | {"id":"5001","type":"None"} | {"id":"1003","type":"Blueberry"} |
> | donut      | 0001       | Cake       | {"id":"5001","type":"None"} | {"id":"1004","type":"Devil's Food"} |
> | donut      | 0001       | Cake       | {"id":"5002","type":"Glazed"} | {"id":"1001","type":"Regular"} |
> | donut      | 0001       | Cake       | {"id":"5002","type":"Glazed"} | {"id":"1002","type":"Chocolate"} |
> | donut      | 0001       | Cake       | {"id":"5002","type":"Glazed"} | {"id":"1003","type":"Blueberry"} |
> | donut      | 0001       | Cake       | {"id":"5002","type":"Glazed"} | {"id":"1004","type":"Devil's Food"} |
> | donut      | 0001       | Cake       | {"id":"5005","type":"Sugar"} | {"id":"1001","type":"Regular"} |
> | donut      | 0001       | Cake       | {"id":"5005","type":"Sugar"} | {"id":"1002","type":"Chocolate"} |
> | donut      | 0001       | Cake       | {"id":"5005","type":"Sugar"} | {"id":"1003","type":"Blueberry"} |
> | donut      | 0001       | Cake       | {"id":"5005","type":"Sugar"} | {"id":"1004","type":"Devil's Food"} |
> | donut      | 0001       | Cake       | {"id":"5007","type":"Powdered Sugar"} | {"id":"1001","type":"Regular"} |
> | donut      | 0001       | Cake       | {"id":"5007","type":"Powdered Sugar"} | {"id":"1002","type":"Chocolate"} |
> | donut      | 0001       | Cake       | {"id":"5007","type":"Powdered Sugar"} | {"id":"1003","type":"Blueberry"} |
> | donut      | 0001       | Cake       | {"id":"5007","type":"Powdered Sugar"} | {"id":"1004","type":"Devil's Food"} |
> | donut      | 0001       | Cake       | {"id":"5006","type":"Chocolate with Sprinkles"} | {"id":"1001","type":"Regular"} |
> | donut      | 0001       | Cake       | {"id":"5006","type":"Chocolate with Sprinkles"} | {"id":"1002","type":"Chocolate"} |
> | donut      | 0001       | Cake       | {"id":"5006","type":"Chocolate with Sprinkles"} | {"id":"1003","type":"Blueberry"} |
> | donut      | 0001       | Cake       | {"id":"5006","type":"Chocolate with Sprinkles"} | {"id":"1004","type":"Devil's Food"} |
> | donut      | 0001       | Cake       | {"id":"5003","type":"Chocolate"} | {"id":"1001","type":"Regular"} |
> | donut      | 0001       | Cake       | {"id":"5003","type":"Chocolate"} | {"id":"1002","type":"Chocolate"} |
> | donut      | 0001       | Cake       | {"id":"5003","type":"Chocolate"} | {"id":"1003","type":"Blueberry"} |
> | donut      | 0001       | Cake       | {"id":"5003","type":"Chocolate"} | {"id":"1004","type":"Devil's Food"} |
> | donut      | 0001       | Cake       | {"id":"5004","type":"Maple"} | {"id":"1001","type":"Regular"} |
> | donut      | 0001       | Cake       | {"id":"5004","type":"Maple"} | {"id":"1002","type":"Chocolate"} |
> | donut      | 0001       | Cake       | {"id":"5004","type":"Maple"} | {"id":"1003","type":"Blueberry"} |
> | donut      | 0001       | Cake       | {"id":"5004","type":"Maple"} | {"id":"1004","type":"Devil's Food"} |
> {code}
> I attached the relevant log file.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)