Separate the act of resolving vs loading a dataset - #717
Conversation
|
Before you submit for review:
If you did not complete any of these, then please explain below. |
r-devulap
left a comment
There was a problem hiding this comment.
This seems simple enough as a first step to prgress to running a a larger than memory dataset.
|
@ashkrisk you might want to rebase this to main |
257d43e to
d7c6b4f
Compare
Make it so that the `DataSetLoader` is no longer responsible for deciding how to make a dataset's files available to the application. It remains responsible solely for resolving a dataset's files, which includes fetching them from a remote if required. To faciliate this, the `DataSetInfo` object now knows about the underlying files which make up a dataset and is free to provide methods which allow the caller to access the dataset in a format of their choosing. In particular, this makes it possible to add methods to `DataSetInfo` which allow for accessing datasets without loading them completely into memory. Summary of changes: - Introduces the `DataSetFiles` class for wrapping the base/query/gt paths of a dataset. - `DataSetInfo` no longer accepts a `Supplier<Dataset>`, instead accepting a `DataSetFiles` object. - `DataSetInfo` is responsible for converting `DataSetFiles` to an in-memory `DataSet` or other future formats. Possible alternatives: - Introduce an additional abstraction layer responsible for converting `DataSetFiles` to a `DataSet` or similar instead of passing the responsiblity onto `DataSetInfo`. This increases complextiy without much immediate benefit, so this is left to future patches if and when it becomes necessary (if we start supporting HDF5 again, for example).
d7c6b4f to
91aa5fb
Compare
|
I think the code looks fine but it feels like we're losing some flexibility in swapping out the Supplier function for the new DataSetFiles class. Would it not be possible to have DataSetFiles implement Supplier to achieve the same thing? |
The goal is to be able to use the same If I agree there are trade-offs associated with this. As I mentioned in the PR description there are alternatives that retain both kinds of flexibility, but I believe such a design is not worth the extra complexity at this point in time (and can always be added later if we really need it). |
|
@MarkWolters looking at the version of the |
|
Yeah, I see where you're going with it and I think it's a worthwhile effort, I just don't like how it's locked into Fvec/Ivec as the data format. I think it would be fairly cheap and easy to implement DataSetFiles as an interface that defines |
Make it so that the
DataSetLoaderis no longer responsible for deciding how to make a dataset's files available to the application. It remains responsible solely for resolving a dataset's files, which includes fetching them from a remote if required.To faciliate this, the
DataSetInfoobject now knows about the underlying files which make up a dataset and is free to provide methods which allow the caller to access the dataset in a format of their choosing. In particular, this makes it possible to add methods toDataSetInfowhich allow for accessing datasets without loading them completely into memory.Summary of changes:
DataSetFilesclass for wrapping the base/query/gt paths of a dataset.DataSetInfono longer accepts aSupplier<Dataset>, instead accepting aDataSetFilesobject.DataSetInfois responsible for convertingDataSetFilesto an in-memoryDataSetor other future formats.Possible alternatives:
DataSetFilesto aDataSetor similar instead of passing the responsibility ontoDataSetInfo. This increases complexity without much immediate benefit, so this is left to future patches if and when it becomes necessary (if we start supporting HDF5 again, for example).