You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Sean Hsuan-Yi Chu <hs...@gmail.com> on 2014/10/30 17:48:41 UTC

[Create view] Unable to create view. Schema [csvtest.default] is immutable.

Hi,

I am trying to create a view from a table which looks like below:

0: jdbc:drill:zk=local> select * from `plays.csv`;

+------------+

|  columns   |

+------------+

| ["1599","As You Like It"] |

| ["1601","Twelfth Night"] |

| ["1594","Comedy of Errors"] |

| ["1595","Romeo and Juliet"] |

| ["1596","The Merchant of Venice"] |

| ["1610","The Tempest"] |

| ["1599","Hamlet"] |

+------------+


But it returns:


0: jdbc:drill:zk=local> create view viewZZZ AS

. . . . . . . . . . . > select * from `plays.csv`;

+------------+------------+

|     ok     |  summary   |

+------------+------------+

| false      | Unable to create view. Schema [csvtest.default] is
immutable.  |

+------------+------------+


Can anybody tell me what's wrong here???


Thanks

Re: [Create view] Unable to create view. Schema [csvtest.default] is immutable.

Posted by Neeraja Rentachintala <nr...@maprtech.com>.
Can you give re storage engine configuration you are using for the csv.default.



> On Oct 30, 2014, at 9:48 AM, Sean Hsuan-Yi Chu <hs...@gmail.com> wrote:
> 
> Hi,
> 
> I am trying to create a view from a table which looks like below:
> 
> 0: jdbc:drill:zk=local> select * from `plays.csv`;
> 
> +------------+
> 
> |  columns   |
> 
> +------------+
> 
> | ["1599","As You Like It"] |
> 
> | ["1601","Twelfth Night"] |
> 
> | ["1594","Comedy of Errors"] |
> 
> | ["1595","Romeo and Juliet"] |
> 
> | ["1596","The Merchant of Venice"] |
> 
> | ["1610","The Tempest"] |
> 
> | ["1599","Hamlet"] |
> 
> +------------+
> 
> 
> But it returns:
> 
> 
> 0: jdbc:drill:zk=local> create view viewZZZ AS
> 
> . . . . . . . . . . . > select * from `plays.csv`;
> 
> +------------+------------+
> 
> |     ok     |  summary   |
> 
> +------------+------------+
> 
> | false      | Unable to create view. Schema [csvtest.default] is
> immutable.  |
> 
> +------------+------------+
> 
> 
> Can anybody tell me what's wrong here???
> 
> 
> Thanks

Re: [Create view] Unable to create view. Schema [csvtest.default] is immutable.

Posted by Bob Rumsby <br...@maprtech.com>.
It's true that you need to query CSV files in that way, but the error here
just means that the workspace you are using is defined as immutable (cannot
be written to).

See the CREATE VIEW command section in the tutorial:
https://cwiki.apache.org/confluence/display/DRILL/Lesson+2%3A+Run+Queries+with+ANSI+SQL

On Fri, Oct 31, 2014 at 6:13 AM, Christopher Matta <cm...@mapr.com> wrote:

> When querying a CSV/TSV/PSV document each row is returned as an array. You
> have to give meaning to the columns by casting them:
>
> SELECT CAST(columns[0] as INT) as `id`, CAST(columns[1] as
> VARCHAR(128)) as `play` FROM `plays.csv`;
>
> ​
>
> Chris Matta
> cmatta@mapr.com
> 215-701-3146
>
> On Thu, Oct 30, 2014 at 12:48 PM, Sean Hsuan-Yi Chu <hs...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I am trying to create a view from a table which looks like below:
> >
> > 0: jdbc:drill:zk=local> select * from `plays.csv`;
> >
> > +------------+
> >
> > |  columns   |
> >
> > +------------+
> >
> > | ["1599","As You Like It"] |
> >
> > | ["1601","Twelfth Night"] |
> >
> > | ["1594","Comedy of Errors"] |
> >
> > | ["1595","Romeo and Juliet"] |
> >
> > | ["1596","The Merchant of Venice"] |
> >
> > | ["1610","The Tempest"] |
> >
> > | ["1599","Hamlet"] |
> >
> > +------------+
> >
> >
> > But it returns:
> >
> >
> > 0: jdbc:drill:zk=local> create view viewZZZ AS
> >
> > . . . . . . . . . . . > select * from `plays.csv`;
> >
> > +------------+------------+
> >
> > |     ok     |  summary   |
> >
> > +------------+------------+
> >
> > | false      | Unable to create view. Schema [csvtest.default] is
> > immutable.  |
> >
> > +------------+------------+
> >
> >
> > Can anybody tell me what's wrong here???
> >
> >
> > Thanks
> >
>

