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

Riju Trivedi updated HIVE-29729:
--------------------------------
    Description: 
A query that applies an {{IS NOT NULL}} predicate above a sub-plan containing 
windowing ({{{}OVER(...){}}}) {{{}Project{}}}s fails at compile time during CBO 
planning with:
{code:java}
java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4  
at ...RegularImmutableList.get(RegularImmutableList.java:60)  
at org.apache.calcite.plan.RelOptUtil$2.visitInputRef(RelOptUtil.java:3181)  
at org.apache.calcite.rex.RexShuttle.visitFieldCollations(RexShuttle.java:186)  
at org.apache.calcite.rex.RexShuttle.visitWindow(RexShuttle.java:66)  
at org.apache.calcite.rex.RexShuttle.visitOver(RexShuttle.java:44)  
at org.apache.calcite.rex.RexOver.accept(RexOver.java:122)  ...  
at 
org.apache.calcite.plan.RelOptUtil.pushPastProjectUnlessBloat(RelOptUtil.java:3166)
  
at ...HiveRelOptUtil.pushPastProjectUnlessBloat(HiveRelOptUtil.java:737)  
at 
...HiveFilterProjectTransposeRule$RedundancyChecker.visit(HiveFilterProjectTransposeRule.java:341)
  ...{code}
This surfaces when {{hive.cbo.fallback.strategy=NEVER}} (the default since 
HIVE-27831). Before HIVE-27831 the default was {{{}CONSERVATIVE{}}}, which 
silently retried the failed CBO plan via the non-CBO path and masked the 
exception.

  was:
When CBO plans a query where an {{IS NOT NULL}} predicate sits above a sub-plan 
that contains a windowing ({{{}OVER(...){}}}) {{{}Project{}}}, planning fails 
with an {{ArrayIndexOutOfBoundsException}} thrown from inside 
{{{}HiveFilterProjectTransposeRule{}}}'s redundant-{{{}IS NOT NULL{}}} check 
(the {{RedundancyChecker}} {{{}RelVisitor{}}}).
{code:java}
java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4  
at ...RegularImmutableList.get(RegularImmutableList.java:60)  
at org.apache.calcite.plan.RelOptUtil$2.visitInputRef(RelOptUtil.java:3181)  
at org.apache.calcite.rex.RexShuttle.visitFieldCollations(RexShuttle.java:186)  
at org.apache.calcite.rex.RexShuttle.visitWindow(RexShuttle.java:66)  
at org.apache.calcite.rex.RexShuttle.visitOver(RexShuttle.java:44)  
at org.apache.calcite.rex.RexOver.accept(RexOver.java:122)  ...  
at 
org.apache.calcite.plan.RelOptUtil.pushPastProjectUnlessBloat(RelOptUtil.java:3166)
  
at ...HiveRelOptUtil.pushPastProjectUnlessBloat(HiveRelOptUtil.java:737)  
at 
...HiveFilterProjectTransposeRule$RedundancyChecker.visit(HiveFilterProjectTransposeRule.java:341)
  ...{code}


> AIBOE in HiveFilterProjectTransposeRule during CBO planning for filters over 
> windowing Projects
> -----------------------------------------------------------------------------------------------
>
>                 Key: HIVE-29729
>                 URL: https://issues.apache.org/jira/browse/HIVE-29729
>             Project: Hive
>          Issue Type: Bug
>          Components: CBO, Hive
>    Affects Versions: 4.2.0
>            Reporter: Riju Trivedi
>            Assignee: Riju Trivedi
>            Priority: Major
>
> A query that applies an {{IS NOT NULL}} predicate above a sub-plan containing 
> windowing ({{{}OVER(...){}}}) {{{}Project{}}}s fails at compile time during 
> CBO planning with:
> {code:java}
> java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4  
> at ...RegularImmutableList.get(RegularImmutableList.java:60)  
> at org.apache.calcite.plan.RelOptUtil$2.visitInputRef(RelOptUtil.java:3181)  
> at 
> org.apache.calcite.rex.RexShuttle.visitFieldCollations(RexShuttle.java:186)  
> at org.apache.calcite.rex.RexShuttle.visitWindow(RexShuttle.java:66)  
> at org.apache.calcite.rex.RexShuttle.visitOver(RexShuttle.java:44)  
> at org.apache.calcite.rex.RexOver.accept(RexOver.java:122)  ...  
> at 
> org.apache.calcite.plan.RelOptUtil.pushPastProjectUnlessBloat(RelOptUtil.java:3166)
>   
> at ...HiveRelOptUtil.pushPastProjectUnlessBloat(HiveRelOptUtil.java:737)  
> at 
> ...HiveFilterProjectTransposeRule$RedundancyChecker.visit(HiveFilterProjectTransposeRule.java:341)
>   ...{code}
> This surfaces when {{hive.cbo.fallback.strategy=NEVER}} (the default since 
> HIVE-27831). Before HIVE-27831 the default was {{{}CONSERVATIVE{}}}, which 
> silently retried the failed CBO plan via the non-CBO path and masked the 
> exception.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to