Tried on a commit on 1.7.0-SNAPSHOT. Looks like I could not re-produce
the problem.  Which version are u using?

create view dfs.tmp.myview as select dir0 as p_day, l_partkey,
l_orderkey, l_suppkey from dfs.tmp.t2;
+-------+---------------------------------------------------------+
|  ok   |                         summary                         |
+-------+---------------------------------------------------------+
| true  | View 'myview' created successfully in 'dfs.tmp' schema  |
+-------+---------------------------------------------------------+

select * from dfs.tmp.myview;
+--------+------------+-------------+------------+
| p_day  | l_partkey  | l_orderkey  | l_suppkey  |
+--------+------------+-------------+------------+
| 1990   | 11001      | 42128896    | 36002      |


select p_day from dfs.tmp.myview;
+--------+
| p_day  |
+--------+
| 1990   |


select dir0 from dfs.tmp.myview;

Error: VALIDATION ERROR: From line 1, column 8 to line 1, column 11:
Column 'dir0' not found in any table



On Thu, Jun 23, 2016 at 1:37 PM, Neeraja Rentachintala
<[email protected]> wrote:
> This is a bug.
>
> On Thu, Jun 23, 2016 at 1:32 PM, rahul challapalli <
> [email protected]> wrote:
>
>> This looks like a bug. If you renamed the dir0 column as p_day, then you
>> should see that in sqlline as well. And I have never seen
>> "_DEFAULT_COL_TO_READ_"
>> before. Can you file a jira?
>>
>> - Rahul
>>
>> On Thu, Jun 23, 2016 at 12:33 PM, John Omernik <[email protected]> wrote:
>>
>> > I have a table that is a directory of parquet files, each row had say 3
>> > columns, and the table is split into subdirectories that allow me to use
>> > dir0 partitioning.
>> >
>> > so if I select * from `table`
>> >
>> > I get col1, col2, col3, and dir0 as my fields returned.
>> >
>> > So if I create a view
>> >
>> > CREATE VIEW view_myview as
>> > select dir0 as `p_day`, col1, col2, col3 from `path/to/table`
>> >
>> > and run
>> > select * from view_myview
>> >
>> > why, in sqlline, isn't the first column named "p_day"
>> >
>> > I can reference things in my query by p_day, however, the returned
>> results,
>> > still say dir0?
>> >
>> > I dir0 | col1| col2 | col3 |
>> >
>> > If I do select p_day, col1 then I get
>> >
>> > | dir0 | col1|
>> >
>> > if I do select p_day then I get
>> >
>> > | _DEFAULT_COL_TO_READ_ | dir0 |
>> >
>> > where the first column (DEFAULT_COL_TO_READ) is always null.
>> >
>> > If I do select dir0 from view I get "dir0" not found.
>> >
>> > I guess, the "expected" (principal of least surprise) would be to have it
>> > just be a column, that is always labeled p_day, and if I only select
>> that,
>> > I get the dir0 value repeated for each value.
>> >
>> > Am I over thinking minutia again? :)
>> >
>>

Reply via email to