All Projects → lemire → Externalsortinginjava

lemire / Externalsortinginjava

Licence: other
External-Memory Sorting in Java

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Externalsortinginjava

Java Ds Algorithms
Data Structures and Algorithms in Java
Stars: ✭ 125 (-36.22%)
Mutual labels:  sort
C Plus Plus
Collection of various algorithms in mathematics, machine learning, computer science and physics implemented in C++ for educational purposes.
Stars: ✭ 17,151 (+8650.51%)
Mutual labels:  sort
Sortrecyclerviewlist
Recyclerview实现字母排序,过滤搜索,顶部悬浮,波浪形的侧边栏
Stars: ✭ 179 (-8.67%)
Mutual labels:  sort
Rails sortable
Easy drag & drop sorting with persisting the arranged order for rails
Stars: ✭ 127 (-35.2%)
Mutual labels:  sort
Android Video Listing Mvp
Android video listing with swipe view tabs based on mvp design pattern with complete functionalities like search and sort
Stars: ✭ 151 (-22.96%)
Mutual labels:  sort
Php Formatter
PHP Formatter is a PHP developer friendly set of tools
Stars: ✭ 163 (-16.84%)
Mutual labels:  sort
Deep sort pytorch
MOT using deepsort and yolov3 with pytorch
Stars: ✭ 1,948 (+893.88%)
Mutual labels:  sort
Interview Questions
List of all the Interview questions practiced from online resources and books
Stars: ✭ 187 (-4.59%)
Mutual labels:  sort
Ordinare
Ordinare sorts gems in your Gemfile alphabetically
Stars: ✭ 153 (-21.94%)
Mutual labels:  sort
N2h4
네이버 뉴스 수집을 위한 도구
Stars: ✭ 177 (-9.69%)
Mutual labels:  sort
Human Falling Detect Tracks
AlphaPose + ST-GCN + SORT.
Stars: ✭ 135 (-31.12%)
Mutual labels:  sort
Laravel Api Handler
Package providing helper functions for a Laravel REST-API
Stars: ✭ 150 (-23.47%)
Mutual labels:  sort
Js Flock
Collection of neat modular utilities for bumping up development in NODE and Browser
Stars: ✭ 172 (-12.24%)
Mutual labels:  sort
List.js
The perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on existing HTML.
Stars: ✭ 10,650 (+5333.67%)
Mutual labels:  sort
Sortpom
Maven plugin that helps the user sort pom.xml.
Stars: ✭ 185 (-5.61%)
Mutual labels:  sort
Ng2 Smart Table
Angular Smart Data Table component
Stars: ✭ 1,590 (+711.22%)
Mutual labels:  sort
Algorithm
The repository algorithms implemented on the Go
Stars: ✭ 163 (-16.84%)
Mutual labels:  sort
Rummage ecto
Search, Sort and Pagination for ecto queries
Stars: ✭ 190 (-3.06%)
Mutual labels:  sort
Pretty Algorithms
🌊 Pretty, common and useful algorithms with modern JS and beautiful tests
Stars: ✭ 2,163 (+1003.57%)
Mutual labels:  sort
Shuffle
Categorize, sort, and filter a responsive grid of items
Stars: ✭ 2,170 (+1007.14%)
Mutual labels:  sort

Externalsortinginjava

Build Status docs-badge Java CI

External-Memory Sorting in Java: useful to sort very large files using multiple cores and an external-memory algorithm.

The versions 0.1 of the library are compatible with Java 6 and above. Versions 0.2 and above require at least Java 8.

This code is used in Apache Jackrabbit Oak as well as in Apache Beam and in Spotify scio.

Code sample

import com.google.code.externalsorting.ExternalSort;

//... inputfile: input file name
//... outputfile: output file name
// next command sorts the lines from inputfile to outputfile
ExternalSort.mergeSortedFiles(ExternalSort.sortInBatch(new File(inputfile)), new File(outputfile));
// you can also provide a custom string comparator, see API

Code sample (CSV)

For sorting CSV files, it might be more convenient to use CsvExternalSort.

import com.google.code.externalsorting.CsvExternalSort;
import com.google.code.externalsorting.CsvSortOptions;

// provide a comparator
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0).compareTo(op2.get(0));
//... inputfile: input file name
//... outputfile: output file name
//...provide sort options
CsvSortOptions sortOptions = new CsvSortOptions
				.Builder(comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, CsvExternalSort.estimateAvailableMemory())
				.charset(Charset.defaultCharset())
				.distinct(false)
				.numHeader(1)
				.skipHeader(false)
				.format(CSVFormat.DEFAULT)
				.build();
// container to store the header lines
ArrayList<CSVRecord> header = new ArrayList<CSVRecord>();

// next two lines sort the lines from inputfile to outputfile
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, null, sortOptions, header);
// at this point you can access header if you'd like.
CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, sortOptions, true, header);

The numHeader parameter is the number of lines of headers in the CSV files (typically 1 or 0) and the skipHeader parameter indicates whether you would like to exclude these lines from the parsing.

API Documentation

http://www.javadoc.io/doc/com.google.code.externalsortinginjava/externalsortinginjava/

Maven dependency

You can download the jar files from the Maven central repository: https://repo1.maven.org/maven2/com/google/code/externalsortinginjava/externalsortinginjava/

You can also specify the dependency in the Maven "pom.xml" file:

    <dependencies>
         <dependency>
	     <groupId>com.google.code.externalsortinginjava</groupId>
	     <artifactId>externalsortinginjava</artifactId>
	     <version>[0.6.0,)</version>
         </dependency>
     </dependencies>

How to build

  • get the java jdk
  • Install Maven 2
  • mvn install - builds jar (requires signing)
  • or mvn package - builds jar (does not require signing)
  • mvn test - runs tests
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].