[ 
https://issues.apache.org/jira/browse/HIVE-30159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on HIVE-30159 started by Mahesh Raju Somalaraju.
-----------------------------------------------------
> SharedWorkOptimizer removes the only ReduceSink of a work, query fails with 
> "cannot find field key from [0:_col0, 1:_col1, 2:_col2]
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-30159
>                 URL: https://issues.apache.org/jira/browse/HIVE-30159
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>            Reporter: Mahesh Raju Somalaraju
>            Assignee: Mahesh Raju Somalaraju
>            Priority: Major
>
> A query that compiles fine fails at runtime when the Map task initializes its 
> operators:                                                                    
>                                             
>                                                                               
>                                     
>   Vertex failed, vertexName=Map 10, vertexId=vertex_1791813272617_0001_3_03, 
> diagnostics=[Task failed,                              
>   taskId=task_1791813272617_0001_3_03_000000, diagnostics=[TaskAttempt 0 
> failed, info=[Error: Error while running task ( failure ) :
>   java.lang.RuntimeException: java.lang.RuntimeException: Map operator 
> initialization failed                                        
>         at 
> org.apache.hadoop.hive.ql.exec.tez.TezProcessor.initializeAndRunProcessor(TezProcessor.java:342)
>                          
>         at 
> org.apache.hadoop.hive.ql.exec.tez.TezProcessor.run(TezProcessor.java:277)    
>                                            
>         at 
> org.apache.tez.runtime.LogicalIOProcessorRuntimeTask.run(LogicalIOProcessorRuntimeTask.java:381)
>                          
>         ...                                                                   
>                                                       
>   Caused by: java.lang.RuntimeException: Map operator initialization failed   
>                                                       
>         at 
> org.apache.hadoop.hive.ql.exec.tez.MapRecordProcessor.init(MapRecordProcessor.java:355)
>                                   
>         at 
> org.apache.hadoop.hive.ql.exec.tez.TezProcessor.initializeAndRunProcessor(TezProcessor.java:293)
>                          
>         ... 15 more                                                           
>                                                       
>   Caused by: java.lang.RuntimeException: cannot find field key from [0:_col0, 
> 1:_col1, 2:_col2]                                     
>         at 
> org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.getStandardStructFieldRef(ObjectInspectorUtils.java:55
>         at 
> org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector.getStructFieldRef(StandardStructObjectInspect
>   a:154)                                                                      
>                                                       
>         at 
> org.apache.hadoop.hive.ql.exec.ExprNodeColumnEvaluator.initialize(ExprNodeColumnEvaluator.java:81)
>                        
>         at 
> org.apache.hadoop.hive.ql.exec.GroupByOperator.initializeOp(GroupByOperator.java:223)
>                                     
>         at 
> org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:361)         
>                                            
>         at 
> org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:550)         
>                                            
>         at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:504) 
>                                            
>         at 
> org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:370)         
>                                            
>         ...                                                                   
>                                                       
>         at 
> org.apache.hadoop.hive.ql.exec.tez.MapRecordProcessor.init(MapRecordProcessor.java:336)
>                                   
>         ... 16 more 
>  
>  
> +*Steps to reproduce*+                                                        
>                                                     
>                                                                               
>              
>    set hive.auto.convert.join=true;                                           
>                                                       set 
> hive.stats.column.autogather=false;                                           
>                                        set 
> hive.tez.dynamic.partition.pruning.max.data.size=1000000;                     
>                                                                               
>                                                            
>   create table ctrl (ctrl_dt string);                                         
>                                                     
>   create table event_hist (user_id string) partitioned by (biz_dt string);    
>                                                                               
>                                                                
>   insert into ctrl values ('2026-10-07');                                     
>                                                   insert into event_hist 
> partition (biz_dt='2026-10-07') values ('u1'), ('u2'), (null);                
>                                                                               
>                                           
>   alter table event_hist partition (biz_dt='2026-10-07') update statistics 
> set('numRows'='23911','rawDataSize'='104884811');                             
>                                          
> with prc_sts as (                                                             
>                                                     
>     select distinct a.ctrl_dt data_dt, b.prc_dttm, b.prc_user                 
>                                       from ctrl a left join (select 'x' 
> prc_dttm, 'y' prc_user) b on 'A' = 'A'                                 
>   ),                                                                          
>                                                       
>   eom_dt as (                                                                 
>                                                       
>     select biz_dt eom_dt from event_hist where biz_dt in (select data_dt from 
> prc_sts)   
>   ),                                                                          
>                                                       
>   pop as (                                                                    
>                                                       
>     select e.user_id, e.biz_dt                                                
>                                                       
>     from event_hist e                                                         
>                                                       
>     where e.biz_dt in (select eom_dt from eom_dt) and e.user_id is null       
>                        
>     union all                                                                 
>                                                       
>     select cast(count * as string), e.biz_dt                                  
>                                             
>     from event_hist e                                                         
>                                                       
>     where e.biz_dt in (select eom_dt from eom_dt) and e.user_id is not null   
>                     
>     group by e.biz_dt                                                         
>                                                       
>   )   
>  
> select count *, p.prc_dttm, p.prc_user, d.biz_dt  from pop d left join 
> prc_sts p on 'A' = 'A'  group by d.biz_dt, p.prc_dttm, p.prc_user;            
>                                                                               
>                                                                               
>                        
>                                                                               
>                                                       
>  +*Expected result:*+ {{{}2  x  y  2026-10-07{}}}.
> +*Actual result:*+ the vertex fails with the exception above.
>  



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to