-
Notifications
You must be signed in to change notification settings - Fork 980
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
DRILL-8393: Allow parameters to be passed to headers through SQL in WHERE clause #2747
Conversation
in WHERE clause. Use the params configuration item to control what parameters are allowed in, passing them into the body and header depending on the prefix.
the WHERE clause. Add request header related unit tests. Modify the document.
@cgivre This is basically all I have to change, I'm not sure if this change is appropriate and what else I have to do. I'd love to hear your opinion. |
@LYCJeff |
@cgivre At this point, I can pass the unprefixed parameters in their place by default, the way they were. This minimizes the impact on existing users, except in the following cases. For example, the argument that the user passed into the request body was called In addition, a problem that had been fixed would reappear. The argument that is passed to the url path is also passed to the end of the url, which has been clearly distinguished since I changed it. Let me know if you think this is more friendly to existing users, then I'll move in this direction. |
Two ideas
|
@jnturton @cgivre That's a good idea without confusing old and new syntax, although it requires existing users to make small additions to the configuration. If it is acceptable to you, I will take some time to add a configuration item in the near future. |
@LYCJeff Thanks for making these changes. I have a few questions:
IE: SELECT ...
FROM api.foo
INNER JOIN dfs.`tail.csv` AS tail
ON tail.id = foo.id
WHERE tail.name = 'something' Do we know how this would be interpreted? |
@cgivre Well, we actually need to recognize If the SELECT ...
FROM api.foo
INNER JOIN dfs.`tail.csv` AS tail
ON tail.id=foo.id
WHERE `tail.name` = 'something' |
@LYCJeff Let's get this merged.
Once that's done, I'm good with merging. |
…nge the boolean to enableEnhancedParamSyntax. Make the default behavior what Drill currently does. Modify the document.
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.
Ok, This is looking good. Can you please add a few unit tests, or simply revert a few where the enhanced
mode is set to false
? Once that's done we're good to go.
I got a COVID. I'll fix it after I recover. |
@cgivre Is there anything else I should do for this PR? |
@LYCJeff Could you please rebase on current master. Other than that, LGTM +1. Sorry this took so long. |
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 +1
DRILL-8393: Allow parameters to be passed to headers through SQL in WHERE clause
Description
Allow parameters to be passed to headers through SQL in WHERE clause. Use the params configuration item to control what parameters are allowed in, passing them into the body and header depending on the prefix.
Config:
{ "url": "https://api.sunrise-sunset.org/json", "requireTail": false, "params": ["body.lat", "body.lng", "body.date", "header.header1"], "parameterLocation": "json_body" }
SQL Query:
Post body:
{ "lat": 36.7201600, "lng": -4.4203400, "date": "2019-10-02"}
Headers:
{ "header1": "value1", ……}
Documentation
The params configuration mode and SQL parameter passing mode need to be described in the document.
Testing
The params configuration and SQL in the original unit test have been changed and have passed this part of the unit test.