-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support SET key=value syntax #9017
Conversation
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.
LGTM otherwise
pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
Outdated
Show resolved
Hide resolved
return options; | ||
} | ||
|
||
private static void setOptions(PinotQuery pinotQuery, List<String> optionsStatements) { |
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.
Is this still used?
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.
yes it is for backward compatibility will remove once the OPTION_REGEX is removed.
pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #9017 +/- ##
============================================
- Coverage 70.08% 66.85% -3.24%
+ Complexity 4957 4766 -191
============================================
Files 1827 1369 -458
Lines 96064 69842 -26222
Branches 14356 10912 -3444
============================================
- Hits 67327 46693 -20634
+ Misses 24092 19864 -4228
+ Partials 4645 3285 -1360
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
} | ||
if (sqlType == null) { | ||
throw new SqlCompilationException("SqlNode with statement not found!"); |
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.
Should we check that there has to be exactly 1 query/DQL statement unless it was an INSERT call ?
SET skipUpsert = 'false';
The above has no query statement but just the option SET which by alone is meaningless ?
Assert.assertEquals(pinotQuery.getQueryOptions().get("foo"), "1234"); | ||
Assert.assertEquals(pinotQuery.getQueryOptions().get("bar"), "'potato'"); | ||
|
||
// test invalid options |
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.
Can you also add a test where you have 2 DQL statements and 0 or more SET statements ?
Background
context: #8906
Description
This PR introduces a new way to set environmental options for executing a SQL query on Pinot.
Syntax examples for single and multiple environment options:
Details
;
at the end of the SET statement indicate it is an end of a statement; However, Pinot doesn't support multiple statements, thus allSET
statement(s) are only valid within the SQL query string context.ALTER SESSION SET key = 'value';
and then executing another query won't affect the query.SET
statements within a single query string