public boolean isIdentity ( AbstractPlanNode childNode ) throws PlanningErrorException { assert ( childNode != null ) ; // Find the output schema. // If the child node has an inline projection node, // then the output schema is the inline projection // node's output schema. Otherwise it's the output // schema of the childNode itself. NodeSchema childSchema = childNode . getTrueOutputSchema ( false ) ; assert ( childSchema != null ) ; NodeSchema outputSchema = getOutputSchema ( ) ; if ( outputSchema . size ( ) != childSchema . size ( ) ) { return false ; } for ( int idx = 0 ; idx < outputSchema . size ( ) ; idx += 1 ) { SchemaColumn col = outputSchema . getColumn ( idx ) ; SchemaColumn childCol = childSchema . getColumn ( idx ) ; if ( col . getValueType ( ) != childCol . getValueType ( ) ) { return false ; } if ( ! ( col . getExpression ( ) instanceof TupleValueExpression ) ) { return false ; } if ( ! ( childCol . getExpression ( ) instanceof TupleValueExpression ) ) { return false ; } TupleValueExpression tve = ( TupleValueExpression ) col . getExpression ( ) ; if ( tve . getColumnIndex ( ) != idx ) { return false ; } } return true ; }
Return true if this node unneeded if its input schema is the given one .