-
Notifications
You must be signed in to change notification settings - Fork 71
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
[Issue #405] In memory index - obscure basetype to end user #576
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are two important structures. RTreeNode and RTree. There are 4 basic functions to interact with this structures: create and rtree, insert something to it, query and rtree and free the memory of an rtree.
We include a basic structure for the Rtree which is working for STBoxes. It allows to insert one by one. Queries are done with an STBox. A function to find each value as a double is required to be passed down to the RTree itself.
Since there is no tests for C code and only for sql code, this example is in some way also a test. It shows how you would normally use the Rtree, inserting and querying.
The largest axis was always choosing to split via the first element. Now it changes. Some thought should be done for the temporal axis since it is normally in a different scale. Maybe a mahalanobis distance would be better.
meos.h should only have information that the user would use. RTreeNode is no an structure that a user would use. Thus, is better to have it in tpoint_rtree.h and have a forward definition in meos.h for RTree node.
Keeping it consistent with the rest of the codebase
RtreeNode will allocate only once and there will be no need to allocate when inserting since it copying to an already allocated block of memory.
I have assumed meostype as an int since I meostype is defined in meos_catalog and I can't import it from meos.h, thus int was best option I had.
It was ambiguous that both #defines were related so they were refactored as RTREE_INNER_NODE and RTREE_INNER_NODE_NO
Adds missing documentation to newly add functions
To answer the query of rtree_search it is necessary to realloc memory, thus the code can become a little obscure. Added one extra function and some comments to make life easier for maintenance.
Included some time taking sinceit is important to know the difference between bruteforce and RTree search.
Change it so that when finding the minimum enclosing STBox there is no need to allocate new memory.
Use a simple STBox instead of a palloc.
This method obscures the use of basetype and other information to the final user, he calls rtree_create_stbox() and inside of it is called rtree_create(T_STBOX) which makes the process cleaner for meos.
The count is being deprecated and the box is being inserted into the metadata.
I pushed a commit that avoids the use of the The rest of the changes seem good, so if you agree with my changes I'll merge the PR. |
mschoema
approved these changes
Aug 27, 2024
Matematikoi
commented
Aug 28, 2024
mschoema
approved these changes
Aug 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously instead of using meosType an int was being used. This new approach allows us to use meosType.
count for the Rtree has been deprecated since it is not being used at the moment.
Replaces rtree_create() for rtree_stbox_create().