Differences
This shows you the differences between two versions of the page.
Next revision Both sides next revision | |||
spark:recipes:using-perl-via-pipes [2014/11/04 15:33] straka created |
spark:recipes:using-perl-via-pipes [2014/11/07 10:38] straka |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Using Perl via Pipes ====== | ====== Using Perl via Pipes ====== | ||
- | Perl can be used to process '' | + | Perl can be used to process '' |
+ | - A //driver// program in Python (Scala, | ||
+ | - Perl programs can operate only on individual '' | ||
+ | Still, this functionality is useful when libraries available only in Perl have to be used. | ||
- | Here we show how data can be passed from Python/ | + | Here we show how data can be passed from Python to Perl and back using JSON format, which allows preserving data types -- '' |
+ | |||
+ | ===== Using Python and JSON ===== | ||
+ | |||
+ | Using JSON format, we can easily serialize and deserialize the data we want to pass from Python to Perl and back. JSON format is used because: | ||
+ | - It allows serializing numbers, strings and arrays. | ||
+ | - The serialized JSON string contains no newlines, which fits the line-oriented Spark piping. | ||
+ | - Libraries for JSON serialization/ | ||
+ | |||
+ | ===== Using Scala and Java ===== | ||
+ | |||
+ | Scala and Java can be used in similar way as Python to communicate with Perl scripts via pipes. Nevertheless, | ||