I ran a Hive query yesterday and found that the number of started maps is much larger than expected. It is strange that the query can be simply abstracted as follows:
For example, there is a table t partition key dt string; query select count (*) from t where dt = 20130926;
Where is the problem? First, let's take a look at the execution plan and find the problem:
First:
Expr: (dt = 2.0130926E7)
Type: boolean
Secondly, partition values is dt and _ HIVE_DEFAULT_PARTITION __
Should there be something like implicit conversion? Modify it to dt = '000000' and check whether it is correct.
It is common in RDBMS that indexes cannot be used due to implicit conversion. However, if implicit conversion is used, it cannot be implemented because only one partition is scanned but not all partitions are scanned, check the source code with such a question: the conclusion is that the partition key columns and values of Hive must be of the String type. If not, Hit may reach bug 4878 (pruneBySequentialScan ), I don't know why CDH4.2 does not have the merge patch.
This article is from "MIKE's old blog" blog, please be sure to keep this source http://boylook.blog.51cto.com/7934327/1302073