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

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

arina-ielchiieva opened a new pull request #1318: DRILL-6489: Fix filter push 
down for Hbase & Mapr-DB binary tables when convert function is used in a view
URL: https://github.com/apache/drill/pull/1318
 
 
   Details in [DRILL-6489](https://issues.apache.org/jira/browse/DRILL-6489).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Fix filter push down for Hbase & Mapr-DB binary tables when convert function 
> is used in a view
> ----------------------------------------------------------------------------------------------
>
>                 Key: DRILL-6489
>                 URL: https://issues.apache.org/jira/browse/DRILL-6489
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Storage - HBase, Storage - MapRDB
>    Affects Versions: 1.13.0
>            Reporter: Arina Ielchiieva
>            Assignee: Arina Ielchiieva
>            Priority: Major
>             Fix For: 1.14.0
>
>
> Query
> {noformat}
> select convert_from(byte_substr(row_key, 1, 8), 'date_epoch_be') as d 
> from hbase.`t` 
> where convert_from(byte_substr(row_key, 1, 8), date_epoch_be') = date 
> '2015-06-13';
> {noformat}
> returns plan with the push down:
> {noformat}
> 00-00    Screen
> 00-01      Project(d=[CONVERT_FROMDATE_EPOCH_BE(BYTE_SUBSTR($0, 1, 8))])
> 00-02        Scan(groupscan=[HBaseGroupScan [HBaseScanSpec=HBaseScanSpec 
> [tableName=TestTableCompositeDate, startRow=\x00\x00\x01M\xEA7D\x00, 
> stopRow=\x00\x00\x01M\xEF]\xA0\x00, filter=null], columns=[`row_key`]]])
> {noformat}
> While the same query in a view does not:
> {noformat}
> create view dfs.tmp.v as select convert_from(byte_substr(row_key, 1, 8), 
> 'date_epoch_be') as d from hbase.`t`;
> select d from dfs.tmp.v where d = date '2015-06-13';
> {noformat}
> {noformat}
> 00-00    Screen
> 00-01      Project(d=[CONVERT_FROMDATE_EPOCH_BE(BYTE_SUBSTR($0, 1, 8))])
> 00-02        SelectionVectorRemover
> 00-03          Filter(condition=[=(CONVERT_FROMDATE_EPOCH_BE(BYTE_SUBSTR($0, 
> 1, 8)), 2015-06-13)])
> 00-04            Scan(groupscan=[HBaseGroupScan [HBaseScanSpec=HBaseScanSpec 
> [tableName=TestTableCompositeDate, startRow=null, stopRow=null, filter=null], 
> columns=[`row_key`]]])
> {noformat}
> The problem that {{CompareFunctionsProcessor}} waits for 
> {{ConvertExpression}} but receives {{FunctionCall}} with convert function. If 
> convert function first appears in filter it is re-presented as 
> {{ConvertExpression}} (case without view). If convert function first appears 
> in select is re-presented as {{FunctionCall}} for convert function (case with 
> view). The reason of such difference is the appliance of the 
> {{PreProcessLogicalRel}} visitor. The solution in this case would be to check 
> {{FunctionCall}} in CompareFunctionsProcessor}} and if this function call for 
> convert from function, process it as {{ConvertExpression}}.
> https://github.com/apache/drill/blob/master/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/CompareFunctionsProcessor.java#L171
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java#L667



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to