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

[Issue #405] In memory index - obscure basetype to end user #576

Merged
merged 28 commits into from
Aug 28, 2024

Conversation

Matematikoi
Copy link
Contributor

@Matematikoi Matematikoi commented Aug 27, 2024

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().

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.
@Matematikoi Matematikoi marked this pull request as ready for review August 27, 2024 14:00
@mschoema
Copy link
Member

I pushed a commit that avoids the use of the RTreeMetadata structure.
The second commit is just there to remove the #if MEOS, since it's not needed anymore thanks to the next PR.

The rest of the changes seem good, so if you agree with my changes I'll merge the PR.

@mschoema mschoema merged commit e8001e3 into MobilityDB:master Aug 28, 2024
15 checks passed
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