Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mupserts and table unions to the state machine tests #475

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jorisdral
Copy link
Collaborator

@jorisdral jorisdral commented Nov 18, 2024

This is a follow-up to #469. This PR is put in draft mode until we've come to a conclusion about the proposal in #469.

In this PR, we first create a class and reference implementation for the "full" API that is introduced in #469. Then, we switch the state machine tests to use this class instead of the Normal class. Finally, we can add infrastructure for both mupserts and table unions to the state machine tests. We start testing mupserts immediately, but table union operations are not yet generated because table union does not have an implementation yet.

@jorisdral jorisdral self-assigned this Nov 18, 2024
@jorisdral jorisdral marked this pull request as draft November 18, 2024 10:39
@jorisdral jorisdral force-pushed the jdral/single-api branch 3 times, most recently from 1a8d287 to 986bec6 Compare November 18, 2024 10:49
@jorisdral jorisdral force-pushed the jdral/single-api branch 2 times, most recently from 7bedfcc to 36b4a77 Compare November 19, 2024 10:48
@jorisdral jorisdral force-pushed the jdral/single-api branch 2 times, most recently from ea4dd27 to 669e7f5 Compare November 26, 2024 15:37
Base automatically changed from jdral/single-api to main November 26, 2024 17:11
@jorisdral
Copy link
Collaborator Author

#469 was merged, so I'll update this PR before undrafting it

, (10, fmap Some $ Inserts <$> genInserts <*> genTableVar)
, (10, fmap Some $ Deletes <$> genDeletes <*> genTableVar)
, (8, fmap Some $ Lookups <$> genLookupKeys <*> genTableVar)
, (4, fmap Some $ RangeLookup <$> genRange <*> genTableVar)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
, (4, fmap Some $ RangeLookup <$> genRange <*> genTableVar)
, (4, fmap Some $ RangeLookup <$> genRange <*> genTableVar)

@jorisdral jorisdral marked this pull request as ready for review November 27, 2024 09:51
Comment on lines +345 to 348
Database.LSMTree.Class
Database.LSMTree.Class.Common
Database.LSMTree.Class.Monoidal
Database.LSMTree.Class.Normal
Copy link
Collaborator

Choose a reason for hiding this comment

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

So we added the unified API in #469 to allow writing tests against it. Here we add a third version of IsTable, the IO model etc. for the the unified API. But why not unify the model/tests as well, resulting in a single IO model and single IsTable class? That would make the tests much leaner.

The only argument against it that I can think of is that we're not yet sure which API(s) we want to provide in the end. If we later remove the unified API again, we might have to re-duplicate the model/tests. 🤷

Copy link
Collaborator Author

@jorisdral jorisdral Nov 27, 2024

Choose a reason for hiding this comment

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

Sure, it would be nice if we could eventually deduplicate the test stuff too, but it's more work, and not strictly necessary for the statemachine tests

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, but would be nice to discuss and tackle soonish then.

@@ -46,6 +46,7 @@ import Data.List (sort)
import qualified Data.Primitive.ByteArray as BA
import qualified Data.Vector.Primitive as VP
import Data.Word
import qualified Database.LSMTree as LSMTree
Copy link
Collaborator

Choose a reason for hiding this comment

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

To fit the pattern of Normal/Monoidal, would it make sense to import it as Unified here and in other places?

Comment on lines +1481 to +1484
R.Insert _ Nothing -> (i+1, iwb , d , m )
R.Insert _ Just{} -> (i , iwb+1, d , m )
R.Delete{} -> (i , iwb , d+1, m )
R.Mupsert{} -> (i , iwb , d , m + 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
R.Insert _ Nothing -> (i+1, iwb , d , m )
R.Insert _ Just{} -> (i , iwb+1, d , m )
R.Delete{} -> (i , iwb , d+1, m )
R.Mupsert{} -> (i , iwb , d , m + 1)
R.Insert _ Nothing -> (i+1, iwb , d , m )
R.Insert _ Just{} -> (i , iwb+1, d , m )
R.Delete{} -> (i , iwb , d+1, m )
R.Mupsert{} -> (i , iwb , d , m+1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants