-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more SQL test case for create-materialized-view
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,4 +89,37 @@ | |
(SELECT * FROM [email protected] l | ||
WHERE l.country_id = 'UK' | ||
AND d.location_id = l.location_id));" db-types="Oracle" /> | ||
<sql-case id="create_materialized_view_scope_for" value="CREATE MATERIALIZED VIEW oe.customers_with_ref_mv | ||
(SCOPE FOR (cust_address) IS oe.cust_address_objtab_mv) | ||
AS SELECT * FROM [email protected];" db-types="Oracle" /> | ||
<sql-case id="create_materialized_view_with_refresh_complete" value="CREATE MATERIALIZED VIEW mv_prod_time | ||
REFRESH COMPLETE ON DEMAND AS | ||
SELECT | ||
(CASE | ||
WHEN ((GROUPING(calendar_year)=0 ) | ||
AND (GROUPING(calendar_quarter_desc)=1 )) | ||
THEN (TO_CHAR(calendar_year) || '_0') | ||
WHEN ((GROUPING(calendar_quarter_desc)=0 ) | ||
AND (GROUPING(calendar_month_desc)=1 )) | ||
THEN (TO_CHAR(calendar_quarter_desc) || '_1') | ||
WHEN ((GROUPING(calendar_month_desc)=0 ) | ||
AND (GROUPING(t.time_id)=1 )) | ||
THEN (TO_CHAR(calendar_month_desc) || '_2') | ||
ELSE (TO_CHAR(t.time_id) || '_3') | ||
END) Hierarchical_Time, | ||
calendar_year year, calendar_quarter_desc quarter, | ||
calendar_month_desc month, t.time_id day, | ||
prod_category cat, prod_subcategory subcat, p.prod_id prod, | ||
GROUPING_ID(prod_category, prod_subcategory, p.prod_id, | ||
calendar_year, calendar_quarter_desc, calendar_month_desc,t.time_id) gid, | ||
GROUPING_ID(prod_category, prod_subcategory, p.prod_id) gid_p, | ||
GROUPING_ID(calendar_year, calendar_quarter_desc, | ||
calendar_month_desc, t.time_id) gid_t, | ||
SUM(amount_sold) s_sold, COUNT(amount_sold) c_sold, COUNT(*) cnt | ||
FROM SALES s, TIMES t, PRODUCTS p | ||
WHERE s.time_id = t.time_id AND | ||
p.prod_name IN ('Bounce', 'Y Box') AND s.prod_id = p.prod_id | ||
GROUP BY | ||
ROLLUP(calendar_year, calendar_quarter_desc, calendar_month_desc, t.time_id), | ||
ROLLUP(prod_category, prod_subcategory, p.prod_id);" db-types="Oracle" /> | ||
</sql-cases> |