question: private static final PipelineOp addDistinct ( PipelineOp left , final QueryBase query , final boolean preserveOrder , final AST2BOpContext ctx ) { final int bopId = ctx . nextId ( ) ; final ProjectionNode projection = query . getProjection ( ) ; if ( projection . isWildcard ( ) ) throw new AssertionError ( "Wildcard projection was not rewritten." ) ; final IVariable < ? > [ ] vars = projection . getProjectionVars ( ) ; final PipelineOp op ; if ( ! ctx . nativeDistinctSolutions || preserveOrder ) { final List < NV > anns = new LinkedList < NV > ( ) ; anns . add ( new NV ( JVMDistinctBindingSetsOp . Annotations . BOP_ID , bopId ) ) ; anns . add ( new NV ( JVMDistinctBindingSetsOp . Annotations . VARIABLES , vars ) ) ; anns . add ( new NV ( JVMDistinctBindingSetsOp . Annotations . EVALUATION_CONTEXT , BOpEvaluationContext . CONTROLLER ) ) ; anns . add ( new NV ( JVMDistinctBindingSetsOp . Annotations . SHARED_STATE , true ) ) ; if ( preserveOrder ) { anns . add ( new NV ( PipelineOp . Annotations . MAX_PARALLEL , 1 ) ) ; anns . add ( new NV ( SliceOp . Annotations . REORDER_SOLUTIONS , false ) ) ; } op = new JVMDistinctBindingSetsOp ( leftOrEmpty ( left ) , anns . toArray ( new NV [ anns . size ( ) ] ) ) ; } else { if ( preserveOrder ) { throw new UnsupportedOperationException ( ) ; } final INamedSolutionSetRef namedSolutionSet = NamedSolutionSetRefUtility . newInstance ( ctx . queryId , "--distinct-" + ctx . nextId ( ) , vars ) ; op = new HTreeDistinctBindingSetsOp ( leftOrEmpty ( left ) , new NV ( HTreeDistinctBindingSetsOp . Annotations . BOP_ID , bopId ) , new NV ( HTreeDistinctBindingSetsOp . Annotations . VARIABLES , vars ) , new NV ( PipelineOp . Annotations . EVALUATION_CONTEXT , BOpEvaluationContext . CONTROLLER ) , new NV ( HTreeDistinctBindingSetsOp . Annotations . NAMED_SET_REF , namedSolutionSet ) , new NV ( PipelineOp . Annotations . SHARED_STATE , true ) , new NV ( PipelineOp . Annotations . MAX_PARALLEL , 1 ) , new NV ( IPredicate . Annotations . RELATION_NAME , new String [ ] { ctx . getLexiconNamespace ( ) } ) ) ; } left = applyQueryHints ( op , query , ctx ) ; return left ; }
target:  Add DISTINCT semantics to the pipeline.