@ Override public List < ? extends ProducerJob > partitionJobs ( ) { UrlTrieNode root = _jobNode . getRight ( ) ; if ( isOperatorEquals ( ) || root . getSize ( ) == 1 ) { //Either at an Equals-Node or a Leaf-Node, both of which actually has actual size 1. return super . partitionJobs ( ) ; } else { if ( _groupSize <= 1 ) { throw new RuntimeException ( "This is impossible. When group size is 1, the operator must be equals" ) ; } UrlTrie trie = new UrlTrie ( getPage ( ) , root ) ; int gs = Math . min ( root . getSize ( ) , _groupSize ) ; UrlTriePrefixGrouper grouper = new UrlTriePrefixGrouper ( trie , ( int ) Math . ceil ( gs / 2.0 ) ) ; List < TrieBasedProducerJob > jobs = new ArrayList <> ( ) ; while ( grouper . hasNext ( ) ) { jobs . add ( new TrieBasedProducerJob ( _startDate , _endDate , grouper . next ( ) , grouper . getGroupSize ( ) ) ) ; } return jobs ; } }
The implementation here will first partition the job by pages and then by dates .