• Hive – partition table query failed when stored as parquet


    Hive is developed by Facebook to analyze and extract useful information from their huge data but now it is very popular in other organizations too such as Netflix and FINRA.

    Use-case:

    Now a days most of us are using different ways to optimize query or we can say to improve the performance of the Hive query. Out of which 2 most common techniques are:

    1. Partitioning
    2. Storing data in parquet format.

    Partitioning is very known concept to the folks who are processing/analyzing/aggregating their data thru Apache Hive and the Parquet file format incorporates several features that make it highly suited to data warehouse-style.

    But most of us are unaware of the fact that Apache hive does not support the query, when storing a partitioned table in parquet format and executing a query on partitioned column.

    Let’s have a detail look into it.

    Below is the pipe delimiter sample data present in HDFS which we will load into managed non-partitioned Hive table

    Below steps will create a managed hive table named “hive_emp1”.

    Loading data from HDFS into hive table (hive_emp1) which we have created in above steps.

    Take a look into data present in Hive table created above.

    We have few Males and 2 Females which are represented by ‘M’ and ‘F’ respectively in last column (sex).

    Now, we will create another table in hive name “hive_emp_dynpart”, which will be partitioned on 2 columns (dept and gender) and also data of this table will be stored in parquet format.

    Set the hive.exec.dynamic.partition to true and hive.exec.dynamic.partition.mode to nonstrict to load the data dynamically in hive table.

    We will insert the data from hive_emp1 table into hive_emp_dynpart table along with partitions too.

    Issue:

    While querying the hive_emp_dynpart table with one of the partition column, you will get the following error, for all other regular column it is working fine. 

    Those who are unable to see above screen, can refer to below statements for error.

    hive> select * from hive_emp_dynpart where gender = 'M';
    OK
    Failed with exception java.io.IOException:java.lang.IllegalArgumentException: Column [gender] was not found in schema!
    Time taken: 0.255 seconds

    Error Description:

    It is a known bug in Apache Hive (HIVE-11401) filtering option, when the partitioned was stored as Parquet.

    Resolution:

    A known workaround is to disable predicate pushdown by setting property hive.optimize.index.filter to false.

    Now query the table using same command.

    Conclusion:

    You need to set the property to false every time you execute the query.

    hive2.3.0 fix it: https://issues.apache.org/jira/browse/HIVE-15782


    正因为当初对未来做了太多的憧憬,所以对现在的自己尤其失望。生命中曾经有过的所有灿烂,终究都需要用寂寞来偿还。
  • 相关阅读:
    blog网页模版
    Sidebyside assembly
    几种hash算法
    [软件调试学习笔记]防止栈缓冲区溢出的基于Cookie的安全检查机制
    erlang注意(经典)
    erlang 的源代码保护机制(经典)
    erlang 的源代码保护机制(经典)
    java反编译工具jad
    erlang注意(经典)
    java反编译工具jad
  • 原文地址:https://www.cnblogs.com/candlia/p/11920260.html
Copyright © 2020-2023  润新知