GithubHelp home page GithubHelp logo

datafuselabs / wizard Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 3.0 163 KB

A GPT4 powered tool for detecting bugs in Databend

License: Apache License 2.0

Python 98.50% Makefile 1.50%
fuzzy-logic gpt-4

wizard's Introduction

wizard

A GPT-4 powered tool for detecting bugs in Databend.

wizard's People

Contributors

bohutang avatar jacktan25 avatar xudong963 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wizard's Issues

SELECT-W3 result not stable

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 order not stable

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

SELECT-W13

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.