private CompiledPlan getNextPlan ( ) { CompiledPlan retval ; AbstractParsedStmt nextStmt = null ; if ( m_parsedSelect != null ) { nextStmt = m_parsedSelect ; retval = getNextSelectPlan ( ) ; } else if ( m_parsedInsert != null ) { nextStmt = m_parsedInsert ; retval = getNextInsertPlan ( ) ; } else if ( m_parsedDelete != null ) { nextStmt = m_parsedDelete ; retval = getNextDeletePlan ( ) ; // note that for replicated tables, multi-fragment plans // need to divide the result by the number of partitions } else if ( m_parsedUpdate != null ) { nextStmt = m_parsedUpdate ; retval = getNextUpdatePlan ( ) ; } else if ( m_parsedUnion != null ) { nextStmt = m_parsedUnion ; retval = getNextUnionPlan ( ) ; } else if ( m_parsedSwap != null ) { nextStmt = m_parsedSwap ; retval = getNextSwapPlan ( ) ; } else if ( m_parsedMigrate != null ) { nextStmt = m_parsedMigrate ; retval = getNextMigratePlan ( ) ; } else { throw new RuntimeException ( "setupForNewPlans encountered unsupported statement type." ) ; } if ( retval == null || retval . rootPlanGraph == null ) { return null ; } assert ( nextStmt != null ) ; retval . setParameters ( nextStmt . getParameters ( ) ) ; return retval ; }
Generate a unique and correct plan for the current SQL statement context . This method gets called repeatedly until it returns null meaning there are no more plans .