AmrDeveloper / GQL

Git Query language is a SQL like language to perform queries on .git files with supports of most of SQL features such as grouping, ordering and aggregations functions
https://amrdeveloper.github.io/GQL/
MIT License
3.19k stars 88 forks source link

output of group by #117

Closed fdncred closed 1 day ago

fdncred commented 1 week ago

Describe the bug I expected this query to produce 1 row. The

❯ ^gitql -q 'select author_name, count(author_name) AS auth_count from commits group by author_name order by count(author_name)'
╭──────────────────┬────────────╮
│ author_name      ┆ auth_count │
╞══════════════════╪════════════╡
│ Darren Schroeder ┆ 6          │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder ┆ 6          │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder ┆ 6          │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder ┆ 6          │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder ┆ 6          │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder ┆ 6          │
╰──────────────────┴────────────╯

There are indeed 6 commits, but shouldn't group by only show the aggregate of 1?

❯ ^gitql -q 'select author_name from commits'
╭──────────────────╮
│ author_name      │
╞══════════════════╡
│ Darren Schroeder │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Darren Schroeder │
╰──────────────────╯

GQL (please complete the following information): ❯ ^gitql --version GitQL version 0.27.0

AmrDeveloper commented 1 week ago

Thank you for reporting @fdncred,

This is important to handled

AmrDeveloper commented 6 days ago

It fixed now, you can run the query from issue description and get good result,

Thanks for reporting, i will release it next version

fdncred commented 6 days ago

Thanks. I'm trying to integrate into a nushell plugin and was wondering why my code didn't work. Then I tried your cli and found out the results were the same. 🤣 Thanks for working on this. I'll try and test it in the next day or so.

AmrDeveloper commented 6 days ago

Thats cool idea to integrate it with nushell plugin,

fdncred commented 6 days ago

prototype image

AmrDeveloper commented 6 days ago

prototype image

Cool 😅

AmrDeveloper commented 1 day ago

I think we can close this

fdncred commented 1 day ago

Thanks for your help! I'm really enjoying GQL!

AmrDeveloper commented 14 hours ago

Thanks for your help! I'm really enjoying GQL!

Thank you, i think it can be even better when implementing line editor, sub query, user defined functions, some optimisations and tree rewriting, but step by step :D