John Omernik created DRILL-4753:
-----------------------------------

             Summary: dir0 labels in views are inconsistent
                 Key: DRILL-4753
                 URL: https://issues.apache.org/jira/browse/DRILL-4753
             Project: Apache Drill
          Issue Type: Bug
          Components:  Server
    Affects Versions: 1.6.0
            Reporter: John Omernik


When using views to handle a level day partitioned folder of parquet files, 
there are inconsistencies with how the table labels are returned to the sqlline 
client. (I am not sure if this happens in the rest interface).  As you can see 
below, sometimes the proper label (p_day) is applied, other times, it shows 
dir0, other times it adds a column for some reason. 

View Creation:
 
CREATE VIEW dfs.prod.view_mytable AS
SELECT dir0 as `p_day`, `field1`, `field2`, `field3`, `field4`, `field5`, 
`field6`, `field7`
FROM dfs.prod.`mytable`
 
View File:
 
{
  "name" : "view_mytable",
  "sql" : "SELECT `dir0` as `p_day`, `field1`, `field2`, `field3`, `field4`, 
`field5`, `field6`, `field7`\nFROM `dfs`.`prod`.`mytable`",
  "fields" : [ {
    "name" : "p_day",
    "type" : "ANY",
    "isNullable" : true
  }, {
    "name" : "field1",
    "type" : "ANY",
    "isNullable" : true
  }, {
    "name" : "field2",
    "type" : "ANY",
    "isNullable" : true
  }, {
    "name" : "field3",
    "type" : "ANY",
    "isNullable" : true
  }, {
    "name" : "field4",
    "type" : "ANY",
    "isNullable" : true
  }, {
    "name" : "field5",
    "type" : "ANY",
    "isNullable" : true
  }, {
    "name" : "field6",
    "type" : "ANY",
    "isNullable" : true
  }, {
    "name" : "field7",
    "type" : "ANY",
    "isNullable" : true
  } ],
  "workspaceSchemaPath" : [ ]
}
 
 
> select * from view_mytable limit 0;
+--------+----------------+--------+----------+----------+----------+--------+--------+
| p_day  | field1         | field2 | field3   | field4   | field5   | field6 | 
field7 |
+--------+----------------+--------+----------+----------+----------+--------+--------+
+--------+----------------+--------+----------+----------+----------+--------+--------+
 
> select * from view_mytable where p_day = '2016-05-09' limit 0;
+--------+----------------+--------+----------+----------+----------+--------+--------+
| p_day  | field1         | field2 | field3   | field4   | field5   | field6 | 
field7 |
+--------+----------------+--------+----------+----------+----------+--------+--------+
+--------+----------------+--------+----------+----------+----------+--------+--------+
 
> select * from view_mytable limit 1;
+--------+----------------+--------+----------+----------+----------+--------+--------+
| dir0   | field1         | field2 | field3   | field4   | field5   | field6 | 
field7 |
+--------+----------------+--------+----------+----------+----------+--------+--------+
+--------+----------------+--------+----------+----------+----------+--------+--------+
 
> select * from view_mytable where p_day = '2016-06-09' limit 1;
+--------+----------------+--------+----------+----------+----------+--------+--------+
| dir0   | field1         | field2 | field3   | field4   | field5   | field6 | 
field7 |
+--------+----------------+--------+----------+----------+----------+--------+--------+
+--------+----------------+--------+----------+----------+----------+--------+--------+
 
> select p_day from view_mytable limit 0;
+--------+
| p_day  |
+--------+
+--------+
 
> select p_day from view_mytable where p_day = '2016-05-09' limit 0;
+--------+
| p_day  |
+--------+
+--------+
 
> select p_day from view_mytable limit 1;
+------------------------+-------------+
| _DEFAULT_COL_TO_READ_  |    dir0     |
+------------------------+-------------+
| null                   | 2016-05-09  |
+------------------------+-------------+
 
> select p_day from view_mytable where p_day = '2016-05-09' limit 1;
+------------------------+-------------+
| _DEFAULT_COL_TO_READ_  |    dir0     |
+------------------------+-------------+
| null                   | 2016-05-09  |
+------------------------+-------------+
 
> select p_day, field1 from view_mytable limit 0;
+--------+----------------+
| p_day  | field1         |
+--------+----------------+
+--------+----------------+
 
> select p_day, field1 from view_mytable where p_day = '2016-05-09' limit 0;
+--------+----------------+
| p_day  | field1         |
+--------+----------------+
+--------+----------------+
 
 
> select p_day, field1 from view_mytable limit 1;
+-------------+----------------+
|    dir0     | field1         |
+-------------+----------------+
| 2016-05-09  | 0              |
+-------------+----------------+
 
> select p_day, field1 from view_mytable where p_day = '2016-05-09' limit 1;
+-------------+----------------+
|    dir0     | field1         |
+-------------+----------------+
| 2016-05-09  | 0              |
+-------------+----------------+



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

Reply via email to