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

feat: support key-value cache for function expressions #550

Merged
merged 45 commits into from
Mar 30, 2023
Merged

Conversation

gaurav274
Copy link
Member

@gaurav274 gaurav274 commented Jan 2, 2023

Support added for caching when the UDF is in the lateral join

from eva.utils.logging_manager import logger


class UdfHistoryColumnService(BaseService):
Copy link
Member

Choose a reason for hiding this comment

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

Can you elaborate when is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is from the older code. Will remove it

@gaurav274 gaurav274 marked this pull request as ready for review March 28, 2023 05:58
eva/catalog/catalog_utils.py Outdated Show resolved Hide resolved
eva/catalog/catalog_utils.py Show resolved Hide resolved
eva/catalog/models/udf_catalog.py Show resolved Hide resolved
eva/executor/create_index_executor.py Show resolved Hide resolved
eva/optimizer/optimizer_utils.py Show resolved Hide resolved
eva/expression/function_expression.py Outdated Show resolved Hide resolved
eva/catalog/catalog_utils.py Show resolved Hide resolved
eva/expression/function_expression.py Outdated Show resolved Hide resolved

reuse_batch = execute_query_fetch_all(select_query)
self._verify_reuse_correctness(select_query, reuse_batch)

Copy link
Member

Choose a reason for hiding this comment

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

Do we want to also check the time speedup with reuse?

Copy link
Member Author

Choose a reason for hiding this comment

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

Might lead to a flaky test.

results[cache_miss] = cache_miss_results.to_numpy()

# 5. return the correct batch
cols = [obj.name for obj in self.output_objs]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Duplicate code at line 193.


results = np.full([len(batch), len(cols)], None)
keys = batch
if self._cache.key:
Copy link
Collaborator

Choose a reason for hiding this comment

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

When I first read code, I was thinking this is the key of the cache store. Maybe add a comment. This is to optimize the key for the function expression (data -> id).

@gaurav274 gaurav274 merged commit e3ee455 into master Mar 30, 2023
@gaurav274 gaurav274 deleted the kv-cache branch March 30, 2023 14:45
@jarulraj jarulraj mentioned this pull request Apr 3, 2023
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.

5 participants