GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DataflowJavaSDK/contrib/sorter at master · luiscbf/DataflowJavaSDK

Expand file tree

/

sorter

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

sorter

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src
src
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

#Sorter This module provides the SortValues transform, which takes a PCollection<KV<K, Iterable<KV<K2, V>>>> and produces a PCollection<KV<K, Iterable<KV<K2, V>>>> where, for each primary key K the paired Iterable<KV<K2, V>> has been sorted by the byte encoding of secondary key (K2). It will efficiently and scalably sort the iterables, even if they are large (do not fit in memory).

##Caveats

  • This transform performs value-only sorting; the iterable accompanying each key is sorted, but there is no relationship between different keys, as Dataflow does not support any defined relationship between different elements in a PCollection.
  • Each Iterable<KV<K2, V>> is sorted on a single worker using local memory and disk. This means that SortValues may be a performance and/or scalability bottleneck when used in different pipelines. For example, users are discouraged from using SortValues on a PCollection of a single element to globally sort a large PCollection.

##Options

  • The user can customize the temporary location used if sorting requires spilling to disk and the maximum amount of memory to use by creating a custom instance of BufferedExternalSorter.Options to pass into SortValues.create.

##Using SortValues

PCollection<KV<String, KV<String, Integer>>> input = ...

// Group by primary key, bringing <SecondaryKey, Value> pairs for the same key together.
PCollection<KV<String, Iterable<KV<String, Integer>>>> grouped =
    input.apply(GroupByKey.<String, KV<String, Integer>>create());

// For every primary key, sort the iterable of <SecondaryKey, Value> pairs by secondary key.
PCollection<KV<String, Iterable<KV<String, Integer>>>> groupedAndSorted =
    grouped.apply(
        SortValues.<String, String, Integer>create(new BufferedExternalSorter.Options()));
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.