You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Rahul Challapalli (JIRA)" <ji...@apache.org> on 2015/01/15 19:01:34 UTC
[jira] [Created] (DRILL-2012) Flatten fails when we filter by a
non-projected column
Rahul Challapalli created DRILL-2012:
----------------------------------------
Summary: 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: Functions - Drill, Storage - JSON
Reporter: Rahul Challapalli
Assignee: Jason Altekruse
Priority: Critical
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)