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

Khurram Faraaz commented on DRILL-1522:
---------------------------------------

Can someone please confirm this behavior ?

In this case the filter is pushed down to the Scan, which is correct.

{code}
0: jdbc:drill:schema=dfs.tmp> explain plan for select 
convert_from(voter.onecf.name, 'UTF8') from voter where 
convert_from(voter.onecf.name, 'UTF8') = 'tom underhill';
+------+------+
| text | json |
+------+------+
| 00-00    Screen
00-01      UnionExchange
01-01        Project(EXPR$0=[CONVERT_FROMUTF8($0)])
01-02          Project(ITEM=[ITEM($0, 'name')])
01-03            Scan(groupscan=[HBaseGroupScan [HBaseScanSpec=HBaseScanSpec 
[tableName=voter, startRow=, stopRow=, filter=SingleColumnValueFilter (onecf, 
name, EQUAL, tom underhill)], columns=[`onecf`.`name`]]])
{code}

In this case we have a Filter after the project, is this expected behavior ?

{code}
0: jdbc:drill:schema=dfs.tmp> explain plan for select 
convert_from(voter.onecf.name, 'UTF8') from voter where 
convert_from(voter.onecf.name, 'UTF8') = 'tom underhill' AND row_key=10;
+------+------+
| text | json |
+------+------+
| 00-00    Screen
00-01      UnionExchange
01-01        Project(EXPR$0=[CONVERT_FROMUTF8($1)])
01-02          SelectionVectorRemover
01-03            Filter(condition=[AND(=(CONVERT_FROM($1, 'UTF8'), 'tom 
underhill'), =($0, 10))])
01-04              Project(row_key=[$1], ITEM=[ITEM($0, 'name')])
01-05                Scan(groupscan=[HBaseGroupScan 
[HBaseScanSpec=HBaseScanSpec [tableName=voter, startRow=, stopRow=, 
filter=SingleColumnValueFilter (onecf, name, EQUAL, tom underhill)], 
columns=[`row_key`, `onecf`.`name`]]])
{code}

In the below case, the use of CONVERT_FROM(ROW_KEY,'UTF8') in the predicate 
does not lead the Filter to be pushed down into the Scan operator. This is seen 
on Drill master 69c73af5

{code}
0: jdbc:drill:schema=dfs.tmp> explain plan for select 
convert_from(voter.onecf.name, 'UTF8') from voter where 
convert_from(voter.onecf.name, 'UTF8') = 'tom underhill' AND 
CONVERT_FROM(ROW_KEY,'UTF8')=10;
+------+------+
| text | json |
+------+------+
| 00-00    Screen
00-01      UnionExchange
01-01        Project(EXPR$0=[CONVERT_FROMUTF8($1)])
01-02          SelectionVectorRemover
01-03            Filter(condition=[AND(=(CONVERT_FROM($1, 'UTF8'), 'tom 
underhill'), =(CONVERT_FROM($0, 'UTF8'), 10))])
01-04              Project(row_key=[$1], ITEM=[ITEM($0, 'name')])
01-05                Scan(groupscan=[HBaseGroupScan 
[HBaseScanSpec=HBaseScanSpec [tableName=voter, startRow=, stopRow=, 
filter=SingleColumnValueFilter (onecf, name, EQUAL, tom underhill)], 
columns=[`row_key`, `onecf`.`name`]]])
{code}

> Hbase convert_from queries are not pushed down
> ----------------------------------------------
>
>                 Key: DRILL-1522
>                 URL: https://issues.apache.org/jira/browse/DRILL-1522
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Storage - HBase
>    Affects Versions: 0.6.0
>            Reporter: Krystal
>            Assignee: Aditya Kishore
>            Priority: Minor
>             Fix For: 1.4.0
>
>
> git.commit.id.abbrev=5c220e3
> The following hbase query contains the convert_from function but was not 
> being pushed down.
> 0: jdbc:drill:schema=hbase> explain plan for select 
> convert_from(voter.onecf.name, 'UTF8') from voter where row_key=10;
> | {
>   "head" : {
>     "version" : 1,
>     "generator" : {
>       "type" : "ExplainHandler",
>       "info" : ""
>     },
>     "type" : "APACHE_DRILL_PHYSICAL",
>     "options" : [ ],
>     "queue" : 0,
>     "resultMode" : "EXEC"
>   },
>   "graph" : [ {
>     "pop" : "hbase-scan",
>     "@id" : 5,
>     "hbaseScanSpec" : {
>       "tableName" : "voter",
>       "startRow" : "",
>       "stopRow" : "",
>       "serializedFilter" : null
>     },



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to