Re: [Create view] Unable to create view. Schema [csvtest.default] is immutable.

Posted by Christopher Matta <cm...@mapr.com>.
When querying a CSV/TSV/PSV document each row is returned as an array. You
have to give meaning to the columns by casting them:

SELECT CAST(columns[0] as INT) as `id`, CAST(columns[1] as
VARCHAR(128)) as `play` FROM `plays.csv`;

​

Chris Matta
cmatta@mapr.com
215-701-3146

On Thu, Oct 30, 2014 at 12:48 PM, Sean Hsuan-Yi Chu <hs...@gmail.com>
wrote:

> Hi,
>
> I am trying to create a view from a table which looks like below:
>
> 0: jdbc:drill:zk=local> select * from `plays.csv`;
>
> +------------+
>
> |  columns   |
>
> +------------+
>
> | ["1599","As You Like It"] |
>
> | ["1601","Twelfth Night"] |
>
> | ["1594","Comedy of Errors"] |
>
> | ["1595","Romeo and Juliet"] |
>
> | ["1596","The Merchant of Venice"] |
>
> | ["1610","The Tempest"] |
>
> | ["1599","Hamlet"] |
>
> +------------+
>
>
> But it returns:
>
>
> 0: jdbc:drill:zk=local> create view viewZZZ AS
>
> . . . . . . . . . . . > select * from `plays.csv`;
>
> +------------+------------+
>
> |     ok     |  summary   |
>
> +------------+------------+
>
> | false      | Unable to create view. Schema [csvtest.default] is
> immutable.  |
>
> +------------+------------+
>
>
> Can anybody tell me what's wrong here???
>
>
> Thanks
>

Re: [Create view] Unable to create view. Schema [csvtest.default] is immutable.

Posted by Sean Hsuan-Yi Chu <hs...@gmail.com>.
Hi,
I figured out :
Just change "writable" in your configuration to true

ref:
https://cwiki.apache.org/confluence/display/DRILL/CREATE+TABLE+AS+(CTAS)+Command


2014-10-30 9:48 GMT-07:00 Sean Hsuan-Yi Chu <hs...@gmail.com>:

> Hi,
>
> I am trying to create a view from a table which looks like below:
>
> 0: jdbc:drill:zk=local> select * from `plays.csv`;
>
> +------------+
>
> |  columns   |
>
> +------------+
>
> | ["1599","As You Like It"] |
>
> | ["1601","Twelfth Night"] |
>
> | ["1594","Comedy of Errors"] |
>
> | ["1595","Romeo and Juliet"] |
>
> | ["1596","The Merchant of Venice"] |
>
> | ["1610","The Tempest"] |
>
> | ["1599","Hamlet"] |
>
> +------------+
>
>
> But it returns:
>
>
> 0: jdbc:drill:zk=local> create view viewZZZ AS
>
> . . . . . . . . . . . > select * from `plays.csv`;
>
> +------------+------------+
>
> |     ok     |  summary   |
>
> +------------+------------+
>
> | false      | Unable to create view. Schema [csvtest.default] is
> immutable.  |
>
> +------------+------------+
>
>
> Can anybody tell me what's wrong here???
>
>
> Thanks
>

Re: [Create view] Unable to create view. Schema [csvtest.default] is immutable.

Posted by James Sun <js...@maprtech.com>.
You may want to make the "writable" attribute true in your schema:

  "writable": true

Thanks

-James

On 10/30/14, 9:48 AM, Sean Hsuan-Yi Chu wrote:
> Hi,
>
> I am trying to create a view from a table which looks like below:
>
> 0: jdbc:drill:zk=local> select * from `plays.csv`;
>
> +------------+
>
> |  columns   |
>
> +------------+
>
> | ["1599","As You Like It"] |
>
> | ["1601","Twelfth Night"] |
>
> | ["1594","Comedy of Errors"] |
>
> | ["1595","Romeo and Juliet"] |
>
> | ["1596","The Merchant of Venice"] |
>
> | ["1610","The Tempest"] |
>
> | ["1599","Hamlet"] |
>
> +------------+
>
>
> But it returns:
>
>
> 0: jdbc:drill:zk=local> create view viewZZZ AS
>
> . . . . . . . . . . . > select * from `plays.csv`;
>
> +------------+------------+
>
> |     ok     |  summary   |
>
> +------------+------------+
>
> | false      | Unable to create view. Schema [csvtest.default] is
> immutable.  |
>
> +------------+------------+
>
>
> Can anybody tell me what's wrong here???
>
>
> Thanks
>