Skip to content

Implement commit_order in dolt_log system table and table function#9250

Merged
timsehn merged 10 commits intomainfrom
tim/commit-order
May 28, 2025
Merged

Implement commit_order in dolt_log system table and table function#9250
timsehn merged 10 commits intomainfrom
tim/commit-order

Conversation

@timsehn
Copy link
Contributor

@timsehn timsehn commented May 27, 2025

This PR implements: #9145. This is implemented using Claude Code.

A customer asked for the commit order in the dolt_log system table. We have that information as we generate the commit log in the height variable. This exposes that variable as a column populated for each commit.

$ dolt sql -q "select * from dolt_log limit 3"
+----------------------------------+--------------------+-----------------------------------+---------------------+--------------------------------------+--------------+
| commit_hash                      | committer          | email                             | date                | message                              | commit_order |
+----------------------------------+--------------------+-----------------------------------+---------------------+--------------------------------------+--------------+
| iifq0hvp5fis9ld2lnhorqr5l697ph38 | post-no-preference | post.no.preference@protonmail.com | 2025-05-23 06:34:26 | volatility_history 2025-05-22 update | 1427         |
| 62n14k63lu5jcc3a3qr18q8ku19e8g8q | post-no-preference | post.no.preference@protonmail.com | 2025-05-23 06:34:15 | option_chain 2025-05-22 update       | 1426         |
| 2paehofana33lbbbjnqa18v3nlsvbgbk | post-no-preference | post.no.preference@protonmail.com | 2025-05-22 06:34:38 | volatility_history 2025-05-21 update | 1425         |
+----------------------------------+--------------------+-----------------------------------+---------------------+--------------------------------------+--------------+

@coffeegoddd
Copy link
Contributor

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
51d9615 ok 5937457
version total_tests
51d9615 5937457
correctness_percentage
100.0

@coffeegoddd
Copy link
Contributor

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
b98bbdf ok 5937457
version total_tests
b98bbdf 5937457
correctness_percentage
100.0

@coffeegoddd
Copy link
Contributor

@timsehn DOLT

comparing_percentages
100.000000 to 100.000000
version result total
92991fb ok 5937457
version total_tests
92991fb 5937457
correctness_percentage
100.0

@timsehn timsehn requested a review from fulghum May 27, 2025 19:52
@timsehn
Copy link
Contributor Author

timsehn commented May 27, 2025

I manually tested this and it seems to work:

$ dolt init --fun
Successfully initialized dolt data repository.
$ dolt sql -q "select * from dolt_log"
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+
| commit_hash                      | committer | email           | date                | message                    | commit_order |
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+
| d0lt4bas03smpcqv3nhig1aa7monspp8 | timsehn   | tim@dolthub.com | 2025-05-27 22:53:08 | Іnіtіalіzе datа repositоry | 1            |
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+

$ dolt commit --allow-empty -m "Another" 
commit 50ipro4d1hd1kcnbgbf95n7oi305laql (HEAD -> main) 
Author: timsehn <tim@dolthub.com>
Date:  Tue May 27 15:53:41 -0700 2025

        Another

$ dolt sql -q "select * from dolt_log"   
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+
| commit_hash                      | committer | email           | date                | message                    | commit_order |
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+
| 50ipro4d1hd1kcnbgbf95n7oi305laql | timsehn   | tim@dolthub.com | 2025-05-27 22:53:41 | Another                    | 2            |
| d0lt4bas03smpcqv3nhig1aa7monspp8 | timsehn   | tim@dolthub.com | 2025-05-27 22:53:08 | Іnіtіalіzе datа repositоry | 1            |
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+

$ dolt branch b1
$ dolt commit --allow-empty -m "Another main" 
commit 8n4gk4eoil6le7nvhgno1tk0kqiosurn (HEAD -> main) 
Author: timsehn <tim@dolthub.com>
Date:  Tue May 27 15:54:02 -0700 2025

        Another main

$ dolt checkout b1
Switched to branch 'b1'
$ dolt commit --allow-empty -m "Another b1"   
commit 247541rgkebo3bpbnvfd81ql6hfe40np (HEAD -> b1) 
Author: timsehn <tim@dolthub.com>
Date:  Tue May 27 15:54:15 -0700 2025

        Another b1

$ dolt sql -q "select * from dolt_log"        
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+
| commit_hash                      | committer | email           | date                | message                    | commit_order |
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+
| 247541rgkebo3bpbnvfd81ql6hfe40np | timsehn   | tim@dolthub.com | 2025-05-27 22:54:15 | Another b1                 | 3            |
| 50ipro4d1hd1kcnbgbf95n7oi305laql | timsehn   | tim@dolthub.com | 2025-05-27 22:53:41 | Another                    | 2            |
| d0lt4bas03smpcqv3nhig1aa7monspp8 | timsehn   | tim@dolthub.com | 2025-05-27 22:53:08 | Іnіtіalіzе datа repositоry | 1            |
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+

