Skip to content

autogenerate indices using parallel loader - #228

Merged
JoshStoddard merged 14 commits into
developfrom
create-indices
May 4, 2023
Merged

JoshStoddard merged 14 commits into
developfrom
create-indices

Conversation

@JoshStoddard

@JoshStoddard JoshStoddard commented Apr 24, 2023 •

Copy link
Copy Markdown
Contributor

When using data loaders, it will attempt to create an index for any property we use for conditional add (ie. with constraint_ prefix), if it is not already indexed.

Fixes #136

@JoshStoddard
JoshStoddard marked this pull request as ready for review April 27, 2023 00:06
Comment thread aperturedb/BBoxDataCSV.py
def __init__(self, filename, df=None, use_dask=False):

super().__init__(filename, df=df, use_dask=use_dask)
if not use_dask:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This check ensures that a CSV file is not read at the first pass when dask mode is used. It's a performance optimization, but it's impact can be observed when using a file with millions of rows. I can explain more offline.

@JoshStoddard JoshStoddard May 2, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, sorry, forgot to hit send 🤦

My interpretation was that this was only making use of the header, which should already be populated by super().__init__() and validation().

In any event, for this PT, I only need the header row. Is there a way to get that without having to read the whole file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. I think we can merge it and worry about the optimization part later.

@JoshStoddard
JoshStoddard merged commit 93f24de into develop May 4, 2023
@JoshStoddard
JoshStoddard deleted the create-indices branch May 4, 2023 17:24
super().__init__(db, dry_run=dry_run)
self.type = "element"

def get_existing_indices(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sorry to join the party late here 🥲

This functionality is pretty much a re-implementation of what we have on our Utils.py file. We should try to re-use those.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I will create an issue for re-factoring this later, it is not a big deal.


create_indices = [{"CreateIndex": idx} for idx in new_indices]

res, _ = self.db.query(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here, we should just use this method on Utils.py.

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.

Ingesting CSV data with a unique_ parameter that is not indexed is slow

3 participants