static boolean fragmentReferencesPersistentTable ( AbstractPlanNode node ) { if ( node == null ) return false ; // these nodes can read/modify persistent tables if ( node instanceof AbstractScanPlanNode ) return true ; if ( node instanceof InsertPlanNode ) return true ; if ( node instanceof DeletePlanNode ) return true ; if ( node instanceof UpdatePlanNode ) return true ; // recursively check out children for ( int i = 0 ; i < node . getChildCount ( ) ; i ++ ) { AbstractPlanNode child = node . getChild ( i ) ; if ( fragmentReferencesPersistentTable ( child ) ) return true ; } // if nothing found, return false return false ; }
Check through a plan graph and return true if it ever touches a persistent table .