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

Rahul Challapalli commented on DRILL-4830:
------------------------------------------

Looks like it is independent of whether we have a view or not
{code}
explain plan for select l_orderkey from l_3level where dir0 = 2 and 
substr(dir1, 1, 2) = 'tw' and extract(day from dir2)=12;
+------+------+
| text | json |
+------+------+
| 00-00    Screen
00-01      Project(l_orderkey=[$3])
00-02        SelectionVectorRemover
00-03          Filter(condition=[AND(=($0, 2), =(substr($1, 1, 2), 'tw'), 
=(EXTRACT(FLAG(DAY), $2), 12))])
00-04            Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath 
[path=/drill/testdata/metadata_caching_pp/l_3level/2/two/2015-8-12/40.parquet], 
ReadEntryWithPath 
[path=/drill/testdata/metadata_caching_pp/l_3level/2/two/2015-9-12/50.parquet], 
ReadEntryWithPath 
[path=/drill/testdata/metadata_caching_pp/l_3level/2/two/2015-7-12/30.parquet]],
 selectionRoot=/drill/testdata/metadata_caching_pp/l_3level, numFiles=3, 
usedMetadataFile=true, 
cacheFileRoot=/drill/testdata/metadata_caching_pp/l_3level/2/two, 
columns=[`dir0`, `dir1`, `dir2`, `l_orderkey`]]])
{code}

> We are reading from sub-directory cache when we have a view
> -----------------------------------------------------------
>
>                 Key: DRILL-4830
>                 URL: https://issues.apache.org/jira/browse/DRILL-4830
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 1.8.0
>            Reporter: Rahul Challapalli
>         Attachments: l_3level.tgz
>
>
> git.commit.id.abbrev=f476eb5
> The below plan suggests we are not reading from the sub-directory cache file
> {code}
> create or replace view l1 as select dir0 num, substr(dir1, 1, 2) let, 
> extract(day from dir2) `day`, l_orderkey, l_partkey, l_suppkey, l_linenumber, 
> l_quantity, l_extendedorice, l_discount, l_tax from l_3level;
> +-------+----------------------------------------------------------------------+
> |  ok   |                               summary                               
>  |
> +-------+----------------------------------------------------------------------+
> | true  | View 'l1' replaced successfully in 'dfs.metadata_caching_pp' schema 
>  |
> +-------+----------------------------------------------------------------------+
> 1 row selected (0.355 seconds)
> explain plan for select num, let, `day`, l_orderkey from l2 where num=2 and 
> let='tw' and `day` = 12;
> +------+------+
> | text | json |
> +------+------+
> | 00-00    Screen
> 00-01      Project(num=[$0], let=[$1], day=[$2], l_orderkey=[$3])
> 00-02        Project(num=[$0], let=[SUBSTR($1, 1, 2)], 
> day=[EXTRACT(FLAG(DAY), $2)], l_orderkey=[$3])
> 00-03          SelectionVectorRemover
> 00-04            Filter(condition=[AND(=($0, 2), =(SUBSTR($1, 1, 2), 'tw'), 
> =(EXTRACT(FLAG(DAY), $2), 12))])
> 00-05              Scan(groupscan=[ParquetGroupScan 
> [entries=[ReadEntryWithPath 
> [path=/drill/testdata/metadata_caching_pp/l_3level/2/two/2015-8-12/40.parquet],
>  ReadEntryWithPath 
> [path=/drill/testdata/metadata_caching_pp/l_3level/2/two/2015-9-12/50.parquet],
>  ReadEntryWithPath 
> [path=/drill/testdata/metadata_caching_pp/l_3level/2/two/2015-7-12/30.parquet]],
>  selectionRoot=/drill/testdata/metadata_caching_pp/l_3level, numFiles=3, 
> usedMetadataFile=true, 
> cacheFileRoot=/drill/testdata/metadata_caching_pp/l_3level/2/two, 
> columns=[`dir0`, `dir1`, `dir2`, `l_orderkey`]]])
> {code}
> I attached the data set required.



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

Reply via email to