A GPT-4 powered tool for detecting bugs in Databend.
datafuselabs / wizard Goto Github PK
View Code? Open in Web Editor NEWA GPT4 powered tool for detecting bugs in Databend
License: Apache License 2.0
A GPT4 powered tool for detecting bugs in Databend
License: Apache License 2.0
SELECT-W3
order is not stable, need to fix.
Run result:
DIFFERENCE FOUND
SELECT-W3:
-- SELECT-W3: Determine the growth in sales quantity for each product from the first sale to the latest sale, with stable ordering
SELECT product_id,
first_sale_quantity,
last_sale_quantity,
last_sale_quantity - first_sale_quantity AS growth
FROM (
SELECT product_id,
FIRST_VALUE(quantity) OVER (PARTITION BY product_id ORDER BY sale_date ASC) AS first_sale_quantity,
LAST_VALUE(quantity) OVER (PARTITION BY product_id ORDER BY sale_date ASC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS last_sale_quantity
FROM sales
) AS sub
ORDER BY growth DESC, product_id ASC
LIMIT 10
Differences:
bendsql:
1406 1 21 20
1406 1 21 20
1406 1 21 20
1406 1 21 20
1406 1 21 20
1406 1 21 20
1406 1 21 20
1406 1 21 20
1406 1 21 20
1406 1 21 20
snowsql:
2550 1 21 20
2550 1 21 20
2550 1 21 20
2550 1 21 20
2550 1 21 20
2550 1 21 20
2550 1 21 20
2550 1 21 20
2550 1 21 20
2550 1 21 20
SELECT-W12:
-- SELECT-W12: Display the top 5 products with the highest average sales quantity, along with their rank across all categories
WITH ProductAverage AS (
SELECT
p.product_id,
p.product_name,
AVG(s.quantity) AS avg_quantity
FROM
products p
JOIN
sales s ON p.product_id = s.product_id
GROUP BY
p.product_id, p.product_name
)
SELECT
product_id,
product_name,
TRUNCATE(avg_quantity, 2),
RANK() OVER (ORDER BY avg_quantity DESC) AS overall_rank
FROM
ProductAverage
ORDER BY
overall_rank
LIMIT 5
Differences:
bendsql:
29952 Product 29952 14.18 1
18738 Product 18738 14.08 2
32378 Product 32378 14.08 2
26567 Product 26567 14.06 4
30774 Product 30774 14.06 4
snowsql:
29952 Product 29952 14.18 1
32378 Product 32378 14.08 2
18738 Product 18738 14.08 2
26567 Product 26567 14.06 4
30774 Product 30774 14.06 4
DIFFERENCE FOUND
SELECT-W13:
-- SELECT-W13: Calculate a cumulative total of sales and a running three-month average, then rank these by customer
WITH SalesData AS (
SELECT
customer_id,
sale_date,
net_paid,
SUM(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date) AS cumulative_sales,
AVG(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) AS running_3m_avg
FROM
sales
)
SELECT
customer_id,
sale_date,
cumulative_sales,
running_3m_avg,
RANK() OVER (ORDER BY running_3m_avg DESC, cumulative_sales DESC) AS sales_rank
FROM
SalesData
ORDER BY
customer_id, sale_date
LIMIT 10
Differences:
bendsql:
0 2021-04-24 14.14 14.1400 800148
0 2021-04-25 22.74 11.3700 1844037
0 2021-05-07 35.11 11.7033 1678601
0 2021-07-25 46.51 10.7900 2117114
0 2021-09-24 54.73 10.6633 2172949
1 2021-01-07 7.36 7.3600 3691368
1 2021-03-23 22.78 11.3900 1833730
1 2021-04-23 42.45 14.1500 797047
1 2021-11-16 51.35 14.6633 678086
1 2021-11-22 65.86 14.3600 745871
snowsql:
0 2021-04-24 14.14 14.14000 800164
0 2021-04-25 22.74 11.37000 1844037
0 2021-05-07 35.11 11.70333 1678589
0 2021-07-25 46.51 10.79000 2117106
0 2021-09-24 54.73 10.66333 2172924
1 2021-01-07 7.36 7.36000 3691305
1 2021-03-23 22.78 11.39000 1833736
1 2021-04-23 42.45 14.15000 797060
1 2021-11-16 51.35 14.66333 678100
1 2021-11-22 65.86 14.36000 745878
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.