Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL parsing Enhancement: add more SQL test case for create-materialized-view #29081

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@
<create-materialized-view sql-case-id="create_materialized_view_for_update" />
<create-materialized-view sql-case-id="create_materialized_view_with_refresh_force" />
<create-materialized-view sql-case-id="create_materialized_view_with_refresh_fast_for_update_as_with_recursive" />
<create-materialized-view sql-case-id="create_materialized_view_scope_for" />
<create-materialized-view sql-case-id="create_materialized_view_with_refresh_complete" />
</sql-parser-test-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -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>