public AbstractExpression getAllFilters ( ) { ArrayDeque < JoinNode > joinNodes = new ArrayDeque <> ( ) ; ArrayDeque < AbstractExpression > in = new ArrayDeque <> ( ) ; ArrayDeque < AbstractExpression > out = new ArrayDeque <> ( ) ; // Iterate over the join nodes to collect their join and where expressions joinNodes . add ( this ) ; while ( ! joinNodes . isEmpty ( ) ) { JoinNode joinNode = joinNodes . poll ( ) ; if ( joinNode . m_joinExpr != null ) { in . add ( joinNode . m_joinExpr ) ; } if ( joinNode . m_whereExpr != null ) { in . add ( joinNode . m_whereExpr ) ; } joinNode . queueChildren ( joinNodes ) ; } // this chunk of code breaks the code into a list of expression that // all have to be true for the where clause to be true AbstractExpression inExpr = null ; while ( ( inExpr = in . poll ( ) ) != null ) { if ( inExpr . getExpressionType ( ) == ExpressionType . CONJUNCTION_AND ) { in . add ( inExpr . getLeft ( ) ) ; in . add ( inExpr . getRight ( ) ) ; } else { out . add ( inExpr ) ; } } return ExpressionUtil . combinePredicates ( out ) ; }
Collect all JOIN and WHERE expressions combined with AND for the entire tree .