$ dolt checkout main
Switched to branch 'main'
$ dolt sql -q "select * from dolt_log"
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+
| commit_hash                      | committer | email           | date                | message                    | commit_order |
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+
| 8n4gk4eoil6le7nvhgno1tk0kqiosurn | timsehn   | tim@dolthub.com | 2025-05-27 22:54:02 | Another main               | 3            |
| 50ipro4d1hd1kcnbgbf95n7oi305laql | timsehn   | tim@dolthub.com | 2025-05-27 22:53:41 | Another                    | 2            |
| d0lt4bas03smpcqv3nhig1aa7monspp8 | timsehn   | tim@dolthub.com | 2025-05-27 22:53:08 | Іnіtіalіzе datа repositоry | 1            |
+----------------------------------+-----------+-----------------+---------------------+----------------------------+--------------+

$ dolt merge --no-ff b1
Updating kf9jk3glcs8levjbdtufie1uvfpbvbgg..247541rgkebo3bpbnvfd81ql6hfe40np
Everything up-to-date
$ dolt sql -q "select * from dolt_log"
+----------------------------------+-----------+-----------------+---------------------+-----------------------------+--------------+
| commit_hash                      | committer | email           | date                | message                     | commit_order |
+----------------------------------+-----------+-----------------+---------------------+-----------------------------+--------------+
| kf9jk3glcs8levjbdtufie1uvfpbvbgg | timsehn   | tim@dolthub.com | 2025-05-27 22:54:47 | Merge branch 'b1' into main | 4            |
| 247541rgkebo3bpbnvfd81ql6hfe40np | timsehn   | tim@dolthub.com | 2025-05-27 22:54:15 | Another b1                  | 3            |
| 8n4gk4eoil6le7nvhgno1tk0kqiosurn | timsehn   | tim@dolthub.com | 2025-05-27 22:54:02 | Another main                | 3            |
| 50ipro4d1hd1kcnbgbf95n7oi305laql | timsehn   | tim@dolthub.com | 2025-05-27 22:53:41 | Another                     | 2            |
| d0lt4bas03smpcqv3nhig1aa7monspp8 | timsehn   | tim@dolthub.com | 2025-05-27 22:53:08 | Іnіtіalіzе datа repositоry  | 1            |
+----------------------------------+-----------+-----------------+---------------------+-----------------------------+--------------+

$ dolt commit --allow-empty -m "Another main" 
commit mofkhajnmboief6p6dgip4lhshptj1k5 (HEAD -> main) 
Author: timsehn <tim@dolthub.com>
Date:  Tue May 27 15:55:12 -0700 2025

        Another main

$ dolt sql -q "select * from dolt_log"        
+----------------------------------+-----------+-----------------+---------------------+-----------------------------+--------------+
| commit_hash                      | committer | email           | date                | message                     | commit_order |
+----------------------------------+-----------+-----------------+---------------------+-----------------------------+--------------+
| mofkhajnmboief6p6dgip4lhshptj1k5 | timsehn   | tim@dolthub.com | 2025-05-27 22:55:12 | Another main                | 5            |
| kf9jk3glcs8levjbdtufie1uvfpbvbgg | timsehn   | tim@dolthub.com | 2025-05-27 22:54:47 | Merge branch 'b1' into main | 4            |
| 247541rgkebo3bpbnvfd81ql6hfe40np | timsehn   | tim@dolthub.com | 2025-05-27 22:54:15 | Another b1                  | 3            |
| 8n4gk4eoil6le7nvhgno1tk0kqiosurn | timsehn   | tim@dolthub.com | 2025-05-27 22:54:02 | Another main                | 3            |
| 50ipro4d1hd1kcnbgbf95n7oi305laql | timsehn   | tim@dolthub.com | 2025-05-27 22:53:41 | Another                     | 2            |
| d0lt4bas03smpcqv3nhig1aa7monspp8 | timsehn   | tim@dolthub.com | 2025-05-27 22:53:08 | Іnіtіalіzе datа repositоry  | 1            |
+----------------------------------+-----------+-----------------+---------------------+-----------------------------+--------------+

Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job Claude! 👏

@timsehn timsehn merged commit 92e7fca into main May 28, 2025
21 checks passed
@tbantle22 tbantle22 deleted the tim/commit-order branch May 28, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants