A Bug in Hive partition prune

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.