-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 support for WITH SESSION clause #24889
Conversation
|
7eed9a9
to
b8110ef
Compare
@martint disregard last comment, I've managed to figure it out. I'll push it shortly. |
56ec4c4
to
78f05fd
Compare
core/trino-main/src/main/java/io/trino/testing/MaterializedResult.java
Outdated
Show resolved
Hide resolved
78f05fd
to
cb7d2b2
Compare
core/trino-main/src/test/java/io/trino/sql/query/TestInlineSessionProperties.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/sql/query/TestInlineSessionProperties.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/sql/query/TestInlineSessionProperties.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the expectation if client submit multiple statements? For example:
WITH
SESSION s1=v1, s2=v2
SELECT 1;
WITH
SESSION s1=update_v1
SELECT 2;
core/trino-main/src/main/java/io/trino/testing/MaterializedResult.java
Outdated
Show resolved
Hide resolved
core/trino-grammar/src/main/antlr4/io/trino/grammar/sql/SqlBase.g4
Outdated
Show resolved
Hide resolved
core/trino-parser/src/main/java/io/trino/sql/tree/SessionProperty.java
Outdated
Show resolved
Hide resolved
core/trino-parser/src/test/java/io/trino/sql/parser/TestSqlParser.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/sql/query/TestSessionProperties.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java
Show resolved
Hide resolved
plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/AbstractTestEngineOnlyQueries.java
Outdated
Show resolved
Hide resolved
@chenjian2664 the WITH SESSION applies to a single query (it's query scoped):
|
cb7d2b2
to
4afe3c8
Compare
4afe3c8
to
536ce18
Compare
@sajjoseph you can find this interesting :) |
Absolutely! This will be really useful as we can embed the session variables in SQL itself. Thanks for this feature. |
@sajjoseph yes, I was thinking about these use cases :) |
I just realized this change makes the following syntax valid, even though it should fail:
|
Add support for WITH SESSION clause:
The syntax with both sessions and SQL functions:
Supersedes #23474
Round 4 :)