[ 
https://issues.apache.org/jira/browse/CALCITE-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15878479#comment-15878479
 ] 

Remus Rusanu edited comment on CALCITE-1653 at 2/22/17 5:31 PM:
----------------------------------------------------------------

In some cases the executor has to percolate through quite a lengthy stack to 
reach the place is needed:

{noformat}
Thread [00a86df3-c98c-4766-b3ee-3ab82a63219e main] (Suspended (exception 
NumberFormatException))        
        BigDecimal.<init>(double, MathContext) line: 895        
        RexBuilder.clean(Object, RelDataType) line: 1390        
        RexBuilder.makeLiteral(Object, RelDataType, boolean) line: 1237 
        RexBuilder.makeLiteral(Object, RelDataType, boolean) line: 1234 
        RexExecutable.reduce(RexBuilder, List<RexNode>, List<RexNode>) line: 84 
        RexExecutorImpl.reduce(RexBuilder, List<RexNode>, List<RexNode>) line: 
129      
        RexUtil.simplifyCast(RexBuilder, RexCall, RelOptPlanner$Executor) line: 
2387       <-- we need the executor here
        RexUtil.simplify(RexBuilder, RexNode, boolean, RelOptPlanner$Executor) 
line: 1626       
        RexUtil$ExprSimplifier.visitCall(RexCall) line: 2984    
        RexUtil$ExprSimplifier.visitCall(RexCall) line: 2953    
        RexCall.accept(RexVisitor<R>) line: 107 
        RexUtil$ExprSimplifier(RexShuttle).apply(RexNode) line: 275     
        ReduceExpressionsRule.reduceExpressions(RelNode, List<RexNode>, 
RelOptPredicateList, boolean) line: 468 
        ReduceExpressionsRule.reduceExpressions(RelNode, List<RexNode>, 
RelOptPredicateList) line: 445  
        
ReduceExpressionsRule$ProjectReduceExpressionsRule.onMatch(RelOptRuleCall) 
line: 268    
        HepPlanner(AbstractRelOptPlanner).fireRule(RelOptRuleCall) line: 316    
        HepPlanner.applyRule(RelOptRule, HepRelVertex, boolean) line: 506       
        HepPlanner.applyRules(Collection<RelOptRule>, boolean) line: 385        
        HepPlanner.executeInstruction(HepInstruction$RuleCollection) line: 279  
        HepInstruction$RuleCollection.execute(HepPlanner) line: 72      
        HepPlanner.executeProgram(HepProgram) line: 210 
        HepPlanner.findBestExp() line: 197      
        CalcitePlanner$CalcitePlannerAction.hepPlan(RelNode, boolean, 
RelMetadataProvider, RelOptPlanner$Executor, HepMatchOrder, RelOptRule...) 
line: 1749       <-- we have the executor here
{noformat}



was (Author: rusanu):
In some cases the executor has to percolate through quite a lengthy stack to 
reach the place is needed:

{{noformat}}
Thread [00a86df3-c98c-4766-b3ee-3ab82a63219e main] (Suspended (exception 
NumberFormatException))        
        BigDecimal.<init>(double, MathContext) line: 895        
        RexBuilder.clean(Object, RelDataType) line: 1390        
        RexBuilder.makeLiteral(Object, RelDataType, boolean) line: 1237 
        RexBuilder.makeLiteral(Object, RelDataType, boolean) line: 1234 
        RexExecutable.reduce(RexBuilder, List<RexNode>, List<RexNode>) line: 84 
        RexExecutorImpl.reduce(RexBuilder, List<RexNode>, List<RexNode>) line: 
129      
        RexUtil.simplifyCast(RexBuilder, RexCall, RelOptPlanner$Executor) line: 
2387       <-- we need the executor here
        RexUtil.simplify(RexBuilder, RexNode, boolean, RelOptPlanner$Executor) 
line: 1626       
        RexUtil$ExprSimplifier.visitCall(RexCall) line: 2984    
        RexUtil$ExprSimplifier.visitCall(RexCall) line: 2953    
        RexCall.accept(RexVisitor<R>) line: 107 
        RexUtil$ExprSimplifier(RexShuttle).apply(RexNode) line: 275     
        ReduceExpressionsRule.reduceExpressions(RelNode, List<RexNode>, 
RelOptPredicateList, boolean) line: 468 
        ReduceExpressionsRule.reduceExpressions(RelNode, List<RexNode>, 
RelOptPredicateList) line: 445  
        
ReduceExpressionsRule$ProjectReduceExpressionsRule.onMatch(RelOptRuleCall) 
line: 268    
        HepPlanner(AbstractRelOptPlanner).fireRule(RelOptRuleCall) line: 316    
        HepPlanner.applyRule(RelOptRule, HepRelVertex, boolean) line: 506       
        HepPlanner.applyRules(Collection<RelOptRule>, boolean) line: 385        
        HepPlanner.executeInstruction(HepInstruction$RuleCollection) line: 279  
        HepInstruction$RuleCollection.execute(HepPlanner) line: 72      
        HepPlanner.executeProgram(HepProgram) line: 210 
        HepPlanner.findBestExp() line: 197      
        CalcitePlanner$CalcitePlannerAction.hepPlan(RelNode, boolean, 
RelMetadataProvider, RelOptPlanner$Executor, HepMatchOrder, RelOptRule...) 
line: 1749       <-- we have the executor here
{{noformat}}


> Allow for custom RelOptPlanner.Executor in RexUtil.simplify
> -----------------------------------------------------------
>
>                 Key: CALCITE-1653
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1653
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Remus Rusanu
>            Assignee: Julian Hyde
>
> {{RexUtil.simplify}} (and derivatives) use a default {{EXECUTOR}} for 
> evaluating literals and expression in {{simplifyCast}}. This causes value 
> differences from Hive, triggering issues like CALCITE-1650, CALCITE-1651. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to