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

[c++] Column abstraction: SOMAGeometryColumn, part 3 #3427

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

Conversation

XanthosXanthopoulos
Copy link
Collaborator

This PR introduces the SOMAGeometryColumn concrete class that implement a spatial index WKB (Well-Known Binary) column. A set of internal TileDB dimensions are used to provide the index mechanics as well as a TileDB Attribute to hold the geometry data encoded in a WKB blob.

@XanthosXanthopoulos XanthosXanthopoulos changed the title SOMAGeometryColumn, part 3 [c++] Column abstraction: SOMAGeometryColumn, part 3 Dec 12, 2024
Copy link
Member

@johnkerl johnkerl left a comment

Choose a reason for hiding this comment

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

@XanthosXanthopoulos thanks for working on this! The split-up makes this PR much easier to review.


// Create a range object and reuse if for all dimensions
std::vector<std::pair<double_t, double_t>> range(1);
size_t dimensionality = dimensions.size() / 2;
Copy link
Member

Choose a reason for hiding this comment

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

Please explain the magic number 2 here

transformed_points = _transform_points(
std::any_cast<std::span<const std::vector<double_t>>>(points));

auto domain_limits = _limits(ctx, *query->schema());
Copy link
Member

Choose a reason for hiding this comment

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

Core has current domain and domain. SOMA has domain and maxdomain.

Saying "domain" is ambiguous.

I've been consistent to say "core_domain", "core_current_domain"/"current_domain", "soma_domain", "soma_maxdomain". Please do the same here and make the variable name indicate whether this domain variable is intended to be core domain or soma domain (which are not the same).

}

void SOMAGeometryColumn::_set_current_domain_slot(
NDRectangle& rectangle, std::span<const std::any> domain) const {
Copy link
Member

Choose a reason for hiding this comment

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

As above: we must not use the plain variable name domain without qualification, as it is ambiguous and error-prone.


void SOMAGeometryColumn::_set_current_domain_slot(
NDRectangle& rectangle, std::span<const std::any> domain) const {
if (2 * domain.size() != dimensions.size()) {
Copy link
Member

Choose a reason for hiding this comment

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

Please explain the magic number 2 here.


std::pair<bool, std::string> SOMAGeometryColumn::_can_set_current_domain_slot(
std::optional<NDRectangle>& rectangle,
std::span<const std::any> new_domain) const {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
std::span<const std::any> new_domain) const {
std::span<const std::any> new_current_domain) const {

std::span<const std::any> new_domain) const {
if (new_domain.size() != dimensions.size() / 2) {
throw TileDBSOMAError(std::format(
"[SOMADimension][_can_set_current_domain_slot] Expected domain "
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"[SOMADimension][_can_set_current_domain_slot] Expected domain "
"[SOMADimension][_can_set_current_domain_slot] Expected current_domain "

const SOMAContext& ctx, const ArraySchema& schema) const {
std::vector<std::pair<double_t, double_t>> limits;

for (size_t i = 0; i < dimensions.size() / 2; ++i) {
Copy link
Member

Choose a reason for hiding this comment

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

Please explain the magic number 2 here

ranges) const {
if (ranges.size() != 1) {
throw TileDBSOMAError(
"Multi ranges are not supported for geometry dimension");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Multi ranges are not supported for geometry dimension");
"Multiranges are not supported for geometry dimension");

const std::span<const std::vector<double_t>>& points) const {
if (points.size() != 1) {
throw TileDBSOMAError(
"Multi points are not supported for geometry dimension");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Multi points are not supported for geometry dimension");
"Multipoints are not supported for geometry dimension");

@@ -49,9 +49,6 @@
#include "soma/column_buffer.h"
#include "soma/soma_array.h"
#include "soma/soma_collection.h"
#include "soma/soma_column.h"
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why these lines are being deleted on this PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are intended to be used internally (within SOMAArray and subclasses) so exporting them seemed unnecessary. In any case if the usage pattern changes, we can export them again or do it preemptively now, I have no opinion on that.

@XanthosXanthopoulos XanthosXanthopoulos force-pushed the xan/sc-59427/soma-geometry-column branch from fc53e6e to 497224a Compare December 13, 2024 15:25
@jp-dark jp-dark self-requested a review December 23, 2024 16:10
@XanthosXanthopoulos XanthosXanthopoulos force-pushed the xan/sc-59427/soma-attribute branch 2 times, most recently from 73865cb to 5bcd88d Compare January 2, 2025 11:36
@XanthosXanthopoulos XanthosXanthopoulos force-pushed the xan/sc-59427/soma-geometry-column branch from 497224a to e02f78e Compare January 2, 2025 13:48
@XanthosXanthopoulos XanthosXanthopoulos force-pushed the xan/sc-59427/soma-attribute branch from a215ce4 to b0a1976 Compare January 2, 2025 17:38
@XanthosXanthopoulos XanthosXanthopoulos force-pushed the xan/sc-59427/soma-attribute branch from b0a1976 to 3faefd9 Compare January 2, 2025 20:56
@XanthosXanthopoulos XanthosXanthopoulos force-pushed the xan/sc-59427/soma-geometry-column branch from e02f78e to 6f4d6a2 Compare January 3, 2025 14:41
Base automatically changed from xan/sc-59427/soma-attribute to main January 3, 2025 16:08
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.

[c++] Add an abstraction layer between SOMA columns and TileDB dimensions and attributes
2 participants