文档首页/
    
      
      MapReduce服务 MRS/
      
      
        
        
        组件操作指南(LTS版)(巴黎区域)/
        
        
        使用Hive/
        
        
        Hive常见问题/
        
      
      FusionInsight Hive使用WHERE条件查询超过3.2万分区的表报错
    
  
  
    
        更新时间:2022-12-14 GMT+08:00
        
          
          
        
      
      
      
      
      
      
      
      
  
      
      
      
        
FusionInsight Hive使用WHERE条件查询超过3.2万分区的表报错
问题
   Hive创建超过3.2万分区的表,执行带有WHERE分区的条件查询时出现异常,且“metastore.log”中打印的异常信息包含以下信息:
   
 Caused by: java.io.IOException: Tried to send an out-of-range integer as a 2-byte value: 32970
        at org.postgresql.core.PGStream.SendInteger2(PGStream.java:199)
        at org.postgresql.core.v3.QueryExecutorImpl.sendParse(QueryExecutorImpl.java:1330)
        at org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1601)
        at org.postgresql.core.v3.QueryExecutorImpl.sendParse(QueryExecutorImpl.java:1191)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:346)
  回答
带有分区条件的查询,Hiveserver会对分区进行优化,避免全表扫描,需要查询元数据符合条件的所有分区,而gaussDB中提供的接口sendOneQuery,调用的sendParse方法中对参数的限制为32767,如果分区条件数超过32767就异常。
   父主题: Hive常见问题