[ 
https://issues.apache.org/jira/browse/DRILL-8393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17700914#comment-17700914
 ] 

ASF GitHub Bot commented on DRILL-8393:
---------------------------------------

LYCJeff commented on PR #2747:
URL: https://github.com/apache/drill/pull/2747#issuecomment-1471106650

   > @LYCJeff Thanks for making these changes. I have a few questions:
   > 
   > 1. Are you certain that these filters are in fact being pushed down as 
intended?
   > 2. I'm really concerned about what would happen if a user aliased a data 
source as `header` or `tail`.
   > 
   > IE:
   > 
   > ```sql
   > 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?
   
   Well, we actually need to recognize `header.xxx` as a whole parameter name, 
so we need to use back quotes. Only then can it be pushed normally, so these 
prefixes are not confused with data source aliases.
   
   If the `name` in your example above is an argument to the `foo` api, it 
should be written as follows.
   
   ```sql
   SELECT ...
   FROM api.foo
   INNER JOIN dfs.`tail.csv` AS tail
   ON tail.id=foo.id
   WHERE `tail.name` = 'something'
   ```




> Allow parameters to be passed to headers through SQL in WHERE clause
> --------------------------------------------------------------------
>
>                 Key: DRILL-8393
>                 URL: https://issues.apache.org/jira/browse/DRILL-8393
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Storage - HTTP
>    Affects Versions: 1.20.0
>            Reporter: Yuchen Liang
>            Priority: Major
>
> Some APIs require parameters (e.g. digital signature) in the headers to be 
> generated at access time.So I'm wondering if we can pass it in through filter 
> statement.
> Perhaps we could design it like the params field in connections parameter. 
> For example:
>  
> Config:
> { "url": "https://api.sunrise-sunset.org/json";, "requireTail": false, 
> "params": ["body.lat", "body.lng", "body.date", "header.header1"], 
> "parameterLocation": "json_body" }
>  
> SQL Query:
> SELECT * FROM api.sunrise
> WHERE `body.lat` = 36.7201600
> AND `body.lng` = -4.4203400
> AND `body.date` = '2019-10-02'
> AND `header.header1` = 'value1';
>  
> Post body:
> { "lat": 36.7201600, "lng": -4.4203400, "date": "2019-10-02"}
>  
> Headers:
> { "header1": "value1", ……}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to