Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems the implicit conversion from Enumeration#Value is missing, so you could define it yourself:</p> <pre><code>import cascading.tuple.Fields implicit def valueToFields(v: Enumeration#Value): Fields = v.toString object Schema extends Enumeration { val first, last, phone, age, country = Value // arbitrary number of fields } import Schema._ var current = Int.MaxValue Csv("tutorial/data/phones.txt", separator = " ", fields = Schema) .read .map(age -&gt; ('current, 'previous)) { a: String =&gt; val previous = current current = a.toInt current -&gt; previous } .filter('current, 'previous) { age: (Int, Int) =&gt; age._1 &gt; age._2 } .project(first, age) .write(Tsv("tutorial/data/output6.tsv")) </code></pre> <p>In the end, we expect the result to be the same as that of:</p> <pre><code>Csv("tutorial/data/phones.txt", separator = " ", fields = Schema) .read .map((new Fields("age"), (new Fields("current", "previous"))) { a: String =&gt; val previous = current current = a.toInt current -&gt; previous } .filter(new Fields("current", "previous")) { age: (Int, Int) =&gt; age._1 &gt; age._2 } .project(new Fields("first", "age")) .write(Tsv("tutorial/data/output6.tsv")) </code></pre> <p>The implicit conversions provided by scalding allow you to write shorter versions of these <code>new Fields(...)</code>.</p> <p>An inplicit conversion is just a view, which will get used by the compiler when you pass arguments which are not of the expected type, but can be converted to the appropriate type by this view. For example, because <code>map()</code> expects a pair of <code>Fields</code> while you're passing it a pair of Symbols, Scala will search for an implicit conversion from <code>Symbol -&gt; Symbol</code> to <code>Fields -&gt; Fields</code>. A short explanation on views can be found <a href="http://www.scala-lang.org/node/130" rel="nofollow">here</a>.</p> <p>Scalding 0.8.5 introduced conversions from a product of <code>Eumeration#Value</code> to a <code>Fields</code>, but was missing conversions from a pair of values. The <code>develop</code> branch now also provides the latter.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload