public void harmonizeOutputSchema ( ) { boolean changedCurrent ; boolean changedBase ; boolean changedRecursive = false ; NodeSchema currentSchema = getOutputSchema ( ) ; NodeSchema baseSchema = getBestCostBasePlan ( ) . rootPlanGraph . getTrueOutputSchema ( false ) ; NodeSchema recursiveSchema = ( getBestCostRecursivePlan ( ) == null ) ? null : getBestCostRecursivePlan ( ) . rootPlanGraph . getTrueOutputSchema ( true ) ; // First, make the current schema // the widest. changedCurrent = currentSchema . harmonize ( baseSchema , "Base Query" ) ; if ( recursiveSchema != null ) { // Widen the current schema to the recursive // schema if necessary as well. boolean changedRec = currentSchema . harmonize ( recursiveSchema , "Recursive Query" ) ; changedCurrent = changedCurrent || changedRec ; } // Then change the base and current // schemas. changedBase = baseSchema . harmonize ( currentSchema , "Base Query" ) ; if ( recursiveSchema != null ) { changedRecursive = recursiveSchema . harmonize ( currentSchema , "Recursive Query" ) ; } // If we changed something, update the output schemas // which depend on the one we changed. if ( changedBase ) { getBestCostBasePlan ( ) . rootPlanGraph . getTrueOutputSchema ( true ) ; } if ( changedRecursive ) { getBestCostRecursivePlan ( ) . rootPlanGraph . getTrueOutputSchema ( true ) ; } }
We have just planned the base query and perhaps the recursive query . We need to make sure that the output schema of the scan and the output schemas of the base and recursive plans are all compatible .