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

Jungtaek Lim commented on CALCITE-1438:
---------------------------------------

I have been digging it more, and just find out there is a bug in my code.
CheapestPlanReplacer does its job well, but my InsertRel doesn't replace its 
input with parameter in copy(), so RelSubset is still there even after copy.
I should dig more before asking... Sorry to waste your time. Closing.

> RelOptUtils.toString() throws StackOverflowError when RelSubset and input 
> makes cycle
> -------------------------------------------------------------------------------------
>
>                 Key: CALCITE-1438
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1438
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jungtaek Lim
>            Assignee: Julian Hyde
>            Priority: Critical
>
> I found that one of rels in Relsub has parent Relsub as 'input' (Relsub and 
> Project). Fortunately it was not selected to 'best', but Relsub print out 
> first occurence of rel which match the trait, and unfortunately it's first 
> one.
> Query is really simple, INSERT INTO BAR SELECT ID, NAME, ADDR FROM FOO WHERE 
> ID > 3. I didn't see this when I directly uses Calcite logical.
> rels:
> {code}
> 0 = {LogicalFilter@3579} 
> "rel#10:LogicalFilter.NONE.[](input=rel#9:Subset#0.ENUMERABLE.[],condition=>($0,
>  3))"
> 1 = {LogicalProject@3584} 
> "rel#12:LogicalProject.NONE.[](input=rel#11:Subset#1.NONE.[],ID=$0,NAME=$1,ADDR=$2)"
> 2 = {StormProjectRel@3554} 
> "rel#21:StormProjectRel.STORM_LOGICAL.[](input=rel#20:Subset#1.STORM_LOGICAL.[],ID=$0,NAME=$1,ADDR=$2)"
> 3 = {LogicalCalc@3585} 
> "rel#22:LogicalCalc.NONE.[[]](input=rel#11:Subset#1.NONE.[],expr#0..2={inputs},ID=$t0,NAME=$t1,ADDR=$t2)"
> 4 = {TridentStormFilterRel@3569} 
> "rel#24:TridentStormFilterRel.STORM_LOGICAL.[](input=rel#23:Subset#0.STORM_LOGICAL.[],condition=>($0,
>  3))"
> 5 = {TridentStormCalcRel@3586} 
> "rel#25:TridentStormCalcRel.STORM_LOGICAL.[[]](input=rel#20:Subset#1.STORM_LOGICAL.[],expr#0..2={inputs},ID=$t0,NAME=$t1,ADDR=$t2)"
> 6 = {LogicalCalc@3587} 
> "rel#26:LogicalCalc.NONE.[[]](input=rel#9:Subset#0.ENUMERABLE.[],expr#0..2={inputs},expr#3=3,expr#4=>($t0,
>  $t3),ID=$t0,NAME=$t1,ADDR=$t2,$condition=$t4)"
> 7 = {TridentStormCalcRel@3588} 
> "rel#27:TridentStormCalcRel.STORM_LOGICAL.[[]](input=rel#23:Subset#0.STORM_LOGICAL.[],expr#0..2={inputs},expr#3=3,expr#4=>($t0,
>  $t3),ID=$t0,NAME=$t1,ADDR=$t2,$condition=$t4)"
> {code}
> best: 
> {code}
> rel#24:TridentStormFilterRel.STORM_LOGICAL.[](input=rel#23:Subset#0.STORM_LOGICAL.[],condition=>($0,
>  3))
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to