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

[native] Retrieve Json function metadata for prestissimo functions #22332

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

pramodsatya
Copy link
Contributor

@pramodsatya pramodsatya commented Mar 26, 2024

Motivation and Context

For fail fast function validation in Prestissimo, the coordinator needs to know the list of function signatures that are supported by Prestissimo. This is so we can validate during parsing and analysis that a function is supported. In order to expose this, a new HTTP method is added that returns the function signatures supported by the Prestissimo worker.

The format of the functions should be a map of name to function signature. Name is a simple string. Function signature is a JSON object which matches the format of JsonBasedUdfFunctionMetadata in the Java code. All functions currently come from Velox, hence we need to retrieve the list of supported functions in Velox. This map is translated to a format that conforms to JsonBasedUdfFunctionMetadata and is serialized to JSON for consumption by the Java coordinator.

Description

For full context, see #23000

This PR adds a http endpoint /v1/functions to the sidecar, which returns the list of function signatures conforming to format JsonBasedUdfFunctionMetadata for all the registered Presto native functions.

Test Plan

Unit tests are added in FunctionMetadataTest.cpp. E2E tests will be added in a followup PR

== NO RELEASE NOTE ==

@pramodsatya pramodsatya changed the title [WIP] [native] Retrieve Json function metadata for prestissimo functions [native] Retrieve Json function metadata for prestissimo functions Jun 7, 2024
@aditi-pandit
Copy link
Contributor

@pramodsatya : Please give more information about how this http method will be used in Presto server.

Copy link
Contributor 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 review comments. Could you please take another look?

Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

@pramodsatya Would you document the new endpoint somewhere in https://prestodb.io/docs/current/develop/worker-protocol.html ?

@tdcmeehan
Copy link
Contributor

@mbasmanova we have started to document our endpoints using OpenAPI, and eventually all sidecar endpoints (and, hopefully all Presto endpoints) will have corresponding OpenAPI documentation.

@mbasmanova
Copy link
Contributor

we have started to document our endpoints using OpenAPI, and eventually all sidecar endpoints (and, hopefully all Presto endpoints) will have corresponding OpenAPI documentation.

Sounds cool. Where can I see docs for the new endpoint?

Copy link
Contributor

@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 changes look good. Please add more test cases though... We should cover functions with different types, template parameters, array, map functions as well.

Copy link
Contributor

@steveburnett steveburnett 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 doc! Pulled branch and made a local docs build. Some nits of capitalization, everything else looks fine.

presto-docs/src/main/sphinx/develop/worker-protocol.rst Outdated Show resolved Hide resolved
presto-docs/src/main/sphinx/develop/worker-protocol.rst Outdated Show resolved Hide resolved
presto-docs/src/main/sphinx/develop/worker-protocol.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@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, I have a few comments.

@pramodsatya
Copy link
Contributor Author

Thanks, I have a few comments.

Thanks for the feedback @czentgr, I have addressed the comments. Could you please take another look?

@steveburnett
Copy link
Contributor

Hi @steveburnett, @tdcmeehan shared that the OpenAPI documentation for this endpoint will be added in: #23358 , so I reverted the previous documentation. Would that be fine?

Thanks @pramodsatya, I missed that! I thought there was probably a good reason for it that I had overlooked and didn't know what it was. Yes, that's fine with me, and I appreciate your explanation.

@aditi-pandit
Copy link
Contributor

@pramodsatya : Please can you rebase your code. I'll continue with the review then.

@pramodsatya pramodsatya force-pushed the fn_metadata branch 2 times, most recently from 4ed8961 to 56813d3 Compare August 22, 2024 21:46
@pramodsatya
Copy link
Contributor Author

@pramodsatya : Please can you rebase your code. I'll continue with the review then.

Thanks @aditi-pandit, rebased and fixed the CI failures.

- presto-main/src/main/java/com/facebook/presto/connector/system/SystemTransactionHandle.java
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree that there isn't particular organization in this file. But we should make it in alphabetical order. Will send out a PR for it.

@aditi-pandit
Copy link
Contributor

@pramodsatya : This code looks good.

@czentgr : Would be great if you did a pass as well. Will give approval once you give a heads-up.

Copy link
Contributor

@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.

One thought and one nit.

Copy link
Contributor 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 @czentgr @aditi-pandit. Consolidated the sidecar endpoints to a single function, also added a helper function to identify and exclude function signatures with unsupported Presto types (hugeint is currently unsupported in Presto). Could you please take another look?

presto-native-execution/presto_cpp/main/PrestoServer.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@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 : Have 2 minor comments. Rest is looking good.

Copy link
Contributor 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?

Copy link
Contributor

@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

Please can you also add a link to the documentation of the API.

@pdabre12
Copy link
Contributor

@aditi-pandit
The OpenAPI documentation for the endpoint should be added in this PR: #23358

@pramodsatya pramodsatya merged commit bba64ad into prestodb:master Oct 21, 2024
59 checks passed
@pramodsatya pramodsatya deleted the fn_metadata branch October 21, 2024 17:39
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.

7 participants