Skip to content

Conversation

@BrianMichell
Copy link

Supersedes #264

Removes bool open_as_void = false default in C++ function declarations and definitions.

Uses a derived DataCache implementation similar to strategy used in neuroglancer_precomputed driver for UnshardedDataCache and ShardedDataCache

@laramiel
Copy link
Collaborator

laramiel commented Jan 6, 2026

Ok, I imported this locally and am looking at a few things.

  1. Please make sure that all the tests build and pass. By removing the open_as_void = true, the spec tests fail to build.

@BrianMichell
Copy link
Author

Ok, I imported this locally and am looking at a few things.

  1. Please make sure that all the tests build and pass. By removing the open_as_void = true, the spec tests fail to build.

My bad, I don't know how I missed the compilation issue for the spec test. I've fixed the issue and resolved your comments.

Thanks for taking a look and getting back to this so fast!

}
metadata->dtype = *partial_metadata.dtype;
} else {
if (!selected_field.empty()) {
Copy link
Collaborator

@laramiel laramiel Jan 7, 2026

Choose a reason for hiding this comment

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

This should fail in open_as_void.

if (open_as_void) {
  return absl::InvalidArgumentError(
    "\"dtype\" must be specified in \"metadata\" if \"open_as_void\" is specified");
}

if (partial_metadata.dtype) {
// If a zarr dtype is specified explicitly, determine the field index. If a
// multi-field zarr dtype is desired, it must be specified explicitly.
TENSORSTORE_ASSIGN_OR_RETURN(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems a little roundabout. I'd need to look at where GetFieldIndex is used, but it seeems like it might be more direct to do something like (spitballing here):

if (open_as_void) {
metadata->dtype = ... open_as_void dtype with a single dtype.field set ...
} else {
metadata->dtype = *partial_metadata.dtype;
}


std::string DataCache::GetBaseKvstorePath() { return key_prefix_; }

// VoidDataCache implementation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Once we compose a ZarrMetadata with an open as void field I think that most of these can just be the base implementation with the above metadata ptr.

Must be specified if the `.metadata.dtype` specified in the array
metadata has more than one field.
default: null
oneOf:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't a valid schema --- but also I don't think we actually want the oneOf constraint since specifying open_as_void=false along with non-empty field name should be allowed

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was thinking about field vs. open_as_void as a variant.

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.

3 participants