[MCOL-561] Can't create view by using ColumnStore's windowing funcion SQL Created: 2017-02-10  Updated: 2017-09-07  Resolved: 2017-09-07

Status: Closed
Project: MariaDB ColumnStore
Component/s: MariaDB Server
Affects Version/s: 1.0.7
Fix Version/s: 1.1.0

Type: Bug Priority: Major
Reporter: Allen Chan Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Sprint: 2017-12, 2017-13, 2017-14, 2017-15, 2017-16, 2017-17, 2017-18

 Description   

Original SQL:
SELECT mobile, nick_name, lead (nick_name, 1) over (PARTITION BY wm ORDER BY create_date ASC) AS next_name FROM ods_user;

Create View SQL:
SELECT `ods_user`.`MOBILE` AS `mobile`, `ods_user`.`NICK_NAME` AS `nick_name`, `lead`(
`test`.`ods_user`.`NICK_NAME`,1,NULL,1) AS `next_name`
FROM `ods_user`



 Comments   
Comment by David Thompson (Inactive) [ 2017-05-08 ]

It appears that this works in 1.1.0 likely as a side affect of the work to consolidate with the server 10.2 window function code. We should consider some more verification and addition of a regression test around this.

Comment by David Thompson (Inactive) [ 2017-06-12 ]

Can you verify and add test cases for this.

Comment by Daniel Lee (Inactive) [ 2017-06-23 ]

Build tested: 1.0.9-1, 1.1.0 Github source.

select o_custkey, o_orderkey, Lead(o_orderkey,1) OVER (PARTITION BY abs(o_custkey) ORDER BY o_custkey ASC) as next_name from orders;

create view myview as select o_custkey, o_orderkey, Lead(o_orderkey,1) OVER (PARTITION BY abs(o_custkey) ORDER BY o_custkey ASC) as next_name from orders;

select * from myview;

The above statement worked on 1.1.0. For 1.0.9-1, the create view statement worked, but returned the following error when selecting from the view.

MariaDB [mytest]> select * from myview;
ERROR 1356 (HY000): View 'mytest.myview' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

There are no errors in the ColumnStore log files.

More samples that worked in 1.1.0, but not 1.0.9-1

MariaDB [mytest]> create view myview as select o_custkey, Max(o_custkey) OVER ( ) from orders where o_orderkey < 100;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mytest]> select * from myview;
ERROR 1815 (HY000): Internal error: IDB-2021: 'o_custkey' is not in GROUP BY clause. All non-aggregate columns in the SELECT and ORDER BY clause must be included in the GROUP BY clause.

MariaDB [mytest]> create view myview as select o_custkey, Count(o_custkey) OVER ( ORDER BY o_custkey ) from orders where o_orderkey < 100;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mytest]> select * from myview;
ERROR 1815 (HY000): Internal error: IDB-2021: 'o_custkey' is not in GROUP BY clause. All non-aggregate columns in the SELECT and ORDER BY clause must be included in the GROUP BY clause.

Comment by Daniel Lee (Inactive) [ 2017-09-07 ]

Build verified: 1.1.0 Github source

/root/columnstore/mariadb-columnstore-server
commit 9e855a6415e0edd6771c449a6591c21c3915bfec
Merge: 6ed33d1 c206e51
Author: David.Hall <david.hall@mariadb.com>
Date: Tue Sep 5 09:43:29 2017 -0500

Merge pull request #68 from mariadb-corporation/MCOL-887

MCOL-887 Merge MariaDB 10.2.8

/root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine
commit 14f20421f4dc7da4942bce417e8d55d6df5de36a
Merge: 1594230 dbbfb84
Author: david hill <david.hill@mariadb.com>
Date: Thu Sep 7 15:21:08 2017 -0500

Merge pull request #248 from mariadb-corporation/MCOL-519-gluster

removeModule fixes, check for glusterd in postConfigure, fix glusterU…

Retested with the latest build today. It worked fine. Closing it.

Generated at Thu Feb 08 02:22:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.