Skip to content

Conversation

rschlussel
Copy link
Contributor

@rschlussel rschlussel commented Apr 18, 2023

This feature was broken by #16699, which no longer added the new temporary functions to the QueryStateMachine. It has been completely broken since release 0.269. This commit basically reverts those changes for CREATE/DROP FUNCTION.

Test plan - fixed unit tests and also tested locally with the CLI

presto> CREATE TEMPORARY FUNCTION foo() RETURNS int RETURN 1;
CREATE FUNCTION
presto> SELECT foo();
 _col0 
-------
     1 
(1 row)

presto> CREATE TEMPORARY FUNCTION foo() RETURNS int RETURN 1;
Query 20230418_200502_00002_qud78 failed: Session function presto.session.foo() has already been defined
presto> DROP TEMPORARY FUNCTION foo;
DROP FUNCTION
presto> CREATE TEMPORARY FUNCTION foo() RETURNS int RETURN 1;
CREATE FUNCTION


== RELEASE NOTES ==

General Changes
* Fix ``CREATE TEMPORARY FUNCTION`` and ``DROP TEMPORARY FUNCTION``, which have not worked since release 0.269.  This also removes ``CREATE FUNCTION`` and ``DROP FUNCTION`` support from Presto-on-Spark

@rschlussel rschlussel force-pushed the fix-temporary-function branch from d683b7b to f160d11 Compare April 18, 2023 20:38
@rschlussel
Copy link
Contributor Author

@pranjalssh @ClarenceThreepwood I think the combo of your PRs (removing original expression and subquery improvements)is causing test failures : https://github.com/prestodb/presto/actions/runs/4736766457/jobs/8408722176?pr=19429

@rschlussel rschlussel marked this pull request as ready for review April 18, 2023 21:38
@rschlussel rschlussel requested a review from a team as a code owner April 18, 2023 21:38
@rschlussel rschlussel force-pushed the fix-temporary-function branch from f160d11 to 05286cb Compare April 20, 2023 16:03
This was broken by prestodb#16699 and has
not worked since release 0.268.  The CreateFunctionTask and
DropFunctionTask should be adding functions directly to the
QueryStateMachine rather than keeping a special map in the task. This
commit basically reverts the changes that prestodb#16699 introduced for create
and drop function.
@rschlussel rschlussel force-pushed the fix-temporary-function branch from 05286cb to 0363c8a Compare April 20, 2023 17:05
@pranjalssh
Copy link
Contributor

pranjalssh commented Apr 20, 2023

Why did we remove support from presto-on-spark. Is it because of lack of a proper APIs there(like state machine) making it hard to implement?

Edit: just saw the breaking PR. I get it now.

builder.put(DropMaterializedView.class, QueryType.DATA_DEFINITION);
builder.put(CreateFunction.class, QueryType.DATA_DEFINITION);
builder.put(CreateFunction.class, QueryType.CONTROL);
builder.put(AlterFunction.class, QueryType.DATA_DEFINITION);
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually wonder if we should move AlterFunction as well to Control types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i thought about it, but it doesn't use session because there's no support for temporary functions. It's only the temporary functions really that need the control type, but they're bundled up together. Ideally temporary functions would be split out, but that's a much bigger change and wasn't worth the bother right now.

@rschlussel rschlussel merged commit 76854b9 into prestodb:master Apr 20, 2023
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.

3 participants