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

chore: Remote fn runtime_preference() from TableFunc trait. #2288

Merged
merged 7 commits into from
Dec 27, 2023

Conversation

vrongmeal
Copy link
Contributor

We should only have 1 source of truth for runtime preference for the functions. Here, runtime_preference method is removed so the runtime is always calculated from detect_runtime.

Fixes #2165

We should only have 1 source of truth for runtime preference for the
functions. Here, `runtime_preference` method is removed so the runtime
is always calculated from `detect_runtime`.

Fixes #2165

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
EntryMeta meta = 1;
FunctionType func_type = 2;
RuntimePreference runtime_preference = 3;
reserved 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

since this isn't public do we need to reserve this? is there any harm in just removing?

Copy link
Member

Choose a reason for hiding this comment

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

This is tricky since these protos also have definitions that get written to disk, and so we have to be careful to make sure we're not clobbering something accidentally.

In this case, FunctionEntry is only sent over the network and never persisted, so removing the reserve would be fine. But it's on the programmer to know that this specific entry isn't serialized, but something like TunnelEntry is. Since we don't have a clear distinction, I think always being safe and reserving ids is the preferred action.

(Also when we reserve, we should make a comment on what it was previously just to provide context when we look back at it)

@@ -1302,10 +1302,10 @@ impl BuiltinCatalog {
let schema_id = schema_names
.get(DEFAULT_SCHEMA)
.ok_or_else(|| MetastoreError::MissingNamedSchema(DEFAULT_SCHEMA.to_string()))?;
let mut entry = func.as_function_entry(oid, *schema_id);
entry.runtime_preference = func.runtime_preference();

Copy link
Contributor

Choose a reason for hiding this comment

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

previously the only reason we needed different for loops for table_funcs() and scalar_funcs() was for the handling of runtime_preference. Since that is removed, we should follow up with cleaning up that logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will open another PR for this (since it would require some more review).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened #2305 just to keep a track.

_args: &[FuncParamValue],
_parent: RuntimePreference,
) -> Result<RuntimePreference> {
Ok(RuntimePreference::Remote)
Copy link
Contributor

Choose a reason for hiding this comment

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

tangent: but shouldn't this technically check the url path to detect the runtime? Same with a few of these other object store related ones.

The other ones have todo's so it's clear that it's not yet implemented. Can we add that same here? We should also open up an issue to properly detect the runtimes for these functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'll add a TODO here as well.

@vrongmeal vrongmeal enabled auto-merge (squash) December 26, 2023 09:04
@vrongmeal vrongmeal merged commit b5cec63 into main Dec 27, 2023
13 checks passed
@vrongmeal vrongmeal deleted the vrongmeal/function-stuff branch December 27, 2023 09:33
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.

Chore: Clarify where table functions run
4 participants