private Optional < PushDownBooleanExpressionProposal > buildProposal ( JoinOrFilterNode providerNode , ImmutableMultimap < Recipient , ImmutableExpression > recipientMap ) { ImmutableCollection < Map . Entry < Recipient , ImmutableExpression > > recipientEntries = recipientMap . entries ( ) ; /* * Collect new direct recipients nodes for each expression, * filtering out provider nodes, and therefore also LeftJoinNodes. */ ImmutableMultimap < CommutativeJoinOrFilterNode , ImmutableExpression > directRecipientNodes = recipientEntries . stream ( ) . filter ( e -> e . getKey ( ) . directRecipientNode . isPresent ( ) ) . filter ( e -> e . getKey ( ) . directRecipientNode . get ( ) != providerNode ) . map ( e -> new AbstractMap . SimpleEntry <> ( ( CommutativeJoinOrFilterNode ) e . getKey ( ) . directRecipientNode . get ( ) , e . getValue ( ) ) ) . collect ( ImmutableCollectors . toMultimap ( ) ) ; /* * Collect indirect recipient nodes */ ImmutableMultimap < QueryNode , ImmutableExpression > indirectRecipientNodes = recipientEntries . stream ( ) . filter ( e -> e . getKey ( ) . indirectRecipientNode . isPresent ( ) ) . map ( e -> new AbstractMap . SimpleEntry <> ( e . getKey ( ) . indirectRecipientNode . get ( ) , e . getValue ( ) ) ) . collect ( ImmutableCollectors . toMultimap ( ) ) ; if ( directRecipientNodes . isEmpty ( ) && indirectRecipientNodes . isEmpty ( ) ) { return Optional . empty ( ) ; } else { ImmutableList < ImmutableExpression > expressionsToKeep = recipientEntries . stream ( ) . filter ( e -> e . getKey ( ) . directRecipientNode . isPresent ( ) ) . filter ( e -> e . getKey ( ) . directRecipientNode . get ( ) == providerNode ) . map ( Map . Entry :: getValue ) . collect ( ImmutableCollectors . toList ( ) ) ; return Optional . of ( new PushDownBooleanExpressionProposalImpl ( providerNode , directRecipientNodes , indirectRecipientNodes , expressionsToKeep ) ) ; } }
Builds the PushDownBooleanExpressionProposal .