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

Julian Hyde resolved CALCITE-1626.
----------------------------------
    Resolution: Not A Problem

Not a bug. The client needs to ensure when making a RexCall that all operands 
have the right type. In this case, the operands of '<' (resulting from the 
expansion of BETWEEN) are timestamp and varchar, but should be timestamp and 
timestamp. Hive should implicitly add a cast from the character literal to 
timestamp. Calcite will constant-reduce that cast if the character string is a 
valid timestamp.

> DruidDateTimeUtils.literalValue: ClassCastException 
> org.apache.calcite.util.NlsString cannot be cast to java.util.Calendar
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-1626
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1626
>             Project: Calcite
>          Issue Type: Bug
>          Components: druid
>            Reporter: Remus Rusanu
>            Assignee: Julian Hyde
>             Fix For: 1.12.0
>
>
> Hit this when testing Hive against 1.12-SNAPSHOT.
> {noformat}
> EXPLAIN
> SELECT `__time`
> FROM druid_table_1
> WHERE `__time` BETWEEN '2010-01-01 00:00:00' AND '2011-01-01 00:00:00'
> {noformat}
> {noformat}
> FAILED: ClassCastException org.apache.calcite.util.NlsString cannot be cast 
> to java.util.Calendar$
>  
> Thread [788b959f-16ae-47ba-9c88-a74e2843eaf2 main] (Suspended (exception 
> ClassCastException))    
>                 DruidDateTimeUtils.literalValue(RexNode) line: 247            
>   
>                 DruidDateTimeUtils.leafToRanges(RexCall, boolean) line: 207   
>           
>                 DruidDateTimeUtils.extractRanges(RexNode, boolean) line: 120  
>      
>                 DruidDateTimeUtils.createInterval(RelDataType, RexNode) line: 
> 65 
>                 DruidRules$DruidFilterRule.onMatch(RelOptRuleCall) line: 129  
>         
>                 HepPlanner(AbstractRelOptPlanner).fireRule(RelOptRuleCall) 
> line: 316           
>                 HepPlanner.applyRule(RelOptRule, HepRelVertex, boolean) line: 
> 506               
>                 HepPlanner.applyRules(Collection<RelOptRule>, boolean) line: 
> 385   
>                 HepPlanner.executeInstruction(HepInstruction$RuleInstance) 
> line: 251          
>                 HepInstruction$RuleInstance.execute(HepPlanner) line: 125     
>          
>                 HepPlanner.executeProgram(HepProgram) line: 210             
>                 HepPlanner.findBestExp() line: 197              
>                 CalcitePlanner$CalcitePlannerAction.hepPlan(RelNode, boolean, 
> RelMetadataProvider, RelOptPlanner$Executor, HepMatchOrder, RelOptRule...) 
> line: 1707 (out of synch)      
>                 CalcitePlanner$CalcitePlannerAction.apply(RelOptCluster, 
> RelOptSchema, SchemaPlus) line: 1436 (out of synch)
>                 CalcitePlanner$CalcitePlannerAction.apply(RelOptCluster, 
> RelOptSchema, SchemaPlus) line: 1194 (out of synch)
>                 Frameworks$1.apply(RelOptCluster, RelOptSchema, SchemaPlus, 
> CalciteServerStatement) line: 113      
>                 CalcitePrepareImpl.perform(CalciteServerStatement, 
> PrepareAction<R>) line: 1028   
>                 Frameworks.withPrepare(PrepareAction<R>) line: 149         
>                 Frameworks.withPlanner(PlannerAction<R>, FrameworkConfig) 
> line: 106        
>                 CalcitePlanner.logicalPlan() line: 1002 (out of synch)        
>        
>                 CalcitePlanner.getOptimizedAST() line: 1018 (out of synch)  
>                 CalcitePlanner.genOPTree(ASTNode, 
> SemanticAnalyzer$PlannerContext) line: 358 (out of synch)            
>                 CalcitePlanner(SemanticAnalyzer).analyzeInternal(ASTNode, 
> SemanticAnalyzer$PlannerContext) line: 11019 (out of synch)   
>                 CalcitePlanner.analyzeInternal(ASTNode) line: 285 (out of 
> synch)       
>                 CalcitePlanner(BaseSemanticAnalyzer).analyze(ASTNode, 
> Context) line: 258 (out of synch)        
>                 ExplainSemanticAnalyzer.analyzeInternal(ASTNode) line: 165    
>          
>                 
> ExplainSemanticAnalyzer(BaseSemanticAnalyzer).analyze(ASTNode, Context) line: 
> 258 (out of synch)    
>                 Driver.compile(String, boolean, boolean) line: 514 (out of 
> synch)         
>                 Driver.compileInternal(String, boolean) line: 1319 (out of 
> synch)        
>                 Driver.runInternal(String, boolean) line: 1459 (out of synch) 
>                 Driver.run(String, boolean) line: 1239 (out of synch)
>                 Driver.run(String) line: 1229 (out of synch) 
> {noformat}



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

Reply via email to