[
https://issues.apache.org/jira/browse/DRILL-3702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jinfeng Ni updated DRILL-3702:
------------------------------
Attachment: 0001-DRILL-3702-Fix-partition-pruning-rule-when-the-pruni.patch
> PartitionPruning hit ClassCastException in Interpreter when the pruning
> filter expression is of non-nullable type.
> ------------------------------------------------------------------------------------------------------------------
>
> Key: DRILL-3702
> URL: https://issues.apache.org/jira/browse/DRILL-3702
> Project: Apache Drill
> Issue Type: Bug
> Components: Query Planning & Optimization
> Reporter: Jinfeng Ni
> Assignee: Jinfeng Ni
> Fix For: 1.2.0
>
> Attachments:
> 0001-DRILL-3702-Fix-partition-pruning-rule-when-the-pruni.patch
>
>
> I have the following parquet table, created using partition by clause:
> {code}
> create table mypart (id, name) partition by (id) as select cast(n_regionkey
> as varchar(20)), n_name from cp.`tpch/nation.parquet`;
> {code}
> The generated parquet table consists of 5 files, each representing a
> partition:
> {code}
> 0_0_1.parquet 0_0_2.parquet 0_0_3.parquet 0_0_4.parquet 0_0_5.parquet
> {code}
> For the following query, partition pruning works as expected:
> {code}
> select id, name from mypart where id = '0' ;
> 00-01 Project(id=[$1], name=[$0])
> 00-02 Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath
> [path=/tmp/mypart/0_0_1.parquet]], selectionRoot=file:/tmp/mypart,
> numFiles=1, columns=[`id`, `name`]]])
> "selectionRoot" : "file:/tmp/mypart",
> "fileSet" : [ "/tmp/mypart/0_0_1.parquet" ],
> "cost" : 5.0
> {code}
> However, the following query would hit ClassCastException when PruneScanRule
> calls interpreter to evaluate the filtering condition, which happens to be
> non-nullable.
> {code}
> select id, name from mypart where concat(id,'') = '0' ;
> 00-05 Project(id=[$1], name=[$0])
> 00-06 Scan(groupscan=[ParquetGroupScan
> [entries=[ReadEntryWithPath [path=file:/tmp/mypart]],
> selectionRoot=file:/tmp/mypart, numFiles=1, columns=[`id`, `name`]]])
> "selectionRoot" : "file:/tmp/mypart",
> "fileSet" : [ "/tmp/mypart/0_0_1.parquet", "/tmp/mypart/0_0_4.parquet",
> "/tmp/mypart/0_0_5.parquet", "/tmp/mypart/0_0_2.parquet",
> "/tmp/mypart/0_0_3.parquet" ],
> "cost" : 25.0
> },
> {code}
> Here is the error for the ClassCastException, raised in Interpreter:
> {code}
> java.lang.ClassCastException: org.apache.drill.exec.expr.holders.BitHolder
> cannot be cast to org.apache.drill.exec.expr.holders.NullableBitHolder
> {code}
> The cause of the problem is that PruneScanRule assumes the output type of a
> filter condition is NullableBit, while in this case the filter condition is
> Bit type, which leads to ClassCastException.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)