You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2014/12/05 23:45:13 UTC

[jira] [Commented] (CALCITE-504) Support adding new columns when creating/altering VIEW

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

Julian Hyde commented on CALCITE-504:
-------------------------------------

If we implemented CALCITE-493 you could write

{code}
CREATE VIEW mobile_product_metrics AS
SELECT carrier, dropped_calls FROM product_metrics (dropped_calls BIGINT)
WHERE metric_type = 'm';
{code}

and achieve the same effect as

{code}
CREATE VIEW mobile_product_metrics (carrier VARCHAR, dropped_calls BIGINT) AS
SELECT * FROM product_metrics
WHERE metric_type = 'm';
{code}

The latter isn't valid SQL in most DBs I know. The column count has to match. For example, MySQL:

{code}
mysql> select * from emp limit 2;
+-------+--------+--------+
| ename | deptno | gender |
+-------+--------+--------+
| Jane  |     10 | F      |
| Bob   |     10 | M      |
+-------+--------+--------+
2 rows in set (0.00 sec)

mysql> create view v (ename, deptno) as select * from emp;
ERROR 1353 (HY000): View's SELECT and view's field list have different column counts
{code}

> Support adding new columns when creating/altering VIEW
> ------------------------------------------------------
>
>                 Key: CALCITE-504
>                 URL: https://issues.apache.org/jira/browse/CALCITE-504
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Julian Hyde
>              Labels: phoenix
>
> When the underlying storage layer allows more flexibility in defining a schema, it's useful to allow a VIEW to define new columns. It'd be great if Calcite supported this as well. See http://phoenix.apache.org/views.html and http://phoenix.apache.org/multi-tenancy.html for examples.



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