drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Challapalli (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-3613) Partition Pruning not taking effect when we use a round function and a cast on top of it
Date Thu, 06 Aug 2015 20:29:04 GMT
Rahul Challapalli created DRILL-3613:
----------------------------------------

             Summary: Partition Pruning not taking effect when we use a round function and
a cast on top of it
                 Key: DRILL-3613
                 URL: https://issues.apache.org/jira/browse/DRILL-3613
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
    Affects Versions: 1.1.0
            Reporter: Rahul Challapalli
            Assignee: Jinfeng Ni
             Fix For: 1.2.0


git.commit.id.abbrev=4d967ed

The below plan should only scan 2 files

{code}
explain plan for select columns[0], columns[1], columns[4], columns[10], columns[13] from
`/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring` where (dir0=cast(round(1993.11)
as integer) and dir1='oct') or (dir0=1994 and dir1='may');
+------+------+
| text | json |
+------+------+
| 00-00    Screen
00-01      Project(EXPR$0=[$0], EXPR$1=[$1], EXPR$2=[$2], EXPR$3=[$3], EXPR$4=[$4])
00-02        Project(EXPR$0=[$2], EXPR$1=[$3], EXPR$2=[$4], EXPR$3=[$5], EXPR$4=[$6])
00-03          SelectionVectorRemover
00-04            Filter(condition=[OR(AND(=($0, CAST(ROUND(1993.11)):INTEGER), =($1, 'oct')),
AND(=($0, 1994), =($1, 'may')))])
00-05              Project(dir0=[$0], dir1=[$2], ITEM=[ITEM($1, 0)], ITEM3=[ITEM($1, 1)],
ITEM4=[ITEM($1, 4)], ITEM5=[ITEM($1, 10)], ITEM6=[ITEM($1, 13)])
00-06                Scan(groupscan=[EasyGroupScan [selectionRoot=maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring,
numFiles=8, columns=[`dir0`, `dir1`, `columns`[0], `columns`[1], `columns`[4], `columns`[10],
`columns`[13]], files=[maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1991/oct/lineitemaj.tbl,
maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1992/oct/lineitemaj.tbl,
maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1996/oct/lineitemaj.tbl,
maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1994/may/lineitemae.tbl,
maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1994/oct/lineitemaj.tbl,
maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1993/oct/lineitemaj.tbl,
maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1997/oct/lineitemaj.tbl,
maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1995/oct/lineitemaj.tbl]]])
{code}

The above plan should only scan the below 2 files ideally
{code}
/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1994/may/lineitemae.tbl
/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1993/oct/lineitemaj.tbl
{code}

I tested with a different function below and the plan seems to be pruning properly
{code}
explain plan for select columns[0], columns[1], columns[4], columns[10], columns[13] from
`/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring` where (dir0=cast(abs(-1993)
as integer) and dir1='oct') or (dir0=1994 and dir1='may');
+------+------+
| text | json |
+------+------+
| 00-00    Screen
00-01      Project(EXPR$0=[$0], EXPR$1=[$1], EXPR$2=[$2], EXPR$3=[$3], EXPR$4=[$4])
00-02        Project(EXPR$0=[ITEM($1, 0)], EXPR$1=[ITEM($1, 1)], EXPR$2=[ITEM($1, 4)], EXPR$3=[ITEM($1,
10)], EXPR$4=[ITEM($1, 13)])
00-03          Scan(groupscan=[EasyGroupScan [selectionRoot=maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring,
numFiles=2, columns=[`dir0`, `dir1`, `columns`[0], `columns`[1], `columns`[4], `columns`[10],
`columns`[13]], files=[maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1994/may/lineitemae.tbl,
maprfs:/drill/testdata/partition_pruning/hive/text/lineitem_hierarchical_intstring/1993/oct/lineitemaj.tbl]]])
{code}



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

Mime
View raw message