[MCOL-91] SQL Statement cause syntax error when vtable mode = 1 Created: 2016-05-31  Updated: 2016-11-01  Resolved: 2016-11-01

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr, MariaDB Server
Affects Version/s: 1.0.0
Fix Version/s: 1.0.5

Type: Bug Priority: Minor
Reporter: David Hall (Inactive) Assignee: David Hall (Inactive)
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Any


Sprint: 2016-21

 Description   

A certain query is used in working_tpch1_compareLogOnly/tableMode. During the test, vtable mode is set to 0 and to 2. The query is run in each mode successfully. Not part of the test, but when run with vtable mode 1 (auto switch between 0 and 2), it returns a syntax error.

SELECT SUM(L_EXTENDEDPRICE * (1 - L_DISCOUNT)) AS REVENUE FROM LINEITEM, PART WHERE ( P_PARTKEY = L_PARTKEY AND P_BRAND = 'Brand#41' AND P_CONTAINER IN ( 'SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') AND L_QUANTITY >= 3 AND L_QUANTITY <= 3 + 1 AND P_SIZE BETWEEN 1 AND 5 AND L_SHIPMODE IN ('AIR', 'AIR REG') AND L_SHIPINSTRUCT = 'DELIVER IN PERSON' ) OR ( P_PARTKEY = L_PARTKEY AND P_BRAND = 'Brand#33' AND P_CONTAINER IN ( 'MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') AND L_QUANTITY >= 14 AND L_QUANTITY <= 14 + 1 AND P_SIZE BETWEEN 1 AND 10 AND L_SHIPMODE IN ('AIR', 'AIR REG') AND L_SHIPINSTRUCT = 'DELIVER IN PERSON' ) OR ( P_PARTKEY = L_PARTKEY AND P_BRAND = 'Brand#45' AND P_CONTAINER IN ( 'LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') AND L_QUANTITY >= 25 AND L_QUANTITY <= 25 + 1 AND P_SIZE BETWEEN 1 AND 15 AND L_SHIPMODE IN ('AIR', 'AIR REG') AND L_SHIPINSTRUCT = 'DELIVER IN PERSON' );

Note, this issue is seen in InfiniDB 4.6



 Comments   
Comment by Dipti Joshi (Inactive) [ 2016-05-31 ]

David.HallIf this existing InfiniDB 4.6 issue - then it is not introduced by ColumnStore to MariaDB Server integration it self right ? If that is the case - will I find it in release notes for InfiniDB 4.6 somewhere ?

SELECT SUM(L_EXTENDEDPRICE * (1 - L_DISCOUNT)) AS REVENUE FROM LINEITEM, PART 
WHERE ( P_PARTKEY = L_PARTKEY AND P_BRAND = 'Brand#41' AND P_CONTAINER IN ( 'SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') AND L_QUANTITY >= 3 AND L_QUANTITY <= 3 + 1 AND P_SIZE BETWEEN 1 AND 5 AND L_SHIPMODE IN ('AIR', 'AIR REG') AND L_SHIPINSTRUCT = 'DELIVER IN PERSON' ) 
OR 
( P_PARTKEY = L_PARTKEY AND P_BRAND = 'Brand#33' AND P_CONTAINER IN ( 'MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') AND L_QUANTITY >= 14 AND L_QUANTITY <= 14 + 1 AND P_SIZE BETWEEN 1 AND 10 AND L_SHIPMODE IN ('AIR', 'AIR REG') AND L_SHIPINSTRUCT = 'DELIVER IN PERSON' ) 
OR
 ( P_PARTKEY = L_PARTKEY AND P_BRAND = 'Brand#45' AND P_CONTAINER IN ( 'LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') AND L_QUANTITY >= 25 AND L_QUANTITY <= 25 + 1 AND P_SIZE BETWEEN 1 AND 15 AND L_SHIPMODE IN ('AIR', 'AIR REG') AND L_SHIPINSTRUCT = 'DELIVER IN PERSON' );

I put it on code form above, so I can describe it. Does this only happen for SUM with a three part OR condition in "WHERE" clause - Or does it also happen with other window functions such as MAX, MIN, AVG etc Or does this only happen when you have the IN clause in the WHERE clause ?

Comment by David Hall (Inactive) [ 2016-06-02 ]

There are no windowing functions in this query. I believe you mean aggregate functions. I have not studied the specifics of when – 3 part OR – type stuff. Since this problem (if it is a problem) existed in earlier versions of InfiniDB and our current focus is on new breakage due to the port, I deemed this a very low priority and opened this issue for documentation and future action purposes.

I don't believe it was a documented issue in earlier InfiniDB releases. I only found it because the query failed with vtable mode = 0 and vtable mode = 2. This was different than InfiniDB 4.6, so it needed to be looked into. After fixing, I noticed that it still didn't work for vtable mode = 1, so I tested on InfiniDB 6.4 and got the same result.

Comment by David Hall (Inactive) [ 2016-11-01 ]

This is not a bug. It used to cause syntax error, but now it says:
ERROR 1815 (HY000): Internal error: IDB-1000: 'lineitem' and 'part' are not joined.

This is correct. In vtable mode 1, columnstore can't currently evaluate this query. In mode 0, it can. Mode 2 fails silently while trying mode 1 and switches to mode 0 and tries again.

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