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

Value update options for BulkInsert and AddRange #9

Open
VJalili opened this issue Feb 11, 2015 · 1 comment
Open

Value update options for BulkInsert and AddRange #9

VJalili opened this issue Feb 11, 2015 · 1 comment

Comments

@VJalili
Copy link

VJalili commented Feb 11, 2015

First of all, I would like to thank you (again) for sharing such an excellent work with us.

I usually use AddOrUpdate method to add a new item to the bplustree. The possibility of passing a struct of AddUpdateValue that implements ICreateOrUpdateValue<C, B>, IRemoveValue<C, B> is a perfect option that extends and facilitates value update procedure. However, I wonder why such a magnificent feature is avoided in BulkInsert and AddRange.

Depending on application, value update by replacing old value with new one might be preferred, however, some applications could have custom update procedures. Some applications may require updating the value of a given key with new value where the new value it self depends on old one. For instance, lets suppose value is the average of all observed measures for a key; you observe new measure, now you would like to update the value, not replace it. AddOrUpdate perfectly addresses this requirement, but BulkInsert and AddRange are very limited in this regard.

I would like to know if you have any plans for incorporating AddUpdateValue feature in these super fast :) insertions ?

@csharptest
Copy link
Owner

@VJalili, You are correct AddRange could easily adopt this behavior and gain a bit of performance with it. I'll leave this open for when I get some time to add the overload.

For BulkInsert I think you would be better off merging the sets before insertion and performing whatever add/update logic at that time. If you look at the implementation of the BulkInsert operation you should be able to see how this is done.

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

No branches or pull requests

2 participants