Skip to content

A DSL for Concord that allows very simple Spark-like transformations

License

Notifications You must be signed in to change notification settings

jjmalina/concord-python-dsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concord Python DSL

A simple Spark-like DSL for Concord's Python client.

Example

import sys
from concord_sources import InputSource


def print_word_count(key, value):
    sys.stderr.write(str(value) + " words counted\n")


source = InputSource('sentence-counter', 'sentences')
words = source.map(
    lambda key, val: ((word, word) for word in val.split(' '))
)
word_count = words \
    .map(lambda key, word: (word, 1)) \
    .reduce(lambda word, counts: (word, sum(counts))) \
    .map(lambda word, frequency: (0, frequency)) \
    .reduce(lambda key, counts: (key, sum(counts)))

word_count.sink('word-count')
word_count.on_batched_record(print_word_count)
word_count.run()

About

A DSL for Concord that allows very simple Spark-like transformations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages