Java Code Examples for org.apache.hadoop.util.QuickSort#sort()
The following examples show how to use
org.apache.hadoop.util.QuickSort#sort() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuickSorterTemplate.java From dremio-oss with Apache License 2.0 | 6 votes |
@Override public SelectionVector4 getFinalSort(BufferAllocator allocator, int targetBatchSize){ Stopwatch watch = Stopwatch.createStarted(); intVector.setValueCount(totalCount); QuickSort qs = new QuickSort(); if (totalCount > 0) { qs.sort(this, 0, totalCount); } SelectionVector4 finalSortedSV4 = new SelectionVector4(allocator.buffer(totalCount * 4), totalCount, targetBatchSize); for (int i = 0; i < totalCount; i++) { finalSortedSV4.set(i, intVector.get(i)); } logger.debug("Took {} us to final sort {} records in {} batches", watch.elapsed(TimeUnit.MICROSECONDS), totalCount, hyperBatch.size()); return finalSortedSV4; }
Example 2
Source File: SortTemplate.java From Bats with Apache License 2.0 | 5 votes |
@Override public void sort(SelectionVector4 vector4, VectorContainer container){ Stopwatch watch = Stopwatch.createStarted(); QuickSort qs = new QuickSort(); qs.sort(this, 0, vector4.getTotalCount()); logger.debug("Took {} us to sort {} records", watch.elapsed(TimeUnit.MICROSECONDS), vector4.getTotalCount()); }
Example 3
Source File: SingleBatchSorterTemplate.java From Bats with Apache License 2.0 | 5 votes |
@Override public void sort(SelectionVector2 vector2){ QuickSort qs = new QuickSort(); Stopwatch watch = Stopwatch.createStarted(); if (vector2.getCount() > 0) { qs.sort(this, 0, vector2.getCount()); } logger.debug("Took {} us to sort {} records", watch.elapsed(TimeUnit.MICROSECONDS), vector2.getCount()); }
Example 4
Source File: SingleBatchSorterTemplate.java From dremio-oss with Apache License 2.0 | 5 votes |
@Override public void sort(SelectionVector2 vector2){ QuickSort qs = new QuickSort(); Stopwatch watch = Stopwatch.createStarted(); if (vector2.getCount() > 0) { qs.sort(this, 0, vector2.getCount()); } logger.debug("Took {} us to sort {} records", watch.elapsed(TimeUnit.MICROSECONDS), vector2.getCount()); }
Example 5
Source File: SortTest.java From dremio-oss with Apache License 2.0 | 5 votes |
public long doSort(){ QuickSort qs = new QuickSort(); ByteSortable b = new ByteSortable(); long nano = System.nanoTime(); qs.sort(b, 0, RECORD_COUNT); return System.nanoTime() - nano; }
Example 6
Source File: BasicReducePartition.java From RDFS with Apache License 2.0 | 5 votes |
protected void sortMemBlock(MemoryBlock memBlock) { if (memBlock.currentPtr <= 0) { return; } // quick sort the offsets OffsetSortable sortableObj = new OffsetSortable(memBlock, kvbuffer); QuickSort quickSort = new QuickSort(); quickSort.sort(sortableObj, 0, memBlock.currentPtr); }
Example 7
Source File: SampleSortTemplate.java From Bats with Apache License 2.0 | 4 votes |
@Override public void sort(SelectionVector2 vector2, VectorContainer container){ QuickSort qs = new QuickSort(); qs.sort(this, 0, vector2.getCount()); }
Example 8
Source File: LookUpTable.java From Cubert with Apache License 2.0 | 4 votes |
private void buildTable() throws IOException { QuickSort quickSort = new QuickSort(); long start, end; /* Sort the offsets array */ start = System.currentTimeMillis(); if (offsetArr.length > 1) { quickSort.sort(sortable, 0, offsetArr.length); } end = System.currentTimeMillis(); print.f("LookUpTable: Sorted %d entries in %d ms", offsetArr.length, (end - start)); /* Fill in the HashCode array */ start = System.currentTimeMillis(); int prevHashCode = -1; Tuple prevTuple = newTuple(); Tuple t = newTuple(); for (int i = 0; i < offsetArr.length; ++i) { t = store.getTuple(offsetArr[i], t); int hashCode = tupleHashCode(t); if (prevHashCode != hashCode) { hashCodeArr[hashCode] = i; prevHashCode = hashCode; } if (i == 0 || !compareKeys(prevTuple, t)) { offsetArr[i] = offsetArr[i] | SIGNBIT; } /* Object Reuse: Swap the tuples instead of creating new ones */ Tuple temp = t; t = prevTuple; prevTuple = temp; } end = System.currentTimeMillis(); print.f("LookUpTable: Created HashCode Array for %d entries in %d ms", offsetArr.length, (end - start)); }