mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 16:09:05 +00:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new JSON file for SQL join query test cases, enhancing the variety and coverage of tests. - Added multiple new test cases for various SQL join operations, improving testing capabilities. - **Bug Fixes** - Improved error handling in data ingestion steps to ensure successful test execution. - **Refactor** - Transitioned from hardcoded test data to a parameterized approach for better maintainability and flexibility in testing. - Updated method signature to streamline test parameters. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
44 lines
2.3 KiB
JSON
44 lines
2.3 KiB
JSON
[
|
|
{
|
|
"test_name": "Basic join query",
|
|
"sql_query": "SELECT o.order_id, o.product, o.amount, u.name, u.age FROM \"orders\" o JOIN \"u1\" u ON o.user_id = u.user_id"
|
|
},
|
|
{
|
|
"test_name": "Left join query",
|
|
"sql_query": "SELECT o.order_id, o.product, o.amount, u.name, u.age FROM \"orders\" AS o LEFT JOIN \"u1\" AS u ON o.user_id = u.user_id"
|
|
},
|
|
{
|
|
"test_name": "Grouped left join query",
|
|
"sql_query": "SELECT u.name AS user_name, u.status AS user_status, COUNT(o.order_id) AS order_count FROM u1 u LEFT JOIN orders o ON u.user_id = o.user_id GROUP BY u.name, u.status"
|
|
},
|
|
{
|
|
"test_name": "Filtered grouped left join query",
|
|
"sql_query": "SELECT usr.name AS user_name, usr.status AS user_status, COUNT(o.order_id) AS order_count FROM u1 usr LEFT JOIN orders o ON usr.user_id = o.user_id WHERE usr.status IN ('active','pending') GROUP BY usr.name, usr.status"
|
|
},
|
|
{
|
|
"test_name": "Grouped left join with alias",
|
|
"sql_query": "SELECT usr.name AS user_name, usr.status AS user_status, COUNT(o.order_id) AS order_count FROM u1 usr LEFT JOIN orders o ON usr.user_id = o.user_id GROUP BY user_name, user_status"
|
|
},
|
|
{
|
|
"test_name": "Inner join with subquery for total orders",
|
|
"sql_query": "SELECT u1.name, u1.status, o.amount, (SELECT COUNT(*) FROM orders ) AS total_orders FROM u1 JOIN orders o ON u1.user_id = o.user_id"
|
|
},
|
|
{
|
|
"test_name": "Right join with subquery for total orders",
|
|
"sql_query": "SELECT u1.name, u1.status, o.amount, (SELECT COUNT(*) FROM orders ) AS total_orders FROM u1 RIGHT JOIN orders o ON u1.user_id = o.user_id"
|
|
},
|
|
{
|
|
"test_name": "Union query: Select amount from orders and age from u1",
|
|
"sql_query": "SELECT amount FROM \"orders\" UNION SELECT age FROM \"u1\""
|
|
},
|
|
{
|
|
"test_name": "Error count query: Users without orders",
|
|
"sql_query": "SELECT COUNT(*) AS error_count FROM u1 usr LEFT JOIN orders o ON usr.user_id = o.user_id WHERE o.order_id IS NULL"
|
|
},
|
|
|
|
{
|
|
"test_name": "Total Orders Query",
|
|
"sql_query": "WITH total AS (SELECT COUNT(*) AS total_count FROM orders) SELECT u1.name, u1.status, o.amount, total.total_count AS total_orders FROM u1 JOIN orders o ON u1.user_id = o.user_id CROSS JOIN total"
|
|
}
|
|
]
|
|
|