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.24k stars 89 forks source link

commit and title not populated properly when using substring #120

Open fdncred opened 1 month ago

fdncred commented 1 month ago

Describe the bug I think I've formulated my query properly but the text is being put in the wrong column for some reason.

Example with my prototype nushell plugin. (the information in the "mess" column should be in the title column)

❯ gitql 'select substring(commit_id,1,7) as commit_id, substring(title,1,15) as title, substring(message,1,20) as mess, author_name, datetime from commits limit 10'
╭─#─┬─commit_id─┬─title─┬─────────mess─────────┬───author_name───┬──datetime──╮
│ 0 │           │       │ Improve #12008 UX, c │ Tooster         │ 1726086800 │
│ 1 │           │       │ fix path exists on a │ Wind            │ 1726076739 │
│ 2 │           │       │ Config: change ctrl- │ Wind            │ 1726076712 │
│ 3 │           │       │ add `metadata access │ Bahex           │ 1726076646 │
│ 4 │           │       │ Migrating polars com │ Jack Wright     │ 1726075985 │
│ 5 │           │       │ Fix padding issue wi │ Maxim Zhiburt   │ 1726053173 │
│ 6 │           │       │ Bump crate-ci/typos  │ dependabot[bot] │ 1726036546 │
│ 7 │           │       │ Bump hustcer/setup-n │ dependabot[bot] │ 1726036538 │
│ 8 │           │       │ Bump shadow-rs from  │ dependabot[bot] │ 1726036527 │
│ 9 │           │       │ Fix remaining mismat │ Devyn Cairns    │ 1725937386 │
╰─#─┴─commit_id─┴─title─┴─────────mess─────────┴───author_name───┴──datetime──╯

And the same with the gitql cli

❯ ^gitql -q 'select substring(commit_id,1,7) as commit_id, substring(title,1,15) as title, substring(message,1,20) as mess, author_name, datetime from commits limit 10'
╭───────────┬───────┬──────────────────────┬─────────────────┬─────────────────────────╮
│ commit_id ┆ title ┆ mess                 ┆ author_name     ┆ datetime                │
╞═══════════╪═══════╪══════════════════════╪═════════════════╪═════════════════════════╡
│           ┆       ┆ Improve #12008 UX, c ┆ Tooster         ┆ 2024-09-11 20:33:20.000 │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│           ┆       ┆ fix path exists on a ┆ Wind            ┆ 2024-09-11 17:45:39.000 │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│           ┆       ┆ Config: change ctrl- ┆ Wind            ┆ 2024-09-11 17:45:12.000 │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│           ┆       ┆ add `metadata access ┆ Bahex           ┆ 2024-09-11 17:44:06.000 │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│           ┆       ┆ Migrating polars com ┆ Jack Wright     ┆ 2024-09-11 17:33:05.000 │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│           ┆       ┆ Fix padding issue wi ┆ Maxim Zhiburt   ┆ 2024-09-11 11:12:53.000 │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│           ┆       ┆ Bump crate-ci/typos  ┆ dependabot[bot] ┆ 2024-09-11 06:35:46.000 │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│           ┆       ┆ Bump hustcer/setup-n ┆ dependabot[bot] ┆ 2024-09-11 06:35:38.000 │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│           ┆       ┆ Bump shadow-rs from  ┆ dependabot[bot] ┆ 2024-09-11 06:35:27.000 │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│           ┆       ┆ Fix remaining mismat ┆ Devyn Cairns    ┆ 2024-09-10 03:03:06.000 │
╰───────────┴───────┴──────────────────────┴─────────────────┴─────────────────────────╯

But when I only use one column, it seems to work fine.

❯ gitql 'select substring(commit_id,1,7) from commits limit 10'
╭─#─┬─column_1─╮
│ 0 │ 1bcceaf  │
│ 1 │ 217eb4e  │
│ 2 │ 78af66f  │
│ 3 │ f63cecc  │
│ 4 │ 8d60c0d  │
│ 5 │ 0c139c7  │
│ 6 │ c4bac90  │
│ 7 │ 2ab8751  │
│ 8 │ d192d85  │
│ 9 │ 6b59066  │
╰─#─┴─column_1─╯

GQL (please complete the following information):

AmrDeveloper commented 1 month ago

Thank you @fdncred, I will check it

AmrDeveloper commented 1 month ago

The issue is because as alias as the name of table column, i will check why is that