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

Make neighbor's dataset path as optional #464

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

VijayanB
Copy link
Member

@VijayanB VijayanB commented Feb 17, 2024

Description

If neighbor's dataset path or corpus is not set,
use dataset path as neighbor's dataset path. This will avoid
users to set neighbors dataset path if same h5 file with
different dataset is used.

Issues Resolved

Testing

  • New functionality includes testing

[Describe how this change was tested]


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@@ -2862,20 +2862,20 @@ def test_params_default(self):
Context.QUERY,
self.data_set_dir
)
neighbors_data_set_path = create_data_set(
create_data_set(
Copy link
Collaborator

@IanHoang IanHoang Feb 20, 2024

Choose a reason for hiding this comment

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

When is this being used? Should we just remove this callable?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, In this case we are creating neighbor's dataset as part of query's dataset. In first step, you see that query dataset is created and it returns the dataset path. In step two, we pass same file and in this case, we don't create new file, instead create new dataset with key as neighbors in same file.

If neighbor's dataset path or corpus is not set,
use dataset path as neighbor's dataset path.

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
@IanHoang IanHoang merged commit 4cc54bd into opensearch-project:main Feb 20, 2024
8 checks passed
Comment on lines -1076 to -1079
if not self.data_set_path and not self.data_set_corpus:
raise exceptions.ConfigurationError(
"Dataset is missing. Provide either dataset file path or valid corpus.")
if self.data_set_path and self.data_set_corpus:
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens when both path and corpus are specified?

raise exceptions.ConfigurationError(
"Provide either dataset file path '%s' or corpus '%s'." % (self.data_set_path, self.data_set_corpus))
"Provide either neighbor's dataset file path '%s' or corpus '%s'." % (file_path, corpus))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Recommend using f-strings for newer code.

@@ -188,12 +188,16 @@ def create_data_set(
dimension: int,
extension: str,
data_set_context: Context,
data_set_dir
data_set_dir,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a type hint for clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants