Enforcing procedure name args only#10545
Conversation
There was a problem hiding this comment.
I believe this is a departure from the SQL spec, but I'd need to check the document.
There was a problem hiding this comment.
Ok Thx, let me know can we proceed with that. This is limiting spec, but i think in resonable way within its boundries.
There was a problem hiding this comment.
What's the motivation for this? Why would we ever need it?
There was a problem hiding this comment.
In case when we have all arguments optional and logic is dependent on set non-required arguments.
This would not cause backward compatibility issues if we will ever decide some new argument is added or required. Only documentation would need to be update.
Perfect example is current flush_metadata_cache procedure.
For now we allow below use cases
USE example_catalog.some_schema;
# Clear all caches in catalog 'example_catalog' for all schema
system.flush_metadata_cache();
# Clear all caches for specific partition 'partition_column=partition_value'
# in table 'example_catalog.example_schema.example_table'
system.flush_metadata_cache(
schema_name => 'example_schema',
table_name => 'example_table',
partition_columns => ARRAY['partition_column'],
partition_values => ARRAY['partition_value']
);But at some point we might extend scope to
USE example_catalog.some_schema;
# Clear all caches for specific schema 'example_catalog.example_schema'
system.flush_metadata_cache(
schema_name => 'example_schema'
);
# Clear all caches for specific table 'example_catalog.example_schema.example_table'
system.flush_metadata_cache(
schema_name => 'example_schema',
table_name => 'example_table'
);Maybe even other use cases which are hard to predict at the moment.
CC: @findepi
82016c9 to
d22613a
Compare
2633e67 to
a7aa8bc
Compare
core/trino-spi/src/main/java/io/trino/spi/procedure/Procedure.java
Outdated
Show resolved
Hide resolved
a7aa8bc to
5a309c1
Compare
1645d56 to
15f3170
Compare
15f3170 to
c05afbd
Compare
c05afbd to
0cebc5d
Compare
|
@martint is there any update on this. Should i close this PR ? |
@martint any update around your concern here #10545 (comment) |
0cebc5d to
0130296
Compare
ce40322 to
f67cb85
Compare
There was a problem hiding this comment.
Wow, that was a clever workaround. Glad that it's gone :D
Also we are not disallowing using positional arguments at all. It's just one procedure definition that disallows it's usage. |
From what I see the given procedure was already like that, it already required named arguments. We just remove hack and have dedicated support for such procedures. @martint let me know if you have any more comments, otherwise I would like to merge it |
martint
left a comment
There was a problem hiding this comment.
One minor comment. Otherwise it looks good, and I'm ok with the change.
There was a problem hiding this comment.
Rename to requiresNamedArguments
376f2b0 to
4c1cc99
Compare
|
Merged, thanks! |
|
Hey, do we think this needs a release note, or is it just better and more clear error handling? cc @kokosing |
|
@colebow my opinion is that is just internal mechanics. |
Enforcing using named arguments when calling procedure