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

Add isCompanionFunction to function metadata #9250

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pramodsatya
Copy link
Collaborator

@pramodsatya pramodsatya commented Mar 26, 2024

No description provided.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 26, 2024
Copy link

netlify bot commented Mar 26, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 0dccd1c
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/66d099be4298e10008d40f35

velox/functions/CoverageUtil.h Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.h Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/CoverageUtil.h Outdated Show resolved Hide resolved
velox/functions/CoverageUtil.h Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
@aditi-pandit aditi-pandit changed the title [WIP] Support retrieving function metadata [WIP] Add FunctionRegistry APIs to retrieve function metadata. Mar 26, 2024
@aditi-pandit
Copy link
Collaborator

aditi-pandit commented Mar 26, 2024

@pramodsatya : How do we take care that we get only Prestissimo functions from the registry ? If there is a conflict between a Prestissimo and Spark function with the same name, then how do we disambiguate ?

@pramodsatya
Copy link
Collaborator Author

pramodsatya commented Mar 27, 2024

Thanks for the feedback @aditi-pandit, @czentgr. We are not checking that only Prestissimo functions are retrieved from the registry. Instead we rely on the Prestissimo worker to have registered only the presto functions, such as in this function, so there are no Spark functions in the registry. Please let me know if this is fine or whether we should have an additional way to distinguish between Presto and Spark functions in the registry.

@pramodsatya pramodsatya force-pushed the get_fn_metadata branch 3 times, most recently from c2011b1 to 8a28ec9 Compare March 29, 2024 02:49
@pramodsatya pramodsatya changed the title [WIP] Add FunctionRegistry APIs to retrieve function metadata. Add FunctionRegistry APIs to retrieve function metadata. Jun 7, 2024
@pramodsatya
Copy link
Collaborator Author

Hi @aditi-pandit, @czentgr, could you please take another look at this PR?

velox/functions/CMakeLists.txt Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@pramodsatya pramodsatya left a comment

Choose a reason for hiding this comment

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

Thanks for the feedback @aditi-pandit, addressed the comments. Could you please take another look?

velox/functions/CMakeLists.txt Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
@pramodsatya pramodsatya marked this pull request as ready for review August 2, 2024 00:31
Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pramodsatya

velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.h Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.h Outdated Show resolved Hide resolved
velox/functions/tests/FunctionRegistryTest.cpp Outdated Show resolved Hide resolved
@pramodsatya pramodsatya changed the title Add FunctionRegistry APIs to retrieve function metadata. Expose helper functions to retrieve registered functions from FunctionRegistry Aug 3, 2024
Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pramodsatya. This is looking very good to close.

velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.h Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@pramodsatya pramodsatya left a comment

Choose a reason for hiding this comment

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

Thanks @aditi-pandit, addressed the comments, could you please take another look?

velox/functions/FunctionRegistry.h Outdated Show resolved Hide resolved
@czentgr
Copy link
Collaborator

czentgr commented Aug 6, 2024

Moved it back to CoverageUtil, but now velox_function_registry would have a dependency on velox_coverage_util, and this results in a circular dependency between them. It doesn't appear to be causing any issues but I would prefer to avoid this.

Yes, you don't want a circular dependency. Building the Velox library statically will work but building it as a dynamic library is then broken due to the circular dependency.

@pramodsatya pramodsatya force-pushed the get_fn_metadata branch 2 times, most recently from 506891a to 54f667a Compare August 6, 2024 23:49
Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

@pramodsatya : The PR is looking good minus the issues with the isCompanionFunctionName function.

velox/functions/CoverageUtil.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/CoverageUtil.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.h Outdated Show resolved Hide resolved
velox/functions/tests/FunctionRegistryTest.cpp Outdated Show resolved Hide resolved
velox/functions/tests/FunctionRegistryTest.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@pramodsatya pramodsatya left a comment

Choose a reason for hiding this comment

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

Thanks @aditi-pandit, addressed the comments. Could you please take another look?

velox/functions/CoverageUtil.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pramodsatya. Changes look good.

@Yuhta Yuhta requested a review from mbasmanova August 15, 2024 16:10
velox/functions/FunctionRegistry.h Outdated Show resolved Hide resolved
@pramodsatya pramodsatya force-pushed the get_fn_metadata branch 2 times, most recently from 8bdded7 to 2b18863 Compare August 27, 2024 03:08
@pramodsatya pramodsatya changed the title Expose helper functions to retrieve registered functions from FunctionRegistry Modify FunctionRegistry APIs to retrieve function metadata for coverage map Aug 27, 2024
velox/exec/Aggregate.cpp Outdated Show resolved Hide resolved
velox/exec/WindowFunction.cpp Outdated Show resolved Hide resolved
velox/functions/CoverageUtil.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.cpp Outdated Show resolved Hide resolved
velox/functions/FunctionRegistry.h Outdated Show resolved Hide resolved
@pramodsatya
Copy link
Collaborator Author

Thanks for the feedback @aditi-pandit. @czentgr suggested that because this API modification is centered around detecting and removing companion functions, it would be better to include information about whether a function is a companion function in it's metadata. Since the concept of companion functions is specific to velox and not prestissimo, it would be better to get this information from the velox function metadata and detect companion functions from the function metadata in prestissimo (and handle them as per the requirement in prestissimo). This also helps avoid a dependency on velox_exec in velox_function_registry, and detect companion functions in a cleaner manner instead of gathering this information by finding specific substrings in the registered function name.

I have updated the PR accordingly to include companion function information in the function metadata (in VectorFunctionMetadata for vector functions, in AggregateFunctionMetadata for aggregates, and in WindowFunction::Metadata for window functions). Could you please help review the updated changes and share if this approach is fine, @aditi-pandit @mbasmanova ?

@pramodsatya pramodsatya changed the title Modify FunctionRegistry APIs to retrieve function metadata for coverage map Add isCompanionFunction to function metadata Aug 27, 2024
Copy link
Collaborator

@czentgr czentgr left a comment

Choose a reason for hiding this comment

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

Thanks, looks good now.

@@ -413,10 +423,11 @@ bool CompanionFunctionsRegistrar::registerMergeExtractFunction(

auto mergeExtractFunctionName =
CompanionSignatures::mergeExtractFunctionName(name);
return registerAggregateFunction(
return registerMergeExtractFunctionImpl(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe rename to registerMergeExtractFunctionInternal.

@aditi-pandit
Copy link
Collaborator

@pramodsatya. @czentgr : This is a reasonable solution as well, if we are okay exposing companion function concept to the services using Velox.

With the other API to return all functions with a boolean parameter to say 'skipInternalFunctions' a single function could be used to skip all companion or any other internal functions added by the Velox framework.

@mbasmanova : wdyt ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants